summaryrefslogtreecommitdiffstats
path: root/sys/contrib
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2002-07-30 19:35:32 +0000
committeriwasaki <iwasaki@FreeBSD.org>2002-07-30 19:35:32 +0000
commitb2baff05fb67090f8db119f0d0bb418e4d61c212 (patch)
treed1f4cc7bb805f34f1eedacd80e590c7f8bfa4478 /sys/contrib
parentb22b2c8b83b39d40736d7874ad9e889ed10051fd (diff)
downloadFreeBSD-src-b2baff05fb67090f8db119f0d0bb418e4d61c212.zip
FreeBSD-src-b2baff05fb67090f8db119f0d0bb418e4d61c212.tar.gz
Resolve conflicts arising from the ACPI CA 20020725 import.
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/dev/acpica/acconfig.h11
-rw-r--r--sys/contrib/dev/acpica/acenv.h15
-rw-r--r--sys/contrib/dev/acpica/acfreebsd.h166
-rw-r--r--sys/contrib/dev/acpica/acpiosxf.h8
-rw-r--r--sys/contrib/dev/acpica/acpixf.h4
-rw-r--r--sys/contrib/dev/acpica/acutils.h4
-rw-r--r--sys/contrib/dev/acpica/dbcmds.c2
-rw-r--r--sys/contrib/dev/acpica/dbdisasm.c867
-rw-r--r--sys/contrib/dev/acpica/dbfileio.c23
-rw-r--r--sys/contrib/dev/acpica/dbxface.c8
-rw-r--r--sys/contrib/dev/acpica/psparse.c7
-rw-r--r--sys/contrib/dev/acpica/rscreate.c4
-rw-r--r--sys/contrib/dev/acpica/tbget.c842
-rw-r--r--sys/contrib/dev/acpica/utglobal.c127
14 files changed, 341 insertions, 1747 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h
index ba289f0..05b6b4f 100644
--- a/sys/contrib/dev/acpica/acconfig.h
+++ b/sys/contrib/dev/acpica/acconfig.h
@@ -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
diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h
index bc9f59b..fbc9cd2 100644
--- a/sys/contrib/dev/acpica/acenv.h
+++ b/sys/contrib/dev/acpica/acenv.h
@@ -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
/******************************************************************************
*
diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h
index 334af1c..fc26ec9 100644
--- a/sys/contrib/dev/acpica/acfreebsd.h
+++ b/sys/contrib/dev/acpica/acfreebsd.h
@@ -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__ */
diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h
index 4678cd8..a6bece7 100644
--- a/sys/contrib/dev/acpica/acpiosxf.h
+++ b/sys/contrib/dev/acpica/acpiosxf.h
@@ -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
diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h
index 046bc52..8ea681e 100644
--- a/sys/contrib/dev/acpica/acpixf.h
+++ b/sys/contrib/dev/acpica/acpixf.h
@@ -135,6 +135,10 @@ AcpiEnableSubsystem (
UINT32 Flags);
ACPI_STATUS
+AcpiInitializeObjects (
+ UINT32 Flags);
+
+ACPI_STATUS
AcpiTerminate (
void);
diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h
index 7b94784..8ad1802 100644
--- a/sys/contrib/dev/acpica/acutils.h
+++ b/sys/contrib/dev/acpica/acutils.h
@@ -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 */
diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c
index 4992787..380ed1a 100644
--- a/sys/contrib/dev/acpica/dbcmds.c
+++ b/sys/contrib/dev/acpica/dbcmds.c
@@ -449,7 +449,9 @@ AcpiDbDisassembleAml (
NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
}
+#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (NULL, Op, NumStatements);
+#endif
}
diff --git a/sys/contrib/dev/acpica/dbdisasm.c b/sys/contrib/dev/acpica/dbdisasm.c
deleted file mode 100644
index 9e67ada..0000000
--- a/sys/contrib/dev/acpica/dbdisasm.c
+++ /dev/null
@@ -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 */
-
diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c
index d96c510..0c95e51 100644
--- a/sys/contrib/dev/acpica/dbfileio.c
+++ b/sys/contrib/dev/acpica/dbfileio.c
@@ -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;
diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c
index 5bad063..df9fb54 100644
--- a/sys/contrib/dev/acpica/dbxface.c
+++ b/sys/contrib/dev/acpica/dbxface.c
@@ -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);
}
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c
index 7fc5543..d20b6e5 100644
--- a/sys/contrib/dev/acpica/psparse.c
+++ b/sys/contrib/dev/acpica/psparse.c
@@ -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)
diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c
index a0cf550..1a6fc55 100644
--- a/sys/contrib/dev/acpica/rscreate.c
+++ b/sys/contrib/dev/acpica/rscreate.c
@@ -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);
}
diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c
index e7728ba..6af3368 100644
--- a/sys/contrib/dev/acpica/tbget.c
+++ b/sys/contrib/dev/acpica/tbget.c
@@ -126,821 +126,457 @@
/*******************************************************************************
*
- * FUNCTION: AcpiTbTableOverride
+ * FUNCTION: AcpiTbGetTable
*
- * PARAMETERS: *TableInfo - Info for current table
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * TableInfo - Where table info is returned
*
* RETURN: None
*
- * DESCRIPTION: Attempts override of current table with a new one if provided
- * by the host OS.
- *
- ******************************************************************************/
-
-void
-AcpiTbTableOverride (
- ACPI_TABLE_DESC *TableInfo)
-{
- ACPI_TABLE_HEADER *NewTable;
- ACPI_STATUS Status;
- ACPI_POINTER Address;
- ACPI_TABLE_DESC NewTableInfo;
-
-
- ACPI_FUNCTION_TRACE ("AcpiTbTableOverride");
-
-
- Status = AcpiOsTableOverride (TableInfo->Pointer, &NewTable);
- if (ACPI_FAILURE (Status))
- {
- /* Some severe error from the OSL, but we basically ignore it */
-
- ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n",
- AcpiFormatException (Status)));
- return_VOID;
- }
-
- if (!NewTable)
- {
- /* No table override */
-
- return_VOID;
- }
-
- /*
- * We have a new table to override the old one. Get a copy of
- * the new one. We know that the new table has a logical pointer.
- */
- Address.PointerType = ACPI_LOGICAL_POINTER;
- Address.Pointer.Logical = NewTable;
-
- Status = AcpiTbGetTable (&Address, &NewTableInfo);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("Could not copy ACPI table override\n"));
- return_VOID;
- }
-
- /*
- * Delete the original table
- */
- AcpiTbDeleteSingleTable (TableInfo);
-
- /* Copy the table info */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Successful table override [%4.4s]\n",
- ((ACPI_TABLE_HEADER *) NewTableInfo.Pointer)->Signature));
-
- ACPI_MEMCPY (TableInfo, &NewTableInfo, sizeof (ACPI_TABLE_DESC));
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbGetTableWithOverride
- *
- * PARAMETERS: Address - Physical or logical address of table
- * *TableInfo - Where the table info is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Gets and installs the table with possible table override by OS.
+ * DESCRIPTION: Get entire table of unknown size.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbGetTableWithOverride (
+AcpiTbGetTable (
ACPI_POINTER *Address,
ACPI_TABLE_DESC *TableInfo)
{
ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
- ACPI_FUNCTION_TRACE ("AcpiTbGetTableWithOverride");
-
+ ACPI_FUNCTION_TRACE ("TbGetTable");
- Status = AcpiTbGetTable (Address, TableInfo);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("Could not get ACPI table, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
/*
- * Attempt override. It either happens or it doesn't, no status
+ * Get the header in order to get signature and table size
*/
- AcpiTbTableOverride (TableInfo);
-
- /* Install the table */
-
- Status = AcpiTbInstallTable (TableInfo);
+ Status = AcpiTbGetTableHeader (Address, &Header);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not install ACPI table, %s\n",
- AcpiFormatException (Status)));
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbGetTablePtr
- *
- * PARAMETERS: TableType - one of the defined table types
- * Instance - Which table of this type
- * TablePtrLoc - pointer to location to place the pointer for
- * return
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to get the pointer to an ACPI table.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbGetTablePtr (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_TABLE_HEADER **TablePtrLoc)
-{
- ACPI_TABLE_DESC *TableDesc;
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE ("TbGetTablePtr");
-
-
- if (!AcpiGbl_DSDT)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- if (TableType > ACPI_TABLE_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * For all table types (Single/Multiple), the first
- * instance is always in the list head.
- */
- if (Instance == 1)
- {
- /*
- * Just pluck the pointer out of the global table!
- * Will be null if no table is present
- */
- *TablePtrLoc = AcpiGbl_AcpiTables[TableType].Pointer;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
- /*
- * Check for instance out of range
- */
- if (Instance > AcpiGbl_AcpiTables[TableType].Count)
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
+ /* Get the entire table */
- /* Walk the list to get the desired table
- * Since the if (Instance == 1) check above checked for the
- * first table, setting TableDesc equal to the .Next member
- * is actually pointing to the second table. Therefore, we
- * need to walk from the 2nd table until we reach the Instance
- * that the user is looking for and return its table pointer.
- */
- TableDesc = AcpiGbl_AcpiTables[TableType].Next;
- for (i = 2; i < Instance; i++)
+ Status = AcpiTbGetTableBody (Address, &Header, TableInfo);
+ if (ACPI_FAILURE (Status))
{
- TableDesc = TableDesc->Next;
+ ACPI_REPORT_ERROR (("Could not get ACPI table (size %X), %s\n",
+ Header.Length, AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
}
- /* We are now pointing to the requested table's descriptor */
-
- *TablePtrLoc = TableDesc->Pointer;
-
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbGetTable
+ * FUNCTION: AcpiTbGetTableHeader
*
- * PARAMETERS: Address - Physical address of table to retrieve
- * *TableInfo - Where the table info is returned
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * ReturnHeader - Where the table header is returned
*
* RETURN: Status
*
- * DESCRIPTION: Maps the physical address of table into a logical address
+ * DESCRIPTION: Get an ACPI table header. Works in both physical or virtual
+ * addressing mode. Works with both physical or logical pointers.
+ * Table is either copied or mapped, depending on the pointer
+ * type and mode of the processor.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbGetTable (
+AcpiTbGetTableHeader (
ACPI_POINTER *Address,
- ACPI_TABLE_DESC *TableInfo)
+ ACPI_TABLE_HEADER *ReturnHeader)
{
- ACPI_TABLE_HEADER *TableHeader = NULL;
- ACPI_TABLE_HEADER *FullTable = NULL;
- ACPI_SIZE Size;
- UINT8 Allocation;
ACPI_STATUS Status = AE_OK;
+ ACPI_TABLE_HEADER *Header = NULL;
- ACPI_FUNCTION_TRACE ("TbGetTable");
+ ACPI_FUNCTION_TRACE ("TbGetTableHeader");
- if (!TableInfo || !Address)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
+ /*
+ * Flags contains the current processor mode (Virtual or Physical addressing)
+ * The PointerType is either Logical or Physical
+ */
switch (Address->PointerType)
{
- case ACPI_LOGICAL_POINTER:
-
- /*
- * Getting data from a buffer, not BIOS tables
- */
- TableHeader = Address->Pointer.Logical;
+ case ACPI_PHYSMODE_PHYSPTR:
+ case ACPI_LOGMODE_LOGPTR:
- /* Allocate buffer for the entire table */
+ /* Pointer matches processor mode, copy the header */
- FullTable = ACPI_MEM_ALLOCATE (TableHeader->Length);
- if (!FullTable)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Copy the entire table (including header) to the local buffer */
-
- Size = (ACPI_SIZE) TableHeader->Length;
- ACPI_MEMCPY (FullTable, TableHeader, Size);
-
- /* Save allocation type */
-
- Allocation = ACPI_MEM_ALLOCATED;
+ ACPI_MEMCPY (ReturnHeader, Address->Pointer.Logical, sizeof (ACPI_TABLE_HEADER));
break;
- case ACPI_PHYSICAL_POINTER:
+ case ACPI_LOGMODE_PHYSPTR:
- /*
- * Not reading from a buffer, just map the table's physical memory
- * into our address space.
- */
- Size = SIZE_IN_HEADER;
+ /* Create a logical address for the physical pointer*/
- Status = AcpiTbMapAcpiTable (Address->Pointer.Physical, &Size, &FullTable);
+ Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (ACPI_TABLE_HEADER),
+ (void **) &Header);
if (ACPI_FAILURE (Status))
{
+ ACPI_REPORT_ERROR (("Could not map memory at %p for length %X\n",
+ Address->Pointer.Physical, sizeof (ACPI_TABLE_HEADER)));
return_ACPI_STATUS (Status);
}
- /* Save allocation type */
+ /* Copy header and delete mapping */
- Allocation = ACPI_MEM_MAPPED;
+ ACPI_MEMCPY (ReturnHeader, Header, sizeof (ACPI_TABLE_HEADER));
+ AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER));
break;
default:
+
+ ACPI_REPORT_ERROR (("Invalid address flags %X\n",
+ Address->PointerType));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Return values */
-
- TableInfo->Pointer = FullTable;
- TableInfo->Length = Size;
- TableInfo->Allocation = Allocation;
- TableInfo->BasePointer = FullTable;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
- FullTable->Signature,
- ACPI_HIDWORD (Address->Pointer.Physical),
- ACPI_LODWORD (Address->Pointer.Physical), FullTable));
-
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbGetAllTables
+ * FUNCTION: AcpiTbGetTableBody
*
- * PARAMETERS: NumberOfTables - Number of tables to get
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * Header - Header of the table to retrieve
+ * TableInfo - Where the table info is returned
*
* 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)
+ * DESCRIPTION: Get an entire ACPI table with support to allow the host OS to
+ * replace the table with a newer version (table override.)
+ * Works in both physical or virtual
+ * addressing mode. Works with both physical or logical pointers.
+ * Table is either copied or mapped, depending on the pointer
+ * type and mode of the processor.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbGetAllTables (
- UINT32 NumberOfTables)
+AcpiTbGetTableBody (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo)
{
- ACPI_STATUS Status = AE_OK;
- UINT32 Index;
- ACPI_TABLE_DESC TableInfo;
- ACPI_POINTER Address;
-
-
- ACPI_FUNCTION_TRACE ("TbGetAllTables");
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Number of tables: %d\n", NumberOfTables));
-
-
- /*
- * 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 table we are interested in getting here is the FADT.
- */
- for (Index = 0; Index < NumberOfTables; Index++)
- {
- /* Clear the TableInfo each time */
-
- ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC));
-
- /* Get the table via the XSDT */
-
- Address.PointerType = AcpiGbl_TableFlags;
- Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]);
-
- Status = AcpiTbGetTable (&Address, &TableInfo);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Recognize and install the table */
-
- Status = AcpiTbInstallTable (&TableInfo);
- if (ACPI_FAILURE (Status))
- {
- /*
- * Unrecognized or unsupported table, delete it and ignore the
- * error. Just get as many tables as we can, later we will
- * determine if there are enough tables to continue.
- */
- (void) AcpiTbUninstallTable (&TableInfo);
- Status = AE_OK;
- }
- }
+ ACPI_STATUS Status;
- if (!AcpiGbl_FADT)
- {
- ACPI_REPORT_ERROR (("No FADT present in R/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);
- }
+ ACPI_FUNCTION_TRACE ("TbGetTableBody");
- /*
- * Get the FACS (must have the FADT first, from loop above)
- * AcpiTbGetTableFacs will fail if FADT pointer is not valid
- */
- Address.PointerType = AcpiGbl_TableFlags;
- Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl);
- Status = AcpiTbGetTable (&Address, &TableInfo);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("Could not get the FACS, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
-
- /* Install the FACS */
-
- Status = AcpiTbInstallTable (&TableInfo);
- if (ACPI_FAILURE (Status))
+ if (!TableInfo || !Address)
{
- ACPI_REPORT_ERROR (("Could not install the FACS, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
- * Create the common FACS pointer table
- * (Contains pointers to the original table)
+ * Attempt table override.
*/
- Status = AcpiTbBuildCommonFacs (&TableInfo);
- if (ACPI_FAILURE (Status))
+ Status = AcpiTbTableOverride (Header, TableInfo);
+ if (ACPI_SUCCESS (Status))
{
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Get/install the DSDT (We know that the FADT is valid now)
- */
- Address.PointerType = AcpiGbl_TableFlags;
- Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt);
+ /* Table was overridden by the host OS */
- Status = AcpiTbGetTableWithOverride (&Address, &TableInfo);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("Could not get 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 */
+ /* No override, get the original table */
- AcpiTbDeleteAcpiTable (ACPI_TABLE_RSDP);
+ Status = AcpiTbGetThisTable (Address, Header, TableInfo);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbVerifyRsdp
+ * FUNCTION: AcpiTbTableOverride
*
- * PARAMETERS: NumberOfTables - Where the table count is placed
+ * PARAMETERS: Header - Pointer to table header
+ * TableInfo - Return info if table is overridden
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
+ * DESCRIPTION: Attempts override of current table with a new one if provided
+ * by the host OS.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbVerifyRsdp (
- ACPI_POINTER *Address)
+AcpiTbTableOverride (
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo)
{
- ACPI_TABLE_DESC TableInfo;
+ ACPI_TABLE_HEADER *NewTable;
ACPI_STATUS Status;
- RSDP_DESCRIPTOR *Rsdp;
-
-
- ACPI_FUNCTION_TRACE ("TbVerifyRsdp");
+ ACPI_POINTER Address;
- switch (Address->PointerType)
- {
- case ACPI_LOGICAL_POINTER:
+ ACPI_FUNCTION_TRACE ("TbTableOverride");
- 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
+ * The OSL will examine the header and decide whether to override this
+ * table. If it decides to override, a table will be returned in NewTable,
+ * which we will then copy.
*/
- if (ACPI_STRNCMP ((NATIVE_CHAR *) Rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ Status = AcpiOsTableOverride (Header, &NewTable);
+ if (ACPI_FAILURE (Status))
{
- /* Nope, BAD Signature */
+ /* Some severe error from the OSL, but we basically ignore it */
- Status = AE_BAD_SIGNATURE;
- goto Cleanup;
+ ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
}
- /* Check the standard checksum */
-
- if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ if (!NewTable)
{
- Status = AE_BAD_CHECKSUM;
- goto Cleanup;
- }
-
- /* Check extended checksum if table version >= 2 */
+ /* No table override */
- if (Rsdp->Revision >= 2)
- {
- if (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)
- {
- Status = AE_BAD_CHECKSUM;
- goto Cleanup;
- }
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
- /* 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 */
+ /*
+ * We have a new table to override the old one. Get a copy of
+ * the new one. We know that the new table has a logical pointer.
+ */
+ Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
+ Address.Pointer.Logical = NewTable;
- Status = AcpiTbInitTableDescriptor (ACPI_TABLE_RSDP, &TableInfo);
+ Status = AcpiTbGetThisTable (&Address, NewTable, 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));
+ ACPI_REPORT_ERROR (("Could not copy override ACPI table, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
}
- 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 ();
+ /* Copy the table info */
- OutAddress->PointerType = AcpiGbl_TableFlags;
+ ACPI_REPORT_INFO (("Table [%4.4s] replaced by host OS\n",
+ TableInfo->Pointer->Signature));
- /*
- * 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);
- }
+ return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbValidateRsdt
+ * FUNCTION: AcpiTbGetThisTable
*
- * PARAMETERS: TablePtr - Addressable pointer to the RSDT.
+ * PARAMETERS: Address - Address of table to retrieve. Can be
+ * Logical or Physical
+ * Header - Header of the table to retrieve
+ * TableInfo - Where the table info is returned
*
* RETURN: Status
*
- * DESCRIPTION: Validate signature for the RSDT or XSDT
+ * DESCRIPTION: Get an entire ACPI table. Works in both physical or virtual
+ * addressing mode. Works with both physical or logical pointers.
+ * Table is either copied or mapped, depending on the pointer
+ * type and mode of the processor.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbValidateRsdt (
- ACPI_TABLE_HEADER *TablePtr)
+AcpiTbGetThisTable (
+ ACPI_POINTER *Address,
+ ACPI_TABLE_HEADER *Header,
+ ACPI_TABLE_DESC *TableInfo)
{
- int NoMatch;
-
+ ACPI_TABLE_HEADER *FullTable = NULL;
+ UINT8 Allocation;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_NAME ("TbValidateRsdt");
+
+ ACPI_FUNCTION_TRACE ("TbGetThisTable");
/*
- * For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 and above, we use the XSDT
+ * Flags contains the current processor mode (Virtual or Physical addressing)
+ * The PointerType is either Logical or Physical
*/
- if (AcpiGbl_RSDP->Revision < 2)
- {
- NoMatch = ACPI_STRNCMP ((char *) TablePtr, RSDT_SIG,
- sizeof (RSDT_SIG) -1);
- }
- else
+ switch (Address->PointerType)
{
- NoMatch = ACPI_STRNCMP ((char *) TablePtr, XSDT_SIG,
- sizeof (XSDT_SIG) -1);
- }
+ case ACPI_PHYSMODE_PHYSPTR:
+ case ACPI_LOGMODE_LOGPTR:
- if (NoMatch)
- {
- /* Invalid RSDT or XSDT signature */
+ /* Pointer matches processor mode, copy the table to a new buffer */
+
+ FullTable = ACPI_MEM_ALLOCATE (Header->Length);
+ if (!FullTable)
+ {
+ ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n",
+ Header->Signature, Header->Length));
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
+ /* Copy the entire table (including header) to the local buffer */
- ACPI_DUMP_BUFFER (AcpiGbl_RSDP, 20);
+ ACPI_MEMCPY (FullTable, Address->Pointer.Logical, Header->Length);
- 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));
+ /* Save allocation type */
- return (AE_BAD_SIGNATURE);
- }
+ Allocation = ACPI_MEM_ALLOCATED;
+ break;
- return (AE_OK);
-}
+ case ACPI_LOGMODE_PHYSPTR:
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbGetTablePointer
- *
- * PARAMETERS: PhysicalAddress - Address from RSDT
- * Flags - virtual or physical addressing
- * TablePtr - Addressable address (output)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create an addressable pointer to an ACPI table
- *
- ******************************************************************************/
+ /*
+ * Just map the table's physical memory
+ * into our address space.
+ */
+ Status = AcpiOsMapMemory (Address->Pointer.Physical, (ACPI_SIZE) Header->Length,
+ (void **) &FullTable);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %p for length %X\n",
+ Header->Signature, Address->Pointer.Physical, Header->Length));
+ return (Status);
+ }
-ACPI_STATUS
-AcpiTbGetTablePointer (
- ACPI_POINTER *Address,
- UINT32 Flags,
- ACPI_SIZE *Size,
- ACPI_TABLE_HEADER **TablePtr)
-{
- ACPI_STATUS Status = AE_OK;
+ /* Save allocation type */
+ Allocation = ACPI_MEM_MAPPED;
+ break;
- ACPI_FUNCTION_ENTRY ();
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n",
+ Address->PointerType));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
/*
- * What mode is the processor in? (Virtual or Physical addressing)
+ * Validate checksum for _most_ tables,
+ * even the ones whose signature we don't recognize
*/
- if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
+ if (TableInfo->Type != ACPI_TABLE_FACS)
{
- /* Incoming pointer can be either logical or physical */
+ Status = AcpiTbVerifyTableChecksum (FullTable);
- switch (Address->PointerType)
+#if (!ACPI_CHECKSUM_ABORT)
+ if (ACPI_FAILURE (Status))
{
- case ACPI_PHYSICAL_POINTER:
+ /* Ignore the error if configuration says so */
- *Size = SIZE_IN_HEADER;
- Status = AcpiTbMapAcpiTable (Address->Pointer.Physical, Size, TablePtr);
- break;
-
- case ACPI_LOGICAL_POINTER:
-
- *TablePtr = Address->Pointer.Logical;
- *Size = 0;
- break;
-
- default:
- return (AE_BAD_PARAMETER);
+ Status = AE_OK;
}
+#endif
}
- else
- {
- /* In Physical addressing mode, all pointers must be physical */
-
- switch (Address->PointerType)
- {
- case ACPI_PHYSICAL_POINTER:
- *Size = 0;
- *TablePtr = Address->Pointer.Logical;
- break;
- case ACPI_LOGICAL_POINTER:
+ /* Return values */
- Status = AE_BAD_PARAMETER;
- break;
+ TableInfo->Pointer = FullTable;
+ TableInfo->Length = (ACPI_SIZE) Header->Length;
+ TableInfo->Allocation = Allocation;
+ TableInfo->BasePointer = FullTable;
- default:
- return (AE_BAD_PARAMETER);
- }
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
+ FullTable->Signature,
+ ACPI_HIDWORD (Address->Pointer.Physical),
+ ACPI_LODWORD (Address->Pointer.Physical), FullTable));
- return (Status);
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbGetTableRsdt
+ * FUNCTION: AcpiTbGetTablePtr
*
- * PARAMETERS: NumberOfTables - Where the table count is placed
+ * PARAMETERS: TableType - one of the defined table types
+ * Instance - Which table of this type
+ * TablePtrLoc - pointer to location to place the pointer for
+ * return
*
* RETURN: Status
*
- * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
+ * DESCRIPTION: This function is called to get the pointer to an ACPI table.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbGetTableRsdt (
- UINT32 *NumberOfTables)
+AcpiTbGetTablePtr (
+ ACPI_TABLE_TYPE TableType,
+ UINT32 Instance,
+ ACPI_TABLE_HEADER **TablePtrLoc)
{
- ACPI_TABLE_DESC TableInfo;
- ACPI_STATUS Status;
- ACPI_POINTER Address;
-
+ ACPI_TABLE_DESC *TableDesc;
+ UINT32 i;
- ACPI_FUNCTION_TRACE ("TbGetTableRsdt");
+ ACPI_FUNCTION_TRACE ("TbGetTablePtr");
- /* Get the RSDT/XSDT from the RSDP */
- AcpiTbGetRsdtAddress (&Address);
- Status = AcpiTbGetTable (&Address, &TableInfo);
- if (ACPI_FAILURE (Status))
+ if (!AcpiGbl_DSDT)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the R/XSDT, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, 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))
+ if (TableType > ACPI_TABLE_MAX)
{
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
- * Valid RSDT signature, verify the checksum. If it fails, just
- * print a warning and ignore it.
+ * For all table types (Single/Multiple), the first
+ * instance is always in the list head.
*/
- Status = AcpiTbVerifyTableChecksum (TableInfo.Pointer);
-
- /* Convert and/or copy to an XSDT structure */
-
- Status = AcpiTbConvertToXsdt (&TableInfo, NumberOfTables);
- if (ACPI_FAILURE (Status))
+ if (Instance == 1)
{
- return_ACPI_STATUS (Status);
+ /*
+ * Just pluck the pointer out of the global table!
+ * Will be null if no table is present
+ */
+ *TablePtrLoc = AcpiGbl_AcpiTables[TableType].Pointer;
+ return_ACPI_STATUS (AE_OK);
}
- /* Save the table pointers and allocation info */
+ /*
+ * Check for instance out of range
+ */
+ if (Instance > AcpiGbl_AcpiTables[TableType].Count)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
- Status = AcpiTbInitTableDescriptor (ACPI_TABLE_XSDT, &TableInfo);
- if (ACPI_FAILURE (Status))
+ /* Walk the list to get the desired table
+ * Since the if (Instance == 1) check above checked for the
+ * first table, setting TableDesc equal to the .Next member
+ * is actually pointing to the second table. Therefore, we
+ * need to walk from the 2nd table until we reach the Instance
+ * that the user is looking for and return its table pointer.
+ */
+ TableDesc = AcpiGbl_AcpiTables[TableType].Next;
+ for (i = 2; i < Instance; i++)
{
- return_ACPI_STATUS (Status);
+ TableDesc = TableDesc->Next;
}
- AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer;
+ /* We are now pointing to the requested table's descriptor */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", AcpiGbl_XSDT));
- return_ACPI_STATUS (Status);
-}
+ *TablePtrLoc = TableDesc->Pointer;
+ return_ACPI_STATUS (AE_OK);
+}
diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c
index 95d10f0..5b286ca 100644
--- a/sys/contrib/dev/acpica/utglobal.c
+++ b/sys/contrib/dev/acpica/utglobal.c
@@ -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? */
-
- /* 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},
+ /*********** 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_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 0
-#include "amlcode.h"
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
-/* Data used in keeping track of fields */
+/*
+ * Strings and procedures used for debug only
+ *
+ */
-static const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] =
-{
- "skip",
- "?access?"
-}; /* FE = Field Element */
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetMutexName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
+ *
+ ****************************************************************************/
-static const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] =
+NATIVE_CHAR *
+AcpiUtGetMutexName (
+ UINT32 MutexId)
{
- "Error",
- "MTR",
- "MEQ",
- "MLE",
- "MLT",
- "MGE",
- "MGT"
-};
+ if (MutexId > MAX_MTX)
+ {
+ return ("Invalid Mutex ID");
+ }
-/* Access type decoding */
-
-static const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] =
-{
- "AnyAcc",
- "ByteAcc",
- "WordAcc",
- "DWordAcc",
- "QWordAcc",
- "BufferAcc",
-};
-
+ return (AcpiGbl_MutexNames[MutexId]);
+}
-/* Update rule decoding */
-static const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] =
-{
- "Preserve",
- "WriteAsOnes",
- "WriteAsZeros"
-};
-#endif /* Future use */
+#endif
/*****************************************************************************
OpenPOWER on IntegriCloud