Resolve conflicts arising from the ACPI CA 20020725 import.

This commit is contained in:
Mitsuru IWASAKI 2002-07-30 19:35:32 +00:00
parent 432a633569
commit b69ed3f4c6
21 changed files with 815 additions and 1826 deletions

View File

@ -0,0 +1,125 @@
/*-
* Copyright (c) 2002 Mitsuru IWASAKI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
/******************************************************************************
*
* Name: acpica_machdep.h - arch-specific defines, etc.
* $Revision$
*
*****************************************************************************/
#ifndef __ACPICA_MACHDEP_H__
#define __ACPICA_MACHDEP_H__
#ifdef _KERNEL
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
/* Asm macros */
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS() disable_intr()
#define ACPI_ENABLE_IRQS() enable_intr()
#define ACPI_FLUSH_CPU_CACHE() wbinvd()
#define asm __asm
/*! [Begin] no source code translation
*
* A brief explanation as GNU inline assembly is a bit hairy
* %0 is the output parameter in EAX ("=a")
* %1 and %2 are the input parameters in ECX ("c")
* and an immediate value ("i") respectively
* All actual register references are preceded with "%%" as in "%%edx"
* Immediate values in the assembly are preceded by "$" as in "$0x1"
* The final asm parameter are the operation altered non-output registers.
*/
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
do { \
int dummy; \
asm("1: movl (%1),%%eax;" \
"movl %%eax,%%edx;" \
"andl %2,%%edx;" \
"btsl $0x1,%%edx;" \
"adcl $0x0,%%edx;" \
"lock; cmpxchgl %%edx,(%1);" \
"jnz 1b;" \
"cmpb $0x3,%%dl;" \
"sbbl %%eax,%%eax" \
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
} while(0)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
do { \
int dummy; \
asm("1: movl (%1),%%eax;" \
"movl %%eax,%%edx;" \
"andl %2,%%edx;" \
"lock; cmpxchgl %%edx,(%1);" \
"jnz 1b;" \
"andl $0x1,%%eax" \
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
} while(0)
/*
* Math helper asm macros
*/
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
asm("divl %2;" \
:"=a"(q32), "=d"(r32) \
:"r"(d32), \
"0"(n_lo), "1"(n_hi))
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
asm("shrl $1,%2;" \
"rcrl $1,%3;" \
:"=r"(n_hi), "=r"(n_lo) \
:"0"(n_hi), "1"(n_lo))
/*! [End] no source code translation !*/
#endif /* _KERNEL */
#define ACPI_MACHINE_WIDTH 32
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_USE_NATIVE_DIVIDE
#endif /* __ACPICA_MACHDEP_H__ */

View File

@ -56,7 +56,6 @@ coda/coda_vfsops.c optional vcoda
coda/coda_vnops.c optional vcoda
compat/linprocfs/linprocfs.c optional linprocfs
contrib/dev/acpica/dbcmds.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbdisasm.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbdisply.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbexec.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbfileio.c optional acpica acpi_debug nowerror
@ -65,6 +64,14 @@ contrib/dev/acpica/dbinput.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbstats.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbutils.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dbxface.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmbuffer.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmnames.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmopcode.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmresrc.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmresrcl.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmresrcs.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmutils.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dmwalk.c optional acpica acpi_debug nowerror
contrib/dev/acpica/dsfield.c optional acpica nowerror
contrib/dev/acpica/dsmethod.c optional acpica
contrib/dev/acpica/dsmthdat.c optional acpica
@ -122,8 +129,9 @@ contrib/dev/acpica/nsobject.c optional acpica
contrib/dev/acpica/nssearch.c optional acpica
contrib/dev/acpica/nsutils.c optional acpica
contrib/dev/acpica/nswalk.c optional acpica
contrib/dev/acpica/nsxfeval.c optional acpica nowerror
contrib/dev/acpica/nsxfname.c optional acpica nowerror
contrib/dev/acpica/nsxfobj.c optional acpica
contrib/dev/acpica/nsxfobj.c optional acpica nowerror
contrib/dev/acpica/psargs.c optional acpica
contrib/dev/acpica/psfind.c optional acpica
contrib/dev/acpica/psopcode.c optional acpica
@ -146,7 +154,9 @@ contrib/dev/acpica/rsutils.c optional acpica
contrib/dev/acpica/rsxface.c optional acpica
contrib/dev/acpica/tbconvrt.c optional acpica
contrib/dev/acpica/tbget.c optional acpica
contrib/dev/acpica/tbgetall.c optional acpica
contrib/dev/acpica/tbinstal.c optional acpica
contrib/dev/acpica/tbrsdt.c optional acpica
contrib/dev/acpica/tbutils.c optional acpica
contrib/dev/acpica/tbxface.c optional acpica
contrib/dev/acpica/tbxfroot.c optional acpica

View File

@ -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

View File

@ -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
@ -276,7 +280,6 @@
/*
* Use the standard C library headers.
* We want to keep these to a minimum.
*
*/
#ifdef ACPI_USE_STANDARD_HEADERS
@ -306,12 +309,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
/******************************************************************************
*

View File

@ -126,6 +126,7 @@
/* FreeBSD uses GCC */
#include "acgcc.h"
#include <machine/acpica_machdep.h>
#ifdef _KERNEL
#include "opt_acpi.h"
@ -136,160 +137,6 @@
#include <sys/libkern.h>
#include <machine/stdarg.h>
#ifdef __ia64__
#define _IA64
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
/* Asm macros */
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS() disable_intr()
#define ACPI_ENABLE_IRQS() enable_intr()
#define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */
/*! [Begin] no source code translation */
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
do { \
__asm__ volatile ("1: ld4 r29=%1\n" \
";;\n" \
"mov ar.ccv=r29\n" \
"mov r2=r29\n" \
"shr.u r30=r29,1\n" \
"and r29=-4,r29\n" \
";;\n" \
"add r29=2,r29\n" \
"and r30=1,r30\n" \
";;\n" \
"add r29=r29,r30\n" \
";;\n" \
"cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
";;\n" \
"cmp.eq p6,p7=r2,r30\n" \
"(p7) br.dpnt.few 1b\n" \
"cmp.gt p8,p9=3,r29\n" \
";;\n" \
"(p8) mov %0=-1\n" \
"(p9) mov %0=r0\n" \
:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
} while (0)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
do { \
__asm__ volatile ("1: ld4 r29=%1\n" \
";;\n" \
"mov ar.ccv=r29\n" \
"mov r2=r29\n" \
"and r29=-4,r29\n" \
";;\n" \
"cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
";;\n" \
"cmp.eq p6,p7=r2,r30\n" \
"(p7) br.dpnt.few 1b\n" \
"and %0=1,r2\n" \
";;\n" \
:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
} while (0)
/*! [End] no source code translation !*/
#else /* DO IA32 */
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
/* Asm macros */
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS() disable_intr()
#define ACPI_ENABLE_IRQS() enable_intr()
#define ACPI_FLUSH_CPU_CACHE() wbinvd()
#define asm __asm
/*! [Begin] no source code translation
*
* A brief explanation as GNU inline assembly is a bit hairy
* %0 is the output parameter in EAX ("=a")
* %1 and %2 are the input parameters in ECX ("c")
* and an immediate value ("i") respectively
* All actual register references are preceded with "%%" as in "%%edx"
* Immediate values in the assembly are preceded by "$" as in "$0x1"
* The final asm parameter are the operation altered non-output registers.
*/
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
do { \
int dummy; \
asm("1: movl (%1),%%eax;" \
"movl %%eax,%%edx;" \
"andl %2,%%edx;" \
"btsl $0x1,%%edx;" \
"adcl $0x0,%%edx;" \
"lock; cmpxchgl %%edx,(%1);" \
"jnz 1b;" \
"cmpb $0x3,%%dl;" \
"sbbl %%eax,%%eax" \
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
} while(0)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
do { \
int dummy; \
asm("1: movl (%1),%%eax;" \
"movl %%eax,%%edx;" \
"andl %2,%%edx;" \
"lock; cmpxchgl %%edx,(%1);" \
"jnz 1b;" \
"andl $0x1,%%eax" \
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
} while(0)
/*
* Math helper asm macros
*/
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
asm("divl %2;" \
:"=a"(q32), "=d"(r32) \
:"r"(d32), \
"0"(n_lo), "1"(n_hi))
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
asm("shrl $1,%2;" \
"rcrl $1,%3;" \
:"=r"(n_hi), "=r"(n_lo) \
:"0"(n_hi), "1"(n_lo))
/*! [End] no source code translation !*/
#endif /* IA 32 */
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
@ -349,15 +196,4 @@ strstr(char *s, char *find)
}
#endif /* _KERNEL */
#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
#else
#define ACPI_MACHINE_WIDTH 32
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_USE_NATIVE_DIVIDE
#endif
#endif /* __ACFREEBSD_H__ */

View File

@ -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

View File

@ -134,6 +134,10 @@ ACPI_STATUS
AcpiEnableSubsystem (
UINT32 Flags);
ACPI_STATUS
AcpiInitializeObjects (
UINT32 Flags);
ACPI_STATUS
AcpiTerminate (
void);

View File

@ -193,7 +193,6 @@ AcpiUtGetMutexName (
#endif
NATIVE_CHAR *
AcpiUtGetTypeName (
ACPI_OBJECT_TYPE Type);
@ -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 */

View File

@ -449,7 +449,9 @@ AcpiDbDisassembleAml (
NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
}
#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (NULL, Op, NumStatements);
#endif
}

View File

@ -1,867 +0,0 @@
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
* $Revision: 61 $
*
******************************************************************************/
/******************************************************************************
*
* 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 "acdebug.h"
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
ACPI_MODULE_NAME ("dbdisasm")
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define DB_NO_OP_INFO " [%2.2d] "
#define DB_FULL_OP_INFO "%5.5X #%4.4hX [%2.2d] "
/*******************************************************************************
*
* FUNCTION: AcpiDbBlockType
*
* PARAMETERS: Op - Object to be examined
*
* RETURN: Status
*
* DESCRIPTION: Type of block for this op (parens or braces)
*
******************************************************************************/
UINT32
AcpiDbBlockType (
ACPI_PARSE_OBJECT *Op)
{
switch (Op->Common.AmlOpcode)
{
case AML_METHOD_OP:
return (BLOCK_BRACE);
default:
break;
}
return (BLOCK_PAREN);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsDisplayObjectPathname
*
* PARAMETERS: 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 ");
AcpiDbDisplayPath (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)", Buffer.Pointer);
ACPI_MEM_FREE (Buffer.Pointer);
Exit:
/* Restore the debug level */
AcpiDbgLevel = DebugLevel;
return (Status);
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayOp
*
* PARAMETERS: Origin - Starting object
* NumOpcodes - Max number of opcodes to be displayed
*
* RETURN: None
*
* DESCRIPTION: Display parser object and its children
*
******************************************************************************/
void
AcpiDbDisplayOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Origin,
UINT32 NumOpcodes)
{
ACPI_PARSE_OBJECT *Op = Origin;
ACPI_PARSE_OBJECT *arg;
ACPI_PARSE_OBJECT *depth;
UINT32 DepthCount = 0;
UINT32 LastDepth = 0;
UINT32 i;
UINT32 j;
if (!Op)
{
AcpiDbDisplayOpcode (WalkState, Op);
return;
}
while (Op)
{
/* Indentation */
DepthCount = 0;
if (!AcpiGbl_DbOpt_verbose)
{
DepthCount++;
}
/* Determine the nesting depth of this argument */
for (depth = Op->Common.Parent; depth; depth = depth->Common.Parent)
{
arg = AcpiPsGetArg (depth, 0);
while (arg && arg != Origin)
{
arg = arg->Common.Next;
}
if (arg)
{
break;
}
DepthCount++;
}
/* Open a new block if we are nested further than last time */
if (DepthCount > LastDepth)
{
VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth));
for (i = 0; i < LastDepth; i++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
}
if (AcpiDbBlockType (Op) == BLOCK_PAREN)
{
AcpiOsPrintf ("(\n");
}
else
{
AcpiOsPrintf ("{\n");
}
}
/* Close a block if we are nested less than last time */
else if (DepthCount < LastDepth)
{
for (j = LastDepth; j >= (DepthCount + 1); j--)
{
VERBOSE_PRINT ((DB_NO_OP_INFO, (j - 1)));
for (i = 1; i < j; i++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
}
if (AcpiDbBlockType (Op) == BLOCK_PAREN)
{
AcpiOsPrintf (")\n");
}
else
{
AcpiOsPrintf ("}\n");
}
}
}
/* In verbose mode, print the AML offset, opcode and depth count */
VERBOSE_PRINT ((DB_FULL_OP_INFO, (UINT32) Op->Common.AmlOffset,
Op->Common.AmlOpcode, DepthCount));
/* Indent the output according to the depth count */
for (i = 0; i < DepthCount; i++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
}
/* Now print the opcode */
AcpiDbDisplayOpcode (WalkState, Op);
/* Resolve a name reference */
if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP && Op->Common.Value.Name) &&
(Op->Common.Parent) &&
(AcpiGbl_DbOpt_verbose))
{
(void) AcpiPsDisplayObjectPathname (WalkState, Op);
}
AcpiOsPrintf ("\n");
/* Get the next node in the tree */
Op = AcpiPsGetDepthNext (Origin, Op);
LastDepth = DepthCount;
NumOpcodes--;
if (!NumOpcodes)
{
Op = NULL;
}
}
/* Close the last block(s) */
DepthCount = LastDepth -1;
for (i = 0; i < LastDepth; i++)
{
VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - i));
for (j = 0; j < DepthCount; j++)
{
AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent);
}
AcpiOsPrintf ("}\n");
DepthCount--;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayNamestring
*
* PARAMETERS: Name - ACPI Name string to store
*
* RETURN: None
*
* DESCRIPTION: Display namestring. Handles prefix characters
*
******************************************************************************/
void
AcpiDbDisplayNamestring (
NATIVE_CHAR *Name)
{
UINT32 SegCount;
if (!Name)
{
AcpiOsPrintf ("<NULL NAME PTR>");
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 */
AcpiOsPrintf ("%4.4s", Name);
SegCount--;
if (SegCount)
{
/* Not last name, append dot separator */
AcpiOsPrintf (".");
}
Name += ACPI_NAME_SIZE;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayPath
*
* 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
AcpiDbDisplayPath (
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] == '\\'))
{
AcpiDbDisplayNamestring (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))
{
AcpiOsPrintf ("%4.4s", NamePath->Common.Value.String);
}
}
else
{
Name = AcpiPsGetName (Search);
AcpiOsPrintf ("%4.4s", &Name);
}
DoDot = TRUE;
}
}
Prev = Search;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayOpcode
*
* PARAMETERS: Op - Op that is to be printed
*
* RETURN: Status
*
* DESCRIPTION: Store printed op in a Buffer and return its length
* (or -1 if out of space)
*
* NOTE: Terse mode prints out ASL-like code. Verbose mode adds more info.
*
******************************************************************************/
void
AcpiDbDisplayOpcode (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
UINT8 *ByteData;
UINT32 ByteCount;
UINT32 i;
const ACPI_OPCODE_INFO *OpInfo = NULL;
UINT32 Name;
if (!Op)
{
AcpiOsPrintf ("<NULL OP PTR>");
return;
}
/* op and arguments */
switch (Op->Common.AmlOpcode)
{
case AML_BYTE_OP:
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("(UINT8) 0x%2.2hX", Op->Common.Value.Integer8);
}
else
{
AcpiOsPrintf ("0x%2.2hX", Op->Common.Value.Integer8);
}
break;
case AML_WORD_OP:
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("(UINT16) 0x%4.4hX", Op->Common.Value.Integer16);
}
else
{
AcpiOsPrintf ("0x%4.4hX", Op->Common.Value.Integer16);
}
break;
case AML_DWORD_OP:
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Common.Value.Integer32);
}
else
{
AcpiOsPrintf ("0x%8.8X", Op->Common.Value.Integer32);
}
break;
case AML_QWORD_OP:
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("(UINT64) 0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi,
Op->Common.Value.Integer64.Lo);
}
else
{
AcpiOsPrintf ("0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi,
Op->Common.Value.Integer64.Lo);
}
break;
case AML_STRING_OP:
if (Op->Common.Value.String)
{
AcpiOsPrintf ("\"%s\"", Op->Common.Value.String);
}
else
{
AcpiOsPrintf ("<\"NULL STRING PTR\">");
}
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:
AcpiDbDisplayNamestring (Op->Common.Value.Name);
break;
case AML_INT_NAMEDFIELD_OP:
AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Common.Value.Integer32);
break;
case AML_INT_RESERVEDFIELD_OP:
AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Common.Value.Integer32);
break;
case AML_INT_ACCESSFIELD_OP:
AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Common.Value.Integer32);
break;
case AML_INT_BYTELIST_OP:
if (AcpiGbl_DbOpt_verbose)
{
AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Common.Value.Integer32);
}
else
{
AcpiOsPrintf ("0x%2.2X", Op->Common.Value.Integer32);
ByteCount = Op->Common.Value.Integer32;
ByteData = Op->Named.Data;
for (i = 0; i < ByteCount; i++)
{
AcpiOsPrintf (", 0x%2.2X", ByteData[i]);
}
}
break;
default:
/* Just get the opcode name and print it */
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
AcpiOsPrintf ("%s", OpInfo->Name);
#ifndef PARSER_ONLY
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;
}
if (!OpInfo)
{
/* If there is another element in the list, add a comma */
if (Op->Common.Next)
{
AcpiOsPrintf (",");
}
}
/*
* If this is a named opcode, print the associated name value
*/
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (Op && (OpInfo->Flags & AML_NAMED))
{
Name = AcpiPsGetName (Op);
AcpiOsPrintf (" %4.4s", &Name);
if ((AcpiGbl_DbOpt_verbose) && (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP))
{
(void) AcpiPsDisplayObjectPathname (WalkState, Op);
}
}
}
#endif /* ENABLE_DEBUGGER */

