Vendor import of the Intel ACPI CA 20020725 drop.
This commit is contained in:
parent
7174287062
commit
da9df8d45e
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acconfig.h - Global configuration constants
|
||||
* $Revision: 104 $
|
||||
* $Revision: 107 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
|
||||
/* Version string */
|
||||
|
||||
#define ACPI_CA_VERSION 0x20020611
|
||||
#define ACPI_CA_VERSION 0x20020725
|
||||
|
||||
/* Version of ACPI supported */
|
||||
|
||||
@ -243,6 +243,15 @@
|
||||
|
||||
#define ACPI_MAX_ADDRESS_SPACE 255
|
||||
|
||||
/* Array sizes. Used for range checking also */
|
||||
|
||||
#define NUM_ACCESS_TYPES 6
|
||||
#define NUM_UPDATE_RULES 3
|
||||
#define NUM_LOCK_RULES 2
|
||||
#define NUM_MATCH_OPS 6
|
||||
#define NUM_OPCODES 256
|
||||
#define NUM_FIELD_NAMES 2
|
||||
|
||||
/* RSDP checksums */
|
||||
|
||||
#define ACPI_RSDP_CHECKSUM_LENGTH 20
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acdebug.h - ACPI/AML debugger
|
||||
* $Revision: 61 $
|
||||
* $Revision: 63 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -120,7 +120,6 @@
|
||||
|
||||
#define ACPI_DEBUG_BUFFER_SIZE 4196
|
||||
|
||||
|
||||
typedef struct CommandInfo
|
||||
{
|
||||
NATIVE_CHAR *Name; /* Command Name */
|
||||
@ -276,44 +275,6 @@ AcpiDbWalkForSpecificObjects (
|
||||
void **ReturnValue);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* dbdisasm - AML disassembler
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiDbDisplayOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Origin,
|
||||
UINT32 NumOpcodes);
|
||||
|
||||
void
|
||||
AcpiDbDisplayNamestring (
|
||||
NATIVE_CHAR *Name);
|
||||
|
||||
void
|
||||
AcpiDbDisplayPath (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDbDisplayOpcode (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDbDecodeInternalObject (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc);
|
||||
|
||||
UINT32
|
||||
AcpiDbBlockType (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiPsDisplayObjectPathname (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
|
||||
/*
|
||||
* dbdisply - debug display commands
|
||||
*/
|
||||
@ -370,6 +331,10 @@ void *
|
||||
AcpiDbGetPointer (
|
||||
void *Target);
|
||||
|
||||
void
|
||||
AcpiDbDecodeInternalObject (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc);
|
||||
|
||||
|
||||
/*
|
||||
* dbexec - debugger control method execution
|
||||
|
454
sys/contrib/dev/acpica/acdisasm.h
Normal file
454
sys/contrib/dev/acpica/acdisasm.h
Normal file
@ -0,0 +1,454 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acdisasm.h - AML disassembler
|
||||
* $Revision: 2 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACDISASM_H__
|
||||
#define __ACDISASM_H__
|
||||
|
||||
#include "amlresrc.h"
|
||||
|
||||
|
||||
#define BLOCK_NONE 0
|
||||
#define BLOCK_PAREN 1
|
||||
#define BLOCK_BRACE 2
|
||||
#define BLOCK_COMMA_LIST 4
|
||||
|
||||
extern const char *AcpiGbl_IoDecode[2];
|
||||
extern const char *AcpiGbl_WordDecode[4];
|
||||
extern const char *AcpiGbl_ConsumeDecode[2];
|
||||
extern const char *AcpiGbl_MinDecode[2];
|
||||
extern const char *AcpiGbl_MaxDecode[2];
|
||||
extern const char *AcpiGbl_DECDecode[2];
|
||||
extern const char *AcpiGbl_RNGDecode[4];
|
||||
extern const char *AcpiGbl_MEMDecode[4];
|
||||
extern const char *AcpiGbl_RWDecode[2];
|
||||
extern const char *AcpiGbl_IrqDecode[2];
|
||||
extern const char *AcpiGbl_HEDecode[2];
|
||||
extern const char *AcpiGbl_LLDecode[2];
|
||||
extern const char *AcpiGbl_SHRDecode[2];
|
||||
extern const char *AcpiGbl_TYPDecode[4];
|
||||
extern const char *AcpiGbl_BMDecode[2];
|
||||
extern const char *AcpiGbl_SIZDecode[4];
|
||||
extern const NATIVE_CHAR *AcpiGbl_LockRule[NUM_LOCK_RULES];
|
||||
extern const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES];
|
||||
extern const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES];
|
||||
extern const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS];
|
||||
|
||||
|
||||
typedef struct acpi_op_walk_info
|
||||
{
|
||||
UINT32 Level;
|
||||
UINT32 BitOffset;
|
||||
|
||||
} ACPI_OP_WALK_INFO;
|
||||
|
||||
typedef
|
||||
ACPI_STATUS (*ASL_WALK_CALLBACK) (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* dmwalk
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiDmWalkParseTree (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_WALK_CALLBACK DescendingCallback,
|
||||
ASL_WALK_CALLBACK AscendingCallback,
|
||||
void *Context);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDmDescendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDmAscendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
|
||||
|
||||
/*
|
||||
* dmopcode
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiDmValidateName (
|
||||
char *Name,
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
UINT32
|
||||
AcpiDmDumpName (
|
||||
char *Name);
|
||||
|
||||
void
|
||||
AcpiDmString (
|
||||
char *String);
|
||||
|
||||
void
|
||||
AcpiDmUnicode (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmDisassemble (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Origin,
|
||||
UINT32 NumOpcodes);
|
||||
|
||||
void
|
||||
AcpiDmNamestring (
|
||||
NATIVE_CHAR *Name);
|
||||
|
||||
void
|
||||
AcpiDmDisplayPath (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmDisassembleOneOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_OP_WALK_INFO *Info,
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmDecodeInternalObject (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc);
|
||||
|
||||
void
|
||||
AcpiDmDecodeNode (
|
||||
ACPI_NAMESPACE_NODE *Node);
|
||||
|
||||
UINT32
|
||||
AcpiDmBlockType (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
UINT32
|
||||
AcpiDmListType (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiPsDisplayObjectPathname (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmMethodFlags (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmFieldFlags (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmAddressSpace (
|
||||
UINT8 SpaceId);
|
||||
|
||||
void
|
||||
AcpiDmRegionFlags (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmMatchOp (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmMatchKeyword (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmCommaIfListMember (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmCommaIfFieldMember (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
|
||||
/*
|
||||
* dmbuffer
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiIsEisaId (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmEisaId (
|
||||
UINT32 EncodedId);
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmIsUnicodeBuffer (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmIsStringBuffer (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
|
||||
/*
|
||||
* dmresrc
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiDmDisasmByteList (
|
||||
UINT32 Level,
|
||||
UINT8 *ByteData,
|
||||
UINT32 ByteCount);
|
||||
|
||||
void
|
||||
AcpiDmByteList (
|
||||
ACPI_OP_WALK_INFO *Info,
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmResourceDescriptor (
|
||||
ACPI_OP_WALK_INFO *Info,
|
||||
UINT8 *ByteData,
|
||||
UINT32 ByteCount);
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmIsResourceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
void
|
||||
AcpiDmIndent (
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmBitList (
|
||||
UINT16 Mask);
|
||||
|
||||
|
||||
/*
|
||||
* dmresrcl
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiDmIoFlags (
|
||||
UINT8 Flags);
|
||||
|
||||
void
|
||||
AcpiDmMemoryFlags (
|
||||
UINT8 Flags,
|
||||
UINT8 SpecificFlags);
|
||||
|
||||
void
|
||||
AcpiDmWordDescriptor (
|
||||
ASL_WORD_ADDRESS_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmDwordDescriptor (
|
||||
ASL_DWORD_ADDRESS_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmQwordDescriptor (
|
||||
ASL_QWORD_ADDRESS_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmMemory24Descriptor (
|
||||
ASL_MEMORY_24_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmMemory32Descriptor (
|
||||
ASL_MEMORY_32_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmFixedMem32Descriptor (
|
||||
ASL_FIXED_MEMORY_32_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmGenericRegisterDescriptor (
|
||||
ASL_GENERAL_REGISTER_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmInterruptDescriptor (
|
||||
ASL_EXTENDED_XRUPT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmVendorLargeDescriptor (
|
||||
ASL_LARGE_VENDOR_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
|
||||
/*
|
||||
* dmresrcs
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiDmIrqDescriptor (
|
||||
ASL_IRQ_FORMAT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmDmaDescriptor (
|
||||
ASL_DMA_FORMAT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmIoDescriptor (
|
||||
ASL_IO_PORT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmFixedIoDescriptor (
|
||||
ASL_FIXED_IO_PORT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmStartDependentDescriptor (
|
||||
ASL_START_DEPENDENT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmEndDependentDescriptor (
|
||||
ASL_START_DEPENDENT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
void
|
||||
AcpiDmVendorSmallDescriptor (
|
||||
ASL_SMALL_VENDOR_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level);
|
||||
|
||||
|
||||
#endif /* __ACDISASM_H__ */
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acenv.h - Generation environment specific items
|
||||
* $Revision: 95 $
|
||||
* $Revision: 99 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -123,11 +123,13 @@
|
||||
*/
|
||||
|
||||
#ifdef _ACPI_DUMP_APP
|
||||
#ifndef MSDOS
|
||||
#define ACPI_DEBUG
|
||||
#endif
|
||||
#define ACPI_APPLICATION
|
||||
#define ENABLE_DEBUGGER
|
||||
#define ACPI_DISASSEMBLER
|
||||
#define ACPI_NO_METHOD_EXECUTION
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#define PARSER_ONLY
|
||||
#endif
|
||||
|
||||
#ifdef _ACPI_EXEC_APP
|
||||
@ -136,13 +138,15 @@
|
||||
#define ACPI_DEBUG
|
||||
#define ACPI_APPLICATION
|
||||
#define ENABLE_DEBUGGER
|
||||
#define ACPI_DISASSEMBLER
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#endif
|
||||
|
||||
#ifdef _ACPI_ASL_COMPILER
|
||||
#define ACPI_DEBUG
|
||||
#define ACPI_APPLICATION
|
||||
/* #define ENABLE_DEBUGGER */
|
||||
#define ACPI_DISASSEMBLER
|
||||
#define ACPI_CONSTANT_EVAL_ONLY
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#endif
|
||||
|
||||
@ -274,7 +278,6 @@
|
||||
/*
|
||||
* Use the standard C library headers.
|
||||
* We want to keep these to a minimum.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ACPI_USE_STANDARD_HEADERS
|
||||
@ -304,12 +307,16 @@
|
||||
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n))
|
||||
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n))
|
||||
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n))
|
||||
|
||||
#define ACPI_TOUPPER toupper
|
||||
#define ACPI_TOLOWER tolower
|
||||
#define ACPI_IS_XDIGIT isxdigit
|
||||
#define ACPI_IS_DIGIT isdigit
|
||||
#define ACPI_IS_SPACE isspace
|
||||
#define ACPI_IS_UPPER isupper
|
||||
#define ACPI_IS_PRINT isprint
|
||||
#define ACPI_IS_ALPHA isalpha
|
||||
#define ACPI_IS_ASCII isascii
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acfreebsd.h - OS specific defines, etc.
|
||||
* $Revision: 7 $
|
||||
* $Revision: 9 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -126,6 +126,7 @@
|
||||
/* FreeBSD uses GCC */
|
||||
|
||||
#include "acgcc.h"
|
||||
#include <machine/acpica_machdep.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/ctype.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acglobal.h - Declarations for global variables
|
||||
* $Revision: 125 $
|
||||
* $Revision: 128 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -163,6 +163,7 @@ extern UINT32 AcpiGbl_NestingLevel;
|
||||
*
|
||||
*/
|
||||
ACPI_EXTERN UINT32 AcpiGbl_TableFlags;
|
||||
ACPI_EXTERN UINT32 AcpiGbl_RsdtTableCount;
|
||||
ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP;
|
||||
ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT;
|
||||
ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT;
|
||||
@ -232,6 +233,7 @@ extern UINT32 AcpiGbl_StartupFlags;
|
||||
extern const UINT8 AcpiGbl_DecodeTo8bit[8];
|
||||
extern const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES];
|
||||
extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
|
||||
extern const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -327,6 +329,12 @@ ACPI_EXTERN ACPI_GPE_INDEX_INFO *AcpiGbl_GpeNumberToIndex;
|
||||
|
||||
ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
|
||||
@ -337,9 +345,7 @@ ACPI_EXTERN int optind;
|
||||
ACPI_EXTERN NATIVE_CHAR *optarg;
|
||||
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables;
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats;
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
|
||||
|
||||
|
||||
@ -351,7 +357,6 @@ ACPI_EXTERN NATIVE_CHAR AcpiGbl_DbDebugFilename[40];
|
||||
ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
|
||||
ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbBuffer;
|
||||
ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbFilename;
|
||||
ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbDisasmIndent;
|
||||
ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel;
|
||||
ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel;
|
||||
ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: aclocal.h - Internal data types used across the ACPI subsystem
|
||||
* $Revision: 167 $
|
||||
* $Revision: 173 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -124,10 +124,6 @@ typedef void* ACPI_MUTEX;
|
||||
typedef UINT32 ACPI_MUTEX_HANDLE;
|
||||
|
||||
|
||||
#define ACPI_MEMORY_MODE 0x01
|
||||
#define ACPI_LOGICAL_ADDRESSING 0x00
|
||||
#define ACPI_PHYSICAL_ADDRESSING 0x01
|
||||
|
||||
/* Total number of aml opcodes defined */
|
||||
|
||||
#define AML_NUM_OPCODES 0x7E
|
||||
@ -663,8 +659,8 @@ ACPI_STATUS (*ACPI_EXECUTE_OP) (
|
||||
*/
|
||||
typedef struct acpi_opcode_info
|
||||
{
|
||||
#ifdef _OPCODE_NAMES
|
||||
NATIVE_CHAR *Name; /* Opcode name (debug only) */
|
||||
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG)
|
||||
NATIVE_CHAR *Name; /* Opcode name (disassembler/debug only) */
|
||||
#endif
|
||||
UINT32 ParseArgs; /* Grammar/Parse time arguments */
|
||||
UINT32 RuntimeArgs; /* Interpret time arguments */
|
||||
@ -699,15 +695,23 @@ typedef union acpi_parse_val
|
||||
UINT32 AmlOffset; /* offset of declaration in AML */\
|
||||
union acpi_parse_obj *Parent; /* parent op */\
|
||||
union acpi_parse_obj *Next; /* next op */\
|
||||
ACPI_DEBUG_ONLY_MEMBERS (\
|
||||
ACPI_DISASM_ONLY_MEMBERS (\
|
||||
UINT8 DisasmFlags; /* Used during AML disassembly */\
|
||||
UINT8 DisasmOpcode; /* Subtype used for disassembly */\
|
||||
NATIVE_CHAR AmlOpName[16]) /* op name (debug only) */\
|
||||
/* NON-DEBUG members below: */\
|
||||
ACPI_NAMESPACE_NODE *Node; /* for use by interpreter */\
|
||||
ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
|
||||
|
||||
#define ACPI_DASM_BUFFER 0x00
|
||||
#define ACPI_DASM_RESOURCE 0x01
|
||||
#define ACPI_DASM_STRING 0x02
|
||||
#define ACPI_DASM_UNICODE 0x03
|
||||
#define ACPI_DASM_EISAID 0x04
|
||||
#define ACPI_DASM_MATCHOP 0x05
|
||||
|
||||
/*
|
||||
* generic operation (eg. If, While, Store)
|
||||
* generic operation (for example: If, While, Store)
|
||||
*/
|
||||
typedef struct acpi_parseobj_common
|
||||
{
|
||||
@ -722,6 +726,7 @@ typedef struct acpi_parseobj_common
|
||||
typedef struct acpi_parseobj_named
|
||||
{
|
||||
ACPI_PARSE_COMMON
|
||||
UINT8 *Path;
|
||||
UINT8 *Data; /* AML body or bytelist data */
|
||||
UINT32 Length; /* AML length */
|
||||
UINT32 Name; /* 4-byte name or zero if no name */
|
||||
@ -749,15 +754,15 @@ typedef struct acpi_parseobj_asl
|
||||
UINT32 LogicalByteOffset;
|
||||
UINT32 EndLine;
|
||||
UINT32 EndLogicalLine;
|
||||
UINT16 ParseOpcode;
|
||||
UINT32 AcpiBtype;
|
||||
UINT32 AmlLength;
|
||||
UINT32 AmlSubtreeLength;
|
||||
UINT32 FinalAmlLength;
|
||||
UINT32 FinalAmlOffset;
|
||||
UINT16 ParseOpcode;
|
||||
UINT16 CompileFlags;
|
||||
UINT8 AmlOpcodeLength;
|
||||
UINT8 AmlPkgLenBytes;
|
||||
UINT16 CompileFlags;
|
||||
UINT8 Extra;
|
||||
char ParseOpName[12];
|
||||
|
||||
@ -802,6 +807,13 @@ typedef struct acpi_parse_state
|
||||
#define ACPI_PARSEOP_BYTELIST 0x08
|
||||
#define ACPI_PARSEOP_IN_CACHE 0x80
|
||||
|
||||
/* Parse object DisasmFlags */
|
||||
|
||||
#define ACPI_PARSEOP_IGNORE 0x01
|
||||
#define ACPI_PARSEOP_PARAMLIST 0x02
|
||||
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
|
||||
#define ACPI_PARSEOP_SPECIAL 0x10
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acmacros.h - C macros for the entire subsystem.
|
||||
* $Revision: 124 $
|
||||
* $Revision: 126 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -378,12 +378,18 @@
|
||||
/*
|
||||
* Macros for the master AML opcode table
|
||||
*/
|
||||
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
|
||||
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG)
|
||||
#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,PArgs,IArgs,Flags,ObjType,Class,Type}
|
||||
#else
|
||||
#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {PArgs,IArgs,Flags,ObjType,Class,Type}
|
||||
#endif
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
#define ACPI_DISASM_ONLY_MEMBERS(a) a;
|
||||
#else
|
||||
#define ACPI_DISASM_ONLY_MEMBERS(a)
|
||||
#endif
|
||||
|
||||
#define ARG_TYPE_WIDTH 5
|
||||
#define ARG_1(x) ((UINT32)(x))
|
||||
#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH))
|
||||
@ -526,7 +532,6 @@
|
||||
|
||||
#define ACPI_DEBUG_DEFINE(a) a;
|
||||
#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
|
||||
#define _OPCODE_NAMES
|
||||
#define _VERBOSE_STRUCTURES
|
||||
|
||||
|
||||
@ -606,10 +611,6 @@
|
||||
#define return_VALUE(s) return(s)
|
||||
#define return_PTR(s) return(s)
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
#define _OPCODE_NAMES
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
|
||||
* $Revision: 125 $
|
||||
* $Revision: 126 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -134,7 +134,7 @@
|
||||
/* Definitions of the predefined namespace names */
|
||||
|
||||
#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */
|
||||
#define ACPI_ROOT_NAME (UINT32) 0x2F202020 /* Root name is "/ " */
|
||||
#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */
|
||||
#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */
|
||||
|
||||
#define ACPI_NS_ROOT_PATH "\\"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
|
||||
* $Revision: 59 $
|
||||
* $Revision: 60 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -357,6 +357,10 @@ AcpiPsDeleteCompletedOp (
|
||||
|
||||
/* psutils - parser utilities */
|
||||
|
||||
ACPI_PARSE_OBJECT *
|
||||
AcpiPsCreateScopeOp (
|
||||
void);
|
||||
|
||||
void
|
||||
AcpiPsInitOp (
|
||||
ACPI_PARSE_OBJECT *op,
|
||||
|
@ -296,7 +296,6 @@ AcpiOsReadPort (
|
||||
void *Value,
|
||||
UINT32 Width);
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsWritePort (
|
||||
ACPI_IO_ADDRESS Address,
|
||||
@ -314,7 +313,6 @@ AcpiOsReadMemory (
|
||||
void *Value,
|
||||
UINT32 Width);
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsWriteMemory (
|
||||
ACPI_PHYSICAL_ADDRESS Address,
|
||||
@ -333,7 +331,6 @@ AcpiOsReadPciConfiguration (
|
||||
void *Value,
|
||||
UINT32 Width);
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsWritePciConfiguration (
|
||||
ACPI_PCI_ID *PciId,
|
||||
@ -351,7 +348,6 @@ AcpiOsReadable (
|
||||
void *Pointer,
|
||||
UINT32 Length);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
AcpiOsWritable (
|
||||
void *Pointer,
|
||||
@ -380,6 +376,10 @@ AcpiOsVprintf (
|
||||
const NATIVE_CHAR *Format,
|
||||
va_list Args);
|
||||
|
||||
void
|
||||
AcpiOsRedirectOutput (
|
||||
void *Destination);
|
||||
|
||||
|
||||
/*
|
||||
* Debug input
|
||||
|
@ -134,6 +134,10 @@ ACPI_STATUS
|
||||
AcpiEnableSubsystem (
|
||||
UINT32 Flags);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiInitializeObjects (
|
||||
UINT32 Flags);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTerminate (
|
||||
void);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: actables.h - ACPI table management
|
||||
* $Revision: 41 $
|
||||
* $Revision: 42 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -134,8 +134,7 @@ AcpiTbHandleToObject (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbConvertToXsdt (
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT32 *NumberOfTables);
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbConvertTableFadt (
|
||||
@ -154,13 +153,31 @@ AcpiTbGetTableCount (
|
||||
* tbget - Table "get" routines
|
||||
*/
|
||||
|
||||
void
|
||||
AcpiTbTableOverride (
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTableWithOverride (
|
||||
AcpiTbGetTableHeader (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_HEADER *ReturnHeader);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTableBody (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_HEADER *Header,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetThisTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_HEADER *Header,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbTableOverride (
|
||||
ACPI_TABLE_HEADER *Header,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
@ -169,11 +186,6 @@ AcpiTbGetTablePtr (
|
||||
UINT32 Instance,
|
||||
ACPI_TABLE_HEADER **TablePtrLoc);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbVerifyRsdp (
|
||||
ACPI_POINTER *Address);
|
||||
@ -187,20 +199,19 @@ AcpiTbValidateRsdt (
|
||||
ACPI_TABLE_HEADER *TablePtr);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTablePointer (
|
||||
ACPI_POINTER *Address,
|
||||
UINT32 Flags,
|
||||
ACPI_SIZE *Size,
|
||||
ACPI_TABLE_HEADER **TablePtr);
|
||||
|
||||
/*
|
||||
* tbgetall - Get all firmware ACPI tables
|
||||
*/
|
||||
AcpiTbGetRequiredTables (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetAllTables (
|
||||
UINT32 NumberOfTables);
|
||||
AcpiTbGetPrimaryTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetSecondaryTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_STRING Signature,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
|
||||
/*
|
||||
* tbinstall - Table installation
|
||||
@ -213,11 +224,13 @@ AcpiTbInstallTable (
|
||||
ACPI_STATUS
|
||||
AcpiTbMatchSignature (
|
||||
NATIVE_CHAR *Signature,
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT8 SearchType);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbRecognizeTable (
|
||||
ACPI_TABLE_DESC *TableInfo);
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT8 SearchType);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbInitTableDescriptor (
|
||||
@ -256,7 +269,7 @@ AcpiTbFreeAcpiTablesOfType (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTableRsdt (
|
||||
UINT32 *NumberOfTables);
|
||||
void);
|
||||
|
||||
UINT8 *
|
||||
AcpiTbScanMemoryForRsdp (
|
||||
@ -280,12 +293,6 @@ AcpiTbFindTable (
|
||||
NATIVE_CHAR *OemTableId,
|
||||
ACPI_TABLE_HEADER **TablePtr);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbMapAcpiTable (
|
||||
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
|
||||
ACPI_SIZE *Size,
|
||||
ACPI_TABLE_HEADER **LogicalAddress);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbVerifyTableChecksum (
|
||||
ACPI_TABLE_HEADER *TableHeader);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: actbl.h - Table data structures defined in ACPI specification
|
||||
* $Revision: 52 $
|
||||
* $Revision: 53 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -276,9 +276,15 @@ typedef struct /* Smart Battery Description Table */
|
||||
|
||||
/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
|
||||
|
||||
#define ACPI_TABLE_SINGLE 0
|
||||
#define ACPI_TABLE_MULTIPLE 1
|
||||
#define ACPI_TABLE_EXECUTABLE 2
|
||||
#define ACPI_TABLE_SINGLE 0x00
|
||||
#define ACPI_TABLE_MULTIPLE 0x01
|
||||
#define ACPI_TABLE_EXECUTABLE 0x02
|
||||
|
||||
#define ACPI_TABLE_ROOT 0x00
|
||||
#define ACPI_TABLE_PRIMARY 0x10
|
||||
#define ACPI_TABLE_SECONDARY 0x20
|
||||
#define ACPI_TABLE_OTHER 0x30
|
||||
#define ACPI_TABLE_TYPE_MASK 0x30
|
||||
|
||||
/* Data about each known table type */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: actypes.h - Common data types for the entire ACPI subsystem
|
||||
* $Revision: 237 $
|
||||
* $Revision: 238 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -300,8 +300,18 @@ typedef struct AcpiPointer
|
||||
|
||||
/* PointerTypes for above */
|
||||
|
||||
#define ACPI_LOGICAL_POINTER 0x01
|
||||
#define ACPI_PHYSICAL_POINTER 0x02
|
||||
#define ACPI_PHYSICAL_POINTER 0x01
|
||||
#define ACPI_LOGICAL_POINTER 0x02
|
||||
|
||||
/* Processor mode */
|
||||
|
||||
#define ACPI_PHYSICAL_ADDRESSING 0x04
|
||||
#define ACPI_LOGICAL_ADDRESSING 0x08
|
||||
#define ACPI_MEMORY_MODE 0x0C
|
||||
|
||||
#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
|
||||
#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
|
||||
#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
|
||||
* $Revision: 139 $
|
||||
* $Revision: 142 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -191,6 +191,8 @@ NATIVE_CHAR *
|
||||
AcpiUtGetMutexName (
|
||||
UINT32 MutexId);
|
||||
|
||||
#endif
|
||||
|
||||
NATIVE_CHAR *
|
||||
AcpiUtGetTypeName (
|
||||
ACPI_OBJECT_TYPE Type);
|
||||
@ -199,9 +201,6 @@ NATIVE_CHAR *
|
||||
AcpiUtGetObjectTypeName (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
NATIVE_CHAR *
|
||||
AcpiUtGetRegionName (
|
||||
UINT8 SpaceId);
|
||||
@ -316,6 +315,9 @@ extern const UINT8 _acpi_ctype[];
|
||||
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
|
||||
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
|
||||
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
|
||||
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
|
||||
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
|
||||
#define ACPI_IS_ASCII(c) ((c) < 0x80)
|
||||
|
||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
|
||||
* Declarations and definitions contained herein are derived
|
||||
* directly from the ACPI specification.
|
||||
* $Revision: 68 $
|
||||
* $Revision: 69 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -565,13 +565,5 @@ typedef enum
|
||||
#define METHOD_FLAGS_SYNCH_LEVEL 0xF0
|
||||
|
||||
|
||||
/* Array sizes. Used for range checking also */
|
||||
|
||||
#define NUM_ACCESS_TYPES 6
|
||||
#define NUM_UPDATE_RULES 3
|
||||
#define NUM_MATCH_OPS 7
|
||||
#define NUM_OPCODES 256
|
||||
#define NUM_FIELD_NAMES 2
|
||||
|
||||
|
||||
#endif /* __AMLCODE_H__ */
|
||||
|
590
sys/contrib/dev/acpica/amlresrc.h
Normal file
590
sys/contrib/dev/acpica/amlresrc.h
Normal file
@ -0,0 +1,590 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: amlresrc.h - AML resource descriptors
|
||||
* $Revision: 20 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __AMLRESRC_H
|
||||
#define __AMLRESRC_H
|
||||
|
||||
|
||||
#define ASL_RESNAME_ADDRESS "_ADR"
|
||||
#define ASL_RESNAME_ALIGNMENT "_ALN"
|
||||
#define ASL_RESNAME_ADDRESSSPACE "_ASI"
|
||||
#define ASL_RESNAME_BASEADDRESS "_BAS"
|
||||
#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
|
||||
#define ASL_RESNAME_DECODE "_DEC"
|
||||
#define ASL_RESNAME_DMA "_DMA"
|
||||
#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
|
||||
#define ASL_RESNAME_GRANULARITY "_GRA"
|
||||
#define ASL_RESNAME_INTERRUPT "_INT"
|
||||
#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
|
||||
#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
|
||||
#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
|
||||
#define ASL_RESNAME_LENGTH "_LEN"
|
||||
#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
|
||||
#define ASL_RESNAME_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
|
||||
#define ASL_RESNAME_MAXADDR "_MAX"
|
||||
#define ASL_RESNAME_MINADDR "_MIN"
|
||||
#define ASL_RESNAME_MAXTYPE "_MAF"
|
||||
#define ASL_RESNAME_MINTYPE "_MIF"
|
||||
#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
|
||||
#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
|
||||
#define ASL_RESNAME_RANGETYPE "_RNG"
|
||||
#define ASL_RESNAME_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
|
||||
#define ASL_RESNAME_TRANSLATION "_TRA"
|
||||
#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
|
||||
#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
|
||||
#define ASL_RESNAME_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
|
||||
|
||||
|
||||
/* Default sizes for "small" resource descriptors */
|
||||
|
||||
#define ASL_RDESC_IRQ_SIZE 0x02
|
||||
#define ASL_RDESC_DMA_SIZE 0x02
|
||||
#define ASL_RDESC_ST_DEPEND_SIZE 0x00
|
||||
#define ASL_RDESC_END_DEPEND_SIZE 0x00
|
||||
#define ASL_RDESC_IO_SIZE 0x07
|
||||
#define ASL_RDESC_FIXED_IO_SIZE 0x03
|
||||
#define ASL_RDESC_END_TAG_SIZE 0x01
|
||||
|
||||
|
||||
typedef struct asl_resource_node
|
||||
{
|
||||
UINT32 BufferLength;
|
||||
void *Buffer;
|
||||
struct asl_resource_node *Next;
|
||||
|
||||
} ASL_RESOURCE_NODE;
|
||||
|
||||
|
||||
/*
|
||||
* Resource descriptors defined in the ACPI specification.
|
||||
*
|
||||
* Alignment must be BYTE because these descriptors
|
||||
* are used to overlay the AML byte stream.
|
||||
*/
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct asl_irq_format_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 IrqMask;
|
||||
UINT8 Flags;
|
||||
|
||||
} ASL_IRQ_FORMAT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_irq_noflags_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 IrqMask;
|
||||
|
||||
} ASL_IRQ_NOFLAGS_DESC;
|
||||
|
||||
|
||||
typedef struct asl_dma_format_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT8 DmaChannelMask;
|
||||
UINT8 Flags;
|
||||
|
||||
} ASL_DMA_FORMAT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_start_dependent_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT8 Flags;
|
||||
|
||||
} ASL_START_DEPENDENT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_start_dependent_noprio_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
|
||||
} ASL_START_DEPENDENT_NOPRIO_DESC;
|
||||
|
||||
|
||||
typedef struct asl_end_dependent_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
|
||||
} ASL_END_DEPENDENT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_io_port_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT8 Information;
|
||||
UINT16 AddressMin;
|
||||
UINT16 AddressMax;
|
||||
UINT8 Alignment;
|
||||
UINT8 Length;
|
||||
|
||||
} ASL_IO_PORT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_fixed_io_port_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 BaseAddress;
|
||||
UINT8 Length;
|
||||
|
||||
} ASL_FIXED_IO_PORT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_small_vendor_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT8 VendorDefined[7];
|
||||
|
||||
} ASL_SMALL_VENDOR_DESC;
|
||||
|
||||
|
||||
typedef struct asl_end_tag_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT8 Checksum;
|
||||
|
||||
} ASL_END_TAG_DESC;
|
||||
|
||||
|
||||
/* LARGE descriptors */
|
||||
|
||||
typedef struct asl_memory_24_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 Information;
|
||||
UINT16 AddressMin;
|
||||
UINT16 AddressMax;
|
||||
UINT16 Alignment;
|
||||
UINT16 RangeLength;
|
||||
|
||||
} ASL_MEMORY_24_DESC;
|
||||
|
||||
|
||||
typedef struct asl_large_vendor_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 VendorDefined[1];
|
||||
|
||||
} ASL_LARGE_VENDOR_DESC;
|
||||
|
||||
|
||||
typedef struct asl_memory_32_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 Information;
|
||||
UINT32 AddressMin;
|
||||
UINT32 AddressMax;
|
||||
UINT32 Alignment;
|
||||
UINT32 RangeLength;
|
||||
|
||||
} ASL_MEMORY_32_DESC;
|
||||
|
||||
|
||||
typedef struct asl_fixed_memory_32_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 Information;
|
||||
UINT32 BaseAddress;
|
||||
UINT32 RangeLength;
|
||||
|
||||
} ASL_FIXED_MEMORY_32_DESC;
|
||||
|
||||
|
||||
typedef struct asl_qword_address_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 ResourceType;
|
||||
UINT8 Flags;
|
||||
UINT8 SpecificFlags;
|
||||
UINT64 Granularity;
|
||||
UINT64 AddressMin;
|
||||
UINT64 AddressMax;
|
||||
UINT64 TranslationOffset;
|
||||
UINT64 AddressLength;
|
||||
UINT8 OptionalFields[2];
|
||||
|
||||
} ASL_QWORD_ADDRESS_DESC;
|
||||
|
||||
|
||||
typedef struct asl_dword_address_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 ResourceType;
|
||||
UINT8 Flags;
|
||||
UINT8 SpecificFlags;
|
||||
UINT32 Granularity;
|
||||
UINT32 AddressMin;
|
||||
UINT32 AddressMax;
|
||||
UINT32 TranslationOffset;
|
||||
UINT32 AddressLength;
|
||||
UINT8 OptionalFields[2];
|
||||
|
||||
} ASL_DWORD_ADDRESS_DESC;
|
||||
|
||||
|
||||
typedef struct asl_word_address_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 ResourceType;
|
||||
UINT8 Flags;
|
||||
UINT8 SpecificFlags;
|
||||
UINT16 Granularity;
|
||||
UINT16 AddressMin;
|
||||
UINT16 AddressMax;
|
||||
UINT16 TranslationOffset;
|
||||
UINT16 AddressLength;
|
||||
UINT8 OptionalFields[2];
|
||||
|
||||
} ASL_WORD_ADDRESS_DESC;
|
||||
|
||||
|
||||
typedef struct asl_extended_xrupt_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 Flags;
|
||||
UINT8 TableLength;
|
||||
UINT32 InterruptNumber[1];
|
||||
/* ResSourceIndex, ResSource optional fields follow */
|
||||
|
||||
} ASL_EXTENDED_XRUPT_DESC;
|
||||
|
||||
|
||||
typedef struct asl_general_register_desc
|
||||
{
|
||||
UINT8 DescriptorType;
|
||||
UINT16 Length;
|
||||
UINT8 AddressSpaceId;
|
||||
UINT8 BitWidth;
|
||||
UINT8 BitOffset;
|
||||
UINT8 Reserved;
|
||||
UINT64 Address;
|
||||
|
||||
} ASL_GENERAL_REGISTER_DESC;
|
||||
|
||||
/* restore default alignment */
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* Union of all resource descriptors, sow we can allocate the worst case */
|
||||
|
||||
typedef union asl_resource_desc
|
||||
{
|
||||
ASL_IRQ_FORMAT_DESC Irq;
|
||||
ASL_DMA_FORMAT_DESC Dma;
|
||||
ASL_START_DEPENDENT_DESC Std;
|
||||
ASL_END_DEPENDENT_DESC End;
|
||||
ASL_IO_PORT_DESC Iop;
|
||||
ASL_FIXED_IO_PORT_DESC Fio;
|
||||
ASL_SMALL_VENDOR_DESC Smv;
|
||||
ASL_END_TAG_DESC Et;
|
||||
|
||||
ASL_MEMORY_24_DESC M24;
|
||||
ASL_LARGE_VENDOR_DESC Lgv;
|
||||
ASL_MEMORY_32_DESC M32;
|
||||
ASL_FIXED_MEMORY_32_DESC F32;
|
||||
ASL_QWORD_ADDRESS_DESC Qas;
|
||||
ASL_DWORD_ADDRESS_DESC Das;
|
||||
ASL_WORD_ADDRESS_DESC Was;
|
||||
ASL_EXTENDED_XRUPT_DESC Exx;
|
||||
ASL_GENERAL_REGISTER_DESC Grg;
|
||||
UINT32 U32Item;
|
||||
UINT16 U16Item;
|
||||
UINT8 U8Item;
|
||||
|
||||
} ASL_RESOURCE_DESC;
|
||||
|
||||
|
||||
#define NEXT_RESOURCE_DESC(a,b) (ASL_RESOURCE_DESC *) (((char *) (a)) + sizeof(b))
|
||||
|
||||
#define DEFAULT_RESOURCE_DESC_SIZE (sizeof (ASL_RESOURCE_DESC) + sizeof (ASL_END_TAG_DESC))
|
||||
|
||||
|
||||
/*
|
||||
* Resource utilities
|
||||
*/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsAllocateResourceNode (
|
||||
UINT32 Size);
|
||||
|
||||
void
|
||||
RsCreateBitField (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name,
|
||||
UINT32 ByteOffset,
|
||||
UINT32 BitOffset);
|
||||
|
||||
void
|
||||
RsCreateByteField (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
char *Name,
|
||||
UINT32 ByteOffset);
|
||||
|
||||
void
|
||||
RsSetFlagBits (
|
||||
UINT8 *Flags,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT8 Position,
|
||||
UINT8 Default);
|
||||
|
||||
ACPI_PARSE_OBJECT *
|
||||
RsCompleteNodeAndGetNext (
|
||||
ACPI_PARSE_OBJECT *Op);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoOneResourceDescriptor (
|
||||
ACPI_PARSE_OBJECT *DescriptorTypeOp,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
UINT32
|
||||
RsLinkDescriptorChain (
|
||||
ASL_RESOURCE_NODE **PreviousRnode,
|
||||
ASL_RESOURCE_NODE *Rnode);
|
||||
|
||||
|
||||
/*
|
||||
* Small descriptors
|
||||
*/
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDmaDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoEndDependentDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoFixedIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoInterruptDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoIrqNoFlagsDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoMemory24Descriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoMemory32Descriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoMemory32FixedDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoStartDependentDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoStartDependentNoPriDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoVendorSmallDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
/*
|
||||
* Large descriptors
|
||||
*/
|
||||
|
||||
UINT32
|
||||
RsGetStringDataLength (
|
||||
ACPI_PARSE_OBJECT *InitializerOp);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoDwordMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoQwordMemoryDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordIoDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoWordBusNumberDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoVendorLargeDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
ASL_RESOURCE_NODE *
|
||||
RsDoGeneralRegisterDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dbcmds - debug commands and output routines
|
||||
* $Revision: 84 $
|
||||
* $Revision: 85 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -122,6 +122,7 @@
|
||||
#include "acevents.h"
|
||||
#include "acdebug.h"
|
||||
#include "acresrc.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
|
||||
@ -448,7 +449,7 @@ AcpiDbDisassembleAml (
|
||||
NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
|
||||
}
|
||||
|
||||
AcpiDbDisplayOp (NULL, Op, NumStatements);
|
||||
AcpiDmDisassemble (NULL, Op, NumStatements);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dbdisply - debug display commands
|
||||
* $Revision: 75 $
|
||||
* $Revision: 76 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -411,6 +411,12 @@ AcpiDbDecodeInternalObject (
|
||||
return;
|
||||
}
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
|
||||
{
|
||||
AcpiOsPrintf ("%p", ObjDesc);
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
@ -449,12 +455,47 @@ AcpiDbDecodeInternalObject (
|
||||
|
||||
|
||||
default:
|
||||
/* No additional display for other types */
|
||||
|
||||
AcpiOsPrintf ("%p", ObjDesc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbDecodeNode
|
||||
*
|
||||
* PARAMETERS: Node - Object to be displayed
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Short display of a namespace node
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDbDecodeNode (
|
||||
ACPI_NAMESPACE_NODE *Node)
|
||||
{
|
||||
|
||||
|
||||
AcpiOsPrintf ("<Node> Name %4.4s Type-%s",
|
||||
Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
|
||||
|
||||
if (Node->Flags & ANOBJ_METHOD_ARG)
|
||||
{
|
||||
AcpiOsPrintf (" [Method Arg]");
|
||||
}
|
||||
if (Node->Flags & ANOBJ_METHOD_LOCAL)
|
||||
{
|
||||
AcpiOsPrintf (" [Method Local]");
|
||||
}
|
||||
|
||||
AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbDisplayInternalObject
|
||||
@ -496,18 +537,7 @@ AcpiDbDisplayInternalObject (
|
||||
|
||||
case ACPI_DESC_TYPE_NAMED:
|
||||
|
||||
AcpiOsPrintf ("<Node> Name %4.4s Type-%s",
|
||||
((ACPI_NAMESPACE_NODE *)ObjDesc)->Name.Ascii,
|
||||
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type));
|
||||
|
||||
if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG)
|
||||
{
|
||||
AcpiOsPrintf (" [Method Arg]");
|
||||
}
|
||||
if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_LOCAL)
|
||||
{
|
||||
AcpiOsPrintf (" [Method Local]");
|
||||
}
|
||||
AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
|
||||
break;
|
||||
|
||||
|
||||
@ -525,9 +555,11 @@ AcpiDbDisplayInternalObject (
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case INTERNAL_TYPE_REFERENCE:
|
||||
|
||||
switch (ObjDesc->Reference.Opcode)
|
||||
{
|
||||
case AML_LOCAL_OP:
|
||||
|
||||
AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
|
||||
if (WalkState)
|
||||
{
|
||||
@ -537,7 +569,9 @@ AcpiDbDisplayInternalObject (
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_ARG_OP:
|
||||
|
||||
AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
|
||||
if (WalkState)
|
||||
{
|
||||
@ -547,24 +581,52 @@ AcpiDbDisplayInternalObject (
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_DEBUG_OP:
|
||||
|
||||
AcpiOsPrintf ("[Debug] ");
|
||||
break;
|
||||
|
||||
|
||||
case AML_INDEX_OP:
|
||||
|
||||
AcpiOsPrintf ("[Index] ");
|
||||
AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
|
||||
break;
|
||||
|
||||
|
||||
case AML_REF_OF_OP:
|
||||
|
||||
AcpiOsPrintf ("[Reference] ");
|
||||
|
||||
/* Reference can be to a Node or an Operand object */
|
||||
|
||||
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
|
||||
{
|
||||
case ACPI_DESC_TYPE_NAMED:
|
||||
AcpiDbDecodeNode (ObjDesc->Reference.Object);
|
||||
break;
|
||||
|
||||
case ACPI_DESC_TYPE_OPERAND:
|
||||
AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
AcpiOsPrintf ("Unknown Reference opcode %X\n",
|
||||
ObjDesc->Reference.Opcode);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
AcpiOsPrintf ("<Obj> ");
|
||||
AcpiOsPrintf (" ");
|
||||
AcpiDbDecodeInternalObject (ObjDesc);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dbexec - debugger control method execution
|
||||
* $Revision: 41 $
|
||||
* $Revision: 42 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -322,6 +322,9 @@ AcpiDbExecute (
|
||||
AcpiGbl_DbMethodInfo.Args = Args;
|
||||
AcpiGbl_DbMethodInfo.Flags = Flags;
|
||||
|
||||
ReturnObj.Pointer = NULL;
|
||||
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
|
||||
|
||||
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
|
||||
Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
|
||||
|
||||
@ -363,6 +366,11 @@ AcpiDbExecute (
|
||||
AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, ReturnObj.Length);
|
||||
AcpiDbDumpObject (ReturnObj.Pointer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("No return object from execution of %s\n",
|
||||
AcpiGbl_DbMethodInfo.Pathname);
|
||||
}
|
||||
}
|
||||
|
||||
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
|
||||
* be used when running the debugger in Ring 0 (Kernel mode)
|
||||
* $Revision: 63 $
|
||||
* $Revision: 67 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -121,7 +121,7 @@
|
||||
#include "acnamesp.h"
|
||||
#include "actables.h"
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
#if (defined ENABLE_DEBUGGER || defined ACPI_DISASSEMBLER)
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dbfileio")
|
||||
@ -180,6 +180,7 @@ AcpiDbMatchArgument (
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDbCloseDebugFile
|
||||
@ -245,6 +246,7 @@ AcpiDbOpenDebugFile (
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ACPI_APPLICATION
|
||||
@ -288,7 +290,7 @@ AcpiDbLoadTable(
|
||||
|
||||
Status = AcpiTbValidateTableHeader (&TableHeader);
|
||||
if ((ACPI_FAILURE (Status)) ||
|
||||
(TableHeader.Length > 524288)) /* 1/2 Mbyte should be enough */
|
||||
(TableHeader.Length > 0x800000)) /* 8 Mbyte should be enough */
|
||||
{
|
||||
AcpiOsPrintf ("Table header is invalid!\n");
|
||||
return (AE_ERROR);
|
||||
@ -383,9 +385,14 @@ AeLocalLoadTable (
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
TableInfo.Pointer = TablePtr;
|
||||
Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_SECONDARY);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
Status = AcpiTbInstallTable (&TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -397,7 +404,7 @@ AeLocalLoadTable (
|
||||
}
|
||||
|
||||
|
||||
#ifndef PARSER_ONLY
|
||||
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
|
||||
Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
@ -433,7 +440,7 @@ AcpiDbGetAcpiTable (
|
||||
|
||||
/* Get the entire file */
|
||||
|
||||
AcpiOsPrintf ("Loading Acpi table from file %s\n", Filename);
|
||||
fprintf (stderr, "Loading Acpi table from file %s\n", Filename);
|
||||
Status = AcpiDbLoadTable (fp, &AcpiGbl_DbTablePtr, &TableLength);
|
||||
fclose(fp);
|
||||
|
||||
@ -492,8 +499,8 @@ AcpiDbLoadAcpiTable (
|
||||
return (Status);
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n",
|
||||
AcpiGbl_DbTablePtr->Signature, AcpiGbl_DbTablePtr);
|
||||
fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
|
||||
AcpiGbl_DbTablePtr->Signature);
|
||||
|
||||
AcpiGbl_AcpiHardwarePresent = FALSE;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dbxface - AML Debugger external interfaces
|
||||
* $Revision: 59 $
|
||||
* $Revision: 61 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -118,6 +118,7 @@
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdebug.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
@ -268,7 +269,7 @@ AcpiDbSingleStep (
|
||||
|
||||
/* Now we can display it */
|
||||
|
||||
AcpiDbDisplayOp (WalkState, DisplayOp, ACPI_UINT32_MAX);
|
||||
AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX);
|
||||
|
||||
if ((Op->Common.AmlOpcode == AML_IF_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_WHILE_OP))
|
||||
@ -476,7 +477,6 @@ AcpiDbInitialize (void)
|
||||
|
||||
if (!AcpiGbl_DbOpt_verbose)
|
||||
{
|
||||
AcpiGbl_DbDisasmIndent = " ";
|
||||
AcpiGbl_DbOpt_disasm = TRUE;
|
||||
AcpiGbl_DbOpt_stats = FALSE;
|
||||
}
|
||||
|
627
sys/contrib/dev/acpica/dmbuffer.c
Normal file
627
sys/contrib/dev/acpica/dmbuffer.c
Normal file
@ -0,0 +1,627 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmbuffer - AML disassembler, buffer and string support
|
||||
* $Revision: 5 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acdisasm.h"
|
||||
#include "acparser.h"
|
||||
#include "amlcode.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dmbuffer")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDisasmByteList
|
||||
*
|
||||
* PARAMETERS: Level - Current source code indentation level
|
||||
* ByteData - Pointer to the byte list
|
||||
* ByteCount - Length of the byte list
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump a list of bytes in Hex format
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmDisasmByteList (
|
||||
UINT32 Level,
|
||||
UINT8 *ByteData,
|
||||
UINT32 ByteCount)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
|
||||
/* Dump the byte list */
|
||||
|
||||
for (i = 0; i < ByteCount; i++)
|
||||
{
|
||||
AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]);
|
||||
|
||||
/* Add comma if there are more bytes to display */
|
||||
|
||||
if (i < (ByteCount -1))
|
||||
{
|
||||
AcpiOsPrintf (", ");
|
||||
}
|
||||
|
||||
/* New line every 8 bytes */
|
||||
|
||||
if ((((i+1) % 8) == 0) && ((i+1) < ByteCount))
|
||||
{
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDmIndent (Level);
|
||||
}
|
||||
}
|
||||
|
||||
if (Level)
|
||||
{
|
||||
AcpiOsPrintf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmByteList
|
||||
*
|
||||
* PARAMETERS: Info - Parse tree walk info
|
||||
* Op - Byte list op
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump a buffer byte list, handling the various types of buffers.
|
||||
* Buffer type must be already set in the Op DisasmOpcode.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmByteList (
|
||||
ACPI_OP_WALK_INFO *Info,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT8 *ByteData;
|
||||
UINT32 ByteCount;
|
||||
|
||||
|
||||
ByteData = Op->Named.Data;
|
||||
ByteCount = Op->Common.Value.Integer32;
|
||||
|
||||
/*
|
||||
* The byte list belongs to a buffer, and can be produced by either
|
||||
* a ResourceTemplate, Unicode, quoted string, or a plain byte list.
|
||||
*/
|
||||
switch (Op->Common.Parent->Common.DisasmOpcode)
|
||||
{
|
||||
case ACPI_DASM_RESOURCE:
|
||||
|
||||
AcpiDmResourceDescriptor (Info, ByteData, ByteCount);
|
||||
break;
|
||||
|
||||
case ACPI_DASM_STRING:
|
||||
|
||||
AcpiDmIndent (Info->Level);
|
||||
AcpiDmString ((char *) ByteData);
|
||||
AcpiOsPrintf ("\n");
|
||||
break;
|
||||
|
||||
case ACPI_DASM_UNICODE:
|
||||
|
||||
AcpiDmUnicode (Op);
|
||||
break;
|
||||
|
||||
case ACPI_DASM_BUFFER:
|
||||
default:
|
||||
|
||||
/*
|
||||
* Not a resource, string, or unicode string.
|
||||
* Just dump the buffer
|
||||
*/
|
||||
AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIsUnicodeBuffer
|
||||
*
|
||||
* PARAMETERS: Op - Buffer Object to be examined
|
||||
*
|
||||
* RETURN: TRUE if buffer contains a UNICODE string
|
||||
*
|
||||
* DESCRIPTION: Determine if a buffer Op contains a Unicode string
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmIsUnicodeBuffer (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT8 *ByteData;
|
||||
UINT32 ByteCount;
|
||||
UINT32 WordCount;
|
||||
ACPI_PARSE_OBJECT *SizeOp;
|
||||
ACPI_PARSE_OBJECT *NextOp;
|
||||
NATIVE_UINT i;
|
||||
|
||||
|
||||
/* Buffer size is the buffer argument */
|
||||
|
||||
SizeOp = Op->Common.Value.Arg;
|
||||
|
||||
/* Next, the initializer byte list to examine */
|
||||
|
||||
NextOp = SizeOp->Common.Next;
|
||||
if (!NextOp)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Extract the byte list info */
|
||||
|
||||
ByteData = NextOp->Named.Data;
|
||||
ByteCount = NextOp->Common.Value.Integer32;
|
||||
WordCount = ACPI_DIV_2 (ByteCount);
|
||||
|
||||
/*
|
||||
* Unicode string must have an even number of bytes and last
|
||||
* word must be zero
|
||||
*/
|
||||
if ((!ByteCount) ||
|
||||
(ByteCount < 4) ||
|
||||
(ByteCount & 1) ||
|
||||
((UINT16 *) (void *) ByteData)[WordCount - 1] != 0)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* For each word, 1st byte must be ascii, 2nd byte must be zero */
|
||||
|
||||
for (i = 0; i < (ByteCount - 2); i += 2)
|
||||
{
|
||||
if ((!ACPI_IS_PRINT (ByteData[i])) ||
|
||||
(ByteData[i + 1] != 0))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ignore the Size argument in the disassembly of this buffer op */
|
||||
|
||||
SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIsStringBuffer
|
||||
*
|
||||
* PARAMETERS: Op - Buffer Object to be examined
|
||||
*
|
||||
* RETURN: TRUE if buffer contains a ASCII string
|
||||
*
|
||||
* DESCRIPTION: Determine if a buffer Op contains a ASCII string
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmIsStringBuffer (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT8 *ByteData;
|
||||
UINT32 ByteCount;
|
||||
ACPI_PARSE_OBJECT *SizeOp;
|
||||
ACPI_PARSE_OBJECT *NextOp;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Buffer size is the buffer argument */
|
||||
|
||||
SizeOp = Op->Common.Value.Arg;
|
||||
|
||||
/* Next, the initializer byte list to examine */
|
||||
|
||||
NextOp = SizeOp->Common.Next;
|
||||
if (!NextOp)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Extract the byte list info */
|
||||
|
||||
ByteData = NextOp->Named.Data;
|
||||
ByteCount = NextOp->Common.Value.Integer32;
|
||||
|
||||
/* Last byte must be the null terminator */
|
||||
|
||||
if ((!ByteCount) ||
|
||||
(ByteCount < 2) ||
|
||||
(ByteData[ByteCount-1] != 0))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
for (i = 0; i < (ByteCount - 1); i++)
|
||||
{
|
||||
/* TBD: allow some escapes (non-ascii chars).
|
||||
* they will be handled in the string output routine
|
||||
*/
|
||||
|
||||
if (!ACPI_IS_PRINT (ByteData[i]))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmString
|
||||
*
|
||||
* PARAMETERS: String - Null terminated ASCII string
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
|
||||
* sequences.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmString (
|
||||
char *String)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
if (!String)
|
||||
{
|
||||
AcpiOsPrintf ("<\"NULL STRING PTR\">");
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\"");
|
||||
for (i = 0; String[i]; i++)
|
||||
{
|
||||
/* Escape sequences */
|
||||
|
||||
switch (String[i])
|
||||
{
|
||||
case 0x07:
|
||||
AcpiOsPrintf ("\\a"); /* BELL */
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
AcpiOsPrintf ("\\b"); /* BACKSPACE */
|
||||
break;
|
||||
|
||||
case 0x0C:
|
||||
AcpiOsPrintf ("\\f"); /* FORMFEED */
|
||||
break;
|
||||
|
||||
case 0x0A:
|
||||
AcpiOsPrintf ("\\n"); /* LINEFEED */
|
||||
break;
|
||||
|
||||
case 0x0D:
|
||||
AcpiOsPrintf ("\\r"); /* CARRIAGE RETURN*/
|
||||
break;
|
||||
|
||||
case 0x09:
|
||||
AcpiOsPrintf ("\\t"); /* HORIZONTAL TAB */
|
||||
break;
|
||||
|
||||
case 0x0B:
|
||||
AcpiOsPrintf ("\\v"); /* VERTICAL TAB */
|
||||
break;
|
||||
|
||||
case '\'': /* Single Quote */
|
||||
case '\"': /* Double Quote */
|
||||
case '\\': /* Backslash */
|
||||
AcpiOsPrintf ("\\%c", (int) String[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Check for printable character or hex escape */
|
||||
|
||||
if (ACPI_IS_PRINT (String[i]))
|
||||
{
|
||||
/* This is a normal character */
|
||||
|
||||
AcpiOsPrintf ("%c", (int) String[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* All others will be Hex escapes */
|
||||
|
||||
AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
AcpiOsPrintf ("\"");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmUnicode
|
||||
*
|
||||
* PARAMETERS: Op - Byte List op containing Unicode string
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump Unicode string as a standard ASCII string. (Remove
|
||||
* the extra zero bytes).
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmUnicode (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT16 *WordData;
|
||||
UINT32 WordCount;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* Extract the buffer info as a WORD buffer */
|
||||
|
||||
WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
|
||||
WordCount = ACPI_DIV_2 (Op->Common.Value.Integer32);
|
||||
|
||||
|
||||
AcpiOsPrintf ("\"");
|
||||
|
||||
/* Write every other byte as an ASCII character */
|
||||
|
||||
for (i = 0; i < (WordCount - 1); i++)
|
||||
{
|
||||
AcpiOsPrintf ("%c", (int) WordData[i]);
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("\")");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiIsEisaId
|
||||
*
|
||||
* PARAMETERS: Op - Op to be examined
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Determine if an Op can be converted to an EisaId.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiIsEisaId (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT32 Name;
|
||||
UINT32 BigEndianId;
|
||||
ACPI_PARSE_OBJECT *NextOp;
|
||||
NATIVE_UINT i;
|
||||
UINT32 Prefix[3];
|
||||
|
||||
|
||||
/* Get the NameSegment */
|
||||
|
||||
Name = AcpiPsGetName (Op);
|
||||
if (!Name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* We are looking for _HID */
|
||||
|
||||
if (ACPI_STRNCMP ((char *) &Name, "_HID", 4))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* The parameter must be either a word or a dword */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
if ((NextOp->Common.AmlOpcode != AML_DWORD_OP) &&
|
||||
(NextOp->Common.AmlOpcode != AML_WORD_OP))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Swap from little-endian to big-endian to simplify conversion */
|
||||
|
||||
BigEndianId = AcpiUtDwordByteSwap (NextOp->Common.Value.Integer32);
|
||||
|
||||
/* Create the 3 leading ASCII letters */
|
||||
|
||||
Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
|
||||
Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
|
||||
Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
|
||||
|
||||
/* Verify that all 3 are ascii and alpha */
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (!ACPI_IS_ASCII (Prefix[i]) ||
|
||||
!ACPI_IS_ALPHA (Prefix[i]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* OK - mark this node as convertable to an EISA ID */
|
||||
|
||||
NextOp->Common.DisasmOpcode = ACPI_DASM_EISAID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmEisaId
|
||||
*
|
||||
* PARAMETERS: EncodedId - Raw encoded EISA ID.
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Convert an encoded EISAID back to the original ASCII String.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmEisaId (
|
||||
UINT32 EncodedId)
|
||||
{
|
||||
UINT32 BigEndianId;
|
||||
|
||||
|
||||
/* Swap from little-endian to big-endian to simplify conversion */
|
||||
|
||||
BigEndianId = AcpiUtDwordByteSwap (EncodedId);
|
||||
|
||||
|
||||
/* Split to form "AAANNNN" string */
|
||||
|
||||
AcpiOsPrintf ("EisaId (\"%c%c%c%4.4X\")",
|
||||
|
||||
/* Three Alpha characters (AAA), 5 bits each */
|
||||
|
||||
(int) ((BigEndianId >> 26) & 0x1F) + 0x40,
|
||||
(int) ((BigEndianId >> 21) & 0x1F) + 0x40,
|
||||
(int) ((BigEndianId >> 16) & 0x1F) + 0x40,
|
||||
|
||||
/* Numeric part (NNNN) is simply the lower 16 bits */
|
||||
|
||||
(UINT32) (BigEndianId & 0xFFFF));
|
||||
}
|
||||
|
||||
#endif
|
541
sys/contrib/dev/acpica/dmnames.c
Normal file
541
sys/contrib/dev/acpica/dmnames.c
Normal file
@ -0,0 +1,541 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmnames - AML disassembler, names, namestrings, pathnames
|
||||
* $Revision: 2 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dmnames")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmValidateName
|
||||
*
|
||||
* PARAMETERS: Name - 4 character ACPI name
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Lookup the name
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmValidateName (
|
||||
char *Name,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
#ifdef PARSER_ONLY
|
||||
ACPI_PARSE_OBJECT *TargetOp;
|
||||
|
||||
|
||||
if ((!Name) ||
|
||||
(!Op->Common.Parent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TargetOp = AcpiPsFind (Op, Name, 0, 0);
|
||||
if (!TargetOp)
|
||||
{
|
||||
/*
|
||||
* Didn't find the name in the parse tree. This may be
|
||||
* a problem, or it may simply be one of the predefined names
|
||||
* (such as _OS_). Rather than worry about looking up all
|
||||
* the predefined names, just display the name as given
|
||||
*/
|
||||
AcpiOsPrintf (" /**** Name not found or not accessible from this scope ****/ ");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDumpName
|
||||
*
|
||||
* PARAMETERS: Name - 4 character ACPI name
|
||||
*
|
||||
* RETURN: Final length of name
|
||||
*
|
||||
* DESCRIPTION: Dump an ACPI name, minus any trailing underscores.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
AcpiDmDumpName (
|
||||
char *Name)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 Length;
|
||||
char *End = Name + ACPI_NAME_SIZE;
|
||||
|
||||
|
||||
for (i = 0; i < ACPI_NAME_SIZE; i++)
|
||||
{
|
||||
if (Name[i] != '_')
|
||||
{
|
||||
End = &Name[i];
|
||||
}
|
||||
}
|
||||
|
||||
Length = (UINT32)(End - Name) + 1;
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
AcpiOsPrintf ("%c", Name[i]);
|
||||
}
|
||||
|
||||
return (Length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiPsDisplayObjectPathname
|
||||
*
|
||||
* PARAMETERS: WalkState - Current walk state
|
||||
* Op - Object whose pathname is to be obtained
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Diplay the pathname associated with a named object. Two
|
||||
* versions. One searches the parse tree (for parser-only
|
||||
* applications suchas AcpiDump), and the other searches the
|
||||
* ACPI namespace (the parse tree is probably deleted)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef PARSER_ONLY
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiPsDisplayObjectPathname (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *TargetOp;
|
||||
char *Name;
|
||||
|
||||
|
||||
if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
|
||||
{
|
||||
Name = Op->Common.Value.Name;
|
||||
if (Name[0] == '\\')
|
||||
{
|
||||
AcpiOsPrintf (" (Fully Qualified Pathname)");
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Name = (char *) &Op->Named.Name;
|
||||
}
|
||||
|
||||
/* Search parent tree up to the root if necessary */
|
||||
|
||||
TargetOp = AcpiPsFind (Op, Name, 0, 0);
|
||||
if (!TargetOp)
|
||||
{
|
||||
/*
|
||||
* Didn't find the name in the parse tree. This may be
|
||||
* a problem, or it may simply be one of the predefined names
|
||||
* (such as _OS_). Rather than worry about looking up all
|
||||
* the predefined names, just display the name as given
|
||||
*/
|
||||
AcpiOsPrintf (" **** Path not found in parse tree");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The target was found, print the name and complete path */
|
||||
|
||||
AcpiOsPrintf (" (Path ");
|
||||
AcpiDmDisplayPath (TargetOp);
|
||||
AcpiOsPrintf (")");
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiPsDisplayObjectPathname (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_BUFFER Buffer;
|
||||
UINT32 DebugLevel;
|
||||
|
||||
|
||||
/* Save current debug level so we don't get extraneous debug output */
|
||||
|
||||
DebugLevel = AcpiDbgLevel;
|
||||
AcpiDbgLevel = 0;
|
||||
|
||||
/* Just get the Node out of the Op object */
|
||||
|
||||
Node = Op->Common.Node;
|
||||
if (!Node)
|
||||
{
|
||||
/* Node not defined in this scope, look it up */
|
||||
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY,
|
||||
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/*
|
||||
* We can't get the pathname since the object
|
||||
* is not in the namespace. This can happen during single
|
||||
* stepping where a dynamic named object is *about* to be created.
|
||||
*/
|
||||
AcpiOsPrintf (" [Path not found]");
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* Save it for next time. */
|
||||
|
||||
Op->Common.Node = Node;
|
||||
}
|
||||
|
||||
/* Convert NamedDesc/handle to a full pathname */
|
||||
|
||||
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||
Status = AcpiNsHandleToPathname (Node, &Buffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiOsPrintf ("****Could not get pathname****)");
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (" (Path %s)", (char *) Buffer.Pointer);
|
||||
ACPI_MEM_FREE (Buffer.Pointer);
|
||||
|
||||
|
||||
Exit:
|
||||
/* Restore the debug level */
|
||||
|
||||
AcpiDbgLevel = DebugLevel;
|
||||
return (Status);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmNamestring
|
||||
*
|
||||
* PARAMETERS: Name - ACPI Name string to store
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode an ACPI namestring. Handles prefix characters
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmNamestring (
|
||||
NATIVE_CHAR *Name)
|
||||
{
|
||||
UINT32 SegCount;
|
||||
|
||||
|
||||
if (!Name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle all Scope Prefix operators */
|
||||
|
||||
while (AcpiPsIsPrefixChar (ACPI_GET8 (Name)))
|
||||
{
|
||||
/* Append prefix character */
|
||||
|
||||
AcpiOsPrintf ("%1c", ACPI_GET8 (Name));
|
||||
Name++;
|
||||
}
|
||||
|
||||
switch (ACPI_GET8 (Name))
|
||||
{
|
||||
case 0:
|
||||
SegCount = 0;
|
||||
break;
|
||||
|
||||
case AML_DUAL_NAME_PREFIX:
|
||||
SegCount = 2;
|
||||
Name++;
|
||||
break;
|
||||
|
||||
case AML_MULTI_NAME_PREFIX_OP:
|
||||
SegCount = (UINT32) ACPI_GET8 (Name + 1);
|
||||
Name += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
SegCount = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
while (SegCount)
|
||||
{
|
||||
/* Append Name segment */
|
||||
|
||||
AcpiDmDumpName ((char *) Name);
|
||||
|
||||
SegCount--;
|
||||
if (SegCount)
|
||||
{
|
||||
/* Not last name, append dot separator */
|
||||
|
||||
AcpiOsPrintf (".");
|
||||
}
|
||||
Name += ACPI_NAME_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDisplayPath
|
||||
*
|
||||
* PARAMETERS: Op - Named Op whose path is to be constructed
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Walk backwards from current scope and display the name
|
||||
* of each previous level of scope up to the root scope
|
||||
* (like "pwd" does with file systems)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmDisplayPath (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Prev;
|
||||
ACPI_PARSE_OBJECT *Search;
|
||||
UINT32 Name;
|
||||
BOOLEAN DoDot = FALSE;
|
||||
ACPI_PARSE_OBJECT *NamePath;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
|
||||
|
||||
/* We are only interested in named objects */
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
if (!(OpInfo->Flags & AML_NSNODE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OpInfo->Flags & AML_CREATE)
|
||||
{
|
||||
/* Field creation - check for a fully qualified namepath */
|
||||
|
||||
if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
|
||||
{
|
||||
NamePath = AcpiPsGetArg (Op, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
NamePath = AcpiPsGetArg (Op, 2);
|
||||
}
|
||||
|
||||
if ((NamePath) &&
|
||||
(NamePath->Common.Value.String) &&
|
||||
(NamePath->Common.Value.String[0] == '\\'))
|
||||
{
|
||||
AcpiDmNamestring (NamePath->Common.Value.String);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Prev = NULL; /* Start with Root Node */
|
||||
|
||||
while (Prev != Op)
|
||||
{
|
||||
/* Search upwards in the tree to find scope with "prev" as its parent */
|
||||
|
||||
Search = Op;
|
||||
for (; ;)
|
||||
{
|
||||
if (Search->Common.Parent == Prev)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Go up one level */
|
||||
|
||||
Search = Search->Common.Parent;
|
||||
}
|
||||
|
||||
if (Prev)
|
||||
{
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Search->Common.AmlOpcode);
|
||||
if (!(OpInfo->Flags & AML_FIELD))
|
||||
{
|
||||
/* Below root scope, append scope name */
|
||||
|
||||
if (DoDot)
|
||||
{
|
||||
/* Append dot */
|
||||
|
||||
AcpiOsPrintf (".");
|
||||
}
|
||||
|
||||
if (OpInfo->Flags & AML_CREATE)
|
||||
{
|
||||
if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
|
||||
{
|
||||
NamePath = AcpiPsGetArg (Op, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
NamePath = AcpiPsGetArg (Op, 2);
|
||||
}
|
||||
|
||||
if ((NamePath) &&
|
||||
(NamePath->Common.Value.String))
|
||||
{
|
||||
AcpiDmDumpName (NamePath->Common.Value.String);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Name = AcpiPsGetName (Search);
|
||||
AcpiDmDumpName ((char *) &Name);
|
||||
}
|
||||
|
||||
DoDot = TRUE;
|
||||
}
|
||||
}
|
||||
Prev = Search;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
614
sys/contrib/dev/acpica/dmopcode.c
Normal file
614
sys/contrib/dev/acpica/dmopcode.c
Normal file
@ -0,0 +1,614 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmopcode - AML disassembler, specific AML opcodes
|
||||
* $Revision: 75 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdisasm.h"
|
||||
#include "acdebug.h"
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dmopcode")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmMethodFlags
|
||||
*
|
||||
* PARAMETERS: Op - Method Object to be examined
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode control method flags
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmMethodFlags (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT32 Flags;
|
||||
UINT32 Args;
|
||||
|
||||
|
||||
/* The next Op contains the flags */
|
||||
|
||||
Op = AcpiPsGetDepthNext (NULL, Op);
|
||||
Flags = Op->Common.Value.Integer8;
|
||||
Args = Flags & 0x07;
|
||||
|
||||
/* Mark the Op as completed */
|
||||
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
|
||||
/* 1) Method argument count */
|
||||
|
||||
AcpiOsPrintf (", %d, ", Args);
|
||||
|
||||
/* 2) Serialize rule */
|
||||
|
||||
if (!(Flags & 0x08))
|
||||
{
|
||||
AcpiOsPrintf ("Not");
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("Serialized");
|
||||
|
||||
/* 3) SyncLevel */
|
||||
|
||||
if (Flags & 0xF0)
|
||||
{
|
||||
AcpiOsPrintf (", %d", Flags >> 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmFieldFlags
|
||||
*
|
||||
* PARAMETERS: Op - Field Object to be examined
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode Field definition flags
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmFieldFlags (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT32 Flags;
|
||||
|
||||
|
||||
/* The next Op contains the flags */
|
||||
|
||||
Op = AcpiPsGetDepthNext (NULL, Op);
|
||||
Flags = Op->Common.Value.Integer8;
|
||||
|
||||
/* Mark the Op as completed */
|
||||
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
|
||||
AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x0F]);
|
||||
AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
|
||||
AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmAddressSpace
|
||||
*
|
||||
* PARAMETERS: SpaceId - ID to be translated
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmAddressSpace (
|
||||
UINT8 SpaceId)
|
||||
{
|
||||
|
||||
if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
|
||||
{
|
||||
if (SpaceId == 0x7F)
|
||||
{
|
||||
AcpiOsPrintf ("FFixedHW, ");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("0x%.2X, ", SpaceId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmRegionFlags
|
||||
*
|
||||
* PARAMETERS: Op - Object to be examined
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode OperationRegion flags
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmRegionFlags (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
|
||||
|
||||
/* The next Op contains the SpaceId */
|
||||
|
||||
Op = AcpiPsGetDepthNext (NULL, Op);
|
||||
|
||||
/* Mark the Op as completed */
|
||||
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
|
||||
AcpiOsPrintf (", ");
|
||||
AcpiDmAddressSpace (Op->Common.Value.Integer8);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmMatchOp
|
||||
*
|
||||
* PARAMETERS: Op - Match Object to be examined
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode Match opcode operands
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmMatchOp (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *NextOp;
|
||||
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
NextOp = NextOp->Common.Next;
|
||||
|
||||
if (!NextOp)
|
||||
{
|
||||
/* Handle partial tree during single-step */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Mark the two nodes that contain the encoding for the match keywords */
|
||||
|
||||
NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
|
||||
|
||||
NextOp = NextOp->Common.Next;
|
||||
NextOp = NextOp->Common.Next;
|
||||
NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmMatchKeyword
|
||||
*
|
||||
* PARAMETERS: Op - Match Object to be examined
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode Match opcode operands
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmMatchKeyword (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
|
||||
|
||||
if (Op->Common.Value.Integer32 >= NUM_MATCH_OPS)
|
||||
{
|
||||
AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("%s", (char *) AcpiGbl_MatchOps[Op->Common.Value.Integer32]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDisassembleOneOp
|
||||
*
|
||||
* PARAMETERS: WalkState - Current walk info
|
||||
* Info - Parse tree walk info
|
||||
* Op - Op that is to be printed
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Disassemble a single AML opcode
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmDisassembleOneOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_OP_WALK_INFO *Info,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
const ACPI_OPCODE_INFO *OpInfo = NULL;
|
||||
UINT32 Offset;
|
||||
UINT32 Length;
|
||||
|
||||
|
||||
if (!Op)
|
||||
{
|
||||
AcpiOsPrintf ("<NULL OP PTR>");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Op->Common.DisasmOpcode)
|
||||
{
|
||||
case ACPI_DASM_MATCHOP:
|
||||
|
||||
AcpiDmMatchKeyword (Op);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* op and arguments */
|
||||
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_ZERO_OP:
|
||||
|
||||
AcpiOsPrintf ("Zero");
|
||||
break;
|
||||
|
||||
|
||||
case AML_ONE_OP:
|
||||
|
||||
AcpiOsPrintf ("One");
|
||||
break;
|
||||
|
||||
|
||||
case AML_ONES_OP:
|
||||
|
||||
AcpiOsPrintf ("Ones");
|
||||
break;
|
||||
|
||||
|
||||
case AML_REVISION_OP:
|
||||
|
||||
AcpiOsPrintf ("Revision");
|
||||
break;
|
||||
|
||||
|
||||
case AML_BYTE_OP:
|
||||
|
||||
AcpiOsPrintf ("0x%.2X", (UINT32) Op->Common.Value.Integer8);
|
||||
break;
|
||||
|
||||
|
||||
case AML_WORD_OP:
|
||||
|
||||
if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
|
||||
{
|
||||
AcpiDmEisaId (Op->Common.Value.Integer32);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("0x%.2X", (UINT32) Op->Common.Value.Integer16);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_DWORD_OP:
|
||||
|
||||
if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
|
||||
{
|
||||
AcpiDmEisaId (Op->Common.Value.Integer32);
|
||||
}
|
||||
else if ((Op->Common.Value.Integer32 == ACPI_UINT32_MAX) &&
|
||||
(AcpiGbl_DSDT->Revision < 2))
|
||||
{
|
||||
AcpiOsPrintf ("Ones");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("0x%.2X", Op->Common.Value.Integer32);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_QWORD_OP:
|
||||
|
||||
if ((Op->Common.Value.Integer == ACPI_INTEGER_MAX) &&
|
||||
(AcpiGbl_DSDT->Revision >= 2))
|
||||
{
|
||||
AcpiOsPrintf ("Ones");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("0x%X%8.8X", Op->Common.Value.Integer64.Hi,
|
||||
Op->Common.Value.Integer64.Lo);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_STRING_OP:
|
||||
|
||||
AcpiDmString (Op->Common.Value.String);
|
||||
break;
|
||||
|
||||
|
||||
case AML_BUFFER_OP:
|
||||
|
||||
/*
|
||||
* Determine the type of buffer. We can have one of the following:
|
||||
*
|
||||
* 1) ResourceTemplate containing Resource Descriptors.
|
||||
* 2) Unicode String buffer
|
||||
* 3) ASCII String buffer
|
||||
* 4) Raw data buffer (if none of the above)
|
||||
*
|
||||
* Since there are no special AML opcodes to differentiate these
|
||||
* types of buffers, we have to closely look at the data in the
|
||||
* buffer to determine the type.
|
||||
*/
|
||||
if (AcpiDmIsResourceDescriptor (Op))
|
||||
{
|
||||
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
|
||||
AcpiOsPrintf ("ResourceTemplate");
|
||||
}
|
||||
else if (AcpiDmIsUnicodeBuffer (Op))
|
||||
{
|
||||
Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
|
||||
AcpiOsPrintf ("Unicode (");
|
||||
}
|
||||
else if (AcpiDmIsStringBuffer (Op))
|
||||
{
|
||||
Op->Common.DisasmOpcode = ACPI_DASM_STRING;
|
||||
AcpiOsPrintf ("Buffer");
|
||||
}
|
||||
else
|
||||
{
|
||||
Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;
|
||||
AcpiOsPrintf ("Buffer");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_STATICSTRING_OP:
|
||||
|
||||
if (Op->Common.Value.String)
|
||||
{
|
||||
AcpiOsPrintf ("%s", Op->Common.Value.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("\"<NULL STATIC STRING PTR>\"");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_NAMEPATH_OP:
|
||||
|
||||
AcpiDmNamestring (Op->Common.Value.Name);
|
||||
AcpiDmValidateName (Op->Common.Value.Name, Op);
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_NAMEDFIELD_OP:
|
||||
|
||||
Length = AcpiDmDumpName ((char *) &Op->Named.Name);
|
||||
AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", Op->Common.Value.Integer32);
|
||||
AcpiDmCommaIfFieldMember (Op);
|
||||
|
||||
Info->BitOffset += Op->Common.Value.Integer32;
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_RESERVEDFIELD_OP:
|
||||
|
||||
/* Offset() -- Must account for previous offsets */
|
||||
|
||||
Offset = Op->Common.Value.Integer32;
|
||||
Info->BitOffset += Offset;
|
||||
|
||||
if (Info->BitOffset % 8 == 0)
|
||||
{
|
||||
AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf (" , %d", Offset);
|
||||
}
|
||||
|
||||
AcpiDmCommaIfFieldMember (Op);
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_ACCESSFIELD_OP:
|
||||
|
||||
AcpiOsPrintf ("AccessAs (%s, 0x%.2X)",
|
||||
AcpiGbl_AccessTypes [Op->Common.Value.Integer32 >> 8],
|
||||
Op->Common.Value.Integer32 & 0x0F);
|
||||
|
||||
AcpiDmCommaIfFieldMember (Op);
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_BYTELIST_OP:
|
||||
|
||||
AcpiDmByteList (Info, Op);
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_METHODCALL_OP:
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
Op = AcpiPsGetDepthNext (NULL, Op);
|
||||
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
|
||||
AcpiDmNamestring (Op->Common.Value.Name);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Just get the opcode name and print it */
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
AcpiOsPrintf ("%s", OpInfo->Name);
|
||||
|
||||
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
|
||||
if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
|
||||
(WalkState) &&
|
||||
(WalkState->Results) &&
|
||||
(WalkState->Results->Results.NumResults))
|
||||
{
|
||||
AcpiDbDecodeInternalObject (
|
||||
WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ACPI_DISASSEMBLER */
|
528
sys/contrib/dev/acpica/dmresrc.c
Normal file
528
sys/contrib/dev/acpica/dmresrc.c
Normal file
@ -0,0 +1,528 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmresrc.c - Resource Descriptor disassembly
|
||||
* $Revision: 3 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dbresrc")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmBitList
|
||||
*
|
||||
* PARAMETERS: Mask - 16-bit value corresponding to 16 interrupt
|
||||
* or DMA values
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump a bit mask as a list of individual interrupt/dma levels.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmBitList (
|
||||
UINT16 Mask)
|
||||
{
|
||||
UINT32 i;
|
||||
BOOLEAN Previous = FALSE;
|
||||
|
||||
|
||||
/* Open the initializer list */
|
||||
|
||||
AcpiOsPrintf (") {");
|
||||
|
||||
/* Examine each bit */
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
/* Only interested in bits that are set to 1 */
|
||||
|
||||
if (Mask & 1)
|
||||
{
|
||||
if (Previous)
|
||||
{
|
||||
AcpiOsPrintf (",");
|
||||
}
|
||||
Previous = TRUE;
|
||||
AcpiOsPrintf ("%d", i);
|
||||
}
|
||||
|
||||
Mask >>= 1;
|
||||
}
|
||||
|
||||
/* Close list */
|
||||
|
||||
AcpiOsPrintf ("}\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmResourceDescriptor
|
||||
*
|
||||
* PARAMETERS: Info - Curent parse tree walk info
|
||||
* ByteData - Pointer to the byte list data
|
||||
* ByteCount - Length of the byte list
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Dump the contents of one ResourceTemplate descriptor.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmResourceDescriptor (
|
||||
ACPI_OP_WALK_INFO *Info,
|
||||
UINT8 *ByteData,
|
||||
UINT32 ByteCount)
|
||||
{
|
||||
NATIVE_UINT CurrentByteOffset;
|
||||
UINT8 CurrentByte;
|
||||
UINT8 DescriptorId;
|
||||
UINT32 Length;
|
||||
void *DescriptorBody;
|
||||
UINT32 Level;
|
||||
BOOLEAN DependentFns = FALSE;
|
||||
|
||||
|
||||
Level = Info->Level;
|
||||
|
||||
for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
|
||||
{
|
||||
CurrentByte = ByteData[CurrentByteOffset];
|
||||
DescriptorBody = &ByteData[CurrentByteOffset];
|
||||
|
||||
if (CurrentByte & ACPI_RDESC_TYPE_LARGE)
|
||||
{
|
||||
DescriptorId = CurrentByte;
|
||||
Length = (* (ACPI_CAST_PTR (UINT16, &ByteData[CurrentByteOffset + 1])));
|
||||
CurrentByteOffset += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
DescriptorId = (UINT8) (CurrentByte & 0xF8);
|
||||
Length = (ByteData[CurrentByteOffset] & 0x7);
|
||||
CurrentByteOffset += 1;
|
||||
}
|
||||
|
||||
CurrentByteOffset += (NATIVE_UINT) Length;
|
||||
|
||||
/* Determine type of resource */
|
||||
|
||||
switch (DescriptorId)
|
||||
{
|
||||
/*
|
||||
* "Small" type descriptors
|
||||
*/
|
||||
case ACPI_RDESC_TYPE_IRQ_FORMAT:
|
||||
|
||||
AcpiDmIrqDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_DMA_FORMAT:
|
||||
|
||||
AcpiDmDmaDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_START_DEPENDENT:
|
||||
|
||||
/* Finish a previous StartDependentFns */
|
||||
|
||||
if (DependentFns)
|
||||
{
|
||||
Level--;
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("}\n");
|
||||
}
|
||||
|
||||
AcpiDmStartDependentDescriptor (DescriptorBody, Length, Level);
|
||||
DependentFns = TRUE;
|
||||
Level++;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_END_DEPENDENT:
|
||||
|
||||
Level--;
|
||||
DependentFns = FALSE;
|
||||
AcpiDmEndDependentDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_IO_PORT:
|
||||
|
||||
AcpiDmIoDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_FIXED_IO_PORT:
|
||||
|
||||
AcpiDmFixedIoDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_SMALL_VENDOR:
|
||||
|
||||
AcpiDmVendorSmallDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_END_TAG:
|
||||
|
||||
if (DependentFns)
|
||||
{
|
||||
/*
|
||||
* Close an open StartDependentDescriptor. This indicates a missing
|
||||
* EndDependentDescriptor.
|
||||
*/
|
||||
Level--;
|
||||
DependentFns = FALSE;
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("}\n");
|
||||
AcpiDmIndent (Level);
|
||||
|
||||
AcpiOsPrintf ("/*** Missing EndDependentFunctions descriptor */");
|
||||
|
||||
/*
|
||||
* We could fix the problem, but then the ASL would not match the AML
|
||||
* So, we don't do this:
|
||||
* AcpiDmEndDependentDescriptor (DescriptorBody, Length, Level);
|
||||
*/
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
/*
|
||||
* "Large" type descriptors
|
||||
*/
|
||||
case ACPI_RDESC_TYPE_MEMORY_24:
|
||||
|
||||
AcpiDmMemory24Descriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_GENERAL_REGISTER:
|
||||
|
||||
AcpiDmGenericRegisterDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_LARGE_VENDOR:
|
||||
|
||||
AcpiDmVendorLargeDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_MEMORY_32:
|
||||
|
||||
AcpiDmMemory32Descriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
|
||||
|
||||
AcpiDmFixedMem32Descriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
|
||||
|
||||
AcpiDmDwordDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
|
||||
|
||||
AcpiDmWordDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
|
||||
|
||||
AcpiDmInterruptDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
|
||||
|
||||
AcpiDmQwordDescriptor (DescriptorBody, Length, Level);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/*
|
||||
* Anything else is unrecognized.
|
||||
*
|
||||
* Since the entire resource buffer has been already walked and
|
||||
* validated, this is a very serious error indicating that someone
|
||||
* overwrote the buffer.
|
||||
*/
|
||||
AcpiOsPrintf ("/* Unknown Resource type (%X) */\n", DescriptorId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIsResourceDescriptor
|
||||
*
|
||||
* PARAMETERS: Op - Buffer Op to be examined
|
||||
*
|
||||
* RETURN: TRUE if this Buffer Op contains a valid resource
|
||||
* descriptor.
|
||||
*
|
||||
* DESCRIPTION: Walk a byte list to determine if it consists of a valid set
|
||||
* of resource descriptors. Nothing is output.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmIsResourceDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
UINT8 *ByteData;
|
||||
UINT32 ByteCount;
|
||||
ACPI_PARSE_OBJECT *NextOp;
|
||||
NATIVE_UINT CurrentByteOffset;
|
||||
UINT8 CurrentByte;
|
||||
UINT8 DescriptorId;
|
||||
UINT32 Length;
|
||||
|
||||
|
||||
/* This op must be a buffer */
|
||||
|
||||
if (Op->Common.AmlOpcode != AML_BUFFER_OP)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Get to the ByteData list */
|
||||
|
||||
NextOp = Op->Common.Value.Arg;
|
||||
NextOp = NextOp->Common.Next;
|
||||
if (!NextOp)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Extract the data pointer and data length */
|
||||
|
||||
ByteCount = NextOp->Common.Value.Integer32;
|
||||
ByteData = NextOp->Named.Data;
|
||||
|
||||
/* The list must have a valid END_TAG */
|
||||
|
||||
if (ByteData[ByteCount-2] != (ACPI_RDESC_TYPE_END_TAG | 1))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk the byte list. Abort on any invalid descriptor ID or
|
||||
* or length
|
||||
*/
|
||||
for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
|
||||
{
|
||||
CurrentByte = ByteData[CurrentByteOffset];
|
||||
|
||||
/* Large or small resource? */
|
||||
|
||||
if (CurrentByte & ACPI_RDESC_TYPE_LARGE)
|
||||
{
|
||||
DescriptorId = CurrentByte;
|
||||
Length = (* (ACPI_CAST_PTR (UINT16, (&ByteData[CurrentByteOffset + 1]))));
|
||||
CurrentByteOffset += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
DescriptorId = (UINT8) (CurrentByte & 0xF8);
|
||||
Length = (ByteData[CurrentByteOffset] & 0x7);
|
||||
CurrentByteOffset += 1;
|
||||
}
|
||||
|
||||
CurrentByteOffset += (NATIVE_UINT) Length;
|
||||
|
||||
/* Determine type of resource */
|
||||
|
||||
switch (DescriptorId)
|
||||
{
|
||||
/*
|
||||
* "Small" type descriptors
|
||||
*/
|
||||
case ACPI_RDESC_TYPE_IRQ_FORMAT:
|
||||
case ACPI_RDESC_TYPE_DMA_FORMAT:
|
||||
case ACPI_RDESC_TYPE_START_DEPENDENT:
|
||||
case ACPI_RDESC_TYPE_END_DEPENDENT:
|
||||
case ACPI_RDESC_TYPE_IO_PORT:
|
||||
case ACPI_RDESC_TYPE_FIXED_IO_PORT:
|
||||
case ACPI_RDESC_TYPE_SMALL_VENDOR:
|
||||
/*
|
||||
* "Large" type descriptors
|
||||
*/
|
||||
case ACPI_RDESC_TYPE_MEMORY_24:
|
||||
case ACPI_RDESC_TYPE_GENERAL_REGISTER:
|
||||
case ACPI_RDESC_TYPE_LARGE_VENDOR:
|
||||
case ACPI_RDESC_TYPE_MEMORY_32:
|
||||
case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
|
||||
case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
|
||||
case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
|
||||
case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
|
||||
case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
|
||||
|
||||
/* Valid descriptor ID, keep going */
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_RDESC_TYPE_END_TAG:
|
||||
|
||||
/* We must be at the end of the ByteList */
|
||||
|
||||
if (CurrentByteOffset != ByteCount)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* All descriptors/lengths valid, this is a valid descriptor */
|
||||
|
||||
return (TRUE);
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Bad descriptor, abort */
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Did not find an END_TAG, something seriously wrong */
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
605
sys/contrib/dev/acpica/dmresrcl.c
Normal file
605
sys/contrib/dev/acpica/dmresrcl.c
Normal file
@ -0,0 +1,605 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
|
||||
* $Revision: 5 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dbresrcl")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIoFlags
|
||||
*
|
||||
* PARAMETERS: Flags - Flag byte to be decoded
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode the flags specific to IO Address space descriptors
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmIoFlags (
|
||||
UINT8 Flags)
|
||||
{
|
||||
AcpiOsPrintf ("%s, %s, %s, %s,",
|
||||
AcpiGbl_ConsumeDecode [(Flags & 1)],
|
||||
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
|
||||
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
|
||||
AcpiGbl_DECDecode [(Flags & 0x2) >> 1]);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmMemoryFlags
|
||||
*
|
||||
* PARAMETERS: Flags - Flag byte to be decoded
|
||||
* SpecificFlags - "Specific" flag byte to be decoded
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode flags specific to Memory Address Space descriptors
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmMemoryFlags (
|
||||
UINT8 Flags,
|
||||
UINT8 SpecificFlags)
|
||||
{
|
||||
AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
|
||||
AcpiGbl_ConsumeDecode [(Flags & 1)],
|
||||
AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
|
||||
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
|
||||
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
|
||||
AcpiGbl_MEMDecode [(SpecificFlags & 0x6) >> 1],
|
||||
AcpiGbl_RWDecode [(SpecificFlags & 0x1)]);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmWordDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Word Address Space descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmWordDescriptor (
|
||||
ASL_WORD_ADDRESS_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("%s (",
|
||||
AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
|
||||
|
||||
AcpiDmIoFlags (Resource->Flags);
|
||||
|
||||
if ((Resource->ResourceType & 0x3) == 1)
|
||||
{
|
||||
AcpiOsPrintf (" %s,",
|
||||
AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
|
||||
}
|
||||
|
||||
/* The WORD values */
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%4.4X,\n",
|
||||
(UINT32) Resource->Granularity);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%4.4X,\n",
|
||||
(UINT32) Resource->AddressMin);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%4.4X,\n",
|
||||
(UINT32) Resource->AddressMax);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%4.4X,\n",
|
||||
(UINT32) Resource->TranslationOffset);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%4.4X",
|
||||
(UINT32) Resource->AddressLength);
|
||||
|
||||
/* Optional fields */
|
||||
|
||||
if (Length > 13)
|
||||
{
|
||||
AcpiOsPrintf (", 0x%2.2X",
|
||||
(UINT32) Resource->OptionalFields[0]);
|
||||
}
|
||||
|
||||
if (Length > 14)
|
||||
{
|
||||
AcpiOsPrintf (", %s",
|
||||
&Resource->OptionalFields[1]);
|
||||
}
|
||||
AcpiOsPrintf (")\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDwordDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a DWord Address Space descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmDwordDescriptor (
|
||||
ASL_DWORD_ADDRESS_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("D%s (",
|
||||
AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
|
||||
|
||||
if ((Resource->ResourceType & 0x3) == 1)
|
||||
{
|
||||
AcpiDmIoFlags (Resource->Flags);
|
||||
AcpiOsPrintf (" %s,",
|
||||
AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiDmMemoryFlags (Resource->Flags, Resource->SpecificFlags);
|
||||
}
|
||||
|
||||
/* The DWORD values */
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X,\n",
|
||||
Resource->Granularity);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X,\n",
|
||||
Resource->AddressMin);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X,\n",
|
||||
Resource->AddressMax);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X,\n",
|
||||
Resource->TranslationOffset);
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X",
|
||||
Resource->AddressLength);
|
||||
|
||||
/* Optional fields */
|
||||
|
||||
if (Length > 23)
|
||||
{
|
||||
AcpiOsPrintf (", 0x%2.2X",
|
||||
Resource->OptionalFields[0]);
|
||||
}
|
||||
if (Length > 24)
|
||||
{
|
||||
AcpiOsPrintf (", %s",
|
||||
&Resource->OptionalFields[1]);
|
||||
}
|
||||
AcpiOsPrintf (")\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmQwordDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a QWord Address Space descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmQwordDescriptor (
|
||||
ASL_QWORD_ADDRESS_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("Q%s (",
|
||||
AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
|
||||
|
||||
if ((Resource->ResourceType & 0x3) == 1)
|
||||
{
|
||||
AcpiDmIoFlags (Resource->Flags);
|
||||
AcpiOsPrintf (" %s,",
|
||||
AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiDmMemoryFlags (Resource->Flags, Resource->SpecificFlags);
|
||||
}
|
||||
|
||||
/* The QWORD values */
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X%8.8X,\n",
|
||||
ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->Granularity)),
|
||||
ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->Granularity)));
|
||||
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X%8.8X,\n",
|
||||
ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressMin)),
|
||||
ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressMin)));
|
||||
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X%8.8X,\n",
|
||||
ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressMax)),
|
||||
ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressMax)));
|
||||
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X%8.8X,\n",
|
||||
ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->TranslationOffset)),
|
||||
ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->TranslationOffset)));
|
||||
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X%8.8X",
|
||||
ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressLength)),
|
||||
ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressLength)));
|
||||
|
||||
/* Optional fields */
|
||||
|
||||
if (Length > 43)
|
||||
{
|
||||
AcpiOsPrintf (", 0x%2.2X",
|
||||
Resource->OptionalFields[0]);
|
||||
}
|
||||
if (Length > 44)
|
||||
{
|
||||
AcpiOsPrintf (", %s",
|
||||
&Resource->OptionalFields[1]);
|
||||
}
|
||||
|
||||
AcpiOsPrintf (")\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmMemory24Descriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Memory24 descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmMemory24Descriptor (
|
||||
ASL_MEMORY_24_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("Memory24 (%s, 0x%4.4X, 0x%4.4X, 0x%4.4X, 0x%4.4X)\n",
|
||||
AcpiGbl_RWDecode [Resource->Information & 1],
|
||||
(UINT32) Resource->AddressMin,
|
||||
(UINT32) Resource->AddressMax,
|
||||
(UINT32) Resource->Alignment,
|
||||
(UINT32) Resource->RangeLength);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmMemory32Descriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Memory32 descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmMemory32Descriptor (
|
||||
ASL_MEMORY_32_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("Memory32 (%s, 0x%8.8X, 0x%8.8X, 0x%8.8X, 0x%8.8X)\n",
|
||||
AcpiGbl_RWDecode [Resource->Information & 1],
|
||||
Resource->AddressMin,
|
||||
Resource->AddressMax,
|
||||
Resource->Alignment,
|
||||
Resource->RangeLength);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmFixedMem32Descriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Fixed Memory32 descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmFixedMem32Descriptor (
|
||||
ASL_FIXED_MEMORY_32_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("Memory32Fixed (%s, 0x%8.8X, 0x%8.8X)\n",
|
||||
AcpiGbl_RWDecode [Resource->Information & 1],
|
||||
Resource->BaseAddress,
|
||||
Resource->RangeLength);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmGenericRegisterDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Generic Register descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmGenericRegisterDescriptor (
|
||||
ASL_GENERAL_REGISTER_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("Register (");
|
||||
|
||||
AcpiDmAddressSpace (Resource->AddressSpaceId);
|
||||
|
||||
AcpiOsPrintf ("0x%2.2X, 0x%2.2X, 0x%8.8X%8.8X)\n",
|
||||
(UINT32) Resource->BitWidth,
|
||||
(UINT32) Resource->BitOffset,
|
||||
ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->Address)),
|
||||
ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->Address)));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmInterruptDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a extended Interrupt descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmInterruptDescriptor (
|
||||
ASL_EXTENDED_XRUPT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("Interrupt (%s, %s, %s, %s)\n",
|
||||
AcpiGbl_ConsumeDecode [(Resource->Flags & 1)],
|
||||
AcpiGbl_HEDecode [(Resource->Flags >> 1) & 1],
|
||||
AcpiGbl_LLDecode [(Resource->Flags >> 2) & 1],
|
||||
AcpiGbl_SHRDecode [(Resource->Flags >> 3) & 1]);
|
||||
|
||||
/* TBD "Resource Source, optional */
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("{\n");
|
||||
for (i = 0; i < Resource->TableLength; i++)
|
||||
{
|
||||
AcpiDmIndent (Level + 1);
|
||||
AcpiOsPrintf ("0x%8.8X,\n", (UINT32) Resource->InterruptNumber[i]);
|
||||
}
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("}\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmVendorLargeDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Vendor Large descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmVendorLargeDescriptor (
|
||||
ASL_LARGE_VENDOR_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("VendorLong ()\n");
|
||||
AcpiDmIndent (Level);
|
||||
|
||||
AcpiOsPrintf ("{\n");
|
||||
|
||||
AcpiDmDisasmByteList (Level + 1, (UINT8 *) Resource->VendorDefined, Length);
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("}\n");
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
352
sys/contrib/dev/acpica/dmresrcs.c
Normal file
352
sys/contrib/dev/acpica/dmresrcs.c
Normal file
@ -0,0 +1,352 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
|
||||
* $Revision: 2 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dbresrcs")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIrqDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a IRQ descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmIrqDescriptor (
|
||||
ASL_IRQ_FORMAT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("%s (",
|
||||
AcpiGbl_IrqDecode [Length & 1]);
|
||||
|
||||
if (Length & 1)
|
||||
{
|
||||
AcpiOsPrintf ("%s, %s, %s",
|
||||
AcpiGbl_HEDecode [Resource->Flags & 1],
|
||||
AcpiGbl_LLDecode [(Resource->Flags >> 3) & 1],
|
||||
AcpiGbl_SHRDecode [(Resource->Flags >> 4) & 1]);
|
||||
}
|
||||
|
||||
AcpiDmBitList (Resource->IrqMask);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDmaDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a DMA descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmDmaDescriptor (
|
||||
ASL_DMA_FORMAT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("DMA (%s, %s, %s",
|
||||
AcpiGbl_TYPDecode [(Resource->Flags >> 5) & 3],
|
||||
AcpiGbl_BMDecode [(Resource->Flags >> 2) & 1],
|
||||
AcpiGbl_SIZDecode [(Resource->Flags >> 0) & 3]);
|
||||
|
||||
AcpiDmBitList (Resource->DmaChannelMask);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode an IO descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmIoDescriptor (
|
||||
ASL_IO_PORT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("IO (%s, 0x%4.4X, 0x%4.4X, 0x%2.2X, 0x%2.2X)\n",
|
||||
AcpiGbl_IoDecode [(Resource->Information & 1)],
|
||||
(UINT32) Resource->AddressMin,
|
||||
(UINT32) Resource->AddressMax,
|
||||
(UINT32) Resource->Alignment,
|
||||
(UINT32) Resource->Length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmFixedIoDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Fixed IO descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmFixedIoDescriptor (
|
||||
ASL_FIXED_IO_PORT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("FixedIO (0x%4.4X, 0x%2.2X)\n",
|
||||
(UINT32) Resource->BaseAddress,
|
||||
(UINT32) Resource->Length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmStartDependentDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Start Dependendent functions descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmStartDependentDescriptor (
|
||||
ASL_START_DEPENDENT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
|
||||
if (Length & 1)
|
||||
{
|
||||
AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
|
||||
(UINT32) Resource->Flags & 3,
|
||||
(UINT32) (Resource->Flags >> 2) & 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("StartDependentFnNoPri ()\n");
|
||||
}
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("{\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmEndDependentDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode an End Dependent functions descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmEndDependentDescriptor (
|
||||
ASL_START_DEPENDENT_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("}\n");
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("EndDependentFn ()\n");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmVendorSmallDescriptor
|
||||
*
|
||||
* PARAMETERS: Resource - Pointer to the resource descriptor
|
||||
* Length - Length of the descriptor in bytes
|
||||
* Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Decode a Vendor Small Descriptor
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmVendorSmallDescriptor (
|
||||
ASL_SMALL_VENDOR_DESC *Resource,
|
||||
UINT32 Length,
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("VendorShort () {");
|
||||
|
||||
AcpiDmDisasmByteList (0, (UINT8 *) Resource->VendorDefined, Length);
|
||||
AcpiOsPrintf ("}\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
405
sys/contrib/dev/acpica/dmutils.c
Normal file
405
sys/contrib/dev/acpica/dmutils.c
Normal file
@ -0,0 +1,405 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmutils - AML disassembler utilities
|
||||
* $Revision: 2 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdisasm.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dmutils")
|
||||
|
||||
|
||||
|
||||
|
||||
/* Data used in keeping track of fields */
|
||||
#if 0
|
||||
const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] =
|
||||
{
|
||||
"skip",
|
||||
"?access?"
|
||||
}; /* FE = Field Element */
|
||||
#endif
|
||||
|
||||
|
||||
const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] =
|
||||
{
|
||||
"MTR",
|
||||
"MEQ",
|
||||
"MLE",
|
||||
"MLT",
|
||||
"MGE",
|
||||
"MGT"
|
||||
};
|
||||
|
||||
|
||||
/* Access type decoding */
|
||||
|
||||
const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] =
|
||||
{
|
||||
"AnyAcc",
|
||||
"ByteAcc",
|
||||
"WordAcc",
|
||||
"DWordAcc",
|
||||
"QWordAcc",
|
||||
"BufferAcc",
|
||||
};
|
||||
|
||||
|
||||
/* Lock rule decoding */
|
||||
|
||||
const NATIVE_CHAR *AcpiGbl_LockRule[NUM_LOCK_RULES] =
|
||||
{
|
||||
"NoLock",
|
||||
"Lock"
|
||||
};
|
||||
|
||||
/* Update rule decoding */
|
||||
|
||||
const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] =
|
||||
{
|
||||
"Preserve",
|
||||
"WriteAsOnes",
|
||||
"WriteAsZeros"
|
||||
};
|
||||
|
||||
/*
|
||||
* Strings used to decode resource descriptors
|
||||
*/
|
||||
const char *AcpiGbl_IoDecode[2] =
|
||||
{
|
||||
"Decode10",
|
||||
"Decode16"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_WordDecode[4] =
|
||||
{
|
||||
"WordMemory",
|
||||
"WordIO",
|
||||
"WordBusNumber",
|
||||
"Unknown-resource-type"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_ConsumeDecode[2] =
|
||||
{
|
||||
"ResourceProducer",
|
||||
"ResourceConsumer"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_MinDecode[2] =
|
||||
{
|
||||
"MinNotFixed",
|
||||
"MinFixed"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_MaxDecode[2] =
|
||||
{
|
||||
"MaxNotFixed",
|
||||
"MaxFixed"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_DECDecode[2] =
|
||||
{
|
||||
"PosDecode",
|
||||
"SubDecode"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_RNGDecode[4] =
|
||||
{
|
||||
"InvalidRanges",
|
||||
"NonISAOnlyRanges",
|
||||
"ISAOnlyRanges",
|
||||
"EntireRange"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_MEMDecode[4] =
|
||||
{
|
||||
"NonCacheable",
|
||||
"Cacheable",
|
||||
"WriteCombining",
|
||||
"Prefetchable"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_RWDecode[2] =
|
||||
{
|
||||
"ReadOnly",
|
||||
"ReadWrite"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_IrqDecode[2] =
|
||||
{
|
||||
"IRQNoFlags",
|
||||
"IRQ"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_HEDecode[2] =
|
||||
{
|
||||
"Level",
|
||||
"Edge"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_LLDecode[2] =
|
||||
{
|
||||
"ActiveHigh",
|
||||
"ActiveLow"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_SHRDecode[2] =
|
||||
{
|
||||
"Exclusive",
|
||||
"Shared"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_TYPDecode[4] =
|
||||
{
|
||||
"Compatibility",
|
||||
"TypeA",
|
||||
"TypeB",
|
||||
"TypeF"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_BMDecode[2] =
|
||||
{
|
||||
"NotBusMaster",
|
||||
"BusMaster"
|
||||
};
|
||||
|
||||
const char *AcpiGbl_SIZDecode[4] =
|
||||
{
|
||||
"Transfer8",
|
||||
"Transfer8_16",
|
||||
"Transfer16",
|
||||
"InvalidSize"
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmIndent
|
||||
*
|
||||
* PARAMETERS: Level - Current source code indentation level
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Indent 4 spaces per indentation level.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmIndent (
|
||||
UINT32 Level)
|
||||
{
|
||||
|
||||
if (!Level)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiOsPrintf ("%*.s", ACPI_MUL_4 (Level), " ");
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmCommaIfListMember
|
||||
*
|
||||
* PARAMETERS: Op - Current operator/operand
|
||||
*
|
||||
* RETURN: TRUE if a comma was inserted
|
||||
*
|
||||
* DESCRIPTION: Insert a comma if this Op is a member of an argument list.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiDmCommaIfListMember (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
|
||||
if (!Op->Common.Next)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)
|
||||
{
|
||||
/* Check for a NULL target operand */
|
||||
|
||||
if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
|
||||
(!Op->Common.Next->Common.Value.String))
|
||||
{
|
||||
/*
|
||||
* To handle the Divide() case where there are two optional
|
||||
* targets, look ahead one more op. If null, this null target
|
||||
* is the one and only target -- no comma needed. Otherwise,
|
||||
* we need a comma to prepare for the next target.
|
||||
*/
|
||||
if (!Op->Common.Next->Common.Next)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
|
||||
(!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AcpiOsPrintf (", ");
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
|
||||
(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
|
||||
{
|
||||
AcpiOsPrintf (", ");
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmCommaIfFieldMember
|
||||
*
|
||||
* PARAMETERS: Op - Current operator/operand
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Insert a comma if this Op is a member of a Field argument list.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmCommaIfFieldMember (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
|
||||
if (Op->Common.Next)
|
||||
{
|
||||
AcpiOsPrintf (", ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
921
sys/contrib/dev/acpica/dmwalk.c
Normal file
921
sys/contrib/dev/acpica/dmwalk.c
Normal file
@ -0,0 +1,921 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dmwalk - AML disassembly tree walk
|
||||
* $Revision: 6 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdisasm.h"
|
||||
#include "acdebug.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
#define _COMPONENT ACPI_DEBUGGER
|
||||
ACPI_MODULE_NAME ("dmwalk")
|
||||
|
||||
|
||||
#define DB_FULL_OP_INFO "%5.5X #%4.4hX "
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDisassemble
|
||||
*
|
||||
* PARAMETERS: Origin - Starting object
|
||||
* NumOpcodes - Max number of opcodes to be displayed
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Disassemble parser object and its children. This is the
|
||||
* main entry point of the disassembler.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmDisassemble (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Origin,
|
||||
UINT32 NumOpcodes)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op = Origin;
|
||||
ACPI_OP_WALK_INFO Info;
|
||||
|
||||
|
||||
if (!Op)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Info.Level = 0;
|
||||
AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmWalkParseTree
|
||||
*
|
||||
* PARAMETERS: DescendingCallback - Called during tree descent
|
||||
* AscendingCallback - Called during tree ascent
|
||||
* Context - To be passed to the callbacks
|
||||
*
|
||||
* RETURN: Status from callback(s)
|
||||
*
|
||||
* DESCRIPTION: Walk the entire parse tree.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiDmWalkParseTree (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ASL_WALK_CALLBACK DescendingCallback,
|
||||
ASL_WALK_CALLBACK AscendingCallback,
|
||||
void *Context)
|
||||
{
|
||||
BOOLEAN NodePreviouslyVisited;
|
||||
ACPI_PARSE_OBJECT *StartOp = Op;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_PARSE_OBJECT *Next;
|
||||
ACPI_OP_WALK_INFO *Info = Context;
|
||||
|
||||
|
||||
Info->Level = 0;
|
||||
NodePreviouslyVisited = FALSE;
|
||||
|
||||
while (Op)
|
||||
{
|
||||
if (NodePreviouslyVisited)
|
||||
{
|
||||
Status = AscendingCallback (Op, Info->Level, Context);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Let the callback process the node.
|
||||
*/
|
||||
Status = DescendingCallback (Op, Info->Level, Context);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/* Visit children first, once */
|
||||
|
||||
Next = AcpiPsGetArg (Op, 0);
|
||||
if (Next)
|
||||
{
|
||||
Info->Level++;
|
||||
Op = Next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (Status != AE_CTRL_DEPTH)
|
||||
{
|
||||
/* Exit immediately on any error */
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Terminate walk at start op */
|
||||
|
||||
if (Op == StartOp)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* No more children, re-visit this node */
|
||||
|
||||
if (!NodePreviouslyVisited)
|
||||
{
|
||||
NodePreviouslyVisited = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* No more children, visit peers */
|
||||
|
||||
if (Op->Common.Next)
|
||||
{
|
||||
Op = Op->Common.Next;
|
||||
NodePreviouslyVisited = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No peers, re-visit parent */
|
||||
|
||||
if (Info->Level != 0 )
|
||||
{
|
||||
Info->Level--;
|
||||
}
|
||||
|
||||
Op = Op->Common.Parent;
|
||||
NodePreviouslyVisited = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we get here, the walk completed with no errors */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmBlockType
|
||||
*
|
||||
* PARAMETERS: Op - Object to be examined
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Type of block for this op (parens or braces)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
AcpiDmBlockType (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
|
||||
|
||||
if (!Op)
|
||||
{
|
||||
return (BLOCK_NONE);
|
||||
}
|
||||
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_ELSE_OP:
|
||||
|
||||
return (BLOCK_BRACE);
|
||||
|
||||
case AML_METHOD_OP:
|
||||
case AML_DEVICE_OP:
|
||||
case AML_SCOPE_OP:
|
||||
case AML_PROCESSOR_OP:
|
||||
case AML_POWER_RES_OP:
|
||||
case AML_THERMAL_ZONE_OP:
|
||||
case AML_IF_OP:
|
||||
case AML_WHILE_OP:
|
||||
case AML_FIELD_OP:
|
||||
case AML_INDEX_FIELD_OP:
|
||||
case AML_BANK_FIELD_OP:
|
||||
|
||||
return (BLOCK_PAREN | BLOCK_BRACE);
|
||||
|
||||
case AML_BUFFER_OP:
|
||||
|
||||
if (Op->Common.DisasmOpcode == ACPI_DASM_UNICODE)
|
||||
{
|
||||
return (BLOCK_NONE);
|
||||
}
|
||||
|
||||
/*lint -fallthrough */
|
||||
|
||||
case AML_PACKAGE_OP:
|
||||
case AML_VAR_PACKAGE_OP:
|
||||
|
||||
return (BLOCK_PAREN | BLOCK_BRACE);
|
||||
|
||||
case AML_EVENT_OP:
|
||||
|
||||
return (BLOCK_PAREN);
|
||||
|
||||
default:
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
if (OpInfo->Flags & AML_HAS_ARGS)
|
||||
{
|
||||
return (BLOCK_PAREN);
|
||||
}
|
||||
|
||||
return (BLOCK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmListType
|
||||
*
|
||||
* PARAMETERS: Op - Object to be examined
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Type of block for this op (parens or braces)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
AcpiDmListType (
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
{
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
|
||||
|
||||
if (!Op)
|
||||
{
|
||||
return (BLOCK_NONE);
|
||||
}
|
||||
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
|
||||
case AML_ELSE_OP:
|
||||
case AML_METHOD_OP:
|
||||
case AML_DEVICE_OP:
|
||||
case AML_SCOPE_OP:
|
||||
case AML_POWER_RES_OP:
|
||||
case AML_PROCESSOR_OP:
|
||||
case AML_THERMAL_ZONE_OP:
|
||||
case AML_IF_OP:
|
||||
case AML_WHILE_OP:
|
||||
case AML_FIELD_OP:
|
||||
case AML_INDEX_FIELD_OP:
|
||||
case AML_BANK_FIELD_OP:
|
||||
|
||||
return (0);
|
||||
|
||||
case AML_BUFFER_OP:
|
||||
case AML_PACKAGE_OP:
|
||||
case AML_VAR_PACKAGE_OP:
|
||||
|
||||
return (BLOCK_COMMA_LIST);
|
||||
|
||||
default:
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
if (OpInfo->Flags & AML_HAS_ARGS)
|
||||
{
|
||||
return (BLOCK_COMMA_LIST);
|
||||
}
|
||||
|
||||
return (BLOCK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmDescendingOp
|
||||
*
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: First visitation of a parse object during tree descent.
|
||||
* Decode opcode name and begin parameter list(s), if any.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDmDescendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_OP_WALK_INFO *Info = Context;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
UINT32 Name;
|
||||
ACPI_PARSE_OBJECT *NextOp;
|
||||
|
||||
|
||||
if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
|
||||
{
|
||||
/* Ignore this op -- it was handled elsewhere */
|
||||
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
|
||||
if (Level == 0)
|
||||
{
|
||||
/* In verbose mode, print the AML offset, opcode and depth count */
|
||||
|
||||
VERBOSE_PRINT ((DB_FULL_OP_INFO, (UINT32) Op->Common.AmlOffset,
|
||||
Op->Common.AmlOpcode));
|
||||
|
||||
if (Op->Common.AmlOpcode == AML_SCOPE_OP)
|
||||
{
|
||||
AcpiOsPrintf ("{\n");
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
|
||||
(!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
|
||||
(Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
|
||||
{
|
||||
/* This is a first-level element of a term list, indent a new line */
|
||||
|
||||
AcpiDmIndent (Level);
|
||||
}
|
||||
|
||||
/* Print the opcode name */
|
||||
|
||||
AcpiDmDisassembleOneOp (NULL, Info, Op);
|
||||
|
||||
if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_RETURN_OP))
|
||||
{
|
||||
Info->Level--;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the opcode argument list if necessary
|
||||
*/
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
|
||||
|
||||
if ((OpInfo->Flags & AML_HAS_ARGS) ||
|
||||
(Op->Common.AmlOpcode == AML_EVENT_OP))
|
||||
{
|
||||
/* This opcode has an argument list */
|
||||
|
||||
if (AcpiDmBlockType (Op) & BLOCK_PAREN)
|
||||
{
|
||||
AcpiOsPrintf (" (");
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is a named opcode, print the associated name value
|
||||
*/
|
||||
if (OpInfo->Flags & AML_NAMED)
|
||||
{
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_ALIAS_OP:
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
AcpiDmNamestring (NextOp->Common.Value.Name);
|
||||
AcpiOsPrintf (", ");
|
||||
|
||||
/*lint -fallthrough */
|
||||
|
||||
default:
|
||||
|
||||
Name = AcpiPsGetName (Op);
|
||||
if (Op->Named.Path)
|
||||
{
|
||||
AcpiDmNamestring ((char *) Op->Named.Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiDmDumpName ((char *) &Name);
|
||||
}
|
||||
|
||||
|
||||
if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
|
||||
{
|
||||
AcpiDmValidateName ((char *) &Name, Op);
|
||||
if (AcpiGbl_DbOpt_verbose)
|
||||
{
|
||||
(void) AcpiPsDisplayObjectPathname (NULL, Op);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_METHOD_OP:
|
||||
|
||||
AcpiDmMethodFlags (Op);
|
||||
AcpiOsPrintf (")");
|
||||
break;
|
||||
|
||||
|
||||
case AML_NAME_OP:
|
||||
|
||||
/* Check for _HID and related EISAID() */
|
||||
|
||||
AcpiIsEisaId (Op);
|
||||
AcpiOsPrintf (", ");
|
||||
break;
|
||||
|
||||
|
||||
case AML_REGION_OP:
|
||||
|
||||
AcpiDmRegionFlags (Op);
|
||||
break;
|
||||
|
||||
|
||||
case AML_POWER_RES_OP:
|
||||
|
||||
/* Mark the next two Ops as part of the parameter list */
|
||||
|
||||
AcpiOsPrintf (", ");
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
|
||||
NextOp = NextOp->Common.Next;
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_PROCESSOR_OP:
|
||||
|
||||
/* Mark the next three Ops as part of the parameter list */
|
||||
|
||||
AcpiOsPrintf (", ");
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
|
||||
NextOp = NextOp->Common.Next;
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
|
||||
NextOp = NextOp->Common.Next;
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_MUTEX_OP:
|
||||
|
||||
AcpiOsPrintf (", ");
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_EVENT_OP:
|
||||
case AML_ALIAS_OP:
|
||||
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_SCOPE_OP:
|
||||
case AML_DEVICE_OP:
|
||||
case AML_THERMAL_ZONE_OP:
|
||||
|
||||
AcpiOsPrintf (")");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
AcpiOsPrintf ("*** Unhandled named opcode\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_FIELD_OP:
|
||||
case AML_BANK_FIELD_OP:
|
||||
case AML_INDEX_FIELD_OP:
|
||||
|
||||
Info->BitOffset = 0;
|
||||
|
||||
/* Name of the parent OperationRegion */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
AcpiDmNamestring (NextOp->Common.Value.Name);
|
||||
AcpiOsPrintf (", ");
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
|
||||
switch (Op->Common.AmlOpcode)
|
||||
{
|
||||
case AML_BANK_FIELD_OP:
|
||||
|
||||
/* Namestring */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
|
||||
AcpiDmNamestring (NextOp->Common.Value.Name);
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
AcpiOsPrintf (", ");
|
||||
|
||||
|
||||
NextOp = NextOp->Common.Next;
|
||||
AcpiDmDisassembleOneOp (NULL, Info, NextOp);
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
AcpiOsPrintf (", ");
|
||||
break;
|
||||
|
||||
case AML_INDEX_FIELD_OP:
|
||||
|
||||
/* Namestring */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
|
||||
AcpiDmNamestring (NextOp->Common.Value.Name);
|
||||
AcpiOsPrintf (", ");
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
AcpiDmFieldFlags (NextOp);
|
||||
break;
|
||||
|
||||
|
||||
case AML_BUFFER_OP:
|
||||
|
||||
/* The next op is the size parameter */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
if (!NextOp)
|
||||
{
|
||||
/* Single-step support */
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
|
||||
{
|
||||
/*
|
||||
* We have a resource list. Don't need to output
|
||||
* the buffer size Op. Open up a new block
|
||||
*/
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
|
||||
NextOp = NextOp->Common.Next;
|
||||
AcpiOsPrintf (")\n");
|
||||
AcpiDmIndent (Info->Level);
|
||||
AcpiOsPrintf ("{\n");
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Normal Buffer, mark size as in the parameter list */
|
||||
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_VAR_PACKAGE_OP:
|
||||
case AML_IF_OP:
|
||||
case AML_WHILE_OP:
|
||||
|
||||
/* The next op is the size or predicate parameter */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
if (NextOp)
|
||||
{
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
}
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_PACKAGE_OP:
|
||||
|
||||
/* The next op is the size or predicate parameter */
|
||||
|
||||
NextOp = AcpiPsGetDepthNext (NULL, Op);
|
||||
if (NextOp)
|
||||
{
|
||||
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
|
||||
}
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
case AML_MATCH_OP:
|
||||
|
||||
AcpiDmMatchOp (Op);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (AcpiDmBlockType (Op) & BLOCK_BRACE)
|
||||
{
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("{\n");
|
||||
}
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDmAscendingOp
|
||||
*
|
||||
* PARAMETERS: ASL_WALK_CALLBACK
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Second visitation of a parse object, during ascent of parse
|
||||
* tree. Close out any parameter lists and complete the opcode.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDmAscendingOp (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context)
|
||||
{
|
||||
ACPI_OP_WALK_INFO *Info = Context;
|
||||
|
||||
|
||||
if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
|
||||
{
|
||||
/* Ignore this op -- it was handled elsewhere */
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
|
||||
{
|
||||
/* Indicates the end of the current descriptor block (table) */
|
||||
|
||||
AcpiOsPrintf ("}\n\n");
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
switch (AcpiDmBlockType (Op))
|
||||
{
|
||||
case BLOCK_PAREN:
|
||||
|
||||
/* Completed an op that has arguments, add closing paren */
|
||||
|
||||
AcpiOsPrintf (")");
|
||||
|
||||
/* Could be a nested operator, check if comma required */
|
||||
|
||||
if (!AcpiDmCommaIfListMember (Op))
|
||||
{
|
||||
if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
|
||||
(!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
|
||||
(Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
|
||||
{
|
||||
/* This is a first-level element of a term list, start a new line */
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BLOCK_BRACE:
|
||||
case (BLOCK_BRACE | BLOCK_PAREN):
|
||||
|
||||
/* Completed an op that has a term list, add closing brace */
|
||||
|
||||
if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
|
||||
{
|
||||
AcpiOsPrintf ("}");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiDmIndent (Level);
|
||||
AcpiOsPrintf ("}");
|
||||
}
|
||||
|
||||
AcpiDmCommaIfListMember (Op);
|
||||
|
||||
if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
|
||||
{
|
||||
AcpiOsPrintf ("\n");
|
||||
if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
|
||||
{
|
||||
if ((Op->Common.AmlOpcode == AML_IF_OP) &&
|
||||
(Op->Common.Next) &&
|
||||
(Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
|
||||
(!Op->Common.Next))
|
||||
{
|
||||
break;
|
||||
}
|
||||
AcpiOsPrintf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BLOCK_NONE:
|
||||
default:
|
||||
|
||||
/* Could be a nested operator, check if comma required */
|
||||
|
||||
if (!AcpiDmCommaIfListMember (Op))
|
||||
{
|
||||
if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
|
||||
(!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
|
||||
(Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
|
||||
{
|
||||
/* This is a first-level element of a term list, start a new line */
|
||||
|
||||
AcpiOsPrintf ("\n");
|
||||
}
|
||||
}
|
||||
else if (Op->Common.Parent)
|
||||
{
|
||||
switch (Op->Common.Parent->Common.AmlOpcode)
|
||||
{
|
||||
case AML_PACKAGE_OP:
|
||||
case AML_VAR_PACKAGE_OP:
|
||||
|
||||
if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
|
||||
{
|
||||
AcpiOsPrintf ("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
|
||||
{
|
||||
if ((Op->Common.Next) &&
|
||||
(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Just completed a parameter node for something like "Buffer (param)".
|
||||
* Close the paren and open up the term list block with a brace
|
||||
*/
|
||||
if (Op->Common.Next)
|
||||
{
|
||||
AcpiOsPrintf (")\n");
|
||||
AcpiDmIndent (Level - 1);
|
||||
AcpiOsPrintf ("{\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Op->Common.Parent->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
|
||||
AcpiOsPrintf (") {");
|
||||
}
|
||||
}
|
||||
|
||||
if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_RETURN_OP))
|
||||
{
|
||||
Info->Level++;
|
||||
}
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
#endif /* ACPI_DISASSEMBLER */
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
|
||||
* $Revision: 86 $
|
||||
* $Revision: 87 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -398,7 +398,7 @@ AcpiDsCallControlMethod (
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
Op = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
Op = AcpiPsCreateScopeOp ();
|
||||
if (!Op)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dsobject - Dispatcher object management routines
|
||||
* $Revision: 103 $
|
||||
* $Revision: 105 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -127,6 +127,7 @@
|
||||
ACPI_MODULE_NAME ("dsobject")
|
||||
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitOneObject
|
||||
@ -315,203 +316,6 @@ AcpiDsInitializeObjects (
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitObjectFromOp
|
||||
*
|
||||
* PARAMETERS: WalkState - Current walk state
|
||||
* Op - Parser op used to init the internal object
|
||||
* Opcode - AML opcode associated with the object
|
||||
* RetObjDesc - Namespace object to be initialized
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize a namespace object from a parser Op and its
|
||||
* associated arguments. The namespace object is a more compact
|
||||
* representation of the Op and its arguments.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsInitObjectFromOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT16 Opcode,
|
||||
ACPI_OPERAND_OBJECT **RetObjDesc)
|
||||
{
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
|
||||
|
||||
|
||||
ObjDesc = *RetObjDesc;
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
|
||||
if (OpInfo->Class == AML_CLASS_UNKNOWN)
|
||||
{
|
||||
/* Unknown opcode */
|
||||
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
/* Perform per-object initialization */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/*
|
||||
* Defer evaluation of Buffer TermArg operand
|
||||
*/
|
||||
ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
|
||||
ObjDesc->Buffer.AmlStart = Op->Named.Data;
|
||||
ObjDesc->Buffer.AmlLength = Op->Named.Length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
/*
|
||||
* Defer evaluation of Package TermArg operand
|
||||
*/
|
||||
ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
|
||||
ObjDesc->Package.AmlStart = Op->Named.Data;
|
||||
ObjDesc->Package.AmlLength = Op->Named.Length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
switch (OpInfo->Type)
|
||||
{
|
||||
case AML_TYPE_CONSTANT:
|
||||
/*
|
||||
* Resolve AML Constants here - AND ONLY HERE!
|
||||
* All constants are integers.
|
||||
* We mark the integer with a flag that indicates that it started life
|
||||
* as a constant -- so that stores to constants will perform as expected (noop).
|
||||
* (ZeroOp is used as a placeholder for optional target operands.)
|
||||
*/
|
||||
ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
|
||||
|
||||
switch (Opcode)
|
||||
{
|
||||
case AML_ZERO_OP:
|
||||
|
||||
ObjDesc->Integer.Value = 0;
|
||||
break;
|
||||
|
||||
case AML_ONE_OP:
|
||||
|
||||
ObjDesc->Integer.Value = 1;
|
||||
break;
|
||||
|
||||
case AML_ONES_OP:
|
||||
|
||||
ObjDesc->Integer.Value = ACPI_INTEGER_MAX;
|
||||
|
||||
/* Truncate value if we are executing from a 32-bit ACPI table */
|
||||
|
||||
AcpiExTruncateFor32bitTable (ObjDesc);
|
||||
break;
|
||||
|
||||
case AML_REVISION_OP:
|
||||
|
||||
ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", Opcode));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_LITERAL:
|
||||
|
||||
ObjDesc->Integer.Value = Op->Common.Value.Integer;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", OpInfo->Type));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
ObjDesc->String.Pointer = Op->Common.Value.String;
|
||||
ObjDesc->String.Length = ACPI_STRLEN (Op->Common.Value.String);
|
||||
|
||||
/*
|
||||
* The string is contained in the ACPI table, don't ever try
|
||||
* to delete it
|
||||
*/
|
||||
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
break;
|
||||
|
||||
|
||||
case INTERNAL_TYPE_REFERENCE:
|
||||
|
||||
switch (OpInfo->Type)
|
||||
{
|
||||
case AML_TYPE_LOCAL_VARIABLE:
|
||||
|
||||
/* Split the opcode into a base opcode + offset */
|
||||
|
||||
ObjDesc->Reference.Opcode = AML_LOCAL_OP;
|
||||
ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_METHOD_ARGUMENT:
|
||||
|
||||
/* Split the opcode into a base opcode + offset */
|
||||
|
||||
ObjDesc->Reference.Opcode = AML_ARG_OP;
|
||||
ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
|
||||
break;
|
||||
|
||||
|
||||
default: /* Other literals, etc.. */
|
||||
|
||||
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
/* Node was saved in Op */
|
||||
|
||||
ObjDesc->Reference.Node = Op->Common.Node;
|
||||
}
|
||||
|
||||
ObjDesc->Reference.Opcode = Opcode;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
|
||||
ACPI_GET_OBJECT_TYPE (ObjDesc)));
|
||||
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsBuildInternalObject
|
||||
@ -915,4 +719,209 @@ AcpiDsCreateNode (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitObjectFromOp
|
||||
*
|
||||
* PARAMETERS: WalkState - Current walk state
|
||||
* Op - Parser op used to init the internal object
|
||||
* Opcode - AML opcode associated with the object
|
||||
* RetObjDesc - Namespace object to be initialized
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize a namespace object from a parser Op and its
|
||||
* associated arguments. The namespace object is a more compact
|
||||
* representation of the Op and its arguments.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsInitObjectFromOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT16 Opcode,
|
||||
ACPI_OPERAND_OBJECT **RetObjDesc)
|
||||
{
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
|
||||
|
||||
|
||||
ObjDesc = *RetObjDesc;
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
|
||||
if (OpInfo->Class == AML_CLASS_UNKNOWN)
|
||||
{
|
||||
/* Unknown opcode */
|
||||
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
/* Perform per-object initialization */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/*
|
||||
* Defer evaluation of Buffer TermArg operand
|
||||
*/
|
||||
ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
|
||||
ObjDesc->Buffer.AmlStart = Op->Named.Data;
|
||||
ObjDesc->Buffer.AmlLength = Op->Named.Length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
/*
|
||||
* Defer evaluation of Package TermArg operand
|
||||
*/
|
||||
ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
|
||||
ObjDesc->Package.AmlStart = Op->Named.Data;
|
||||
ObjDesc->Package.AmlLength = Op->Named.Length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
switch (OpInfo->Type)
|
||||
{
|
||||
case AML_TYPE_CONSTANT:
|
||||
/*
|
||||
* Resolve AML Constants here - AND ONLY HERE!
|
||||
* All constants are integers.
|
||||
* We mark the integer with a flag that indicates that it started life
|
||||
* as a constant -- so that stores to constants will perform as expected (noop).
|
||||
* (ZeroOp is used as a placeholder for optional target operands.)
|
||||
*/
|
||||
ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
|
||||
|
||||
switch (Opcode)
|
||||
{
|
||||
case AML_ZERO_OP:
|
||||
|
||||
ObjDesc->Integer.Value = 0;
|
||||
break;
|
||||
|
||||
case AML_ONE_OP:
|
||||
|
||||
ObjDesc->Integer.Value = 1;
|
||||
break;
|
||||
|
||||
case AML_ONES_OP:
|
||||
|
||||
ObjDesc->Integer.Value = ACPI_INTEGER_MAX;
|
||||
|
||||
/* Truncate value if we are executing from a 32-bit ACPI table */
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
AcpiExTruncateFor32bitTable (ObjDesc);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case AML_REVISION_OP:
|
||||
|
||||
ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", Opcode));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_LITERAL:
|
||||
|
||||
ObjDesc->Integer.Value = Op->Common.Value.Integer;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", OpInfo->Type));
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
ObjDesc->String.Pointer = Op->Common.Value.String;
|
||||
ObjDesc->String.Length = ACPI_STRLEN (Op->Common.Value.String);
|
||||
|
||||
/*
|
||||
* The string is contained in the ACPI table, don't ever try
|
||||
* to delete it
|
||||
*/
|
||||
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
break;
|
||||
|
||||
|
||||
case INTERNAL_TYPE_REFERENCE:
|
||||
|
||||
switch (OpInfo->Type)
|
||||
{
|
||||
case AML_TYPE_LOCAL_VARIABLE:
|
||||
|
||||
/* Split the opcode into a base opcode + offset */
|
||||
|
||||
ObjDesc->Reference.Opcode = AML_LOCAL_OP;
|
||||
ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
AcpiDsMethodDataGetNode (AML_LOCAL_OP, ObjDesc->Reference.Offset,
|
||||
WalkState, (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_METHOD_ARGUMENT:
|
||||
|
||||
/* Split the opcode into a base opcode + offset */
|
||||
|
||||
ObjDesc->Reference.Opcode = AML_ARG_OP;
|
||||
ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
|
||||
break;
|
||||
|
||||
default: /* Other literals, etc.. */
|
||||
|
||||
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
/* Node was saved in Op */
|
||||
|
||||
ObjDesc->Reference.Node = Op->Common.Node;
|
||||
}
|
||||
|
||||
ObjDesc->Reference.Opcode = Opcode;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
|
||||
ACPI_GET_OBJECT_TYPE (ObjDesc)));
|
||||
|
||||
Status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: dsutils - Dispatcher utilities
|
||||
* $Revision: 93 $
|
||||
* $Revision: 94 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -127,6 +127,7 @@
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME ("dsutils")
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -338,6 +339,49 @@ AcpiDsDeleteResultIfNotUsed (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsResolveOperands
|
||||
*
|
||||
* PARAMETERS: WalkState - Current walk state with operands on stack
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Resolve all operands to their values. Used to prepare
|
||||
* arguments to a control method invocation (a call from one
|
||||
* method to another.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsResolveOperands (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
|
||||
|
||||
|
||||
/*
|
||||
* Attempt to resolve each of the valid operands
|
||||
* Method arguments are passed by value, not by reference
|
||||
*/
|
||||
for (i = 0; i < WalkState->NumOperands; i++)
|
||||
{
|
||||
Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsCreateOperand
|
||||
@ -640,44 +684,3 @@ AcpiDsCreateOperands (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsResolveOperands
|
||||
*
|
||||
* PARAMETERS: WalkState - Current walk state with operands on stack
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Resolve all operands to their values. Used to prepare
|
||||
* arguments to a control method invocation (a call from one
|
||||
* method to another.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsResolveOperands (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
|
||||
|
||||
|
||||
/*
|
||||
* Attempt to resolve each of the valid operands
|
||||
* Method arguments are passed by value, not by reference
|
||||
*/
|
||||
for (i = 0; i < WalkState->NumOperands; i++)
|
||||
{
|
||||
Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswload - Dispatcher namespace load callbacks
|
||||
* $Revision: 66 $
|
||||
* $Revision: 69 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -163,9 +163,11 @@ AcpiDsInitCallbacks (
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
|
||||
WalkState->DescendingCallback = AcpiDsExecBeginOp;
|
||||
WalkState->AscendingCallback = AcpiDsExecEndOp;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -269,6 +271,11 @@ AcpiDsLoad1BeginOp (
|
||||
|
||||
Op->Named.Name = Node->Name.Integer;
|
||||
|
||||
#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
|
||||
Op->Named.Path = (UINT8 *) Path;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Put the Node in the "op" object that the parser uses, so we
|
||||
* can get it again quickly when this scope is closed
|
||||
@ -322,6 +329,7 @@ AcpiDsLoad1EndOp (
|
||||
|
||||
ObjectType = WalkState->OpInfo->ObjectType;
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
if (WalkState->OpInfo->Flags & AML_FIELD)
|
||||
{
|
||||
if (WalkState->Opcode == AML_FIELD_OP ||
|
||||
@ -343,6 +351,7 @@ AcpiDsLoad1EndOp (
|
||||
return (Status);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Op->Common.AmlOpcode == AML_NAME_OP)
|
||||
{
|
||||
@ -555,7 +564,9 @@ AcpiDsLoad2EndOp (
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_PARSE_OBJECT *Arg;
|
||||
ACPI_NAMESPACE_NODE *NewNode;
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
UINT32 i;
|
||||
#endif
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsLoad2EndOp");
|
||||
@ -575,13 +586,6 @@ AcpiDsLoad2EndOp (
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"Ending scope Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
if (Op->Named.Name == ACPI_UINT16_MAX)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
|
||||
Op, WalkState));
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -614,6 +618,7 @@ AcpiDsLoad2EndOp (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Named operations are as follows:
|
||||
*
|
||||
@ -652,6 +657,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
switch (WalkState->OpInfo->Type)
|
||||
{
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
|
||||
case AML_TYPE_CREATE_FIELD:
|
||||
|
||||
/*
|
||||
@ -745,7 +752,7 @@ AcpiDsLoad2EndOp (
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||
|
||||
case AML_TYPE_NAMED_COMPLEX:
|
||||
|
||||
@ -773,6 +780,7 @@ AcpiDsLoad2EndOp (
|
||||
break;
|
||||
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
case AML_REGION_OP:
|
||||
/*
|
||||
* The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId.
|
||||
@ -802,6 +810,7 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
Status = AcpiDsCreateNode (WalkState, Node, Op);
|
||||
break;
|
||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||
|
||||
|
||||
default:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswstate - Dispatcher parse tree walk management routines
|
||||
* $Revision: 65 $
|
||||
* $Revision: 67 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -964,7 +964,7 @@ AcpiDsCreateWalkState (
|
||||
|
||||
/* Init the method args/local */
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
|
||||
AcpiDsMethodDataInit (WalkState);
|
||||
#endif
|
||||
|
||||
@ -987,7 +987,6 @@ AcpiDsCreateWalkState (
|
||||
}
|
||||
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitAmlWalk
|
||||
@ -1079,7 +1078,6 @@ AcpiDsInitAmlWalk (
|
||||
Status = AcpiDsInitCallbacks (WalkState, PassNumber);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
|
||||
* $Revision: 66 $
|
||||
* $Revision: 67 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -234,6 +234,7 @@ AcpiExLoadTableOp (
|
||||
ACPI_FUNCTION_TRACE ("ExLoadTableOp");
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Make sure that the signature does not match one of the tables that
|
||||
* is already loaded.
|
||||
@ -245,6 +246,7 @@ AcpiExLoadTableOp (
|
||||
|
||||
return_ACPI_STATUS (AE_ALREADY_EXISTS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find the ACPI table */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: excreate - Named object creation
|
||||
* $Revision: 92 $
|
||||
* $Revision: 93 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -129,6 +129,7 @@
|
||||
ACPI_MODULE_NAME ("excreate")
|
||||
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExCreateAlias
|
||||
@ -599,6 +600,7 @@ AcpiExCreatePowerResource (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exdump - Interpreter debug output routines
|
||||
* $Revision: 155 $
|
||||
* $Revision: 157 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -220,6 +220,13 @@ AcpiExDumpOperand (
|
||||
break;
|
||||
|
||||
|
||||
case AML_REF_OF_OP:
|
||||
|
||||
AcpiOsPrintf ("Reference: (RefOf) %p\n",
|
||||
ObjDesc->Reference.Object);
|
||||
break;
|
||||
|
||||
|
||||
case AML_ARG_OP:
|
||||
|
||||
AcpiOsPrintf ("Reference: Arg%d",
|
||||
@ -258,10 +265,12 @@ AcpiExDumpOperand (
|
||||
|
||||
|
||||
case AML_INT_NAMEPATH_OP:
|
||||
|
||||
AcpiOsPrintf ("Reference.Node->Name %X\n",
|
||||
ObjDesc->Reference.Node->Name.Integer);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* unknown opcode */
|
||||
@ -675,14 +684,14 @@ AcpiExDumpObjectDescriptor (
|
||||
{
|
||||
if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
|
||||
{
|
||||
return;
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
|
||||
{
|
||||
AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not a valid ACPI object\n", ObjDesc);
|
||||
return;
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* Common Fields */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
|
||||
* $Revision: 106 $
|
||||
* $Revision: 107 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -134,6 +134,7 @@
|
||||
*
|
||||
* PARAMETERS: ObjDesc - Create a reference to this object
|
||||
* ReturnDesc - Where to store the reference
|
||||
* WalkState - Current state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -148,68 +149,79 @@ AcpiExGetObjectReference (
|
||||
ACPI_OPERAND_OBJECT **ReturnDesc,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_OPERAND_OBJECT *ReferenceObj;
|
||||
ACPI_OPERAND_OBJECT *ReferencedObj;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
|
||||
|
||||
|
||||
*ReturnDesc = NULL;
|
||||
|
||||
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_DESC_TYPE_OPERAND:
|
||||
|
||||
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != INTERNAL_TYPE_REFERENCE)
|
||||
{
|
||||
*ReturnDesc = NULL;
|
||||
Status = AE_TYPE;
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Not a Name -- an indirect name pointer would have
|
||||
* been converted to a direct name pointer in AcpiExResolveOperands
|
||||
* Must be a reference to a Local or Arg
|
||||
*/
|
||||
switch (ObjDesc->Reference.Opcode)
|
||||
{
|
||||
case AML_LOCAL_OP:
|
||||
case AML_ARG_OP:
|
||||
|
||||
Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode,
|
||||
ObjDesc->Reference.Offset, WalkState,
|
||||
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, ReturnDesc));
|
||||
/* The referenced object is the pseudo-node for the local/arg */
|
||||
|
||||
ReferencedObj = ObjDesc->Reference.Object;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(Internal) Unknown Ref subtype %02x\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %X\n",
|
||||
ObjDesc->Reference.Opcode));
|
||||
*ReturnDesc = NULL;
|
||||
Status = AE_AML_INTERNAL;
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_DESC_TYPE_NAMED:
|
||||
|
||||
/* Must be a named object; Just return the Node */
|
||||
|
||||
*ReturnDesc = ObjDesc;
|
||||
/*
|
||||
* A named reference that has already been resolved to a Node
|
||||
*/
|
||||
ReferencedObj = ObjDesc;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
*ReturnDesc = NULL;
|
||||
Status = AE_TYPE;
|
||||
break;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type %X in %p\n",
|
||||
ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), ObjDesc));
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
Cleanup:
|
||||
/* Create a new reference object */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p Ref=%p\n", ObjDesc, *ReturnDesc));
|
||||
return_ACPI_STATUS (Status);
|
||||
ReferenceObj = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
|
||||
if (!ReferenceObj)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
ReferenceObj->Reference.Opcode = AML_REF_OF_OP;
|
||||
ReferenceObj->Reference.Object = ReferencedObj;
|
||||
*ReturnDesc = ReferenceObj;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n",
|
||||
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
|
||||
* $Revision: 139 $
|
||||
* $Revision: 141 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -464,7 +464,7 @@ AcpiExOpcode_1A_1T_1R (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Get the object reference and store it */
|
||||
/* Get the object reference, store it, and remove our reference */
|
||||
|
||||
Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -473,6 +473,7 @@ AcpiExOpcode_1A_1T_1R (
|
||||
}
|
||||
|
||||
Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
|
||||
AcpiUtRemoveReference (ReturnDesc2);
|
||||
|
||||
/* The object exists in the namespace, return TRUE */
|
||||
|
||||
@ -867,6 +868,15 @@ AcpiExOpcode_1A_0T_1R (
|
||||
Operand[0] = TempDesc;
|
||||
break;
|
||||
|
||||
case AML_REF_OF_OP:
|
||||
|
||||
/* Get the object to which the reference refers */
|
||||
|
||||
TempDesc = Operand[0]->Reference.Object;
|
||||
AcpiUtRemoveReference (Operand[0]);
|
||||
Operand[0] = TempDesc;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Must be an Index op - handled below */
|
||||
@ -933,17 +943,7 @@ AcpiExOpcode_1A_0T_1R (
|
||||
{
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
|
||||
/* Ensure that the Buffer arguments are evaluated */
|
||||
|
||||
TempDesc = Operand[0]->Reference.Object;
|
||||
#if 0
|
||||
|
||||
Status = AcpiDsGetBufferArguments (TempDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Create a new object that contains one element of the
|
||||
@ -972,15 +972,6 @@ AcpiExOpcode_1A_0T_1R (
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
#if 0
|
||||
/* Ensure that the Package arguments are evaluated */
|
||||
|
||||
Status = AcpiDsGetPackageArguments (Operand[0]->Reference.Object);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Return the referenced element of the package. We must add
|
||||
* another reference to the referenced object, however.
|
||||
@ -1017,6 +1008,12 @@ AcpiExOpcode_1A_0T_1R (
|
||||
|
||||
ReturnDesc = Operand[0]->Reference.Object;
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) == ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
|
||||
ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ReturnDesc);
|
||||
}
|
||||
|
||||
/* Add another reference to the object! */
|
||||
|
||||
AcpiUtAddReference (ReturnDesc);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
|
||||
* $Revision: 108 $
|
||||
* $Revision: 109 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -470,7 +470,8 @@ AcpiExOpcode_2A_1T_1R (
|
||||
|
||||
if (Index >= Operand[0]->Package.Count)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond package end\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond package end (%X)\n",
|
||||
Index, Operand[0]->Package.Count));
|
||||
Status = AE_AML_PACKAGE_LIMIT;
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -516,7 +517,8 @@ AcpiExOpcode_2A_1T_1R (
|
||||
|
||||
if (Index >= Operand[0]->Buffer.Length)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond end of buffer\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond end of buffer (%X)\n",
|
||||
Index, Operand[0]->Buffer.Length));
|
||||
Status = AE_AML_BUFFER_LIMIT;
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -645,7 +647,8 @@ AcpiExOpcode_2A_0T_1R (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n", WalkState->Opcode));
|
||||
ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n",
|
||||
WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exresnte - AML Interpreter object resolution
|
||||
* $Revision: 56 $
|
||||
* $Revision: 57 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -320,7 +320,7 @@ AcpiExResolveNodeToValue (
|
||||
|
||||
/* No named references are allowed here */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X\n",
|
||||
SourceDesc->Reference.Opcode));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exresolv - AML Interpreter object resolution
|
||||
* $Revision: 114 $
|
||||
* $Revision: 115 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -330,9 +330,11 @@ AcpiExResolveObjectToValue (
|
||||
break;
|
||||
|
||||
|
||||
case AML_REF_OF_OP:
|
||||
case AML_DEBUG_OP:
|
||||
|
||||
/* Just leave the object as-is */
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exresop - AML Interpreter operand/object resolution
|
||||
* $Revision: 53 $
|
||||
* $Revision: 54 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -309,6 +309,7 @@ AcpiExResolveOperands (
|
||||
case AML_DEBUG_OP:
|
||||
case AML_NAME_OP:
|
||||
case AML_INDEX_OP:
|
||||
case AML_REF_OF_OP:
|
||||
case AML_ARG_OP:
|
||||
case AML_LOCAL_OP:
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exstore - AML Interpreter object store support
|
||||
* $Revision: 167 $
|
||||
* $Revision: 168 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -227,6 +227,7 @@ AcpiExStore (
|
||||
switch (RefDesc->Reference.Opcode)
|
||||
{
|
||||
case AML_NAME_OP:
|
||||
case AML_REF_OF_OP:
|
||||
|
||||
/* Storing an object into a Name "container" */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exutils - interpreter/scanner utilities
|
||||
* $Revision: 100 $
|
||||
* $Revision: 102 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -142,6 +142,35 @@
|
||||
ACPI_MODULE_NAME ("exutils")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExValidateObjectType
|
||||
*
|
||||
* PARAMETERS: Type Object type to validate
|
||||
*
|
||||
* DESCRIPTION: Determine if a type is a valid ACPI object type
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiExValidateObjectType (
|
||||
ACPI_OBJECT_TYPE Type)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
if ((Type > ACPI_TYPE_MAX && Type < INTERNAL_TYPE_BEGIN) ||
|
||||
(Type > INTERNAL_TYPE_MAX))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExEnterInterpreter
|
||||
@ -210,34 +239,6 @@ AcpiExExitInterpreter (void)
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExValidateObjectType
|
||||
*
|
||||
* PARAMETERS: Type Object type to validate
|
||||
*
|
||||
* DESCRIPTION: Determine if a type is a valid ACPI object type
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiExValidateObjectType (
|
||||
ACPI_OBJECT_TYPE Type)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
if ((Type > ACPI_TYPE_MAX && Type < INTERNAL_TYPE_BEGIN) ||
|
||||
(Type > INTERNAL_TYPE_MAX))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExTruncateFor32bitTable
|
||||
@ -365,6 +366,8 @@ AcpiExReleaseGlobalLock (
|
||||
ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
|
||||
}
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
@ -482,4 +485,4 @@ AcpiExUnsignedIntegerToString (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: nsdump - table dumping routines for debug
|
||||
* $Revision: 136 $
|
||||
* $Revision: 137 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -756,97 +756,6 @@ AcpiNsDumpObjects (
|
||||
}
|
||||
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsDumpOneDevice
|
||||
*
|
||||
* PARAMETERS: Handle - Node to be dumped
|
||||
* Level - Nesting level of the handle
|
||||
* Context - Passed into WalkNamespace
|
||||
*
|
||||
* DESCRIPTION: Dump a single Node that represents a device
|
||||
* This procedure is a UserFunction called by AcpiNsWalkNamespace.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiNsDumpOneDevice (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_DEVICE_INFO Info;
|
||||
ACPI_STATUS Status;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("NsDumpOneDevice");
|
||||
|
||||
|
||||
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
|
||||
|
||||
Status = AcpiGetObjectInfo (ObjHandle, &Info);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
for (i = 0; i < Level; i++)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
|
||||
Info.HardwareId,
|
||||
ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address),
|
||||
Info.CurrentStatus));
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsDumpRootDevices
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* DESCRIPTION: Dump all objects of type "device"
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiNsDumpRootDevices (void)
|
||||
{
|
||||
ACPI_HANDLE SysBusHandle;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("NsDumpRootDevices");
|
||||
|
||||
|
||||
/* Only dump the table if tracing is enabled */
|
||||
|
||||
if (!(ACPI_LV_TABLES & AcpiDbgLevel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Status = AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
|
||||
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||
AcpiNsDumpOneDevice, NULL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsDumpTables
|
||||
|
221
sys/contrib/dev/acpica/nsdumpdv.c
Normal file
221
sys/contrib/dev/acpica/nsdumpdv.c
Normal file
@ -0,0 +1,221 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: nsdump - table dumping routines for debug
|
||||
* $Revision: 1 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __NSDUMPDV_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acparser.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_NAMESPACE
|
||||
ACPI_MODULE_NAME ("nsdumpdv")
|
||||
|
||||
|
||||
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsDumpOneDevice
|
||||
*
|
||||
* PARAMETERS: Handle - Node to be dumped
|
||||
* Level - Nesting level of the handle
|
||||
* Context - Passed into WalkNamespace
|
||||
*
|
||||
* DESCRIPTION: Dump a single Node that represents a device
|
||||
* This procedure is a UserFunction called by AcpiNsWalkNamespace.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiNsDumpOneDevice (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 Level,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_DEVICE_INFO Info;
|
||||
ACPI_STATUS Status;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("NsDumpOneDevice");
|
||||
|
||||
|
||||
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
|
||||
|
||||
Status = AcpiGetObjectInfo (ObjHandle, &Info);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
for (i = 0; i < Level; i++)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
|
||||
Info.HardwareId,
|
||||
ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address),
|
||||
Info.CurrentStatus));
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsDumpRootDevices
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* DESCRIPTION: Dump all objects of type "device"
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiNsDumpRootDevices (void)
|
||||
{
|
||||
ACPI_HANDLE SysBusHandle;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("NsDumpRootDevices");
|
||||
|
||||
|
||||
/* Only dump the table if tracing is enabled */
|
||||
|
||||
if (!(ACPI_LV_TABLES & AcpiDbgLevel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Status = AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
|
||||
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||
AcpiNsDumpOneDevice, NULL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: nseval - Object evaluation interfaces -- includes control
|
||||
* method lookup and execution.
|
||||
* $Revision: 116 $
|
||||
* $Revision: 117 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -602,7 +602,8 @@ AcpiNsGetObjectValue (
|
||||
{
|
||||
Status = AE_CTRL_RETURN_VALUE;
|
||||
*ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", ResolvedNode));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
|
||||
*ReturnObjDesc, AcpiUtGetObjectTypeName (*ReturnObjDesc)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: nsload - namespace loading/expanding/contracting procedures
|
||||
* $Revision: 55 $
|
||||
* $Revision: 57 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -129,61 +129,7 @@
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiLoadNamespace
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
|
||||
* (DSDT points to either the BIOS or a buffer.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiNsLoadNamespace (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
|
||||
|
||||
|
||||
/* There must be at least a DSDT installed */
|
||||
|
||||
if (AcpiGbl_DSDT == NULL)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the namespace. The DSDT is required,
|
||||
* but the SSDT and PSDT tables are optional.
|
||||
*/
|
||||
Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Ignore exceptions from these */
|
||||
|
||||
(void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
|
||||
(void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
|
||||
"ACPI Namespace successfully loaded at root %p\n",
|
||||
AcpiGbl_RootNode));
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsOneParsePass
|
||||
* FUNCTION: NsOneCompleteParse
|
||||
*
|
||||
* PARAMETERS: PassNumber - 1 or 2
|
||||
* TableDesc - The table to be parsed.
|
||||
@ -209,13 +155,12 @@ AcpiNsOneCompleteParse (
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
ParseRoot = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
ParseRoot = AcpiPsCreateScopeOp ();
|
||||
if (!ParseRoot)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
ParseRoot->Named.Name = ACPI_ROOT_NAME;
|
||||
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
@ -303,6 +248,7 @@ AcpiNsParseTable (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -534,6 +480,61 @@ AcpiNsLoadTableByType (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiLoadNamespace
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
|
||||
* (DSDT points to either the BIOS or a buffer.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiNsLoadNamespace (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
|
||||
|
||||
|
||||
/* There must be at least a DSDT installed */
|
||||
|
||||
if (AcpiGbl_DSDT == NULL)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the namespace. The DSDT is required,
|
||||
* but the SSDT and PSDT tables are optional.
|
||||
*/
|
||||
Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Ignore exceptions from these */
|
||||
|
||||
(void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
|
||||
(void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
|
||||
"ACPI Namespace successfully loaded at root %p\n",
|
||||
AcpiGbl_RootNode));
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsDeleteSubtree
|
||||
@ -672,4 +673,5 @@ AcpiNsUnloadNamespace (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: nsnames - Name manipulation and search
|
||||
* $Revision: 77 $
|
||||
* $Revision: 78 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -275,7 +275,7 @@ AcpiNsGetPathnameLength (
|
||||
Size = 0;
|
||||
NextNode = Node;
|
||||
|
||||
while (NextNode != AcpiGbl_RootNode)
|
||||
while (NextNode && (NextNode != AcpiGbl_RootNode))
|
||||
{
|
||||
Size += PATH_SEGMENT_LENGTH;
|
||||
NextNode = AcpiNsGetParentNode (NextNode);
|
||||
|
866
sys/contrib/dev/acpica/nsxfeval.c
Normal file
866
sys/contrib/dev/acpica/nsxfeval.c
Normal file
@ -0,0 +1,866 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
|
||||
* ACPI Object evaluation interfaces
|
||||
* $Revision: 1 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#define __NSXFEVAL_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_NAMESPACE
|
||||
ACPI_MODULE_NAME ("nsxfeval")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvaluateObjectTyped
|
||||
*
|
||||
* PARAMETERS: Handle - Object handle (optional)
|
||||
* *Pathname - Object pathname (optional)
|
||||
* **ExternalParams - List of parameters to pass to method,
|
||||
* terminated by NULL. May be NULL
|
||||
* if no parameters are being passed.
|
||||
* *ReturnBuffer - Where to put method's return value (if
|
||||
* any). If NULL, no value is returned.
|
||||
* ReturnType - Expected type of return object
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Find and evaluate the given object, passing the given
|
||||
* parameters if necessary. One of "Handle" or "Pathname" must
|
||||
* be valid (non-null)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvaluateObjectTyped (
|
||||
ACPI_HANDLE Handle,
|
||||
ACPI_STRING Pathname,
|
||||
ACPI_OBJECT_LIST *ExternalParams,
|
||||
ACPI_BUFFER *ReturnBuffer,
|
||||
ACPI_OBJECT_TYPE ReturnType)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
BOOLEAN MustFree = FALSE;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped");
|
||||
|
||||
|
||||
/* Return buffer must be valid */
|
||||
|
||||
if (!ReturnBuffer)
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER)
|
||||
{
|
||||
MustFree = TRUE;
|
||||
}
|
||||
|
||||
/* Evaluate the object */
|
||||
|
||||
Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Type ANY means "don't care" */
|
||||
|
||||
if (ReturnType == ACPI_TYPE_ANY)
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
if (ReturnBuffer->Length == 0)
|
||||
{
|
||||
/* Error because caller specifically asked for a return value */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"No return value\n"));
|
||||
|
||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
||||
}
|
||||
|
||||
/* Examine the object type returned from EvaluateObject */
|
||||
|
||||
if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType)
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Return object type does not match requested type */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Incorrect return type [%s] requested [%s]\n",
|
||||
AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
|
||||
AcpiUtGetTypeName (ReturnType)));
|
||||
|
||||
if (MustFree)
|
||||
{
|
||||
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
|
||||
|
||||
AcpiOsFree (ReturnBuffer->Pointer);
|
||||
ReturnBuffer->Pointer = NULL;
|
||||
}
|
||||
|
||||
ReturnBuffer->Length = 0;
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvaluateObject
|
||||
*
|
||||
* PARAMETERS: Handle - Object handle (optional)
|
||||
* *Pathname - Object pathname (optional)
|
||||
* **ExternalParams - List of parameters to pass to method,
|
||||
* terminated by NULL. May be NULL
|
||||
* if no parameters are being passed.
|
||||
* *ReturnBuffer - Where to put method's return value (if
|
||||
* any). If NULL, no value is returned.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Find and evaluate the given object, passing the given
|
||||
* parameters if necessary. One of "Handle" or "Pathname" must
|
||||
* be valid (non-null)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvaluateObject (
|
||||
ACPI_HANDLE Handle,
|
||||
ACPI_STRING Pathname,
|
||||
ACPI_OBJECT_LIST *ExternalParams,
|
||||
ACPI_BUFFER *ReturnBuffer)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT **InternalParams = NULL;
|
||||
ACPI_OPERAND_OBJECT *InternalReturnObj = NULL;
|
||||
ACPI_SIZE BufferSpaceNeeded;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
|
||||
|
||||
|
||||
/*
|
||||
* If there are parameters to be passed to the object
|
||||
* (which must be a control method), the external objects
|
||||
* must be converted to internal objects
|
||||
*/
|
||||
if (ExternalParams && ExternalParams->Count)
|
||||
{
|
||||
/*
|
||||
* Allocate a new parameter block for the internal objects
|
||||
* Add 1 to count to allow for null terminated internal list
|
||||
*/
|
||||
InternalParams = ACPI_MEM_CALLOCATE (((ACPI_SIZE) ExternalParams->Count + 1) *
|
||||
sizeof (void *));
|
||||
if (!InternalParams)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert each external object in the list to an
|
||||
* internal object
|
||||
*/
|
||||
for (i = 0; i < ExternalParams->Count; i++)
|
||||
{
|
||||
Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
|
||||
&InternalParams[i]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiUtDeleteInternalObjectList (InternalParams);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
InternalParams[ExternalParams->Count] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Three major cases:
|
||||
* 1) Fully qualified pathname
|
||||
* 2) No handle, not fully qualified pathname (error)
|
||||
* 3) Valid handle
|
||||
*/
|
||||
if ((Pathname) &&
|
||||
(AcpiNsValidRootPrefix (Pathname[0])))
|
||||
{
|
||||
/*
|
||||
* The path is fully qualified, just evaluate by name
|
||||
*/
|
||||
Status = AcpiNsEvaluateByName (Pathname, InternalParams,
|
||||
&InternalReturnObj);
|
||||
}
|
||||
else if (!Handle)
|
||||
{
|
||||
/*
|
||||
* A handle is optional iff a fully qualified pathname
|
||||
* is specified. Since we've already handled fully
|
||||
* qualified names above, this is an error
|
||||
*/
|
||||
if (!Pathname)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Both Handle and Pathname are NULL\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Handle is NULL and Pathname is relative\n"));
|
||||
}
|
||||
|
||||
Status = AE_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We get here if we have a handle -- and if we have a
|
||||
* pathname it is relative. The handle will be validated
|
||||
* in the lower procedures
|
||||
*/
|
||||
if (!Pathname)
|
||||
{
|
||||
/*
|
||||
* The null pathname case means the handle is for
|
||||
* the actual object to be evaluated
|
||||
*/
|
||||
Status = AcpiNsEvaluateByHandle (Handle, InternalParams,
|
||||
&InternalReturnObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Both a Handle and a relative Pathname
|
||||
*/
|
||||
Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams,
|
||||
&InternalReturnObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we are expecting a return value, and all went well above,
|
||||
* copy the return value to an external object.
|
||||
*/
|
||||
if (ReturnBuffer)
|
||||
{
|
||||
if (!InternalReturnObj)
|
||||
{
|
||||
ReturnBuffer->Length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
/*
|
||||
* If we received a NS Node as a return object, this means that
|
||||
* the object we are evaluating has nothing interesting to
|
||||
* return (such as a mutex, etc.) We return an error because
|
||||
* these types are essentially unsupported by this interface.
|
||||
* We don't check up front because this makes it easier to add
|
||||
* support for various types at a later date if necessary.
|
||||
*/
|
||||
Status = AE_TYPE;
|
||||
InternalReturnObj = NULL; /* No need to delete a NS Node */
|
||||
ReturnBuffer->Length = 0;
|
||||
}
|
||||
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/*
|
||||
* Find out how large a buffer is needed
|
||||
* to contain the returned object
|
||||
*/
|
||||
Status = AcpiUtGetObjectSize (InternalReturnObj,
|
||||
&BufferSpaceNeeded);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/* Validate/Allocate/Clear caller buffer */
|
||||
|
||||
Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/*
|
||||
* Caller's buffer is too small or a new one can't be allocated
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Needed buffer size %X, %s\n",
|
||||
(UINT32) BufferSpaceNeeded, AcpiFormatException (Status)));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We have enough space for the object, build it
|
||||
*/
|
||||
Status = AcpiUtCopyIobjectToEobject (InternalReturnObj,
|
||||
ReturnBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete the return and parameter objects */
|
||||
|
||||
if (InternalReturnObj)
|
||||
{
|
||||
/*
|
||||
* Delete the internal return object. (Or at least
|
||||
* decrement the reference count by one)
|
||||
*/
|
||||
AcpiUtRemoveReference (InternalReturnObj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the input parameter list (if we created one),
|
||||
*/
|
||||
if (InternalParams)
|
||||
{
|
||||
/* Free the allocated parameter block */
|
||||
|
||||
AcpiUtDeleteInternalObjectList (InternalParams);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiWalkNamespace
|
||||
*
|
||||
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
|
||||
* StartObject - Handle in namespace where search begins
|
||||
* MaxDepth - Depth to which search is to reach
|
||||
* UserFunction - Called when an object of "Type" is found
|
||||
* Context - Passed to user function
|
||||
* ReturnValue - Location where return value of
|
||||
* UserFunction is put if terminated early
|
||||
*
|
||||
* RETURNS Return value from the UserFunction if terminated early.
|
||||
* Otherwise, returns NULL.
|
||||
*
|
||||
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
|
||||
* starting (and ending) at the object specified by StartHandle.
|
||||
* The UserFunction is called whenever an object that matches
|
||||
* the type parameter is found. If the user function returns
|
||||
* a non-zero value, the search is terminated immediately and this
|
||||
* value is returned to the caller.
|
||||
*
|
||||
* The point of this procedure is to provide a generic namespace
|
||||
* walk routine that can be called from multiple places to
|
||||
* provide multiple services; the User Function can be tailored
|
||||
* to each task, whether it is a print function, a compare
|
||||
* function, etc.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiWalkNamespace (
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
ACPI_HANDLE StartObject,
|
||||
UINT32 MaxDepth,
|
||||
ACPI_WALK_CALLBACK UserFunction,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiWalkNamespace");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((Type > ACPI_TYPE_MAX) ||
|
||||
(!MaxDepth) ||
|
||||
(!UserFunction))
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock the namespace around the walk.
|
||||
* The namespace will be unlocked/locked around each call
|
||||
* to the user function - since this function
|
||||
* must be allowed to make Acpi calls itself.
|
||||
*/
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK,
|
||||
UserFunction, Context, ReturnValue);
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsGetDeviceCallback
|
||||
*
|
||||
* PARAMETERS: Callback from AcpiGetDevice
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
|
||||
* present devices, or if they specified a HID, it filters based
|
||||
* on that.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiNsGetDeviceCallback (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 NestingLevel,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
UINT32 Flags;
|
||||
ACPI_DEVICE_ID Hid;
|
||||
ACPI_DEVICE_ID Cid;
|
||||
ACPI_GET_DEVICES_INFO *Info;
|
||||
|
||||
|
||||
Info = Context;
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (!Node)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Run _STA to determine if device is present
|
||||
*/
|
||||
Status = AcpiUtExecute_STA (Node, &Flags);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
if (!(Flags & 0x01))
|
||||
{
|
||||
/* Don't return at the device or children of the device if not there */
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
/*
|
||||
* Filter based on device HID & CID
|
||||
*/
|
||||
if (Info->Hid != NULL)
|
||||
{
|
||||
Status = AcpiUtExecute_HID (Node, &Hid);
|
||||
if (Status == AE_NOT_FOUND)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
else if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0)
|
||||
{
|
||||
Status = AcpiUtExecute_CID (Node, &Cid);
|
||||
if (Status == AE_NOT_FOUND)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
else if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
/* TBD: Handle CID packages */
|
||||
|
||||
if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetDevices
|
||||
*
|
||||
* PARAMETERS: HID - HID to search for. Can be NULL.
|
||||
* UserFunction - Called when a matching object is found
|
||||
* Context - Passed to user function
|
||||
* ReturnValue - Location where return value of
|
||||
* UserFunction is put if terminated early
|
||||
*
|
||||
* RETURNS Return value from the UserFunction if terminated early.
|
||||
* Otherwise, returns NULL.
|
||||
*
|
||||
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
|
||||
* starting (and ending) at the object specified by StartHandle.
|
||||
* The UserFunction is called whenever an object that matches
|
||||
* the type parameter is found. If the user function returns
|
||||
* a non-zero value, the search is terminated immediately and this
|
||||
* value is returned to the caller.
|
||||
*
|
||||
* This is a wrapper for WalkNamespace, but the callback performs
|
||||
* additional filtering. Please see AcpiGetDeviceCallback.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetDevices (
|
||||
NATIVE_CHAR *HID,
|
||||
ACPI_WALK_CALLBACK UserFunction,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_GET_DEVICES_INFO Info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiGetDevices");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!UserFunction)
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* We're going to call their callback from OUR callback, so we need
|
||||
* to know what it is, and their context parameter.
|
||||
*/
|
||||
Info.Context = Context;
|
||||
Info.UserFunction = UserFunction;
|
||||
Info.Hid = HID;
|
||||
|
||||
/*
|
||||
* Lock the namespace around the walk.
|
||||
* The namespace will be unlocked/locked around each call
|
||||
* to the user function - since this function
|
||||
* must be allowed to make Acpi calls itself.
|
||||
*/
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE,
|
||||
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
|
||||
ACPI_NS_WALK_UNLOCK,
|
||||
AcpiNsGetDeviceCallback, &Info,
|
||||
ReturnValue);
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAttachData
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAttachData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void *Data)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!ObjHandle ||
|
||||
!Handler ||
|
||||
!Data)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Convert and validate the handle */
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
if (!Node)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiNsAttachData (Node, Handler, Data);
|
||||
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDetachData
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDetachData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!ObjHandle ||
|
||||
!Handler)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Convert and validate the handle */
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
if (!Node)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiNsDetachData (Node, Handler);
|
||||
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetData
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!ObjHandle ||
|
||||
!Handler ||
|
||||
!Data)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Convert and validate the handle */
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
if (!Node)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiNsGetAttachedData (Node, Handler, Data);
|
||||
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
|
||||
* ACPI Object oriented interfaces
|
||||
* $Revision: 112 $
|
||||
* $Revision: 113 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -125,420 +125,6 @@
|
||||
#define _COMPONENT ACPI_NAMESPACE
|
||||
ACPI_MODULE_NAME ("nsxfobj")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvaluateObjectTyped
|
||||
*
|
||||
* PARAMETERS: Handle - Object handle (optional)
|
||||
* *Pathname - Object pathname (optional)
|
||||
* **ExternalParams - List of parameters to pass to method,
|
||||
* terminated by NULL. May be NULL
|
||||
* if no parameters are being passed.
|
||||
* *ReturnBuffer - Where to put method's return value (if
|
||||
* any). If NULL, no value is returned.
|
||||
* ReturnType - Expected type of return object
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Find and evaluate the given object, passing the given
|
||||
* parameters if necessary. One of "Handle" or "Pathname" must
|
||||
* be valid (non-null)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvaluateObjectTyped (
|
||||
ACPI_HANDLE Handle,
|
||||
ACPI_STRING Pathname,
|
||||
ACPI_OBJECT_LIST *ExternalParams,
|
||||
ACPI_BUFFER *ReturnBuffer,
|
||||
ACPI_OBJECT_TYPE ReturnType)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
BOOLEAN MustFree = FALSE;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped");
|
||||
|
||||
|
||||
/* Return buffer must be valid */
|
||||
|
||||
if (!ReturnBuffer)
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER)
|
||||
{
|
||||
MustFree = TRUE;
|
||||
}
|
||||
|
||||
/* Evaluate the object */
|
||||
|
||||
Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Type ANY means "don't care" */
|
||||
|
||||
if (ReturnType == ACPI_TYPE_ANY)
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
if (ReturnBuffer->Length == 0)
|
||||
{
|
||||
/* Error because caller specifically asked for a return value */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"No return value\n"));
|
||||
|
||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
||||
}
|
||||
|
||||
/* Examine the object type returned from EvaluateObject */
|
||||
|
||||
if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType)
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Return object type does not match requested type */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Incorrect return type [%s] requested [%s]\n",
|
||||
AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
|
||||
AcpiUtGetTypeName (ReturnType)));
|
||||
|
||||
if (MustFree)
|
||||
{
|
||||
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
|
||||
|
||||
AcpiOsFree (ReturnBuffer->Pointer);
|
||||
ReturnBuffer->Pointer = NULL;
|
||||
}
|
||||
|
||||
ReturnBuffer->Length = 0;
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEvaluateObject
|
||||
*
|
||||
* PARAMETERS: Handle - Object handle (optional)
|
||||
* *Pathname - Object pathname (optional)
|
||||
* **ExternalParams - List of parameters to pass to method,
|
||||
* terminated by NULL. May be NULL
|
||||
* if no parameters are being passed.
|
||||
* *ReturnBuffer - Where to put method's return value (if
|
||||
* any). If NULL, no value is returned.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Find and evaluate the given object, passing the given
|
||||
* parameters if necessary. One of "Handle" or "Pathname" must
|
||||
* be valid (non-null)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEvaluateObject (
|
||||
ACPI_HANDLE Handle,
|
||||
ACPI_STRING Pathname,
|
||||
ACPI_OBJECT_LIST *ExternalParams,
|
||||
ACPI_BUFFER *ReturnBuffer)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT **InternalParams = NULL;
|
||||
ACPI_OPERAND_OBJECT *InternalReturnObj = NULL;
|
||||
ACPI_SIZE BufferSpaceNeeded;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
|
||||
|
||||
|
||||
/*
|
||||
* If there are parameters to be passed to the object
|
||||
* (which must be a control method), the external objects
|
||||
* must be converted to internal objects
|
||||
*/
|
||||
if (ExternalParams && ExternalParams->Count)
|
||||
{
|
||||
/*
|
||||
* Allocate a new parameter block for the internal objects
|
||||
* Add 1 to count to allow for null terminated internal list
|
||||
*/
|
||||
InternalParams = ACPI_MEM_CALLOCATE (((ACPI_SIZE) ExternalParams->Count + 1) *
|
||||
sizeof (void *));
|
||||
if (!InternalParams)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert each external object in the list to an
|
||||
* internal object
|
||||
*/
|
||||
for (i = 0; i < ExternalParams->Count; i++)
|
||||
{
|
||||
Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
|
||||
&InternalParams[i]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiUtDeleteInternalObjectList (InternalParams);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
InternalParams[ExternalParams->Count] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Three major cases:
|
||||
* 1) Fully qualified pathname
|
||||
* 2) No handle, not fully qualified pathname (error)
|
||||
* 3) Valid handle
|
||||
*/
|
||||
if ((Pathname) &&
|
||||
(AcpiNsValidRootPrefix (Pathname[0])))
|
||||
{
|
||||
/*
|
||||
* The path is fully qualified, just evaluate by name
|
||||
*/
|
||||
Status = AcpiNsEvaluateByName (Pathname, InternalParams,
|
||||
&InternalReturnObj);
|
||||
}
|
||||
else if (!Handle)
|
||||
{
|
||||
/*
|
||||
* A handle is optional iff a fully qualified pathname
|
||||
* is specified. Since we've already handled fully
|
||||
* qualified names above, this is an error
|
||||
*/
|
||||
if (!Pathname)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Both Handle and Pathname are NULL\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Handle is NULL and Pathname is relative\n"));
|
||||
}
|
||||
|
||||
Status = AE_BAD_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We get here if we have a handle -- and if we have a
|
||||
* pathname it is relative. The handle will be validated
|
||||
* in the lower procedures
|
||||
*/
|
||||
if (!Pathname)
|
||||
{
|
||||
/*
|
||||
* The null pathname case means the handle is for
|
||||
* the actual object to be evaluated
|
||||
*/
|
||||
Status = AcpiNsEvaluateByHandle (Handle, InternalParams,
|
||||
&InternalReturnObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Both a Handle and a relative Pathname
|
||||
*/
|
||||
Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams,
|
||||
&InternalReturnObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we are expecting a return value, and all went well above,
|
||||
* copy the return value to an external object.
|
||||
*/
|
||||
if (ReturnBuffer)
|
||||
{
|
||||
if (!InternalReturnObj)
|
||||
{
|
||||
ReturnBuffer->Length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED)
|
||||
{
|
||||
/*
|
||||
* If we received a NS Node as a return object, this means that
|
||||
* the object we are evaluating has nothing interesting to
|
||||
* return (such as a mutex, etc.) We return an error because
|
||||
* these types are essentially unsupported by this interface.
|
||||
* We don't check up front because this makes it easier to add
|
||||
* support for various types at a later date if necessary.
|
||||
*/
|
||||
Status = AE_TYPE;
|
||||
InternalReturnObj = NULL; /* No need to delete a NS Node */
|
||||
ReturnBuffer->Length = 0;
|
||||
}
|
||||
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/*
|
||||
* Find out how large a buffer is needed
|
||||
* to contain the returned object
|
||||
*/
|
||||
Status = AcpiUtGetObjectSize (InternalReturnObj,
|
||||
&BufferSpaceNeeded);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
/* Validate/Allocate/Clear caller buffer */
|
||||
|
||||
Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/*
|
||||
* Caller's buffer is too small or a new one can't be allocated
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Needed buffer size %X, %s\n",
|
||||
(UINT32) BufferSpaceNeeded, AcpiFormatException (Status)));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We have enough space for the object, build it
|
||||
*/
|
||||
Status = AcpiUtCopyIobjectToEobject (InternalReturnObj,
|
||||
ReturnBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete the return and parameter objects */
|
||||
|
||||
if (InternalReturnObj)
|
||||
{
|
||||
/*
|
||||
* Delete the internal return object. (Or at least
|
||||
* decrement the reference count by one)
|
||||
*/
|
||||
AcpiUtRemoveReference (InternalReturnObj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the input parameter list (if we created one),
|
||||
*/
|
||||
if (InternalParams)
|
||||
{
|
||||
/* Free the allocated parameter block */
|
||||
|
||||
AcpiUtDeleteInternalObjectList (InternalParams);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetNextObject
|
||||
*
|
||||
* PARAMETERS: Type - Type of object to be searched for
|
||||
* Parent - Parent object whose children we are getting
|
||||
* LastChild - Previous child that was found.
|
||||
* The NEXT child will be returned
|
||||
* RetHandle - Where handle to the next object is placed
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Return the next peer object within the namespace. If Handle is
|
||||
* valid, Scope is ignored. Otherwise, the first object within
|
||||
* Scope is returned.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetNextObject (
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
ACPI_HANDLE Parent,
|
||||
ACPI_HANDLE Child,
|
||||
ACPI_HANDLE *RetHandle)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_NAMESPACE_NODE *ParentNode = NULL;
|
||||
ACPI_NAMESPACE_NODE *ChildNode = NULL;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (Type > ACPI_TYPE_MAX)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* If null handle, use the parent */
|
||||
|
||||
if (!Child)
|
||||
{
|
||||
/* Start search at the beginning of the specified scope */
|
||||
|
||||
ParentNode = AcpiNsMapHandleToNode (Parent);
|
||||
if (!ParentNode)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Non-null handle, ignore the parent */
|
||||
/* Convert and validate the handle */
|
||||
|
||||
ChildNode = AcpiNsMapHandleToNode (Child);
|
||||
if (!ChildNode)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Internal function does the real work */
|
||||
|
||||
Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode);
|
||||
if (!Node)
|
||||
{
|
||||
Status = AE_NOT_FOUND;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
if (RetHandle)
|
||||
{
|
||||
*RetHandle = AcpiNsConvertEntryToHandle (Node);
|
||||
}
|
||||
|
||||
|
||||
UnlockAndExit:
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetType
|
||||
@ -673,287 +259,38 @@ AcpiGetParent (
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiWalkNamespace
|
||||
* FUNCTION: AcpiGetNextObject
|
||||
*
|
||||
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
|
||||
* StartObject - Handle in namespace where search begins
|
||||
* MaxDepth - Depth to which search is to reach
|
||||
* UserFunction - Called when an object of "Type" is found
|
||||
* Context - Passed to user function
|
||||
* ReturnValue - Location where return value of
|
||||
* UserFunction is put if terminated early
|
||||
* PARAMETERS: Type - Type of object to be searched for
|
||||
* Parent - Parent object whose children we are getting
|
||||
* LastChild - Previous child that was found.
|
||||
* The NEXT child will be returned
|
||||
* RetHandle - Where handle to the next object is placed
|
||||
*
|
||||
* RETURNS Return value from the UserFunction if terminated early.
|
||||
* Otherwise, returns NULL.
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
|
||||
* starting (and ending) at the object specified by StartHandle.
|
||||
* The UserFunction is called whenever an object that matches
|
||||
* the type parameter is found. If the user function returns
|
||||
* a non-zero value, the search is terminated immediately and this
|
||||
* value is returned to the caller.
|
||||
*
|
||||
* The point of this procedure is to provide a generic namespace
|
||||
* walk routine that can be called from multiple places to
|
||||
* provide multiple services; the User Function can be tailored
|
||||
* to each task, whether it is a print function, a compare
|
||||
* function, etc.
|
||||
* DESCRIPTION: Return the next peer object within the namespace. If Handle is
|
||||
* valid, Scope is ignored. Otherwise, the first object within
|
||||
* Scope is returned.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiWalkNamespace (
|
||||
AcpiGetNextObject (
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
ACPI_HANDLE StartObject,
|
||||
UINT32 MaxDepth,
|
||||
ACPI_WALK_CALLBACK UserFunction,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiWalkNamespace");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((Type > ACPI_TYPE_MAX) ||
|
||||
(!MaxDepth) ||
|
||||
(!UserFunction))
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock the namespace around the walk.
|
||||
* The namespace will be unlocked/locked around each call
|
||||
* to the user function - since this function
|
||||
* must be allowed to make Acpi calls itself.
|
||||
*/
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK,
|
||||
UserFunction, Context, ReturnValue);
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiNsGetDeviceCallback
|
||||
*
|
||||
* PARAMETERS: Callback from AcpiGetDevice
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Takes callbacks from WalkNamespace and filters out all non-
|
||||
* present devices, or if they specified a HID, it filters based
|
||||
* on that.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiNsGetDeviceCallback (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
UINT32 NestingLevel,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
ACPI_HANDLE Parent,
|
||||
ACPI_HANDLE Child,
|
||||
ACPI_HANDLE *RetHandle)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
UINT32 Flags;
|
||||
ACPI_DEVICE_ID Hid;
|
||||
ACPI_DEVICE_ID Cid;
|
||||
ACPI_GET_DEVICES_INFO *Info;
|
||||
|
||||
|
||||
Info = Context;
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (!Node)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Run _STA to determine if device is present
|
||||
*/
|
||||
Status = AcpiUtExecute_STA (Node, &Flags);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
if (!(Flags & 0x01))
|
||||
{
|
||||
/* Don't return at the device or children of the device if not there */
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
/*
|
||||
* Filter based on device HID & CID
|
||||
*/
|
||||
if (Info->Hid != NULL)
|
||||
{
|
||||
Status = AcpiUtExecute_HID (Node, &Hid);
|
||||
if (Status == AE_NOT_FOUND)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
else if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0)
|
||||
{
|
||||
Status = AcpiUtExecute_CID (Node, &Cid);
|
||||
if (Status == AE_NOT_FOUND)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
else if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
/* TBD: Handle CID packages */
|
||||
|
||||
if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetDevices
|
||||
*
|
||||
* PARAMETERS: HID - HID to search for. Can be NULL.
|
||||
* UserFunction - Called when a matching object is found
|
||||
* Context - Passed to user function
|
||||
* ReturnValue - Location where return value of
|
||||
* UserFunction is put if terminated early
|
||||
*
|
||||
* RETURNS Return value from the UserFunction if terminated early.
|
||||
* Otherwise, returns NULL.
|
||||
*
|
||||
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
|
||||
* starting (and ending) at the object specified by StartHandle.
|
||||
* The UserFunction is called whenever an object that matches
|
||||
* the type parameter is found. If the user function returns
|
||||
* a non-zero value, the search is terminated immediately and this
|
||||
* value is returned to the caller.
|
||||
*
|
||||
* This is a wrapper for WalkNamespace, but the callback performs
|
||||
* additional filtering. Please see AcpiGetDeviceCallback.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetDevices (
|
||||
NATIVE_CHAR *HID,
|
||||
ACPI_WALK_CALLBACK UserFunction,
|
||||
void *Context,
|
||||
void **ReturnValue)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_GET_DEVICES_INFO Info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiGetDevices");
|
||||
ACPI_NAMESPACE_NODE *ParentNode = NULL;
|
||||
ACPI_NAMESPACE_NODE *ChildNode = NULL;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!UserFunction)
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* We're going to call their callback from OUR callback, so we need
|
||||
* to know what it is, and their context parameter.
|
||||
*/
|
||||
Info.Context = Context;
|
||||
Info.UserFunction = UserFunction;
|
||||
Info.Hid = HID;
|
||||
|
||||
/*
|
||||
* Lock the namespace around the walk.
|
||||
* The namespace will be unlocked/locked around each call
|
||||
* to the user function - since this function
|
||||
* must be allowed to make Acpi calls itself.
|
||||
*/
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE,
|
||||
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
|
||||
ACPI_NS_WALK_UNLOCK,
|
||||
AcpiNsGetDeviceCallback, &Info,
|
||||
ReturnValue);
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAttachData
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAttachData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void *Data)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!ObjHandle ||
|
||||
!Handler ||
|
||||
!Data)
|
||||
if (Type > ACPI_TYPE_MAX)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
@ -964,124 +301,49 @@ AcpiAttachData (
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Convert and validate the handle */
|
||||
/* If null handle, use the parent */
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
if (!Node)
|
||||
if (!Child)
|
||||
{
|
||||
/* Start search at the beginning of the specified scope */
|
||||
|
||||
ParentNode = AcpiNsMapHandleToNode (Parent);
|
||||
if (!ParentNode)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiNsAttachData (Node, Handler, Data);
|
||||
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDetachData
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDetachData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!ObjHandle ||
|
||||
!Handler)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
else
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Non-null handle, ignore the parent */
|
||||
/* Convert and validate the handle */
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
if (!Node)
|
||||
ChildNode = AcpiNsMapHandleToNode (Child);
|
||||
if (!ChildNode)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiNsDetachData (Node, Handler);
|
||||
|
||||
UnlockAndExit:
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiGetData
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetData (
|
||||
ACPI_HANDLE ObjHandle,
|
||||
ACPI_OBJECT_HANDLER Handler,
|
||||
void **Data)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!ObjHandle ||
|
||||
!Handler ||
|
||||
!Data)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
/* Internal function does the real work */
|
||||
|
||||
/* Convert and validate the handle */
|
||||
|
||||
Node = AcpiNsMapHandleToNode (ObjHandle);
|
||||
Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode);
|
||||
if (!Node)
|
||||
{
|
||||
Status = AE_BAD_PARAMETER;
|
||||
Status = AE_NOT_FOUND;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
Status = AcpiNsGetAttachedData (Node, Handler, Data);
|
||||
if (RetHandle)
|
||||
{
|
||||
*RetHandle = AcpiNsConvertEntryToHandle (Node);
|
||||
}
|
||||
|
||||
|
||||
UnlockAndExit:
|
||||
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return (Status);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psargs - Parse AML opcode arguments
|
||||
* $Revision: 61 $
|
||||
* $Revision: 62 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -435,7 +435,7 @@ AcpiPsGetNextNamepath (
|
||||
NATIVE_CHAR *Path;
|
||||
ACPI_PARSE_OBJECT *NameOp;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMESPACE_NODE *MethodNode = NULL;
|
||||
ACPI_OPERAND_OBJECT *MethodDesc;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_GENERIC_STATE ScopeInfo;
|
||||
|
||||
@ -476,13 +476,16 @@ AcpiPsGetNextNamepath (
|
||||
{
|
||||
if (Node->Type == ACPI_TYPE_METHOD)
|
||||
{
|
||||
MethodNode = Node;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n",
|
||||
MethodNode, Path));
|
||||
MethodDesc = AcpiNsGetAttachedObject (Node);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n",
|
||||
Node, MethodDesc, Path));
|
||||
|
||||
NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
|
||||
if (NameOp)
|
||||
if (!NameOp)
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* Change arg into a METHOD CALL and attach name to it */
|
||||
|
||||
AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
|
||||
@ -491,17 +494,20 @@ AcpiPsGetNextNamepath (
|
||||
|
||||
/* Point METHODCALL/NAME to the METHOD Node */
|
||||
|
||||
NameOp->Common.Node = MethodNode;
|
||||
NameOp->Common.Node = Node;
|
||||
AcpiPsAppendArg (Arg, NameOp);
|
||||
|
||||
if (!AcpiNsGetAttachedObject (MethodNode))
|
||||
if (!MethodDesc)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p has no attached object\n",
|
||||
Node));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
*ArgCount = (AcpiNsGetAttachedObject (MethodNode))->Method.ParamCount;
|
||||
}
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Args %X\n",
|
||||
Node, MethodDesc->Method.ParamCount));
|
||||
|
||||
*ArgCount = MethodDesc->Method.ParamCount;
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psfind - Parse tree search routine
|
||||
* $Revision: 40 $
|
||||
* $Revision: 42 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -301,6 +301,19 @@ AcpiPsFind (
|
||||
|
||||
AcpiGbl_PsFindCount++;
|
||||
|
||||
#if 0
|
||||
if ((Create) && (Opcode == AML_SCOPE_OP))
|
||||
{
|
||||
Op = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
if (Op)
|
||||
{
|
||||
AcpiPsSetName (Op, 'XXXX');
|
||||
AcpiPsAppendArg (Scope, Op);
|
||||
}
|
||||
/* return_PTR (Op);*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Handle all prefixes in the name path */
|
||||
|
||||
while (AcpiPsIsPrefixChar (ACPI_GET8 (Path)))
|
||||
@ -337,6 +350,7 @@ AcpiPsFind (
|
||||
Path++;
|
||||
}
|
||||
|
||||
|
||||
/* get name segment count */
|
||||
|
||||
switch (ACPI_GET8 (Path))
|
||||
@ -379,6 +393,7 @@ AcpiPsFind (
|
||||
"Search scope %p Segs=%d Opcode=%4.4hX Create=%d\n",
|
||||
Scope, SegCount, Opcode, Create));
|
||||
|
||||
|
||||
/* match each name segment */
|
||||
|
||||
while (Scope && SegCount)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psopcode - Parser/Interpreter opcode information table
|
||||
* $Revision: 70 $
|
||||
* $Revision: 71 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -827,7 +827,7 @@ NATIVE_CHAR *
|
||||
AcpiPsGetOpcodeName (
|
||||
UINT16 Opcode)
|
||||
{
|
||||
#ifdef ACPI_DEBUG
|
||||
#ifdef ACPI_DISASSEMBLER
|
||||
|
||||
const ACPI_OPCODE_INFO *Op;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psparse - Parser top level AML parse routines
|
||||
* $Revision: 127 $
|
||||
* $Revision: 129 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -590,7 +590,7 @@ AcpiPsParseLoop (
|
||||
ParserState = &WalkState->ParserState;
|
||||
WalkState->ArgTypes = 0;
|
||||
|
||||
#ifndef PARSER_ONLY
|
||||
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
|
||||
if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
|
||||
{
|
||||
/* We are restarting a preempted control method */
|
||||
@ -708,6 +708,10 @@ AcpiPsParseLoop (
|
||||
PreOp.Common.Value.Arg = NULL;
|
||||
PreOp.Common.AmlOpcode = WalkState->Opcode;
|
||||
|
||||
/*
|
||||
* Get and append arguments until we find the node that contains
|
||||
* the name (the type ARGP_NAME).
|
||||
*/
|
||||
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME)
|
||||
{
|
||||
Arg = AcpiPsGetNextArg (ParserState,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
|
||||
* $Revision: 51 $
|
||||
* $Revision: 54 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -118,11 +118,43 @@
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
#define _COMPONENT ACPI_PARSER
|
||||
ACPI_MODULE_NAME ("psutils")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiPsCreateScopeOp
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: ScopeOp
|
||||
*
|
||||
* DESCRIPTION: Create a Scope and associated namepath op with the root name
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_PARSE_OBJECT *
|
||||
AcpiPsCreateScopeOp (
|
||||
void)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *ScopeOp;
|
||||
|
||||
|
||||
ScopeOp = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
if (!ScopeOp)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
ScopeOp->Named.Name = ACPI_ROOT_NAME;
|
||||
return (ScopeOp);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiPsInitOp
|
||||
@ -148,7 +180,7 @@ AcpiPsInitOp (
|
||||
Op->Common.DataType = ACPI_DESC_TYPE_PARSER;
|
||||
Op->Common.AmlOpcode = Opcode;
|
||||
|
||||
ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
|
||||
ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
|
||||
(AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName)));
|
||||
}
|
||||
|
||||
@ -254,7 +286,7 @@ AcpiPsFreeOp (
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", Op));
|
||||
}
|
||||
|
||||
if (Op->Common.Flags == ACPI_PARSEOP_GENERIC)
|
||||
if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
|
||||
{
|
||||
AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE, Op);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psxface - Parser external interfaces
|
||||
* $Revision: 64 $
|
||||
* $Revision: 65 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -205,7 +205,7 @@ AcpiPsxExecute (
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
Op = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
Op = AcpiPsCreateScopeOp ();
|
||||
if (!Op)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -249,7 +249,7 @@ AcpiPsxExecute (
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
Op = AcpiPsAllocOp (AML_SCOPE_OP);
|
||||
Op = AcpiPsCreateScopeOp ();
|
||||
if (!Op)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: rscreate - Create resource lists/tables
|
||||
* $Revision: 57 $
|
||||
* $Revision: 58 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -132,7 +132,6 @@
|
||||
*
|
||||
* PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
|
||||
* OutputBuffer - Pointer to the user's buffer
|
||||
* OutputBufferLength - Pointer to the size of OutputBuffer
|
||||
*
|
||||
* RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code
|
||||
* If OutputBuffer is not large enough, OutputBufferLength
|
||||
@ -212,7 +211,6 @@ AcpiRsCreateResourceList (
|
||||
* PARAMETERS: PackageObject - Pointer to an ACPI_OPERAND_OBJECT
|
||||
* package
|
||||
* OutputBuffer - Pointer to the user's buffer
|
||||
* OutputBufferLength - Size of OutputBuffer
|
||||
*
|
||||
* RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
|
||||
* If the OutputBuffer is too small, the error will be
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: rsio - IO and DMA resource descriptors
|
||||
* $Revision: 20 $
|
||||
* $Revision: 22 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -491,7 +491,7 @@ AcpiRsDmaResource (
|
||||
Buffer += 1;
|
||||
Temp8 = *Buffer;
|
||||
|
||||
/* Decode the IRQ bits */
|
||||
/* Decode the DMA channel bits */
|
||||
|
||||
for (i = 0, Index = 0; Index < 8; Index++)
|
||||
{
|
||||
@ -501,19 +501,17 @@ AcpiRsDmaResource (
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i == 0)
|
||||
{
|
||||
/* Zero channels is invalid! */
|
||||
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
/* Zero DMA channels is valid */
|
||||
|
||||
OutputStruct->Data.Dma.NumberOfChannels = i;
|
||||
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
/*
|
||||
* Calculate the structure size based upon the number of interrupts
|
||||
*/
|
||||
StructSize += ((ACPI_SIZE) OutputStruct->Data.Dma.NumberOfChannels - 1) * 4;
|
||||
StructSize += ((ACPI_SIZE) i - 1) * 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Point to Byte 2
|
||||
@ -528,6 +526,7 @@ AcpiRsDmaResource (
|
||||
|
||||
if (0x03 == OutputStruct->Data.Dma.Transfer)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n"));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: rsirq - IRQ resource descriptors
|
||||
* $Revision: 28 $
|
||||
* $Revision: 30 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -190,18 +190,16 @@ AcpiRsIrqResource (
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
/* Zero interrupts is invalid! */
|
||||
/* Zero interrupts is valid */
|
||||
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
OutputStruct->Data.Irq.NumberOfInterrupts = i;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
/*
|
||||
* Calculate the structure size based upon the number of interrupts
|
||||
*/
|
||||
StructSize += ((ACPI_SIZE) OutputStruct->Data.Irq.NumberOfInterrupts - 1) * 4;
|
||||
StructSize += ((ACPI_SIZE) i - 1) * 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Point to Byte 3 if it is used
|
||||
@ -233,6 +231,7 @@ AcpiRsIrqResource (
|
||||
* are allowed (ACPI spec v1.0b ection 6.4.2.1),
|
||||
* so an error will occur if we reach this point
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list\n"));
|
||||
return_ACPI_STATUS (AE_BAD_DATA);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: rslist - Linked list utilities
|
||||
* $Revision: 30 $
|
||||
* $Revision: 31 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -570,6 +570,8 @@ AcpiRsListToByteStream (
|
||||
* If we get here, everything is out of sync,
|
||||
* so exit with an error
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n",
|
||||
LinkedList->Id));
|
||||
Status = AE_BAD_DATA;
|
||||
break;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbconvrt - ACPI Table conversion utilities
|
||||
* $Revision: 41 $
|
||||
* $Revision: 42 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -183,8 +183,7 @@ AcpiTbGetTableCount (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbConvertToXsdt (
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT32 *NumberOfTables)
|
||||
ACPI_TABLE_DESC *TableInfo)
|
||||
{
|
||||
ACPI_SIZE TableSize;
|
||||
UINT32 i;
|
||||
@ -194,13 +193,10 @@ AcpiTbConvertToXsdt (
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* Get the number of tables defined in the RSDT or XSDT */
|
||||
|
||||
*NumberOfTables = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo->Pointer);
|
||||
|
||||
/* Compute size of the converted XSDT */
|
||||
|
||||
TableSize = ((ACPI_SIZE) *NumberOfTables * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER);
|
||||
TableSize = ((ACPI_SIZE) AcpiGbl_RsdtTableCount * sizeof (UINT64)) +
|
||||
sizeof (ACPI_TABLE_HEADER);
|
||||
|
||||
/* Allocate an XSDT */
|
||||
|
||||
@ -217,7 +213,7 @@ AcpiTbConvertToXsdt (
|
||||
|
||||
/* Copy the table pointers */
|
||||
|
||||
for (i = 0; i < *NumberOfTables; i++)
|
||||
for (i = 0; i < AcpiGbl_RsdtTableCount; i++)
|
||||
{
|
||||
if (AcpiGbl_RSDP->Revision < 2)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
397
sys/contrib/dev/acpica/tbgetall.c
Normal file
397
sys/contrib/dev/acpica/tbgetall.c
Normal file
@ -0,0 +1,397 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbgetall - Get all required ACPI tables
|
||||
* $Revision: 1 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __TBGETALL_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "actables.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_TABLES
|
||||
ACPI_MODULE_NAME ("tbgetall")
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbGetPrimaryTable
|
||||
*
|
||||
* PARAMETERS: Address - Physical address of table to retrieve
|
||||
* *TableInfo - Where the table info is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Maps the physical address of table into a logical address
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetPrimaryTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_TABLE_DESC *TableInfo)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_TABLE_HEADER Header;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("TbGetPrimaryTable");
|
||||
|
||||
|
||||
/* Ignore a NULL address in the RSDT */
|
||||
|
||||
if (!Address->Pointer.Value)
|
||||
{
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the header in order to get signature and table size
|
||||
*/
|
||||
Status = AcpiTbGetTableHeader (Address, &Header);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Clear the TableInfo */
|
||||
|
||||
ACPI_MEMSET (TableInfo, 0, sizeof (ACPI_TABLE_DESC));
|
||||
|
||||
/*
|
||||
* Check the table signature and make sure it is recognized.
|
||||
* Also checks the header checksum
|
||||
*/
|
||||
TableInfo->Pointer = &Header;
|
||||
Status = AcpiTbRecognizeTable (TableInfo, ACPI_TABLE_PRIMARY);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Get the entire table */
|
||||
|
||||
Status = AcpiTbGetTableBody (Address, &Header, TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Install the table */
|
||||
|
||||
Status = AcpiTbInstallTable (TableInfo);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbGetSecondaryTable
|
||||
*
|
||||
* PARAMETERS: Address - Physical address of table to retrieve
|
||||
* *TableInfo - Where the table info is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Maps the physical address of table into a logical address
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetSecondaryTable (
|
||||
ACPI_POINTER *Address,
|
||||
ACPI_STRING Signature,
|
||||
ACPI_TABLE_DESC *TableInfo)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_TABLE_HEADER Header;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_STR ("TbGetSecondaryTable", Signature);
|
||||
|
||||
|
||||
/* Get the header in order to match the signature */
|
||||
|
||||
Status = AcpiTbGetTableHeader (Address, &Header);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Signature must match request */
|
||||
|
||||
if (ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n",
|
||||
Signature, Header.Signature));
|
||||
return_ACPI_STATUS (AE_BAD_SIGNATURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the table signature and make sure it is recognized.
|
||||
* Also checks the header checksum
|
||||
*/
|
||||
TableInfo->Pointer = &Header;
|
||||
Status = AcpiTbRecognizeTable (TableInfo, ACPI_TABLE_SECONDARY);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Get the entire table */
|
||||
|
||||
Status = AcpiTbGetTableBody (Address, &Header, TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Install the table */
|
||||
|
||||
Status = AcpiTbInstallTable (TableInfo);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbGetRequiredTables
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load and validate tables other than the RSDT. The RSDT must
|
||||
* already be loaded and validated.
|
||||
*
|
||||
* Get the minimum set of ACPI tables, namely:
|
||||
*
|
||||
* 1) FADT (via RSDT in loop below)
|
||||
* 2) FACS (via FADT)
|
||||
* 3) DSDT (via FADT)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetRequiredTables (
|
||||
void)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 i;
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
ACPI_POINTER Address;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("TbGetRequiredTables");
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%d ACPI tables in RSDT\n",
|
||||
AcpiGbl_RsdtTableCount));
|
||||
|
||||
|
||||
Address.PointerType = AcpiGbl_TableFlags | ACPI_LOGICAL_ADDRESSING;
|
||||
|
||||
/*
|
||||
* Loop through all table pointers found in RSDT.
|
||||
* This will NOT include the FACS and DSDT - we must get
|
||||
* them after the loop.
|
||||
*
|
||||
* The only tables we are interested in getting here is the FADT and
|
||||
* any SSDTs.
|
||||
*/
|
||||
for (i = 0; i < AcpiGbl_RsdtTableCount; i++)
|
||||
{
|
||||
/* Get the table addresss from the common internal XSDT */
|
||||
|
||||
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[i]);
|
||||
|
||||
/*
|
||||
* Get the tables needed by this subsystem (FADT and any SSDTs).
|
||||
* NOTE: All other tables are completely ignored at this time.
|
||||
*/
|
||||
AcpiTbGetPrimaryTable (&Address, &TableInfo);
|
||||
}
|
||||
|
||||
/* We must have a FADT to continue */
|
||||
|
||||
if (!AcpiGbl_FADT)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("No FADT present in RSDT/XSDT\n"));
|
||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the FADT to a common format. This allows earlier revisions of the
|
||||
* table to coexist with newer versions, using common access code.
|
||||
*/
|
||||
Status = AcpiTbConvertTableFadt ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n"));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the FACS (Pointed to by the FADT)
|
||||
*/
|
||||
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl);
|
||||
|
||||
Status = AcpiTbGetSecondaryTable (&Address, FACS_SIG, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Could not get/install the FACS, %s\n",
|
||||
AcpiFormatException (Status)));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the common FACS pointer table
|
||||
* (Contains pointers to the original table)
|
||||
*/
|
||||
Status = AcpiTbBuildCommonFacs (&TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get/install the DSDT (Pointed to by the FADT)
|
||||
*/
|
||||
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt);
|
||||
|
||||
Status = AcpiTbGetSecondaryTable (&Address, DSDT_SIG, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Could not get/install the DSDT\n"));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Set Integer Width (32/64) based upon DSDT revision */
|
||||
|
||||
AcpiUtSetIntegerWidth (AcpiGbl_DSDT->Revision);
|
||||
|
||||
/* Dump the entire DSDT */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
|
||||
"Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n",
|
||||
AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length, AcpiGbl_IntegerBitWidth));
|
||||
ACPI_DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length);
|
||||
|
||||
/* Always delete the RSDP mapping, we are done with it */
|
||||
|
||||
AcpiTbDeleteAcpiTable (ACPI_TABLE_RSDP);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbinstal - ACPI table installation and removal
|
||||
* $Revision: 61 $
|
||||
* $Revision: 62 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -142,7 +142,8 @@
|
||||
ACPI_STATUS
|
||||
AcpiTbMatchSignature (
|
||||
NATIVE_CHAR *Signature,
|
||||
ACPI_TABLE_DESC *TableInfo)
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT8 SearchType)
|
||||
{
|
||||
NATIVE_UINT i;
|
||||
|
||||
@ -155,6 +156,11 @@ AcpiTbMatchSignature (
|
||||
*/
|
||||
for (i = 0; i < NUM_ACPI_TABLES; i++)
|
||||
{
|
||||
if ((AcpiGbl_AcpiTableData[i].Flags & ACPI_TABLE_TYPE_MASK) != SearchType)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ACPI_STRNCMP (Signature, AcpiGbl_AcpiTableData[i].Signature,
|
||||
AcpiGbl_AcpiTableData[i].SigLength))
|
||||
{
|
||||
@ -165,13 +171,18 @@ AcpiTbMatchSignature (
|
||||
TableInfo->Type = (UINT8) i;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Signature match %4.4s\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Table [%4.4s] matched and is a required ACPI table\n",
|
||||
(char *) AcpiGbl_AcpiTableData[i].Signature));
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Table [%4.4s] is not a required ACPI table - ignored\n",
|
||||
(char *) Signature));
|
||||
|
||||
return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
@ -180,7 +191,7 @@ AcpiTbMatchSignature (
|
||||
*
|
||||
* FUNCTION: AcpiTbInstallTable
|
||||
*
|
||||
* PARAMETERS: TableInfo - Return value from AcpiTbGetTable
|
||||
* PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -199,27 +210,24 @@ AcpiTbInstallTable (
|
||||
ACPI_FUNCTION_TRACE ("TbInstallTable");
|
||||
|
||||
|
||||
/*
|
||||
* Check the table signature and make sure it is recognized
|
||||
* Also checks the header checksum
|
||||
*/
|
||||
Status = AcpiTbRecognizeTable (TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Lock tables while installing */
|
||||
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
|
||||
TableInfo->Pointer->Signature, AcpiFormatException (Status)));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Install the table into the global data structure */
|
||||
|
||||
Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Could not install ACPI table [%s], %s\n",
|
||||
TableInfo->Pointer->Signature, AcpiFormatException (Status)));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
|
||||
AcpiGbl_AcpiTableData[TableInfo->Type].Name, TableInfo->Pointer));
|
||||
@ -233,7 +241,7 @@ AcpiTbInstallTable (
|
||||
*
|
||||
* FUNCTION: AcpiTbRecognizeTable
|
||||
*
|
||||
* PARAMETERS: TableInfo - Return value from AcpiTbGetTable
|
||||
* PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -251,7 +259,8 @@ AcpiTbInstallTable (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbRecognizeTable (
|
||||
ACPI_TABLE_DESC *TableInfo)
|
||||
ACPI_TABLE_DESC *TableInfo,
|
||||
UINT8 SearchType)
|
||||
{
|
||||
ACPI_TABLE_HEADER *TableHeader;
|
||||
ACPI_STATUS Status;
|
||||
@ -276,7 +285,7 @@ AcpiTbRecognizeTable (
|
||||
* This can be any one of many valid ACPI tables, it just isn't one of
|
||||
* the tables that is consumed by the core subsystem
|
||||
*/
|
||||
Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo);
|
||||
Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo, SearchType);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -292,24 +301,6 @@ AcpiTbRecognizeTable (
|
||||
|
||||
TableInfo->Length = (ACPI_SIZE) TableHeader->Length;
|
||||
|
||||
/*
|
||||
* Validate checksum for _most_ tables,
|
||||
* even the ones whose signature we don't recognize
|
||||
*/
|
||||
if (TableInfo->Type != ACPI_TABLE_FACS)
|
||||
{
|
||||
Status = AcpiTbVerifyTableChecksum (TableHeader);
|
||||
|
||||
#if (!ACPI_CHECKSUM_ABORT)
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* Ignore the error if configuration says so */
|
||||
|
||||
Status = AE_OK;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
407
sys/contrib/dev/acpica/tbrsdt.c
Normal file
407
sys/contrib/dev/acpica/tbrsdt.c
Normal file
@ -0,0 +1,407 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbrsdt - ACPI RSDT table utilities
|
||||
* $Revision: 2 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
* 2.1. This is your license from Intel Corp. under its intellectual property
|
||||
* rights. You may have additional license terms from the party that provided
|
||||
* you this software, covering your right to use that party's intellectual
|
||||
* property rights.
|
||||
*
|
||||
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
|
||||
* copy of the source code appearing in this file ("Covered Code") an
|
||||
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
|
||||
* base code distributed originally by Intel ("Original Intel Code") to copy,
|
||||
* make derivatives, distribute, use and display any portion of the Covered
|
||||
* Code in any form, with the right to sublicense such rights; and
|
||||
*
|
||||
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
|
||||
* license (with the right to sublicense), under only those claims of Intel
|
||||
* patents that are infringed by the Original Intel Code, to make, use, sell,
|
||||
* offer to sell, and import the Covered Code and derivative works thereof
|
||||
* solely to the minimum extent necessary to exercise the above copyright
|
||||
* license, and in no event shall the patent license extend to any additions
|
||||
* to or modifications of the Original Intel Code. No other license or right
|
||||
* is granted directly or by implication, estoppel or otherwise;
|
||||
*
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
* and the following Disclaimer and Export Compliance provision. In addition,
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
* documentation and/or other materials provided with distribution. In
|
||||
* addition, Licensee may not authorize further sublicense of source of any
|
||||
* portion of the Covered Code, and must include terms to the effect that the
|
||||
* license from Licensee to its licensee is limited to the intellectual
|
||||
* property embodied in the software Licensee provides to its licensee, and
|
||||
* not to intellectual property embodied in modifications its licensee may
|
||||
* make.
|
||||
*
|
||||
* 3.3. Redistribution of Executable. Redistribution in executable form of any
|
||||
* substantial portion of the Covered Code or modification must reproduce the
|
||||
* above Copyright Notice, and the following Disclaimer and Export Compliance
|
||||
* provision in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3.4. Intel retains all right, title, and interest in and to the Original
|
||||
* Intel Code.
|
||||
*
|
||||
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
|
||||
* Intel shall be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in products derived from or relating to the Covered Code
|
||||
* without prior written authorization from Intel.
|
||||
*
|
||||
* 4. Disclaimer and Export Compliance
|
||||
*
|
||||
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
|
||||
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
|
||||
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
|
||||
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
|
||||
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
|
||||
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
|
||||
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
|
||||
* LIMITED REMEDY.
|
||||
*
|
||||
* 4.3. Licensee shall not export, either directly or indirectly, any of this
|
||||
* software or system incorporating such software without first obtaining any
|
||||
* required license or other approval from the U. S. Department of Commerce or
|
||||
* any other agency or department of the United States Government. In the
|
||||
* event Licensee exports any such software from the United States or
|
||||
* re-exports any such software from a foreign destination, Licensee shall
|
||||
* ensure that the distribution and export/re-export of the software is in
|
||||
* compliance with all laws, regulations, orders, or other restrictions of the
|
||||
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
|
||||
* any of its subsidiaries will export/re-export any technical data, process,
|
||||
* software, or service, directly or indirectly, to any country for which the
|
||||
* United States government or any agency thereof requires an export license,
|
||||
* other governmental approval, or letter of assurance, without first obtaining
|
||||
* such license, approval or letter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __TBRSDT_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "actables.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_TABLES
|
||||
ACPI_MODULE_NAME ("tbrsdt")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbVerifyRsdp
|
||||
*
|
||||
* PARAMETERS: Address - RSDP (Pointer to RSDT)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbVerifyRsdp (
|
||||
ACPI_POINTER *Address)
|
||||
{
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
ACPI_STATUS Status;
|
||||
RSDP_DESCRIPTOR *Rsdp;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("TbVerifyRsdp");
|
||||
|
||||
|
||||
switch (Address->PointerType)
|
||||
{
|
||||
case ACPI_LOGICAL_POINTER:
|
||||
|
||||
Rsdp = Address->Pointer.Logical;
|
||||
break;
|
||||
|
||||
case ACPI_PHYSICAL_POINTER:
|
||||
/*
|
||||
* Obtain access to the RSDP structure
|
||||
*/
|
||||
Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (RSDP_DESCRIPTOR),
|
||||
(void **) &Rsdp);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/*
|
||||
* The signature and checksum must both be correct
|
||||
*/
|
||||
if (ACPI_STRNCMP ((NATIVE_CHAR *) Rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
|
||||
{
|
||||
/* Nope, BAD Signature */
|
||||
|
||||
Status = AE_BAD_SIGNATURE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Check the standard checksum */
|
||||
|
||||
if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
|
||||
{
|
||||
Status = AE_BAD_CHECKSUM;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Check extended checksum if table version >= 2 */
|
||||
|
||||
if (Rsdp->Revision >= 2)
|
||||
{
|
||||
if (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)
|
||||
{
|
||||
Status = AE_BAD_CHECKSUM;
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* The RSDP supplied is OK */
|
||||
|
||||
TableInfo.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp);
|
||||
TableInfo.Length = sizeof (RSDP_DESCRIPTOR);
|
||||
TableInfo.Allocation = ACPI_MEM_MAPPED;
|
||||
TableInfo.BasePointer = Rsdp;
|
||||
|
||||
/* Save the table pointers and allocation info */
|
||||
|
||||
Status = AcpiTbInitTableDescriptor (ACPI_TABLE_RSDP, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Save the RSDP in a global for easy access */
|
||||
|
||||
AcpiGbl_RSDP = ACPI_CAST_PTR (RSDP_DESCRIPTOR, TableInfo.Pointer);
|
||||
return_ACPI_STATUS (Status);
|
||||
|
||||
|
||||
/* Error exit */
|
||||
Cleanup:
|
||||
|
||||
if (AcpiGbl_TableFlags & ACPI_PHYSICAL_POINTER)
|
||||
{
|
||||
AcpiOsUnmapMemory (Rsdp, sizeof (RSDP_DESCRIPTOR));
|
||||
}
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbGetRsdtAddress
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: RSDT physical address
|
||||
*
|
||||
* DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
|
||||
* version of the RSDP
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AcpiTbGetRsdtAddress (
|
||||
ACPI_POINTER *OutAddress)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
OutAddress->PointerType = AcpiGbl_TableFlags | ACPI_LOGICAL_ADDRESSING;
|
||||
|
||||
/*
|
||||
* For RSDP revision 0 or 1, we use the RSDT.
|
||||
* For RSDP revision 2 (and above), we use the XSDT
|
||||
*/
|
||||
if (AcpiGbl_RSDP->Revision < 2)
|
||||
{
|
||||
OutAddress->Pointer.Value = AcpiGbl_RSDP->RsdtPhysicalAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
OutAddress->Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbValidateRsdt
|
||||
*
|
||||
* PARAMETERS: TablePtr - Addressable pointer to the RSDT.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Validate signature for the RSDT or XSDT
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbValidateRsdt (
|
||||
ACPI_TABLE_HEADER *TablePtr)
|
||||
{
|
||||
int NoMatch;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("TbValidateRsdt");
|
||||
|
||||
|
||||
/*
|
||||
* For RSDP revision 0 or 1, we use the RSDT.
|
||||
* For RSDP revision 2 and above, we use the XSDT
|
||||
*/
|
||||
if (AcpiGbl_RSDP->Revision < 2)
|
||||
{
|
||||
NoMatch = ACPI_STRNCMP ((char *) TablePtr, RSDT_SIG,
|
||||
sizeof (RSDT_SIG) -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
NoMatch = ACPI_STRNCMP ((char *) TablePtr, XSDT_SIG,
|
||||
sizeof (XSDT_SIG) -1);
|
||||
}
|
||||
|
||||
if (NoMatch)
|
||||
{
|
||||
/* Invalid RSDT or XSDT signature */
|
||||
|
||||
ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
|
||||
|
||||
ACPI_DUMP_BUFFER (AcpiGbl_RSDP, 20);
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
|
||||
"RSDT/XSDT signature at %X (%p) is invalid\n",
|
||||
AcpiGbl_RSDP->RsdtPhysicalAddress,
|
||||
(void *) (NATIVE_UINT) AcpiGbl_RSDP->RsdtPhysicalAddress));
|
||||
|
||||
return (AE_BAD_SIGNATURE);
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbGetTableRsdt
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbGetTableRsdt (
|
||||
void)
|
||||
{
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_POINTER Address;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("TbGetTableRsdt");
|
||||
|
||||
|
||||
/* Get the RSDT/XSDT via the RSDP */
|
||||
|
||||
AcpiTbGetRsdtAddress (&Address);
|
||||
|
||||
Status = AcpiTbGetTable (&Address, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n",
|
||||
AcpiFormatException (Status)));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n",
|
||||
AcpiGbl_RSDP,
|
||||
ACPI_HIDWORD (Address.Pointer.Value),
|
||||
ACPI_LODWORD (Address.Pointer.Value)));
|
||||
|
||||
/* Check the RSDT or XSDT signature */
|
||||
|
||||
Status = AcpiTbValidateRsdt (TableInfo.Pointer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Get the number of tables defined in the RSDT or XSDT */
|
||||
|
||||
AcpiGbl_RsdtTableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo.Pointer);
|
||||
|
||||
/* Convert and/or copy to an XSDT structure */
|
||||
|
||||
Status = AcpiTbConvertToXsdt (&TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Save the table pointers and allocation info */
|
||||
|
||||
Status = AcpiTbInitTableDescriptor (ACPI_TABLE_XSDT, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", AcpiGbl_XSDT));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbutils - Table manipulation utilities
|
||||
* $Revision: 54 $
|
||||
* $Revision: 55 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -218,7 +218,8 @@ AcpiTbValidateTableHeader (
|
||||
"Table signature at %p [%p] has invalid characters\n",
|
||||
TableHeader, &Signature));
|
||||
|
||||
ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", (char *) &Signature));
|
||||
ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
|
||||
(char *) &Signature));
|
||||
ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
|
||||
return (AE_BAD_SIGNATURE);
|
||||
}
|
||||
@ -231,7 +232,8 @@ AcpiTbValidateTableHeader (
|
||||
"Invalid length in table header %p name %4.4s\n",
|
||||
TableHeader, (char *) &Signature));
|
||||
|
||||
ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", TableHeader->Length));
|
||||
ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
|
||||
TableHeader->Length));
|
||||
ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
|
||||
return (AE_BAD_HEADER);
|
||||
}
|
||||
@ -240,95 +242,6 @@ AcpiTbValidateTableHeader (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbMapAcpiTable
|
||||
*
|
||||
* PARAMETERS: PhysicalAddress - Physical address of table to map
|
||||
* *Size - Size of the table. If zero, the size
|
||||
* from the table header is used.
|
||||
* Actual size is returned here.
|
||||
* **LogicalAddress - Logical address of mapped table
|
||||
*
|
||||
* RETURN: Logical address of the mapped table.
|
||||
*
|
||||
* DESCRIPTION: Maps the physical address of table into a logical address
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiTbMapAcpiTable (
|
||||
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
|
||||
ACPI_SIZE *Size,
|
||||
ACPI_TABLE_HEADER **LogicalAddress)
|
||||
{
|
||||
ACPI_TABLE_HEADER *Table;
|
||||
ACPI_SIZE TableSize = *Size;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("TbMapAcpiTable");
|
||||
|
||||
|
||||
/* If size is zero, look at the table header to get the actual size */
|
||||
|
||||
if ((*Size) == 0)
|
||||
{
|
||||
/* Get the table header so we can extract the table length */
|
||||
|
||||
Status = AcpiOsMapMemory (PhysicalAddress, sizeof (ACPI_TABLE_HEADER),
|
||||
(void **) &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/* Extract the full table length before we delete the mapping */
|
||||
|
||||
TableSize = (ACPI_SIZE) Table->Length;
|
||||
|
||||
#if 0
|
||||
/* We don't want to validate the header here. */
|
||||
/*
|
||||
* Validate the header and delete the mapping.
|
||||
* We will create a mapping for the full table below.
|
||||
*/
|
||||
Status = AcpiTbValidateTableHeader (Table);
|
||||
#endif
|
||||
|
||||
/* Always unmap the memory for the header */
|
||||
|
||||
AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
|
||||
|
||||
#if 0
|
||||
/* Exit if header invalid */
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Map the physical memory for the correct length */
|
||||
|
||||
Status = AcpiOsMapMemory (PhysicalAddress, TableSize,
|
||||
(void **) &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Mapped memory for ACPI table, length=%d(%X) at %p\n",
|
||||
TableSize, TableSize, Table));
|
||||
|
||||
*Size = TableSize;
|
||||
*LogicalAddress = Table;
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiTbVerifyTableChecksum
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: tbxface - Public interfaces to the ACPI subsystem
|
||||
* ACPI table oriented interfaces
|
||||
* $Revision: 57 $
|
||||
* $Revision: 58 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -144,7 +144,6 @@ AcpiLoadTables (void)
|
||||
{
|
||||
ACPI_POINTER RsdpAddress;
|
||||
ACPI_STATUS Status;
|
||||
UINT32 NumberOfTables = 0;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiLoadTables");
|
||||
@ -175,7 +174,7 @@ AcpiLoadTables (void)
|
||||
|
||||
/* Get the RSDT via the RSDP */
|
||||
|
||||
Status = AcpiTbGetTableRsdt (&NumberOfTables);
|
||||
Status = AcpiTbGetTableRsdt ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
|
||||
@ -183,9 +182,9 @@ AcpiLoadTables (void)
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
/* Now get the rest of the tables */
|
||||
/* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
|
||||
|
||||
Status = AcpiTbGetAllTables (NumberOfTables);
|
||||
Status = AcpiTbGetRequiredTables ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n",
|
||||
@ -252,10 +251,10 @@ AcpiLoadTable (
|
||||
|
||||
/* Copy the table to a local buffer */
|
||||
|
||||
Address.PointerType = ACPI_LOGICAL_POINTER;
|
||||
Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
|
||||
Address.Pointer.Logical = TablePtr;
|
||||
|
||||
Status = AcpiTbGetTable (&Address, &TableInfo);
|
||||
Status = AcpiTbGetTableBody (&Address, TablePtr, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -266,7 +265,7 @@ AcpiLoadTable (
|
||||
Status = AcpiTbInstallTable (&TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* Free table allocated by AcpiTbGetTable */
|
||||
/* Free table allocated by AcpiTbGetTableBody */
|
||||
|
||||
AcpiTbDeleteSingleTable (&TableInfo);
|
||||
return_ACPI_STATUS (Status);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
|
||||
* $Revision: 63 $
|
||||
* $Revision: 64 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -155,9 +155,9 @@ AcpiTbFindTable (
|
||||
|
||||
/* Validate string lengths */
|
||||
|
||||
if ((ACPI_STRLEN (Signature) > 4) ||
|
||||
(ACPI_STRLEN (OemId) > 6) ||
|
||||
(ACPI_STRLEN (OemTableId) > 8))
|
||||
if ((ACPI_STRLEN (Signature) > ACPI_NAME_SIZE) ||
|
||||
(ACPI_STRLEN (OemId) > sizeof (Table->OemId)) ||
|
||||
(ACPI_STRLEN (OemTableId) > sizeof (Table->OemTableId)))
|
||||
{
|
||||
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
|
||||
}
|
||||
@ -191,7 +191,7 @@ AcpiTbFindTable (
|
||||
* PARAMETERS: Signature - Any ACPI table signature
|
||||
* Instance - the non zero instance of the table, allows
|
||||
* support for multiple tables of the same type
|
||||
* Flags - 0: Physical/Virtual support
|
||||
* Flags - Physical/Virtual support
|
||||
* RetBuffer - pointer to a structure containing a buffer to
|
||||
* receive the table
|
||||
*
|
||||
@ -215,11 +215,10 @@ AcpiGetFirmwareTable (
|
||||
{
|
||||
ACPI_POINTER RsdpAddress;
|
||||
ACPI_POINTER Address;
|
||||
ACPI_TABLE_HEADER *RsdtPtr = NULL;
|
||||
ACPI_TABLE_HEADER *TablePtr;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_SIZE RsdtSize = 0;
|
||||
ACPI_SIZE TableSize;
|
||||
ACPI_TABLE_HEADER Header;
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
ACPI_TABLE_DESC RsdtInfo;
|
||||
UINT32 TableCount;
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
@ -243,6 +242,8 @@ AcpiGetFirmwareTable (
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
RsdtInfo.Pointer = NULL;
|
||||
|
||||
if (!AcpiGbl_RSDP)
|
||||
{
|
||||
/* Get the RSDP */
|
||||
@ -277,16 +278,14 @@ AcpiGetFirmwareTable (
|
||||
{
|
||||
/* Nope, BAD Signature */
|
||||
|
||||
Status = AE_BAD_SIGNATURE;
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_BAD_SIGNATURE);
|
||||
}
|
||||
|
||||
if (AcpiTbChecksum (AcpiGbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
|
||||
{
|
||||
/* Nope, BAD Checksum */
|
||||
|
||||
Status = AE_BAD_CHECKSUM;
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_BAD_CHECKSUM);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,13 +299,17 @@ AcpiGetFirmwareTable (
|
||||
ACPI_HIDWORD (Address.Pointer.Value),
|
||||
ACPI_LODWORD (Address.Pointer.Value)));
|
||||
|
||||
Status = AcpiTbGetTablePointer (&Address, Flags, &RsdtSize, &RsdtPtr);
|
||||
/* Insert ProcessorMode flags */
|
||||
|
||||
Address.PointerType |= Flags;
|
||||
|
||||
Status = AcpiTbGetTable (&Address, &RsdtInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
Status = AcpiTbValidateRsdt (RsdtPtr);
|
||||
Status = AcpiTbValidateRsdt (RsdtInfo.Pointer);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
@ -314,8 +317,9 @@ AcpiGetFirmwareTable (
|
||||
|
||||
/* Get the number of table pointers within the RSDT */
|
||||
|
||||
TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtPtr);
|
||||
TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo.Pointer);
|
||||
|
||||
Address.PointerType = AcpiGbl_TableFlags | Flags;
|
||||
|
||||
/*
|
||||
* Search the RSDT/XSDT for the correct instance of the
|
||||
@ -323,22 +327,21 @@ AcpiGetFirmwareTable (
|
||||
*/
|
||||
for (i = 0, j = 0; i < TableCount; i++)
|
||||
{
|
||||
/* Get the next table pointer */
|
||||
/* Get the next table pointer, handle RSDT vs. XSDT */
|
||||
|
||||
Address.PointerType = AcpiGbl_TableFlags;
|
||||
if (AcpiGbl_RSDP->Revision < 2)
|
||||
{
|
||||
Address.Pointer.Value = ((RSDT_DESCRIPTOR *) RsdtPtr)->TableOffsetEntry[i];
|
||||
Address.Pointer.Value = ((RSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
Address.Pointer.Value = ACPI_GET_ADDRESS (
|
||||
((XSDT_DESCRIPTOR *) RsdtPtr)->TableOffsetEntry[i]);
|
||||
((XSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]);
|
||||
}
|
||||
|
||||
/* Get addressibility if necessary */
|
||||
/* Get the table header */
|
||||
|
||||
Status = AcpiTbGetTablePointer (&Address, Flags, &TableSize, &TablePtr);
|
||||
Status = AcpiTbGetTableHeader (&Address, &Header);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
@ -346,26 +349,24 @@ AcpiGetFirmwareTable (
|
||||
|
||||
/* Compare table signatures and table instance */
|
||||
|
||||
if (!ACPI_STRNCMP ((char *) TablePtr, Signature, ACPI_STRLEN (Signature)))
|
||||
if (!ACPI_STRNCMP (Header.Signature, Signature, ACPI_NAME_SIZE))
|
||||
{
|
||||
/* An instance of the table was found */
|
||||
|
||||
j++;
|
||||
if (j >= Instance)
|
||||
{
|
||||
/* Found the correct instance */
|
||||
/* Found the correct instance, get the entire table */
|
||||
|
||||
*TablePointer = TablePtr;
|
||||
Status = AcpiTbGetTableBody (&Address, &Header, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
*TablePointer = TableInfo.Pointer;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Delete table mapping if using virtual addressing */
|
||||
|
||||
if ((TableSize) &&
|
||||
((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING))
|
||||
{
|
||||
AcpiOsUnmapMemory (TablePtr, TableSize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,10 +376,7 @@ AcpiGetFirmwareTable (
|
||||
|
||||
|
||||
Cleanup:
|
||||
if (RsdtSize)
|
||||
{
|
||||
AcpiOsUnmapMemory (RsdtPtr, RsdtSize);
|
||||
}
|
||||
AcpiOsUnmapMemory (RsdtInfo.Pointer, (ACPI_SIZE) RsdtInfo.Pointer->Length);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: utcopy - Internal to external object translation utilities
|
||||
* $Revision: 101 $
|
||||
* $Revision: 103 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -383,19 +383,21 @@ AcpiUtCopyIpackageToEpackage (
|
||||
/*
|
||||
* Free space begins right after the first package
|
||||
*/
|
||||
Info.Length = 0;
|
||||
Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
||||
Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
||||
Info.ObjectSpace = 0;
|
||||
Info.NumPackages = 1;
|
||||
Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
||||
|
||||
ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
|
||||
ExternalObject->Package.Count = InternalObject->Package.Count;
|
||||
ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace);
|
||||
|
||||
/*
|
||||
* Build an array of ACPI_OBJECTS in the buffer
|
||||
* Leave room for an array of ACPI_OBJECTS in the buffer
|
||||
* and move the free space past it
|
||||
*/
|
||||
Info.Length += (ACPI_SIZE) ExternalObject->Package.Count *
|
||||
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
||||
Info.FreeSpace += ExternalObject->Package.Count *
|
||||
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
||||
|
||||
@ -621,7 +623,6 @@ AcpiUtCopyEpackageToIpackage (
|
||||
ExternalObject->Package.Count = InternalObject->Package.Count;
|
||||
ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace;
|
||||
|
||||
|
||||
/*
|
||||
* Build an array of ACPI_OBJECTS in the buffer
|
||||
* and move the free space past it
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: utglobal - Global variables for the ACPI subsystem
|
||||
* $Revision: 162 $
|
||||
* $Revision: 165 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -119,6 +119,7 @@
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acnamesp.h"
|
||||
#include "amlcode.h"
|
||||
|
||||
#define _COMPONENT ACPI_UTILITIES
|
||||
ACPI_MODULE_NAME ("utglobal")
|
||||
@ -386,15 +387,15 @@ ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
|
||||
|
||||
ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
|
||||
{
|
||||
/*********** Name, Signature, Global typed pointer Signature size, How many allowed?, Contains valid AML? */
|
||||
/*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
|
||||
|
||||
/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE},
|
||||
/* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
|
||||
/* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE},
|
||||
/* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE},
|
||||
/* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
|
||||
/* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
|
||||
/* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE},
|
||||
/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
|
||||
/* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
|
||||
/* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
|
||||
/* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
|
||||
/* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
|
||||
/* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
|
||||
/* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
|
||||
};
|
||||
|
||||
|
||||
@ -457,15 +458,15 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
|
||||
|
||||
/* Region type decoding */
|
||||
|
||||
static const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
|
||||
const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
|
||||
{
|
||||
"SystemMemory",
|
||||
"SystemIO",
|
||||
"PCIConfig",
|
||||
"PCI_Config",
|
||||
"EmbeddedControl",
|
||||
"SMBus",
|
||||
"CMOS",
|
||||
"PCIBarTarget",
|
||||
"PCIBARTarget",
|
||||
"DataTable",
|
||||
};
|
||||
|
||||
@ -527,40 +528,6 @@ AcpiUtGetEventName (
|
||||
}
|
||||
|
||||
|
||||
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
|
||||
|
||||
/*
|
||||
* Strings and procedures used for debug only
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtGetMutexName
|
||||
*
|
||||
* PARAMETERS: None.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Translate a mutex ID into a name string (Debug only)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
NATIVE_CHAR *
|
||||
AcpiUtGetMutexName (
|
||||
UINT32 MutexId)
|
||||
{
|
||||
|
||||
if (MutexId > MAX_MTX)
|
||||
{
|
||||
return ("Invalid Mutex ID");
|
||||
}
|
||||
|
||||
return (AcpiGbl_MutexNames[MutexId]);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtGetTypeName
|
||||
@ -655,55 +622,40 @@ AcpiUtGetObjectTypeName (
|
||||
}
|
||||
|
||||
|
||||
/* Various strings for future use */
|
||||
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
|
||||
|
||||
#if 0
|
||||
#include "amlcode.h"
|
||||
/*
|
||||
* Strings and procedures used for debug only
|
||||
*
|
||||
*/
|
||||
|
||||
/* Data used in keeping track of fields */
|
||||
|
||||
static const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] =
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtGetMutexName
|
||||
*
|
||||
* PARAMETERS: None.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Translate a mutex ID into a name string (Debug only)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
NATIVE_CHAR *
|
||||
AcpiUtGetMutexName (
|
||||
UINT32 MutexId)
|
||||
{
|
||||
"skip",
|
||||
"?access?"
|
||||
}; /* FE = Field Element */
|
||||
|
||||
if (MutexId > MAX_MTX)
|
||||
{
|
||||
return ("Invalid Mutex ID");
|
||||
}
|
||||
|
||||
static const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] =
|
||||
{
|
||||
"Error",
|
||||
"MTR",
|
||||
"MEQ",
|
||||
"MLE",
|
||||
"MLT",
|
||||
"MGE",
|
||||
"MGT"
|
||||
};
|
||||
return (AcpiGbl_MutexNames[MutexId]);
|
||||
}
|
||||
|
||||
|
||||
/* Access type decoding */
|
||||
|
||||
static const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] =
|
||||
{
|
||||
"AnyAcc",
|
||||
"ByteAcc",
|
||||
"WordAcc",
|
||||
"DWordAcc",
|
||||
"QWordAcc",
|
||||
"BufferAcc",
|
||||
};
|
||||
|
||||
|
||||
/* Update rule decoding */
|
||||
|
||||
static const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] =
|
||||
{
|
||||
"Preserve",
|
||||
"WriteAsOnes",
|
||||
"WriteAsZeros"
|
||||
};
|
||||
#endif /* Future use */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: utxface - External interfaces for "global" ACPI functions
|
||||
* $Revision: 96 $
|
||||
* $Revision: 97 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -298,6 +298,31 @@ AcpiEnableSubsystem (
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiInitializeObjects
|
||||
*
|
||||
* PARAMETERS: Flags - Init/enable Options
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Completes namespace initialization by initializing device
|
||||
* objects and executing AML code for Regions, buffers, etc.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiInitializeObjects (
|
||||
UINT32 Flags)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiInitializeObjects");
|
||||
|
||||
/*
|
||||
* Initialize all device objects in the namespace
|
||||
* This runs the _STA and _INI methods.
|
||||
|
Loading…
Reference in New Issue
Block a user