View File

@ -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")
@ -177,6 +177,7 @@ AcpiDbMatchArgument (
}
#ifdef ENABLE_DEBUGGER
/*******************************************************************************
*
* FUNCTION: AcpiDbCloseDebugFile
@ -242,6 +243,7 @@ AcpiDbOpenDebugFile (
#endif
}
#endif
#ifdef ACPI_APPLICATION
@ -285,7 +287,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);
@ -380,9 +382,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))
@ -394,7 +401,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))
{
@ -430,7 +437,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);
@ -489,8 +496,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;

View File

@ -269,7 +269,9 @@ AcpiDbSingleStep (
/* Now we can display it */
#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX);
#endif
if ((Op->Common.AmlOpcode == AML_IF_OP) ||
(Op->Common.AmlOpcode == AML_WHILE_OP))
@ -425,9 +427,11 @@ AcpiDbInitialize (void)
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
AcpiGbl_DbOpt_tables = FALSE;
AcpiGbl_DbOpt_disasm = FALSE;
AcpiGbl_DbOpt_stats = FALSE;
#ifdef ACPI_DISASSEMBLER
AcpiGbl_DbOpt_disasm = FALSE;
AcpiGbl_DbOpt_verbose = TRUE;
#endif
AcpiGbl_DbOpt_ini_methods = TRUE;
AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE);
@ -475,11 +479,13 @@ AcpiDbInitialize (void)
}
}
#ifdef ACPI_DISASSEMBLER
if (!AcpiGbl_DbOpt_verbose)
{
AcpiGbl_DbOpt_disasm = TRUE;
AcpiGbl_DbOpt_stats = FALSE;
}
#endif
return (AE_OK);
}

View File

@ -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,
@ -1297,7 +1301,6 @@ AcpiPsParseAml (
/* We are done with this walk, move on to the parent if any */
WalkState = AcpiDsPopWalkState (Thread);
/* Save the last effective return value */
if (CallerReturnDesc && WalkState->ReturnDesc)

View File

@ -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
@ -349,7 +347,7 @@ AcpiRsCreatePciRoutingTable (
if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
(*SubObjectList)->Reference.Opcode));
return_ACPI_STATUS (AE_BAD_DATA);
}

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,7 @@
#include "acpi.h"
#include "acnamesp.h"
#include "amlcode.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
@ -240,7 +241,6 @@ UINT32 AcpiGbl_NestingLevel = 0;
BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
BOOLEAN AcpiGbl_MethodExecuting = FALSE;
NATIVE_CHAR *AcpiGbl_DbDisasmIndent = "....";
/* System flags */
@ -387,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},
};
@ -458,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",
};
@ -528,42 +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]);
}
#endif
/*****************************************************************************
*
* FUNCTION: AcpiUtGetTypeName
@ -658,54 +622,41 @@ 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");
}
return (AcpiGbl_MutexNames[MutexId]);
}
static const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] =
{
"Error",
"MTR",
"MEQ",
"MLE",
"MLT",
"MGE",
"MGT"
};
/* 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
/*****************************************************************************

View File

@ -45,13 +45,18 @@ AcpiOsTableOverride (
{
caddr_t acpi_dsdt, p;
if (NewTable == NULL)
if (ExistingTable == NULL || NewTable == NULL)
{
return(AE_BAD_PARAMETER);
}
(*NewTable) = NULL;
if (strncmp(ExistingTable->Signature, "DSDT", 4) != 0)
{
return(AE_OK);
}
if ((acpi_dsdt = preload_search_by_type("acpi_dsdt")) == NULL)
{
return(AE_OK);

View File

@ -387,6 +387,11 @@ acpi_attach(device_t dev)
goto out;
}
if (ACPI_FAILURE(status = AcpiInitializeObjects(flags))) {
device_printf(dev, "could not initialize ACPI objects: %s\n", AcpiFormatException(status));
goto out;
}
/*
* Setup our sysctl tree.
*

View File

@ -0,0 +1,125 @@
/*-
* Copyright (c) 2002 Mitsuru IWASAKI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
/******************************************************************************
*
* Name: acpica_machdep.h - arch-specific defines, etc.
* $Revision$
*
*****************************************************************************/
#ifndef __ACPICA_MACHDEP_H__
#define __ACPICA_MACHDEP_H__
#ifdef _KERNEL
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
/* Asm macros */
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS() disable_intr()
#define ACPI_ENABLE_IRQS() enable_intr()
#define ACPI_FLUSH_CPU_CACHE() wbinvd()
#define asm __asm
/*! [Begin] no source code translation
*
* A brief explanation as GNU inline assembly is a bit hairy
* %0 is the output parameter in EAX ("=a")
* %1 and %2 are the input parameters in ECX ("c")
* and an immediate value ("i") respectively
* All actual register references are preceded with "%%" as in "%%edx"
* Immediate values in the assembly are preceded by "$" as in "$0x1"
* The final asm parameter are the operation altered non-output registers.
*/
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
do { \
int dummy; \
asm("1: movl (%1),%%eax;" \
"movl %%eax,%%edx;" \
"andl %2,%%edx;" \
"btsl $0x1,%%edx;" \
"adcl $0x0,%%edx;" \
"lock; cmpxchgl %%edx,(%1);" \
"jnz 1b;" \
"cmpb $0x3,%%dl;" \
"sbbl %%eax,%%eax" \
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
} while(0)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
do { \
int dummy; \
asm("1: movl (%1),%%eax;" \
"movl %%eax,%%edx;" \
"andl %2,%%edx;" \
"lock; cmpxchgl %%edx,(%1);" \
"jnz 1b;" \
"andl $0x1,%%eax" \
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
} while(0)
/*
* Math helper asm macros
*/
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
asm("divl %2;" \
:"=a"(q32), "=d"(r32) \
:"r"(d32), \
"0"(n_lo), "1"(n_hi))
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
asm("shrl $1,%2;" \
"rcrl $1,%3;" \
:"=r"(n_hi), "=r"(n_lo) \
:"0"(n_hi), "1"(n_lo))
/*! [End] no source code translation !*/
#endif /* _KERNEL */
#define ACPI_MACHINE_WIDTH 32
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_USE_NATIVE_DIVIDE
#endif /* __ACPICA_MACHDEP_H__ */

View File

@ -0,0 +1,115 @@
/*-
* Copyright (c) 2002 Mitsuru IWASAKI
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
/******************************************************************************
*
* Name: acpica_machdep.h - arch-specific defines, etc.
* $Revision$
*
*****************************************************************************/
#ifndef __ACPICA_MACHDEP_H__
#define __ACPICA_MACHDEP_H__
#ifdef _KERNEL
#define _IA64
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
/* Asm macros */
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS() disable_intr()
#define ACPI_ENABLE_IRQS() enable_intr()
#define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */
/*! [Begin] no source code translation */
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
do { \
__asm__ volatile ("1: ld4 r29=%1\n" \
";;\n" \
"mov ar.ccv=r29\n" \
"mov r2=r29\n" \
"shr.u r30=r29,1\n" \
"and r29=-4,r29\n" \
";;\n" \
"add r29=2,r29\n" \
"and r30=1,r30\n" \
";;\n" \
"add r29=r29,r30\n" \
";;\n" \
"cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
";;\n" \
"cmp.eq p6,p7=r2,r30\n" \
"(p7) br.dpnt.few 1b\n" \
"cmp.gt p8,p9=3,r29\n" \
";;\n" \
"(p8) mov %0=-1\n" \
"(p9) mov %0=r0\n" \
:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
} while (0)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
do { \
__asm__ volatile ("1: ld4 r29=%1\n" \
";;\n" \
"mov ar.ccv=r29\n" \
"mov r2=r29\n" \
"and r29=-4,r29\n" \
";;\n" \
"cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
";;\n" \
"cmp.eq p6,p7=r2,r30\n" \
"(p7) br.dpnt.few 1b\n" \
"and %0=1,r2\n" \
";;\n" \
:"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
} while (0)
/*! [End] no source code translation !*/
#endif /* _KERNEL */
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
#endif /* __ACPICA_MACHDEP_H__ */

View File

@ -10,21 +10,29 @@ KMOD= acpi
# ACPI CA sources
CFLAGS+= -I${.CURDIR}/../../contrib/dev/acpica
SRCS+= dsfield.c dsmethod.c dsmthdat.c dsobject.c dsopcode.c dsutils.c
SRCS+= dswexec.c dswload.c dswscope.c dswstate.c evevent.c evmisc.c evregion.c
SRCS+= evrgnini.c evsci.c evxface.c evxfevnt.c evxfregn.c exconfig.c exconvrt.c
SRCS+= excreate.c exdump.c exfield.c exfldio.c exmisc.c exmutex.c exnames.c
SRCS+= exoparg1.c exoparg2.c exoparg3.c exoparg6.c exprep.c exregion.c
SRCS+= exresnte.c exresolv.c exresop.c
SRCS+= exstore.c exstoren.c exstorob.c exsystem.c exutils.c hwacpi.c
SRCS+= hwgpe.c hwregs.c hwsleep.c hwtimer.c nsaccess.c nsalloc.c nsdump.c
SRCS+= nseval.c nsinit.c nsload.c nsnames.c nsobject.c nssearch.c nsutils.c
SRCS+= nswalk.c nsxfname.c nsxfobj.c psargs.c psfind.c psopcode.c psparse.c
SRCS+= psscope.c pstree.c psutils.c pswalk.c psxface.c rsaddr.c rscalc.c
SRCS+= rscreate.c rsdump.c rsio.c rsirq.c rslist.c rsmemory.c rsmisc.c
SRCS+= rsutils.c rsxface.c tbconvrt.c tbget.c tbinstal.c tbutils.c tbxface.c
SRCS+= tbxfroot.c utalloc.c utclib.c utcopy.c utdebug.c utdelete.c uteval.c
SRCS+= utglobal.c utinit.c utmath.c utmisc.c utobject.c utxface.c
SRCS+= dsfield.c dsmethod.c dsmthdat.c dsobject.c dsopcode.c
SRCS+= dsutils.c dswexec.c dswload.c dswscope.c dswstate.c
SRCS+= evevent.c evmisc.c evregion.c evrgnini.c evsci.c
SRCS+= evxface.c evxfevnt.c evxfregn.c
SRCS+= exconfig.c exconvrt.c excreate.c exdump.c exfield.c
SRCS+= exfldio.c exmisc.c exmutex.c exnames.c exoparg1.c
SRCS+= exoparg2.c exoparg3.c exoparg6.c exprep.c exregion.c
SRCS+= exresnte.c exresolv.c exresop.c exstore.c exstoren.c
SRCS+= exstorob.c exsystem.c exutils.c
SRCS+= hwacpi.c hwgpe.c hwregs.c hwsleep.c hwtimer.c
SRCS+= nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c
SRCS+= nsload.c nsnames.c nsobject.c nssearch.c nsutils.c
SRCS+= nswalk.c nsxfeval.c nsxfname.c nsxfobj.c
SRCS+= psargs.c psfind.c psopcode.c psparse.c psscope.c
SRCS+= pstree.c psutils.c pswalk.c psxface.c
SRCS+= rsaddr.c rscalc.c rscreate.c rsdump.c rsio.c
SRCS+= rsirq.c rslist.c rsmemory.c rsmisc.c rsutils.c
SRCS+= rsxface.c
SRCS+= tbconvrt.c tbget.c tbgetall.c tbinstal.c tbrsdt.c
SRCS+= tbutils.c tbxface.c tbxfroot.c
SRCS+= utalloc.c utclib.c utcopy.c utdebug.c utdelete.c
SRCS+= uteval.c utglobal.c utinit.c utmath.c utmisc.c
SRCS+= utobject.c utxface.c
# OSD layer
SRCS+= acpi.c acpi_acad.c acpi_battery.c acpi_button.c acpi_cmbat.c acpi_cpu.c
@ -46,8 +54,10 @@ CFLAGS+=-DACPI_MAX_THREADS=${ACPI_MAX_THREADS}
# Debugging support
.if ACPI_DEBUG
CFLAGS+=-DACPI_DEBUG
SRCS+= dbcmds.c dbdisasm.c dbdisply.c dbexec.c dbfileio.c dbhistry.c
SRCS+= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c
SRCS+= dbinput.c dbstats.c dbutils.c dbxface.c
SRCS+= dmbuffer.c dmnames.c dmopcode.c dmresrc.c dmresrcl.c
SRCS+= dmresrcs.c dmutils.c dmwalk.c
opt_ddb.h: Makefile
echo '#define DDB 1' >opt_ddb.h
.else