summaryrefslogtreecommitdiffstats
path: root/sys/contrib
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2002-02-23 05:10:40 +0000
committermsmith <msmith@FreeBSD.org>2002-02-23 05:10:40 +0000
commitb58b48bed8ea5143df93704f27949298f2d54429 (patch)
treecb8c80a21a1f185481adc55c00d2affbdae36b0e /sys/contrib
parentfe76969b7da935c578de24725d0e86947a339135 (diff)
downloadFreeBSD-src-b58b48bed8ea5143df93704f27949298f2d54429.zip
FreeBSD-src-b58b48bed8ea5143df93704f27949298f2d54429.tar.gz
Vendor import of the Intel ACPI CA 20020217 drop.
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/dev/acpica/acconfig.h58
-rw-r--r--sys/contrib/dev/acpica/acdebug.h59
-rw-r--r--sys/contrib/dev/acpica/acdispat.h10
-rw-r--r--sys/contrib/dev/acpica/acefi.h4
-rw-r--r--sys/contrib/dev/acpica/acenv.h96
-rw-r--r--sys/contrib/dev/acpica/acevents.h57
-rw-r--r--sys/contrib/dev/acpica/acexcep.h24
-rw-r--r--sys/contrib/dev/acpica/acfreebsd.h4
-rw-r--r--sys/contrib/dev/acpica/acgcc.h12
-rw-r--r--sys/contrib/dev/acpica/acglobal.h112
-rw-r--r--sys/contrib/dev/acpica/achware.h25
-rw-r--r--sys/contrib/dev/acpica/acinterp.h124
-rw-r--r--sys/contrib/dev/acpica/aclocal.h402
-rw-r--r--sys/contrib/dev/acpica/acmacros.h376
-rw-r--r--sys/contrib/dev/acpica/acnamesp.h82
-rw-r--r--sys/contrib/dev/acpica/acobject.h22
-rw-r--r--sys/contrib/dev/acpica/acoutput.h25
-rw-r--r--sys/contrib/dev/acpica/acparser.h8
-rw-r--r--sys/contrib/dev/acpica/acpi.h4
-rw-r--r--sys/contrib/dev/acpica/acpiosxf.h16
-rw-r--r--sys/contrib/dev/acpica/acpixf.h7
-rw-r--r--sys/contrib/dev/acpica/acresrc.h126
-rw-r--r--sys/contrib/dev/acpica/acstruct.h22
-rw-r--r--sys/contrib/dev/acpica/actables.h16
-rw-r--r--sys/contrib/dev/acpica/actbl.h58
-rw-r--r--sys/contrib/dev/acpica/actbl1.h81
-rw-r--r--sys/contrib/dev/acpica/actbl2.h70
-rw-r--r--sys/contrib/dev/acpica/actbl71.h4
-rw-r--r--sys/contrib/dev/acpica/actypes.h214
-rw-r--r--sys/contrib/dev/acpica/acutils.h97
-rw-r--r--sys/contrib/dev/acpica/amlcode.h23
-rw-r--r--sys/contrib/dev/acpica/dbcmds.c145
-rw-r--r--sys/contrib/dev/acpica/dbdisasm.c71
-rw-r--r--sys/contrib/dev/acpica/dbdisply.c89
-rw-r--r--sys/contrib/dev/acpica/dbexec.c47
-rw-r--r--sys/contrib/dev/acpica/dbfileio.c27
-rw-r--r--sys/contrib/dev/acpica/dbhistry.c14
-rw-r--r--sys/contrib/dev/acpica/dbinput.c119
-rw-r--r--sys/contrib/dev/acpica/dbstats.c39
-rw-r--r--sys/contrib/dev/acpica/dbutils.c43
-rw-r--r--sys/contrib/dev/acpica/dbxface.c132
-rw-r--r--sys/contrib/dev/acpica/dsfield.c79
-rw-r--r--sys/contrib/dev/acpica/dsmethod.c74
-rw-r--r--sys/contrib/dev/acpica/dsmthdat.c55
-rw-r--r--sys/contrib/dev/acpica/dsobject.c47
-rw-r--r--sys/contrib/dev/acpica/dsopcode.c113
-rw-r--r--sys/contrib/dev/acpica/dsutils.c55
-rw-r--r--sys/contrib/dev/acpica/dswexec.c65
-rw-r--r--sys/contrib/dev/acpica/dswload.c64
-rw-r--r--sys/contrib/dev/acpica/dswscope.c18
-rw-r--r--sys/contrib/dev/acpica/dswstate.c50
-rw-r--r--sys/contrib/dev/acpica/evevent.c650
-rw-r--r--sys/contrib/dev/acpica/evmisc.c210
-rw-r--r--sys/contrib/dev/acpica/evregion.c65
-rw-r--r--sys/contrib/dev/acpica/evrgnini.c40
-rw-r--r--sys/contrib/dev/acpica/evsci.c186
-rw-r--r--sys/contrib/dev/acpica/evxface.c136
-rw-r--r--sys/contrib/dev/acpica/evxfevnt.c210
-rw-r--r--sys/contrib/dev/acpica/evxfregn.c54
-rw-r--r--sys/contrib/dev/acpica/exconfig.c388
-rw-r--r--sys/contrib/dev/acpica/exconvrt.c115
-rw-r--r--sys/contrib/dev/acpica/excreate.c117
-rw-r--r--sys/contrib/dev/acpica/exdump.c177
-rw-r--r--sys/contrib/dev/acpica/exfield.c19
-rw-r--r--sys/contrib/dev/acpica/exfldio.c137
-rw-r--r--sys/contrib/dev/acpica/exmisc.c169
-rw-r--r--sys/contrib/dev/acpica/exmutex.c12
-rw-r--r--sys/contrib/dev/acpica/exnames.c71
-rw-r--r--sys/contrib/dev/acpica/exoparg1.c138
-rw-r--r--sys/contrib/dev/acpica/exoparg2.c69
-rw-r--r--sys/contrib/dev/acpica/exoparg3.c21
-rw-r--r--sys/contrib/dev/acpica/exoparg6.c14
-rw-r--r--sys/contrib/dev/acpica/exprep.c63
-rw-r--r--sys/contrib/dev/acpica/exregion.c97
-rw-r--r--sys/contrib/dev/acpica/exresnte.c11
-rw-r--r--sys/contrib/dev/acpica/exresolv.c17
-rw-r--r--sys/contrib/dev/acpica/exresop.c196
-rw-r--r--sys/contrib/dev/acpica/exstore.c277
-rw-r--r--sys/contrib/dev/acpica/exstoren.c158
-rw-r--r--sys/contrib/dev/acpica/exstorob.c30
-rw-r--r--sys/contrib/dev/acpica/exsystem.c52
-rw-r--r--sys/contrib/dev/acpica/exutils.c50
-rw-r--r--sys/contrib/dev/acpica/hwacpi.c106
-rw-r--r--sys/contrib/dev/acpica/hwgpe.c197
-rw-r--r--sys/contrib/dev/acpica/hwregs.c673
-rw-r--r--sys/contrib/dev/acpica/hwsleep.c171
-rw-r--r--sys/contrib/dev/acpica/hwtimer.c76
-rw-r--r--sys/contrib/dev/acpica/nsaccess.c252
-rw-r--r--sys/contrib/dev/acpica/nsalloc.c102
-rw-r--r--sys/contrib/dev/acpica/nsdump.c133
-rw-r--r--sys/contrib/dev/acpica/nseval.c185
-rw-r--r--sys/contrib/dev/acpica/nsinit.c40
-rw-r--r--sys/contrib/dev/acpica/nsload.c76
-rw-r--r--sys/contrib/dev/acpica/nsnames.c236
-rw-r--r--sys/contrib/dev/acpica/nsobject.c55
-rw-r--r--sys/contrib/dev/acpica/nssearch.c48
-rw-r--r--sys/contrib/dev/acpica/nsutils.c157
-rw-r--r--sys/contrib/dev/acpica/nswalk.c33
-rw-r--r--sys/contrib/dev/acpica/nsxfname.c87
-rw-r--r--sys/contrib/dev/acpica/nsxfobj.c224
-rw-r--r--sys/contrib/dev/acpica/psargs.c69
-rw-r--r--sys/contrib/dev/acpica/psfind.c91
-rw-r--r--sys/contrib/dev/acpica/psopcode.c32
-rw-r--r--sys/contrib/dev/acpica/psparse.c346
-rw-r--r--sys/contrib/dev/acpica/psscope.c16
-rw-r--r--sys/contrib/dev/acpica/pstree.c16
-rw-r--r--sys/contrib/dev/acpica/psutils.c44
-rw-r--r--sys/contrib/dev/acpica/pswalk.c20
-rw-r--r--sys/contrib/dev/acpica/psxface.c28
-rw-r--r--sys/contrib/dev/acpica/rsaddr.c219
-rw-r--r--sys/contrib/dev/acpica/rscalc.c118
-rw-r--r--sys/contrib/dev/acpica/rscreate.c171
-rw-r--r--sys/contrib/dev/acpica/rsdump.c203
-rw-r--r--sys/contrib/dev/acpica/rsio.c114
-rw-r--r--sys/contrib/dev/acpica/rsirq.c167
-rw-r--r--sys/contrib/dev/acpica/rslist.c122
-rw-r--r--sys/contrib/dev/acpica/rsmemory.c154
-rw-r--r--sys/contrib/dev/acpica/rsmisc.c162
-rw-r--r--sys/contrib/dev/acpica/rsutils.c160
-rw-r--r--sys/contrib/dev/acpica/rsxface.c44
-rw-r--r--sys/contrib/dev/acpica/tbconvrt.c344
-rw-r--r--sys/contrib/dev/acpica/tbget.c111
-rw-r--r--sys/contrib/dev/acpica/tbinstal.c184
-rw-r--r--sys/contrib/dev/acpica/tbutils.c34
-rw-r--r--sys/contrib/dev/acpica/tbxface.c99
-rw-r--r--sys/contrib/dev/acpica/tbxfroot.c475
-rw-r--r--sys/contrib/dev/acpica/utalloc.c710
-rw-r--r--sys/contrib/dev/acpica/utclib.c20
-rw-r--r--sys/contrib/dev/acpica/utcopy.c225
-rw-r--r--sys/contrib/dev/acpica/utdebug.c32
-rw-r--r--sys/contrib/dev/acpica/utdelete.c56
-rw-r--r--sys/contrib/dev/acpica/uteval.c38
-rw-r--r--sys/contrib/dev/acpica/utglobal.c361
-rw-r--r--sys/contrib/dev/acpica/utinit.c58
-rw-r--r--sys/contrib/dev/acpica/utmath.c22
-rw-r--r--sys/contrib/dev/acpica/utmisc.c325
-rw-r--r--sys/contrib/dev/acpica/utobject.c149
-rw-r--r--sys/contrib/dev/acpica/utxface.c87
138 files changed, 8290 insertions, 7720 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h
index 98dda4e..ad476ad 100644
--- a/sys/contrib/dev/acpica/acconfig.h
+++ b/sys/contrib/dev/acpica/acconfig.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 78 $
+ * $Revision: 90 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,9 +125,9 @@
*****************************************************************************/
/*
- * ACPI_DEBUG - This switch enables all the debug facilities of the
- * ACPI subsystem. This includes the DEBUG_PRINT output
- * statements. When disabled, all DEBUG_PRINT
+ * ACPI_DEBUG - This switch enables all the debug facilities of the
+ * ACPI subsystem. This includes the DEBUG_PRINT output
+ * statements. When disabled, all DEBUG_PRINT
* statements are compiled out.
*
* ACPI_APPLICATION - Use this switch if the subsystem is going to be run
@@ -145,13 +145,12 @@
/* Version string */
-#define ACPI_CA_VERSION 0x20011120
+#define ACPI_CA_VERSION 0x20020214
/* Version of ACPI supported */
#define ACPI_CA_SUPPORT_LEVEL 2
-
/* Maximum objects in the various object caches */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
@@ -160,28 +159,30 @@
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
-
/* String size constants */
#define MAX_STRING_LENGTH 512
#define PATHNAME_MAX 256 /* A full namespace pathname */
-
/* Maximum count for a semaphore object */
#define MAX_SEMAPHORE_COUNT 256
-
/* Max reference count (for debug only) */
#define MAX_REFERENCE_COUNT 0x400
-
/* Size of cached memory mapping for system memory operation region */
#define SYSMEM_REGION_WINDOW_SIZE 4096
+/******************************************************************************
+ *
+ * Configuration of subsystem behavior
+ *
+ *****************************************************************************/
+
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
@@ -190,7 +191,6 @@
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
*/
-
#define DEBUGGER_SINGLE_THREADED 0
#define DEBUGGER_MULTI_THREADED 1
@@ -201,6 +201,12 @@
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
#endif
+/*
+ * Should the subystem abort the loading of an ACPI table if the
+ * table checksum is incorrect?
+ */
+#define ACPI_CHECKSUM_ABORT FALSE
+
/******************************************************************************
*
@@ -208,10 +214,13 @@
*
*****************************************************************************/
+/* Number of distinct GPE register blocks */
+
+#define ACPI_MAX_GPE_BLOCKS 2
+
/*
* Method info (in WALK_STATE), containing local variables and argumetns
*/
-
#define MTH_NUM_LOCALS 8
#define MTH_MAX_LOCAL 7
@@ -225,7 +234,6 @@
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG
*/
-
#define OBJ_NUM_OPERANDS 8
#define OBJ_MAX_OPERAND 7
@@ -235,7 +243,6 @@
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.'
-
/* Constants used in searching for the RSDP in low memory */
#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */
@@ -244,16 +251,33 @@
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
-
/* Operation regions */
-#define ACPI_NUM_PREDEFINED_REGIONS 7
+#define ACPI_NUM_PREDEFINED_REGIONS 8
#define ACPI_USER_REGION_BEGIN 0x80
/* Maximum SpaceIds for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
+/* RSDP checksums */
+
+#define ACPI_RSDP_CHECKSUM_LENGTH 20
+#define ACPI_RSDP_XCHECKSUM_LENGTH 36
+
+
+/******************************************************************************
+ *
+ * ACPI AML Debugger
+ *
+ *****************************************************************************/
+
+
+#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
+
+#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
+#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
+
#endif /* _ACCONFIG_H */
diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h
index f2b105d..a129869 100644
--- a/sys/contrib/dev/acpica/acdebug.h
+++ b/sys/contrib/dev/acpica/acdebug.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 50 $
+ * $Revision: 56 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,61 +118,8 @@
#define __ACDEBUG_H__
-#define DB_MAX_ARGS 8 /* Must be max method args + 1 */
-
-#define DB_COMMAND_PROMPT '-'
-#define DB_EXECUTE_PROMPT '%'
-
-
-extern int optind;
-extern NATIVE_CHAR *optarg;
-extern UINT8 *AmlStart;
-extern UINT32 AmlLength;
-
-extern BOOLEAN AcpiGbl_DbOpt_tables;
-extern BOOLEAN AcpiGbl_DbOpt_disasm;
-extern BOOLEAN AcpiGbl_DbOpt_stats;
-extern BOOLEAN AcpiGbl_DbOpt_parse_jit;
-extern BOOLEAN AcpiGbl_DbOpt_verbose;
-extern BOOLEAN AcpiGbl_DbOpt_ini_methods;
-
-
-extern NATIVE_CHAR *AcpiGbl_DbArgs[DB_MAX_ARGS];
-extern NATIVE_CHAR AcpiGbl_DbLineBuf[80];
-extern NATIVE_CHAR AcpiGbl_DbScopeBuf[40];
-extern NATIVE_CHAR AcpiGbl_DbDebugFilename[40];
-extern BOOLEAN AcpiGbl_DbOutputToFile;
-extern NATIVE_CHAR *AcpiGbl_DbBuffer;
-extern NATIVE_CHAR *AcpiGbl_DbFilename;
-extern NATIVE_CHAR *AcpiGbl_DbDisasmIndent;
-extern UINT8 AcpiGbl_DbOutputFlags;
-extern UINT32 AcpiGbl_DbDebugLevel;
-extern UINT32 AcpiGbl_DbConsoleDebugLevel;
-extern ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr;
-
-/*
- * Statistic globals
- */
-extern UINT16 AcpiGbl_ObjTypeCount[INTERNAL_TYPE_NODE_MAX+1];
-extern UINT16 AcpiGbl_NodeTypeCount[INTERNAL_TYPE_NODE_MAX+1];
-extern UINT16 AcpiGbl_ObjTypeCountMisc;
-extern UINT16 AcpiGbl_NodeTypeCountMisc;
-extern UINT32 AcpiGbl_NumNodes;
-extern UINT32 AcpiGbl_NumObjects;
-
-
-extern UINT32 AcpiGbl_SizeOfParseTree;
-extern UINT32 AcpiGbl_SizeOfMethodTrees;
-extern UINT32 AcpiGbl_SizeOfNodeEntries;
-extern UINT32 AcpiGbl_SizeOfAcpiObjects;
-
-
#define ACPI_DEBUG_BUFFER_SIZE 4196
-#define DB_REDIRECTABLE_OUTPUT 0x01
-#define DB_CONSOLE_OUTPUT 0x02
-#define DB_DUPLICATE_OUTPUT 0x03
-
typedef struct CommandInfo
{
@@ -397,7 +344,7 @@ AcpiDbCreateExecutionThreads (
* dbfileio - Debugger file I/O commands
*/
-ACPI_OBJECT_TYPE8
+ACPI_OBJECT_TYPE
AcpiDbMatchArgument (
NATIVE_CHAR *UserArgument,
ARGUMENT_INFO *Arguments);
diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h
index d62f237..b866490 100644
--- a/sys/contrib/dev/acpica/acdispat.h
+++ b/sys/contrib/dev/acpica/acdispat.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 48 $
+ * $Revision: 51 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -177,7 +177,7 @@ AcpiDsExecEndControlOp (
ACPI_STATUS
AcpiDsGetPredicateValue (
ACPI_WALK_STATE *WalkState,
- UINT32 HasResultObj);
+ ACPI_OPERAND_OBJECT *ResultObj);
ACPI_STATUS
AcpiDsExecBeginOp (
@@ -271,7 +271,7 @@ BOOLEAN
AcpiDsIsMethodValue (
ACPI_OPERAND_OBJECT *ObjDesc);
-ACPI_OBJECT_TYPE8
+ACPI_OBJECT_TYPE
AcpiDsMethodDataGetType (
UINT16 Opcode,
UINT32 Index,
@@ -436,7 +436,7 @@ AcpiDsResolveOperands (
ACPI_STATUS
AcpiDsScopeStackPush (
ACPI_NAMESPACE_NODE *Node,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_WALK_STATE *WalkState);
diff --git a/sys/contrib/dev/acpica/acefi.h b/sys/contrib/dev/acpica/acefi.h
index f0611f6..ea9402f 100644
--- a/sys/contrib/dev/acpica/acefi.h
+++ b/sys/contrib/dev/acpica/acefi.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acefi.h - OS specific defines, etc.
- * $Revision: 6 $
+ * $Revision: 7 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h
index 2060d54..57e79b9 100644
--- a/sys/contrib/dev/acpica/acenv.h
+++ b/sys/contrib/dev/acpica/acenv.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 77 $
+ * $Revision: 83 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -196,18 +196,27 @@
/*! [Begin] no source code translation */
-#ifdef _LINUX
+#if defined(_LINUX)
#include "aclinux.h"
-#elif _AED_EFI
+#elif defined(_AED_EFI)
#include "acefi.h"
-#elif WIN32
+#elif defined(WIN32)
#include "acwin.h"
-#elif __FreeBSD__
+#elif defined(WIN64)
+#include "acwin64.h"
+
+#elif defined(__FreeBSD__)
#include "acfreebsd.h"
+#elif defined(MODESTO)
+#include "acmodesto.h"
+
+#elif defined(NETWARE)
+#include "acnetware.h"
+
#else
/* All other environments */
@@ -226,7 +235,6 @@
#endif
-
/*! [End] no source code translation !*/
/******************************************************************************
@@ -257,21 +265,21 @@
* We will be linking to the standard Clib functions
*/
-#define STRSTR(s1,s2) strstr((s1), (s2))
-#define STRUPR(s) AcpiUtStrupr ((s))
-#define STRLEN(s) (UINT32) strlen((s))
-#define STRCPY(d,s) strcpy((d), (s))
-#define STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n))
-#define STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n))
-#define STRCMP(d,s) strcmp((d), (s))
-#define STRCAT(d,s) strcat((d), (s))
-#define STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n))
-#define STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n))
-#define MEMCPY(d,s,n) memcpy((d), (s), (NATIVE_INT)(n))
-#define MEMSET(d,s,n) memset((d), (s), (NATIVE_INT)(n))
-#define TOUPPER toupper
-#define TOLOWER tolower
-#define IS_XDIGIT isxdigit
+#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
+#define ACPI_STRUPR(s) AcpiUtStrupr ((s))
+#define ACPI_STRLEN(s) (UINT32) strlen((s))
+#define ACPI_STRCPY(d,s) strcpy((d), (s))
+#define ACPI_STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n))
+#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n))
+#define ACPI_STRCMP(d,s) strcmp((d), (s))
+#define ACPI_STRCAT(d,s) strcat((d), (s))
+#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n))
+#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n))
+#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (NATIVE_INT)(n))
+#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (NATIVE_INT)(n))
+#define ACPI_TOUPPER toupper
+#define ACPI_TOLOWER tolower
+#define ACPI_IS_XDIGIT isxdigit
/******************************************************************************
*
@@ -298,35 +306,35 @@ typedef char *va_list;
* Storage alignment properties
*/
-#define _AUPBND (sizeof (NATIVE_INT) - 1)
-#define _ADNBND (sizeof (NATIVE_INT) - 1)
+#define _AUPBND (sizeof (NATIVE_INT) - 1)
+#define _ADNBND (sizeof (NATIVE_INT) - 1)
/*
* Variable argument list macro definitions
*/
-#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
-#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
-#define va_end(ap) (void) 0
-#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
+#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
+#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
+#define va_end(ap) (void) 0
+#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
#endif /* va_arg */
-#define STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
-#define STRUPR(s) AcpiUtStrupr ((s))
-#define STRLEN(s) AcpiUtStrlen ((s))
-#define STRCPY(d,s) AcpiUtStrcpy ((d), (s))
-#define STRNCPY(d,s,n) AcpiUtStrncpy ((d), (s), (n))
-#define STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (n))
-#define STRCMP(d,s) AcpiUtStrcmp ((d), (s))
-#define STRCAT(d,s) AcpiUtStrcat ((d), (s))
-#define STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (n))
-#define STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s),(n))
-#define MEMCPY(d,s,n) AcpiUtMemcpy ((d), (s), (n))
-#define MEMSET(d,v,n) AcpiUtMemset ((d), (v), (n))
-#define TOUPPER AcpiUtToUpper
-#define TOLOWER AcpiUtToLower
+#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
+#define ACPI_STRUPR(s) AcpiUtStrupr ((s))
+#define ACPI_STRLEN(s) AcpiUtStrlen ((s))
+#define ACPI_STRCPY(d,s) AcpiUtStrcpy ((d), (s))
+#define ACPI_STRNCPY(d,s,n) AcpiUtStrncpy ((d), (s), (n))
+#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (n))
+#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s))
+#define ACPI_STRCAT(d,s) AcpiUtStrcat ((d), (s))
+#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (n))
+#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s),(n))
+#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (n))
+#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (n))
+#define ACPI_TOUPPER AcpiUtToUpper
+#define ACPI_TOLOWER AcpiUtToLower
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
@@ -352,8 +360,8 @@ typedef char *va_list;
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
-#define disable()
-#define enable()
+#define acpi_disable_irqs()
+#define acpi_enable_irqs()
#define halt()
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)
diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h
index c9045af..134642b 100644
--- a/sys/contrib/dev/acpica/acevents.h
+++ b/sys/contrib/dev/acpica/acevents.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 67 $
+ * $Revision: 74 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,9 +122,13 @@ ACPI_STATUS
AcpiEvInitialize (
void);
+ACPI_STATUS
+AcpiEvHandlerInitialize (
+ void);
+
/*
- * AcpiEvfixed - Fixed event handling
+ * Evfixed - Fixed event handling
*/
ACPI_STATUS
@@ -137,16 +141,16 @@ AcpiEvFixedEventDetect (
UINT32
AcpiEvFixedEventDispatch (
- UINT32 AcpiEvent);
+ UINT32 Event);
/*
- * AcpiEvglock - Global Lock support
+ * Evmisc
*/
ACPI_STATUS
AcpiEvAcquireGlobalLock(
- void);
+ UINT32 Timeout);
void
AcpiEvReleaseGlobalLock(
@@ -156,9 +160,26 @@ ACPI_STATUS
AcpiEvInitGlobalLockHandler (
void);
+UINT32
+AcpiEvGetGpeRegisterIndex (
+ UINT32 GpeNumber);
+
+UINT32
+AcpiEvGetGpeNumberIndex (
+ UINT32 GpeNumber);
+
+ACPI_STATUS
+AcpiEvQueueNotifyRequest (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 NotifyValue);
+
+void
+AcpiEvNotifyDispatch (
+ void *Context);
+
/*
- * AcpiEvgpe - GPE handling and dispatch
+ * Evgpe - GPE handling and dispatch
*/
ACPI_STATUS
@@ -177,22 +198,8 @@ UINT32
AcpiEvGpeDetect (
void);
-
/*
- * AcpiEvnotify - Device Notify handling and dispatch
- */
-
-ACPI_STATUS
-AcpiEvQueueNotifyRequest (
- ACPI_NAMESPACE_NODE *Node,
- UINT32 NotifyValue);
-
-void
-AcpiEvNotifyDispatch (
- void *Context);
-
-/*
- * AcpiEvregion - Address Space handling
+ * Evregion - Address Space handling
*/
ACPI_STATUS
@@ -227,7 +234,7 @@ AcpiEvAssociateRegionAndHandler (
/*
- * AcpiEvregini - Region initialization and setup
+ * Evregini - Region initialization and setup
*/
ACPI_STATUS
@@ -295,10 +302,6 @@ AcpiEvInitializeSCI (
UINT32 ProgramSCI);
void
-AcpiEvRestoreAcpiState (
- void);
-
-void
AcpiEvTerminate (
void);
diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h
index 278dc51..3065adc 100644
--- a/sys/contrib/dev/acpica/acexcep.h
+++ b/sys/contrib/dev/acpica/acexcep.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 53 $
+ * $Revision: 57 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -176,8 +176,9 @@
#define AE_BAD_PATHNAME (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER)
#define AE_BAD_DATA (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER)
#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER)
+#define AE_ALIGNMENT (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER)
-#define AE_CODE_PGM_MAX 0x0005
+#define AE_CODE_PGM_MAX 0x0006
/*
@@ -187,8 +188,9 @@
#define AE_BAD_HEADER (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES)
#define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES)
#define AE_BAD_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES)
+#define AE_TABLE_NOT_SUPPORTED (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES)
-#define AE_CODE_TBL_MAX 0x0003
+#define AE_CODE_TBL_MAX 0x0005
/*
@@ -222,8 +224,9 @@
#define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0019 | AE_CODE_AML)
#define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x001A | AE_CODE_AML)
#define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_AML)
+#define AE_AML_NO_WHILE (ACPI_STATUS) (0x001C | AE_CODE_AML)
-#define AE_CODE_AML_MAX 0x001B
+#define AE_CODE_AML_MAX 0x001C
/*
* Internal exceptions used for control
@@ -236,8 +239,10 @@
#define AE_CTRL_DEPTH (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL)
#define AE_CTRL_END (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL)
#define AE_CTRL_TRANSFER (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL)
+#define AE_CTRL_BREAK (ACPI_STATUS) (0x0009 | AE_CODE_CONTROL)
+#define AE_CTRL_CONTINUE (ACPI_STATUS) (0x000A | AE_CODE_CONTROL)
-#define AE_CODE_CTRL_MAX 0x0008
+#define AE_CODE_CTRL_MAX 0x000A
#ifdef DEFINE_ACPI_GLOBALS
@@ -274,7 +279,7 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Env[] =
"AE_NOT_ACQUIRED",
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
- "AE_NO_GLOBAL_LOCK",
+ "AE_NO_GLOBAL_LOCK"
};
NATIVE_CHAR const *AcpiGbl_ExceptionNames_Pgm[] =
@@ -284,6 +289,7 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Pgm[] =
"AE_BAD_PATHNAME",
"AE_BAD_DATA",
"AE_BAD_ADDRESS",
+ "AE_ALIGNMENT"
};
NATIVE_CHAR const *AcpiGbl_ExceptionNames_Tbl[] =
@@ -292,6 +298,7 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Tbl[] =
"AE_BAD_HEADER",
"AE_BAD_CHECKSUM",
"AE_BAD_VALUE",
+ "AE_TABLE_NOT_SUPPORTED"
};
NATIVE_CHAR const *AcpiGbl_ExceptionNames_Aml[] =
@@ -323,6 +330,7 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Aml[] =
"AE_AML_INVALID_RESOURCE_TYPE",
"AE_AML_INVALID_INDEX",
"AE_AML_REGISTER_LIMIT",
+ "AE_AML_NO_WHILE"
};
NATIVE_CHAR const *AcpiGbl_ExceptionNames_Ctrl[] =
@@ -335,6 +343,8 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Ctrl[] =
"AE_CTRL_DEPTH",
"AE_CTRL_END",
"AE_CTRL_TRANSFER",
+ "AE_CTRL_BREAK",
+ "AE_CTRL_CONTINUE"
};
#endif /* ACPI GLOBALS */
diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h
index 894af50..c2e8a93 100644
--- a/sys/contrib/dev/acpica/acfreebsd.h
+++ b/sys/contrib/dev/acpica/acfreebsd.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
- * $Revision: 6 $
+ * $Revision: 7 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h
index 5581e48..539131b 100644
--- a/sys/contrib/dev/acpica/acgcc.h
+++ b/sys/contrib/dev/acpica/acgcc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 15 $
+ * $Revision: 17 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,8 +128,8 @@
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
-#define disable() __cli()
-#define enable() __sti()
+#define acpi_disable_irqs() __cli()
+#define acpi_enable_irqs() __sti()
/*! [Begin] no source code translation */
@@ -189,8 +189,8 @@
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3
-#define disable() __cli()
-#define enable() __sti()
+#define acpi_disable_irqs() __cli()
+#define acpi_enable_irqs() __sti()
#define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
/*! [Begin] no source code translation
diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h
index 62d938b..7edec62 100644
--- a/sys/contrib/dev/acpica/acglobal.h
+++ b/sys/contrib/dev/acpica/acglobal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 109 $
+ * $Revision: 120 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -162,11 +162,12 @@ extern UINT32 AcpiGbl_NestingLevel;
* of each in the system. Each global points to the actual table.
*
*/
-ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP;
-ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT;
-ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT;
-ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
-ACPI_EXTERN ACPI_COMMON_FACS *AcpiGbl_FACS;
+ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP;
+ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT;
+ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT;
+ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
+ACPI_EXTERN FACS_DESCRIPTOR *AcpiGbl_FACS;
+ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS;
/*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not
@@ -198,22 +199,18 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX];
ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify;
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify;
-ACPI_EXTERN UINT8 *AcpiGbl_Gpe0EnableRegisterSave;
-ACPI_EXTERN UINT8 *AcpiGbl_Gpe1EnableRegisterSave;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore;
ACPI_EXTERN UINT32 AcpiGbl_GlobalLockThreadCount;
-ACPI_EXTERN UINT32 AcpiGbl_RestoreAcpiChipset;
ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
-ACPI_EXTERN UINT32 AcpiGbl_EdgeLevelSave;
-ACPI_EXTERN UINT32 AcpiGbl_IrqEnableSave;
ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation;
ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount;
ACPI_EXTERN UINT32 AcpiGbl_PsFindCount;
ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave;
ACPI_EXTERN UINT16 AcpiGbl_NextTableOwnerId;
ACPI_EXTERN UINT16 AcpiGbl_NextMethodOwnerId;
+ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
@@ -240,14 +237,14 @@ ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct;
ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode;
extern const UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES];
-extern const PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
+extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
#ifdef ACPI_DEBUG
ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount;
ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize;
ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount;
-ACPI_EXTERN UINT32 AcpiGbl_EntryStackPointer;
-ACPI_EXTERN UINT32 AcpiGbl_LowestStackPointer;
+ACPI_EXTERN ACPI_SIZE AcpiGbl_EntryStackPointer;
+ACPI_EXTERN ACPI_SIZE AcpiGbl_LowestStackPointer;
ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting;
#endif
@@ -273,34 +270,41 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep;
ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+/*****************************************************************************
+ *
+ * Hardware globals
+ *
+ ****************************************************************************/
+
+ACPI_EXTERN ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG];
+ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA;
+ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB;
+
/*****************************************************************************
*
- * Event globals
+ * Event and GPE globals
*
****************************************************************************/
-ACPI_EXTERN ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
+extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
+
ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeObjHandle;
ACPI_EXTERN UINT32 AcpiGbl_GpeRegisterCount;
-ACPI_EXTERN ACPI_GPE_REGISTERS *AcpiGbl_GpeRegisters;
-ACPI_EXTERN ACPI_GPE_LEVEL_INFO *AcpiGbl_GpeInfo;
+ACPI_EXTERN UINT32 AcpiGbl_GpeNumberMax;
+ACPI_EXTERN ACPI_GPE_REGISTER_INFO *AcpiGbl_GpeRegisterInfo;
+ACPI_EXTERN ACPI_GPE_NUMBER_INFO *AcpiGbl_GpeNumberInfo;
+ACPI_EXTERN ACPI_GPE_BLOCK_INFO AcpiGbl_GpeBlockInfo[ACPI_MAX_GPE_BLOCKS];
/*
- * Gpe validation and translation table
- * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported.
- * Otherwise, returns a valid index into the global GPE table.
+ * GPE translation table
+ * Indexed by the GPE number, returns a valid index into the global GPE tables.
*
* This table is needed because the GPE numbers supported by block 1 do not
* have to be contiguous with the GPE numbers supported by block 0.
*/
-ACPI_EXTERN UINT8 AcpiGbl_GpeValid [ACPI_NUM_GPE];
-
-/* AcpiEvent counter for debug only */
-
-#ifdef ACPI_DEBUG
-ACPI_EXTERN UINT32 AcpiGbl_EventCount[ACPI_NUM_FIXED_EVENTS];
-#endif
+ACPI_EXTERN ACPI_GPE_INDEX_INFO *AcpiGbl_GpeNumberToIndex;
/*****************************************************************************
@@ -309,10 +313,58 @@ ACPI_EXTERN UINT32 AcpiGbl_EventCount[ACPI_NUM_FIXED_EVENTS
*
****************************************************************************/
+
+ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
+
+
#ifdef ENABLE_DEBUGGER
+
ACPI_EXTERN BOOLEAN AcpiGbl_MethodExecuting;
ACPI_EXTERN BOOLEAN AcpiGbl_DbTerminateThreads;
-#endif
+
+ACPI_EXTERN int optind;
+ACPI_EXTERN NATIVE_CHAR *optarg;
+ACPI_EXTERN UINT8 *AmlStart;
+ACPI_EXTERN UINT32 AmlLength;
+
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
+
+
+ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN NATIVE_CHAR AcpiGbl_DbLineBuf[80];
+ACPI_EXTERN NATIVE_CHAR AcpiGbl_DbParsedBuf[80];
+ACPI_EXTERN NATIVE_CHAR AcpiGbl_DbScopeBuf[40];
+ACPI_EXTERN NATIVE_CHAR AcpiGbl_DbDebugFilename[40];
+ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
+ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbBuffer;
+ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbFilename;
+ACPI_EXTERN NATIVE_CHAR *AcpiGbl_DbDisasmIndent;
+ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel;
+ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel;
+ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr;
+ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode;
+
+/*
+ * Statistic globals
+ */
+ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[INTERNAL_TYPE_NODE_MAX+1];
+ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[INTERNAL_TYPE_NODE_MAX+1];
+ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc;
+ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc;
+ACPI_EXTERN UINT32 AcpiGbl_NumNodes;
+ACPI_EXTERN UINT32 AcpiGbl_NumObjects;
+
+
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree;
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees;
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries;
+ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects;
+
+#endif /* ENABLE_DEBUGGER */
#endif /* __ACGLOBAL_H__ */
diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h
index 341bc4e..8efcfd5 100644
--- a/sys/contrib/dev/acpica/achware.h
+++ b/sys/contrib/dev/acpica/achware.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 56 $
+ * $Revision: 58 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -151,13 +151,20 @@ AcpiHwGetModeCapabilities (
/* Register I/O Prototypes */
+ACPI_BIT_REGISTER_INFO *
+AcpiHwGetBitRegisterInfo (
+ UINT32 RegisterId);
UINT32
-AcpiHwRegisterBitAccess (
- NATIVE_UINT ReadWrite,
- BOOLEAN UseLock,
+AcpiHwBitRegisterRead (
+ UINT32 RegisterId,
+ UINT32 Flags);
+
+UINT32
+AcpiHwBitRegisterWrite (
UINT32 RegisterId,
- ... /* DWORD Write Value */);
+ UINT32 Value,
+ UINT32 Flags);
UINT32
AcpiHwRegisterRead (
@@ -187,10 +194,6 @@ void
AcpiHwClearAcpiStatus (
void);
-UINT32
-AcpiHwGetBitShift (
- UINT32 Mask);
-
/* GPE support */
@@ -231,7 +234,7 @@ AcpiHwEnableNonWakeupGpes (
/* Sleep Prototypes */
ACPI_STATUS
-AcpiHwObtainSleepTypeRegisterData (
+AcpiHwGetSleepTypeData (
UINT8 SleepState,
UINT8 *Slp_TypA,
UINT8 *Slp_TypB);
diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h
index a917e15..3cbf6ef 100644
--- a/sys/contrib/dev/acpica/acinterp.h
+++ b/sys/contrib/dev/acpica/acinterp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 122 $
+ * $Revision: 132 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,7 +118,7 @@
#define __ACINTERP_H__
-#define WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
+#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
ACPI_STATUS
@@ -129,7 +129,7 @@ AcpiExResolveOperands (
/*
- * amxface - External interpreter interfaces
+ * exxface - External interpreter interfaces
*/
ACPI_STATUS
@@ -144,7 +144,7 @@ AcpiExExecuteMethod (
/*
- * amconvrt - object conversion
+ * exconvrt - object conversion
*/
ACPI_STATUS
@@ -169,13 +169,14 @@ AcpiExConvertToString (
ACPI_STATUS
AcpiExConvertToTargetType (
- ACPI_OBJECT_TYPE8 DestinationType,
- ACPI_OPERAND_OBJECT **ObjDesc,
+ ACPI_OBJECT_TYPE DestinationType,
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
ACPI_WALK_STATE *WalkState);
/*
- * amfield - ACPI AML (p-code) execution - field manipulation
+ * exfield - ACPI AML (p-code) execution - field manipulation
*/
ACPI_STATUS
@@ -246,7 +247,7 @@ AcpiExWriteDataToField (
ACPI_OPERAND_OBJECT *ObjDesc);
/*
- * ammisc - ACPI AML (p-code) execution - specific opcodes
+ * exmisc - ACPI AML (p-code) execution - specific opcodes
*/
ACPI_STATUS
@@ -268,6 +269,13 @@ AcpiExGetObjectReference (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
+AcpiExConcatTemplate (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualReturnDesc,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
AcpiExDoConcatenate (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT *ObjDesc2,
@@ -287,15 +295,6 @@ AcpiExDoMathOp (
ACPI_INTEGER Operand1);
ACPI_STATUS
-AcpiExLoadOp (
- ACPI_OPERAND_OBJECT *RgnDesc,
- ACPI_OPERAND_OBJECT *DdbHandle);
-
-ACPI_STATUS
-AcpiExUnloadTable (
- ACPI_OPERAND_OBJECT *DdbHandle);
-
-ACPI_STATUS
AcpiExCreateMutex (
ACPI_WALK_STATE *WalkState);
@@ -334,7 +333,33 @@ AcpiExCreateMethod (
/*
- * ammutex - mutex support
+ * exconfig - dynamic table load/unload
+ */
+
+ACPI_STATUS
+AcpiExAddTable (
+ ACPI_TABLE_HEADER *Table,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_OPERAND_OBJECT **DdbHandle);
+
+ACPI_STATUS
+AcpiExLoadOp (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *Target,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiExLoadTableOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **ReturnDesc);
+
+ACPI_STATUS
+AcpiExUnloadTable (
+ ACPI_OPERAND_OBJECT *DdbHandle);
+
+
+/*
+ * exmutex - mutex support
*/
ACPI_STATUS
@@ -362,7 +387,7 @@ AcpiExLinkMutex (
ACPI_THREAD_STATE *Thread);
/*
- * amprep - ACPI AML (p-code) execution - prep utilities
+ * exprep - ACPI AML (p-code) execution - prep utilities
*/
ACPI_STATUS
@@ -378,7 +403,7 @@ AcpiExPrepFieldValue (
ACPI_CREATE_FIELD_INFO *Info);
/*
- * amsystem - Interface to OS services
+ * exsystem - Interface to OS services
*/
ACPI_STATUS
@@ -386,11 +411,11 @@ AcpiExSystemDoNotifyOp (
ACPI_OPERAND_OBJECT *Value,
ACPI_OPERAND_OBJECT *ObjDesc);
-void
+ACPI_STATUS
AcpiExSystemDoSuspend(
UINT32 Time);
-void
+ACPI_STATUS
AcpiExSystemDoStall (
UINT32 Time);
@@ -423,7 +448,7 @@ AcpiExSystemWaitSemaphore (
/*
- * ammonadic - ACPI AML (p-code) execution, monadic operators
+ * exmonadic - ACPI AML (p-code) execution, monadic operators
*/
ACPI_STATUS
@@ -443,7 +468,7 @@ AcpiExOpcode_1A_1T_0R (
ACPI_WALK_STATE *WalkState);
/*
- * amdyadic - ACPI AML (p-code) execution, dyadic operators
+ * exdyadic - ACPI AML (p-code) execution, dyadic operators
*/
ACPI_STATUS
@@ -464,7 +489,7 @@ AcpiExOpcode_2A_2T_1R (
/*
- * amresolv - Object resolution and get value functions
+ * exresolv - Object resolution and get value functions
*/
ACPI_STATUS
@@ -484,7 +509,7 @@ AcpiExResolveObjectToValue (
/*
- * amdump - Scanner debug output routines
+ * exdump - Scanner debug output routines
*/
void
@@ -501,7 +526,7 @@ AcpiExDumpOperand (
void
AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **Operands,
- OPERATING_MODE InterpreterMode,
+ ACPI_INTERPRETER_MODE InterpreterMode,
NATIVE_CHAR *Ident,
UINT32 NumLevels,
NATIVE_CHAR *Note,
@@ -521,7 +546,7 @@ AcpiExDumpNode (
/*
- * amnames - interpreter/scanner name load/execute
+ * exnames - interpreter/scanner name load/execute
*/
NATIVE_CHAR *
@@ -540,7 +565,7 @@ AcpiExNameSegment (
ACPI_STATUS
AcpiExGetNameString (
- ACPI_OBJECT_TYPE8 DataType,
+ ACPI_OBJECT_TYPE DataType,
UINT8 *InAmlAddress,
NATIVE_CHAR **OutNameString,
UINT32 *OutNameLength);
@@ -548,11 +573,11 @@ AcpiExGetNameString (
ACPI_STATUS
AcpiExDoName (
ACPI_OBJECT_TYPE DataType,
- OPERATING_MODE LoadExecMode);
+ ACPI_INTERPRETER_MODE LoadExecMode);
/*
- * amstore - Object store support
+ * exstore - Object store support
*/
ACPI_STATUS
@@ -573,42 +598,36 @@ AcpiExStoreObjectToNode (
ACPI_NAMESPACE_NODE *Node,
ACPI_WALK_STATE *WalkState);
-ACPI_STATUS
-AcpiExStoreObjectToObject (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
- ACPI_WALK_STATE *WalkState);
-
/*
- *
+ * exstoren
*/
ACPI_STATUS
AcpiExResolveObject (
ACPI_OPERAND_OBJECT **SourceDescPtr,
- ACPI_OBJECT_TYPE8 TargetType,
+ ACPI_OBJECT_TYPE TargetType,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
-AcpiExStoreObject (
+AcpiExStoreObjectToObject (
ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OBJECT_TYPE8 TargetType,
- ACPI_OPERAND_OBJECT **TargetDescPtr,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_OPERAND_OBJECT **NewDesc,
ACPI_WALK_STATE *WalkState);
/*
- * amcopy - object copy
+ * excopy - object copy
*/
ACPI_STATUS
-AcpiExCopyBufferToBuffer (
+AcpiExStoreBufferToBuffer (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
ACPI_STATUS
-AcpiExCopyStringToString (
+AcpiExStoreStringToString (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
@@ -633,7 +652,7 @@ AcpiExCopyIntegerToBufferField (
ACPI_OPERAND_OBJECT *TargetDesc);
/*
- * amutils - interpreter/scanner utilities
+ * exutils - interpreter/scanner utilities
*/
ACPI_STATUS
@@ -678,7 +697,7 @@ AcpiExUnsignedIntegerToString (
/*
- * amregion - default OpRegion handlers
+ * exregion - default OpRegion handlers
*/
ACPI_STATUS
@@ -745,4 +764,13 @@ AcpiExSmBusSpaceHandler (
void *RegionContext);
+ACPI_STATUS
+AcpiExDataTableSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
+
#endif /* __INTERP_H__ */
diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h
index 3a3e77c..bd0b431 100644
--- a/sys/contrib/dev/acpica/aclocal.h
+++ b/sys/contrib/dev/acpica/aclocal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 145 $
+ * $Revision: 159 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -230,10 +230,10 @@ typedef struct AcpiMutexInfo
typedef UINT16 ACPI_OWNER_ID;
-#define OWNER_TYPE_TABLE 0x0
-#define OWNER_TYPE_METHOD 0x1
-#define FIRST_METHOD_ID 0x0000
-#define FIRST_TABLE_ID 0x8000
+#define ACPI_OWNER_TYPE_TABLE 0x0
+#define ACPI_OWNER_TYPE_METHOD 0x1
+#define ACPI_FIRST_METHOD_ID 0x0000
+#define ACPI_FIRST_TABLE_ID 0x8000
/* TBD: [Restructure] get rid of the need for this! */
@@ -258,11 +258,11 @@ typedef UINT16 ACPI_OWNER_ID;
typedef enum
{
- IMODE_LOAD_PASS1 = 0x01,
- IMODE_LOAD_PASS2 = 0x02,
- IMODE_EXECUTE = 0x0E
+ ACPI_IMODE_LOAD_PASS1 = 0x01,
+ ACPI_IMODE_LOAD_PASS2 = 0x02,
+ ACPI_IMODE_EXECUTE = 0x0E
-} OPERATING_MODE;
+} ACPI_INTERPRETER_MODE;
/*
@@ -275,7 +275,7 @@ typedef enum
typedef struct acpi_node
{
- UINT8 DataType;
+ UINT8 Descriptor; /* Used to differentiate object descriptor types */
UINT8 Type; /* Type associated with this name */
UINT16 OwnerId;
UINT32 Name; /* ACPI Name, always 4 chars per ACPI spec */
@@ -290,7 +290,7 @@ typedef struct acpi_node
} ACPI_NAMESPACE_NODE;
-#define ENTRY_NOT_FOUND NULL
+#define ACPI_ENTRY_NOT_FOUND NULL
/* Node flags */
@@ -335,13 +335,13 @@ typedef struct
ACPI_HANDLE *List;
UINT32 *Count;
-} FIND_CONTEXT;
+} ACPI_FIND_CONTEXT;
typedef struct
{
ACPI_NAMESPACE_NODE *Node;
-} NS_SEARCH_DATA;
+} ACPI_NS_SEARCH_DATA;
/*
@@ -350,10 +350,10 @@ typedef struct
typedef struct
{
NATIVE_CHAR *Name;
- ACPI_OBJECT_TYPE8 Type;
+ UINT8 Type;
NATIVE_CHAR *Val;
-} PREDEFINED_NAMES;
+} ACPI_PREDEFINED_NAMES;
/* Object types used during package copies */
@@ -395,33 +395,23 @@ typedef struct
} ACPI_CREATE_FIELD_INFO;
-
/*****************************************************************************
*
* Event typedefs and structs
*
****************************************************************************/
+/* Information about each GPE register block */
-/* Status bits. */
-
-#define ACPI_STATUS_PMTIMER 0x0001
-#define ACPI_STATUS_BUSMASTER 0x0010
-#define ACPI_STATUS_GLOBAL 0x0020
-#define ACPI_STATUS_POWER_BUTTON 0x0100
-#define ACPI_STATUS_SLEEP_BUTTON 0x0200
-#define ACPI_STATUS_RTC_ALARM 0x0400
-
-/* Enable bits. */
-
-#define ACPI_ENABLE_PMTIMER 0x0001
-#define ACPI_ENABLE_GLOBAL 0x0020
-#define ACPI_ENABLE_POWER_BUTTON 0x0100
-#define ACPI_ENABLE_SLEEP_BUTTON 0x0200
-#define ACPI_ENABLE_RTC_ALARM 0x0400
+typedef struct
+{
+ UINT16 RegisterCount;
+ UINT16 BlockAddress;
+ UINT8 BlockBaseNumber;
+} ACPI_GPE_BLOCK_INFO;
-/* Values and addresses of the GPE registers (both banks) */
+/* Information about a particular GPE register pair */
typedef struct
{
@@ -430,9 +420,9 @@ typedef struct
UINT8 Status; /* Current value of status reg */
UINT8 Enable; /* Current value of enable reg */
UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */
- UINT8 GpeBase; /* Base GPE number */
+ UINT8 BaseGpeNumber; /* Base GPE number for this register */
-} ACPI_GPE_REGISTERS;
+} ACPI_GPE_REGISTER_INFO;
#define ACPI_GPE_LEVEL_TRIGGERED 1
@@ -443,15 +433,22 @@ typedef struct
typedef struct
{
- UINT8 Type; /* Level or Edge */
-
ACPI_HANDLE MethodHandle; /* Method handle for direct (fast) execution */
ACPI_GPE_HANDLER Handler; /* Address of handler, if any */
void *Context; /* Context to be passed to handler */
+ UINT8 Type; /* Level or Edge */
+ UINT8 BitMask;
+
-} ACPI_GPE_LEVEL_INFO;
+} ACPI_GPE_NUMBER_INFO;
+typedef struct
+{
+ UINT8 NumberIndex;
+
+} ACPI_GPE_INDEX_INFO;
+
/* Information about each particular fixed event */
typedef struct
@@ -459,9 +456,18 @@ typedef struct
ACPI_EVENT_HANDLER Handler; /* Address of handler. */
void *Context; /* Context to be passed to handler */
-} ACPI_FIXED_EVENT_INFO;
+} ACPI_FIXED_EVENT_HANDLER;
+typedef struct
+{
+ UINT8 StatusRegisterId;
+ UINT8 EnableRegisterId;
+ UINT16 StatusBitMask;
+ UINT16 EnableBitMask;
+
+} ACPI_FIXED_EVENT_INFO;
+
/* Information used during field processing */
typedef struct
@@ -480,11 +486,11 @@ typedef struct
****************************************************************************/
-#define CONTROL_NORMAL 0xC0
-#define CONTROL_CONDITIONAL_EXECUTING 0xC1
-#define CONTROL_PREDICATE_EXECUTING 0xC2
-#define CONTROL_PREDICATE_FALSE 0xC3
-#define CONTROL_PREDICATE_TRUE 0xC4
+#define ACPI_CONTROL_NORMAL 0xC0
+#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
+#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
+#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
+#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
/* Forward declarations */
@@ -543,6 +549,8 @@ typedef struct acpi_control_state
ACPI_STATE_COMMON
struct acpi_parse_obj *PredicateOp;
UINT8 *AmlPredicateStart; /* Start of if/while predicate */
+ UINT8 *PackageEnd; /* End of if/while block */
+ UINT16 Opcode;
} ACPI_CONTROL_STATE;
@@ -571,7 +579,7 @@ typedef struct acpi_pscope_state
/*
- * Thread state - one per thread across multiple walk states. Multiple walk
+ * Thread state - one per thread across multiple walk states. Multiple walk
* states are created when there are nested control methods executing.
*/
typedef struct acpi_thread_state
@@ -671,7 +679,6 @@ typedef struct acpi_opcode_info
UINT8 Class; /* Opcode class */
UINT8 Type; /* Opcode type */
-
} ACPI_OPCODE_INFO;
@@ -698,7 +705,7 @@ typedef union acpi_parse_val
UINT32 AmlOffset; /* offset of declaration in AML */\
struct acpi_parse_obj *Parent; /* parent op */\
struct acpi_parse_obj *Next; /* next op */\
- DEBUG_ONLY_MEMBERS (\
+ ACPI_DEBUG_ONLY_MEMBERS (\
NATIVE_CHAR OpName[16]) /* op name (debug only) */\
/* NON-DEBUG members below: */\
ACPI_NAMESPACE_NODE *Node; /* for use by interpreter */\
@@ -740,149 +747,143 @@ typedef struct acpi_parse_state
UINT8 *AmlEnd; /* (last + 1) AML byte */
UINT8 *PkgStart; /* current package begin */
UINT8 *PkgEnd; /* current package end */
-
struct acpi_parse_obj *StartOp; /* root of parse tree */
struct acpi_node *StartNode;
union acpi_gen_state *Scope; /* current scope */
+ struct acpi_parse_obj *StartScope;
+} ACPI_PARSE_STATE;
- struct acpi_parse_obj *StartScope;
+/* Parse object flags */
-} ACPI_PARSE_STATE;
+#define ACPI_PARSEOP_GENERIC 0x01
+#define ACPI_PARSEOP_NAMED 0x02
+#define ACPI_PARSEOP_DEFERRED 0x04
+#define ACPI_PARSEOP_BYTELIST 0x08
+#define ACPI_PARSEOP_IN_CACHE 0x80
/*****************************************************************************
*
- * Hardware and PNP
+ * Hardware (ACPI registers) and PNP
*
****************************************************************************/
+#define PCI_ROOT_HID_STRING "PNP0A03"
-/* PCI */
-#define PCI_ROOT_HID_STRING "PNP0A03"
-
-/*
- * The #define's and enum below establish an abstract way of identifying what
- * register block and register is to be accessed. Do not change any of the
- * values as they are used in switch statements and offset calculations.
- */
-
-#define REGISTER_BLOCK_MASK 0xFF00 /* Register Block Id */
-#define BIT_IN_REGISTER_MASK 0x00FF /* Bit Id in the Register Block Id */
-#define BYTE_IN_REGISTER_MASK 0x00FF /* Register Offset in the Register Block */
-
-#define REGISTER_BLOCK_ID(RegId) (RegId & REGISTER_BLOCK_MASK)
-#define REGISTER_BIT_ID(RegId) (RegId & BIT_IN_REGISTER_MASK)
-#define REGISTER_OFFSET(RegId) (RegId & BYTE_IN_REGISTER_MASK)
-
-/*
- * Access Rule
- * To access a Register Bit:
- * -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum.
- *
- * To access a Register:
- * -> Use Register Id (= Register Block Id | Register Offset)
- */
+typedef struct
+{
+ UINT8 ParentRegister;
+ UINT8 BitPosition;
+ UINT16 AccessBitMask;
+} ACPI_BIT_REGISTER_INFO;
-/*
- * Register Block Id
- */
-#define PM1_STS 0x0100
-#define PM1_EN 0x0200
-#define PM1_CONTROL 0x0300
-#define PM1A_CONTROL 0x0400
-#define PM1B_CONTROL 0x0500
-#define PM2_CONTROL 0x0600
-#define PM_TIMER 0x0700
-#define PROCESSOR_BLOCK 0x0800
-#define GPE0_STS_BLOCK 0x0900
-#define GPE0_EN_BLOCK 0x0A00
-#define GPE1_STS_BLOCK 0x0B00
-#define GPE1_EN_BLOCK 0x0C00
-#define SMI_CMD_BLOCK 0x0D00
/*
- * Address space bitmasks for mmio or io spaces
+ * Register IDs
+ * These are the full ACPI registers
*/
+#define ACPI_REGISTER_PM1_STATUS 0x01
+#define ACPI_REGISTER_PM1_ENABLE 0x02
+#define ACPI_REGISTER_PM1_CONTROL 0x03
+#define ACPI_REGISTER_PM1A_CONTROL 0x04
+#define ACPI_REGISTER_PM1B_CONTROL 0x05
+#define ACPI_REGISTER_PM2_CONTROL 0x06
+#define ACPI_REGISTER_PM_TIMER 0x07
+#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
+#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
-#define SMI_CMD_ADDRESS_SPACE 0x01
-#define PM1_BLK_ADDRESS_SPACE 0x02
-#define PM2_CNT_BLK_ADDRESS_SPACE 0x04
-#define PM_TMR_BLK_ADDRESS_SPACE 0x08
-#define GPE0_BLK_ADDRESS_SPACE 0x10
-#define GPE1_BLK_ADDRESS_SPACE 0x20
/*
- * Control bit definitions
+ * BitRegister IDs
+ * These are bitfields defined within the full ACPI registers
*/
-#define TMR_STS (PM1_STS | 0x01)
-#define BM_STS (PM1_STS | 0x02)
-#define GBL_STS (PM1_STS | 0x03)
-#define PWRBTN_STS (PM1_STS | 0x04)
-#define SLPBTN_STS (PM1_STS | 0x05)
-#define RTC_STS (PM1_STS | 0x06)
-#define WAK_STS (PM1_STS | 0x07)
-
-#define TMR_EN (PM1_EN | 0x01)
- /* no BM_EN */
-#define GBL_EN (PM1_EN | 0x03)
-#define PWRBTN_EN (PM1_EN | 0x04)
-#define SLPBTN_EN (PM1_EN | 0x05)
-#define RTC_EN (PM1_EN | 0x06)
-#define WAK_EN (PM1_EN | 0x07)
-
-#define SCI_EN (PM1_CONTROL | 0x01)
-#define BM_RLD (PM1_CONTROL | 0x02)
-#define GBL_RLS (PM1_CONTROL | 0x03)
-#define SLP_TYPE_A (PM1_CONTROL | 0x04)
-#define SLP_TYPE_B (PM1_CONTROL | 0x05)
-#define SLP_EN (PM1_CONTROL | 0x06)
-
-#define ARB_DIS (PM2_CONTROL | 0x01)
-
-#define TMR_VAL (PM_TIMER | 0x01)
-
-#define GPE0_STS (GPE0_STS_BLOCK | 0x01)
-#define GPE0_EN (GPE0_EN_BLOCK | 0x01)
-
-#define GPE1_STS (GPE1_STS_BLOCK | 0x01)
-#define GPE1_EN (GPE1_EN_BLOCK | 0x01)
-
-
-#define TMR_STS_MASK 0x0001
-#define BM_STS_MASK 0x0010
-#define GBL_STS_MASK 0x0020
-#define PWRBTN_STS_MASK 0x0100
-#define SLPBTN_STS_MASK 0x0200
-#define RTC_STS_MASK 0x0400
-#define WAK_STS_MASK 0x8000
-
-#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \
- | PWRBTN_STS_MASK | SLPBTN_STS_MASK \
- | RTC_STS_MASK | WAK_STS_MASK)
-
-#define TMR_EN_MASK 0x0001
-#define GBL_EN_MASK 0x0020
-#define PWRBTN_EN_MASK 0x0100
-#define SLPBTN_EN_MASK 0x0200
-#define RTC_EN_MASK 0x0400
-
-#define SCI_EN_MASK 0x0001
-#define BM_RLD_MASK 0x0002
-#define GBL_RLS_MASK 0x0004
-#define SLP_TYPE_X_MASK 0x1C00
-#define SLP_EN_MASK 0x2000
-
-#define ARB_DIS_MASK 0x0001
-#define TMR_VAL_MASK 0xFFFFFFFF
-
-#define GPE0_STS_MASK
-#define GPE0_EN_MASK
-
-#define GPE1_STS_MASK
-#define GPE1_EN_MASK
+#define ACPI_BITREG_TIMER_STATUS 0x00
+#define ACPI_BITREG_BUS_MASTER_STATUS 0x01
+#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
+#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
+#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
+#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
+#define ACPI_BITREG_WAKE_STATUS 0x06
+
+#define ACPI_BITREG_TIMER_ENABLE 0x07
+#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08
+#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09
+#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A
+#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B
+#define ACPI_BITREG_WAKE_ENABLE 0x0C
+
+#define ACPI_BITREG_SCI_ENABLE 0x0D
+#define ACPI_BITREG_BUS_MASTER_RLD 0x0E
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F
+#define ACPI_BITREG_SLEEP_TYPE_A 0x10
+#define ACPI_BITREG_SLEEP_TYPE_B 0x11
+#define ACPI_BITREG_SLEEP_ENABLE 0x12
+
+#define ACPI_BITREG_ARB_DISABLE 0x13
+
+#define ACPI_BITREG_MAX 0x13
+#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
+
+
+/* Masks used to access the BitRegisters */
+
+#define ACPI_BITMASK_TIMER_STATUS 0x0001
+#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
+#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
+#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
+#define ACPI_BITMASK_WAKE_STATUS 0x8000
+
+#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
+ ACPI_BITMASK_BUS_MASTER_STATUS | \
+ ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
+ ACPI_BITMASK_POWER_BUTTON_STATUS | \
+ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
+ ACPI_BITMASK_RT_CLOCK_STATUS | \
+ ACPI_BITMASK_WAKE_STATUS)
+
+#define ACPI_BITMASK_TIMER_ENABLE 0x0001
+#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
+#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
+#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
+
+#define ACPI_BITMASK_SCI_ENABLE 0x0001
+#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
+#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
+#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
+#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
+
+#define ACPI_BITMASK_ARB_DISABLE 0x0001
+
+
+/* Raw bit position of each BitRegister */
+
+#define ACPI_BITPOSITION_TIMER_STATUS 0x00
+#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
+#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
+#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
+#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
+
+#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
+#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
+#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
+
+#define ACPI_BITPOSITION_SCI_ENABLE 0x00
+#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
+#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
+#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
+#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
+
+#define ACPI_BITPOSITION_ARB_DISABLE 0x00
/*****************************************************************************
@@ -894,45 +895,45 @@ typedef struct acpi_parse_state
/* ResourceType values */
-#define RESOURCE_TYPE_MEMORY_RANGE 0
-#define RESOURCE_TYPE_IO_RANGE 1
-#define RESOURCE_TYPE_BUS_NUMBER_RANGE 2
+#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
+#define ACPI_RESOURCE_TYPE_IO_RANGE 1
+#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
/* Resource descriptor types and masks */
-#define RESOURCE_DESC_TYPE_LARGE 0x80
-#define RESOURCE_DESC_TYPE_SMALL 0x00
+#define ACPI_RDESC_TYPE_LARGE 0x80
+#define ACPI_RDESC_TYPE_SMALL 0x00
-#define RESOURCE_DESC_TYPE_MASK 0x80
-#define RESOURCE_DESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
+#define ACPI_RDESC_TYPE_MASK 0x80
+#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
/*
* Small resource descriptor types
* Note: The 3 length bits (2:0) must be zero
*/
-#define RESOURCE_DESC_IRQ_FORMAT 0x20
-#define RESOURCE_DESC_DMA_FORMAT 0x28
-#define RESOURCE_DESC_START_DEPENDENT 0x30
-#define RESOURCE_DESC_END_DEPENDENT 0x38
-#define RESOURCE_DESC_IO_PORT 0x40
-#define RESOURCE_DESC_FIXED_IO_PORT 0x48
-#define RESOURCE_DESC_SMALL_VENDOR 0x70
-#define RESOURCE_DESC_END_TAG 0x78
+#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
+#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
+#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
+#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
+#define ACPI_RDESC_TYPE_IO_PORT 0x40
+#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
+#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
+#define ACPI_RDESC_TYPE_END_TAG 0x78
/*
* Large resource descriptor types
*/
-#define RESOURCE_DESC_MEMORY_24 0x81
-#define RESOURCE_DESC_GENERAL_REGISTER 0x82
-#define RESOURCE_DESC_LARGE_VENDOR 0x84
-#define RESOURCE_DESC_MEMORY_32 0x85
-#define RESOURCE_DESC_FIXED_MEMORY_32 0x86
-#define RESOURCE_DESC_DWORD_ADDRESS_SPACE 0x87
-#define RESOURCE_DESC_WORD_ADDRESS_SPACE 0x88
-#define RESOURCE_DESC_EXTENDED_XRUPT 0x89
-#define RESOURCE_DESC_QWORD_ADDRESS_SPACE 0x8A
+#define ACPI_RDESC_TYPE_MEMORY_24 0x81
+#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
+#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
+#define ACPI_RDESC_TYPE_MEMORY_32 0x85
+#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
+#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
+#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
+#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
+#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
/* String version of device HIDs and UIDs */
@@ -952,7 +953,7 @@ typedef struct
*
****************************************************************************/
-#define ASCII_ZERO 0x30
+#define ACPI_ASCII_ZERO 0x30
/*****************************************************************************
*
@@ -969,7 +970,12 @@ typedef struct dbmethodinfo
UINT32 NumLoops;
NATIVE_CHAR Pathname[128];
-} DB_METHOD_INFO;
+} ACPI_DB_METHOD_INFO;
+
+
+#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
+#define ACPI_DB_CONSOLE_OUTPUT 0x02
+#define ACPI_DB_DUPLICATE_OUTPUT 0x03
/*****************************************************************************
@@ -989,10 +995,9 @@ typedef struct
/* Entry for a memory allocation (debug only) */
-
-#define MEM_MALLOC 0
-#define MEM_CALLOC 1
-#define MAX_MODULE_NAME 16
+#define ACPI_MEM_MALLOC 0
+#define ACPI_MEM_CALLOC 1
+#define ACPI_MAX_MODULE_NAME 16
#define ACPI_COMMON_DEBUG_MEM_HEADER \
struct AcpiDebugMemBlock *Previous; \
@@ -1000,10 +1005,9 @@ typedef struct
UINT32 Size; \
UINT32 Component; \
UINT32 Line; \
- NATIVE_CHAR Module[MAX_MODULE_NAME]; \
+ NATIVE_CHAR Module[ACPI_MAX_MODULE_NAME]; \
UINT8 AllocType;
-
typedef struct
{
ACPI_COMMON_DEBUG_MEM_HEADER
diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h
index e73f8c7..d730eca 100644
--- a/sys/contrib/dev/acpica/acmacros.h
+++ b/sys/contrib/dev/acpica/acmacros.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 100 $
+ * $Revision: 115 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,37 +122,10 @@
* Data manipulation macros
*/
-#ifndef LOWORD
-#define LOWORD(l) ((UINT16)(NATIVE_UINT)(l))
-#endif
-
-#ifndef HIWORD
-#define HIWORD(l) ((UINT16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF))
-#endif
-
-#ifndef LOBYTE
-#define LOBYTE(l) ((UINT8)(UINT16)(l))
-#endif
-
-#ifndef HIBYTE
-#define HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF))
-#endif
-
-#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0)
-#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0)
-#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0)
-
-#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0)
-#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0)
-#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0)
-#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0)
-#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0)
-
-#define LOW_BASE(w) ((UINT16) ((w) & 0x0000FFFF))
-#define MID_BASE(b) ((UINT8) (((b) & 0x00FF0000) >> 16))
-#define HI_BASE(b) ((UINT8) (((b) & 0xFF000000) >> 24))
-#define LOW_LIMIT(w) ((UINT16) ((w) & 0x0000FFFF))
-#define HI_LIMIT(b) ((UINT8) (((b) & 0x00FF0000) >> 16))
+#define ACPI_LOWORD(l) ((UINT16)(NATIVE_UINT)(l))
+#define ACPI_HIWORD(l) ((UINT16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF))
+#define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l))
+#define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF))
#ifdef _IA16
@@ -160,13 +133,8 @@
* For 16-bit addresses, we have to assume that the upper 32 bits
* are zero.
*/
-#ifndef LODWORD
-#define LODWORD(l) (l)
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l) (0)
-#endif
+#define ACPI_LODWORD(l) (l)
+#define ACPI_HIDWORD(l) (0)
#define ACPI_GET_ADDRESS(a) ((a).Lo)
#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(b);}
@@ -177,13 +145,8 @@
/*
* ACPI_INTEGER is 32-bits, no 64-bit support on this platform
*/
-#ifndef LODWORD
-#define LODWORD(l) ((UINT32)(l))
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l) (0)
-#endif
+#define ACPI_LODWORD(l) ((UINT32)(l))
+#define ACPI_HIDWORD(l) (0)
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
@@ -194,13 +157,8 @@
/*
* Full 64-bit address/integer on both 32-bit and 64-bit platforms
*/
-#ifndef LODWORD
-#define LODWORD(l) ((UINT32)(UINT64)(l))
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(&l))).Hi))
-#endif
+#define ACPI_LODWORD(l) ((UINT32)(UINT64)(l))
+#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(&l))).Hi))
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
@@ -212,13 +170,28 @@
* Extract a byte of data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below
*/
-#define GET8(addr) (*(UINT8*)(addr))
+#define ACPI_GET8(addr) (*(UINT8*)(addr))
/* Pointer arithmetic */
+#define ACPI_PTR_ADD(t,a,b) (t *) ((char *)(a) + (b))
+#define ACPI_PTR_DIFF(a,b) (NATIVE_UINT) ((char *)(a) - (char *)(b))
+
+/* Pointer/Integer type conversions */
+
+#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void,NULL,(NATIVE_UINT)i)
+#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,NULL)
+#define ACPI_OFFSET(d,o) ((ACPI_SIZE) ACPI_TO_INTEGER (&(((d *)0)->o)))
+#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
-#define POINTER_ADD(t,a,b) (t *) ((NATIVE_UINT)(a) + (NATIVE_UINT)(b))
-#define POINTER_DIFF(a,b) ((UINT32) ((NATIVE_UINT)(a) - (NATIVE_UINT)(b)))
+
+#ifdef _IA16
+#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
+#define ACPI_PTR_TO_PHYSADDR(i) (char *)(i)
+#else
+#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
+#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
+#endif
/*
* Macros for moving data around to/from buffers that are possibly unaligned.
@@ -230,10 +203,10 @@
/* The hardware supports unaligned transfers, just do the move */
-#define MOVE_UNALIGNED16_TO_16(d,s) *(UINT16*)(d) = *(UINT16*)(s)
-#define MOVE_UNALIGNED32_TO_32(d,s) *(UINT32*)(d) = *(UINT32*)(s)
-#define MOVE_UNALIGNED16_TO_32(d,s) *(UINT32*)(d) = *(UINT16*)(s)
-#define MOVE_UNALIGNED64_TO_64(d,s) *(UINT64*)(d) = *(UINT64*)(s)
+#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(UINT16 *)(d) = *(UINT16 *)(s)
+#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(UINT32 *)(d) = *(UINT32 *)(s)
+#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(UINT32 *)(d) = *(UINT16 *)(s)
+#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(UINT64 *)(d) = *(UINT64 *)(s)
#else
/*
@@ -242,24 +215,24 @@
* the destination (or both) is/are unaligned.
*/
-#define MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\
- ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];}
+#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\
+ ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];}
-#define MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\
- ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\
- ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\
- ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];}
+#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\
+ ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\
+ ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\
+ ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];}
-#define MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);}
+#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);}
-#define MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\
- ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\
- ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\
- ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];\
- ((UINT8 *)(d))[4] = ((UINT8 *)(s))[4];\
- ((UINT8 *)(d))[5] = ((UINT8 *)(s))[5];\
- ((UINT8 *)(d))[6] = ((UINT8 *)(s))[6];\
- ((UINT8 *)(d))[7] = ((UINT8 *)(s))[7];}
+#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\
+ ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\
+ ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\
+ ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];\
+ ((UINT8 *)(d))[4] = ((UINT8 *)(s))[4];\
+ ((UINT8 *)(d))[5] = ((UINT8 *)(s))[5];\
+ ((UINT8 *)(d))[6] = ((UINT8 *)(s))[6];\
+ ((UINT8 *)(d))[7] = ((UINT8 *)(s))[7];}
#endif
@@ -268,52 +241,50 @@
* Fast power-of-two math macros for non-optimized compilers
*/
-#define _DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2)))
-#define _MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2)))
-#define _MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1)))
+#define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2)))
+#define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2)))
+#define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1)))
-#define DIV_2(a) _DIV(a,1)
-#define MUL_2(a) _MUL(a,1)
-#define MOD_2(a) _MOD(a,2)
+#define ACPI_DIV_2(a) _ACPI_DIV(a,1)
+#define ACPI_MUL_2(a) _ACPI_MUL(a,1)
+#define ACPI_MOD_2(a) _ACPI_MOD(a,2)
-#define DIV_4(a) _DIV(a,2)
-#define MUL_4(a) _MUL(a,2)
-#define MOD_4(a) _MOD(a,4)
+#define ACPI_DIV_4(a) _ACPI_DIV(a,2)
+#define ACPI_MUL_4(a) _ACPI_MUL(a,2)
+#define ACPI_MOD_4(a) _ACPI_MOD(a,4)
-#define DIV_8(a) _DIV(a,3)
-#define MUL_8(a) _MUL(a,3)
-#define MOD_8(a) _MOD(a,8)
+#define ACPI_DIV_8(a) _ACPI_DIV(a,3)
+#define ACPI_MUL_8(a) _ACPI_MUL(a,3)
+#define ACPI_MOD_8(a) _ACPI_MOD(a,8)
-#define DIV_16(a) _DIV(a,4)
-#define MUL_16(a) _MUL(a,4)
-#define MOD_16(a) _MOD(a,16)
+#define ACPI_DIV_16(a) _ACPI_DIV(a,4)
+#define ACPI_MUL_16(a) _ACPI_MUL(a,4)
+#define ACPI_MOD_16(a) _ACPI_MOD(a,16)
/*
* Rounding macros (Power of two boundaries only)
*/
-#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
-#define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1)))
+#define ACPI_ROUND_DOWN(value,boundary) (((NATIVE_UINT)(value)) & (~((boundary)-1)))
+#define ACPI_ROUND_UP(value,boundary) ((((NATIVE_UINT)(value)) + ((boundary)-1)) & (~((boundary)-1)))
-#define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4)
-#define ROUND_DOWN_TO_64_BITS(a) ROUND_DOWN(a,8)
-#define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
+#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
+#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
-#define ROUND_UP_TO_32BITS(a) ROUND_UP(a,4)
-#define ROUND_UP_TO_64BITS(a) ROUND_UP(a,8)
-#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+#define ACPI_ROUND_UP_TO_32BITS(a) ACPI_ROUND_UP(a,4)
+#define ACPI_ROUND_UP_TO_64BITS(a) ACPI_ROUND_UP(a,8)
+#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
-#define ROUND_PTR_UP_TO_4(a,b) ((b *)(((NATIVE_UINT)(a) + 3) & ~3))
-#define ROUND_PTR_UP_TO_8(a,b) ((b *)(((NATIVE_UINT)(a) + 7) & ~7))
-#define ROUND_BITS_UP_TO_BYTES(a) DIV_8((a) + 7)
-#define ROUND_BITS_DOWN_TO_BYTES(a) DIV_8((a))
+#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
+#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
-#define ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
+#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
/* Generic (non-power-of-two) rounding */
-#define ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
+#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
/*
* Bitmask creation
@@ -321,9 +292,10 @@
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
-#define MASK_BITS_ABOVE(position) (~(((ACPI_INTEGER)(-1)) << ((UINT32) (position))))
-#define MASK_BITS_BELOW(position) (((ACPI_INTEGER)(-1)) << ((UINT32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position) (~(((ACPI_INTEGER)(-1)) << ((UINT32) (position))))
+#define ACPI_MASK_BITS_BELOW(position) (((ACPI_INTEGER)(-1)) << ((UINT32) (position)))
+#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
/* Macros for GAS addressing */
@@ -347,23 +319,30 @@
#endif
+
+/* Bitfields within ACPI registers */
+
+#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask)
+#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
+
/*
* An ACPI_NAMESPACE_NODE * can appear in some contexts,
* where a pointer to an ACPI_OPERAND_OBJECT can also
* appear. This macro is used to distinguish them.
*
- * The DataType field is the first field in both structures.
+ * The "Descriptor" field is the first field in both structures.
*/
-#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->DataType == t)
+#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_NAMESPACE_NODE *)d)->Descriptor)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->Descriptor = t)
/* Macro to test the object type */
-#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OPERAND_OBJECT *)d)->Common.Type == (UINT8)t)
+#define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)d)->Common.Type)
/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
-#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
+#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
/*
* Macro to check if a pointer is within an ACPI table.
@@ -372,11 +351,11 @@
* and ((UINT8 *)b+b->Length) points one byte past the end of the table.
*/
#ifndef _IA16
-#define IS_IN_ACPI_TABLE(a,b) (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\
- ((UINT8 *)(a) < ((UINT8 *)b + b->Length)))
+#define ACPI_IS_IN_ACPI_TABLE(a,b) (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\
+ ((UINT8 *)(a) < ((UINT8 *)b + b->Length)))
#else
-#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\
+#define ACPI_IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\
(((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\
((UINT8 *)(a) < ((UINT8 *)b + b->Length)))
#endif
@@ -426,7 +405,7 @@
* 5) Expand address to 64 bits
*/
#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) {a.AddressSpaceId = (UINT8) d;\
- a.RegisterBitWidth = (UINT8) MUL_8 (b);\
+ a.RegisterBitWidth = (UINT8) ACPI_MUL_8 (b);\
a.RegisterBitOffset = 0;\
a.Reserved = 0;\
ACPI_STORE_ADDRESS (a.Address,c);}
@@ -440,7 +419,7 @@
* Reporting macros that are never compiled out
*/
-#define PARAM_LIST(pl) pl
+#define ACPI_PARAM_LIST(pl) pl
/*
* Error reporting. These versions add callers module and line#. Since
@@ -450,32 +429,32 @@
#ifdef ACPI_DEBUG
-#define REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \
- AcpiOsPrintf PARAM_LIST(fp);}
-#define REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \
- AcpiOsPrintf PARAM_LIST(fp);}
-#define REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \
- AcpiOsPrintf PARAM_LIST(fp);}
+#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
#else
-#define REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf PARAM_LIST(fp);}
-#define REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf PARAM_LIST(fp);}
-#define REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf PARAM_LIST(fp);}
+#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
#endif
/* Error reporting. These versions pass thru the module and line# */
-#define _REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \
- AcpiOsPrintf PARAM_LIST(fp);}
-#define _REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \
- AcpiOsPrintf PARAM_LIST(fp);}
-#define _REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \
- AcpiOsPrintf PARAM_LIST(fp);}
+#define _ACPI_REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \
+ AcpiOsPrintf ACPI_PARAM_LIST(fp);}
/*
* Debug macros that are conditionally compiled
@@ -483,7 +462,7 @@
#ifdef ACPI_DEBUG
-#define MODULE_NAME(name) static char *_THIS_MODULE = name;
+#define ACPI_MODULE_NAME(name) static char *_THIS_MODULE = name;
/*
* Function entry tracing.
@@ -491,21 +470,21 @@
* as a local string ("_ProcName) so that it can be also used by the function exit macros below.
*/
-#define PROC_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \
+#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \
_Dbg.ComponentId = _COMPONENT; \
_Dbg.ProcName = a; \
_Dbg.ModuleName = _THIS_MODULE;
-#define FUNCTION_TRACE(a) PROC_NAME(a)\
- AcpiUtTrace(__LINE__,&_Dbg)
-#define FUNCTION_TRACE_PTR(a,b) PROC_NAME(a)\
- AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b)
-#define FUNCTION_TRACE_U32(a,b) PROC_NAME(a)\
- AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b)
-#define FUNCTION_TRACE_STR(a,b) PROC_NAME(a)\
- AcpiUtTraceStr(__LINE__,&_Dbg,(NATIVE_CHAR *)b)
+#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a)\
+ AcpiUtTrace(__LINE__,&_Dbg)
+#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a)\
+ AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a)\
+ AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a)\
+ AcpiUtTraceStr(__LINE__,&_Dbg,(NATIVE_CHAR *)b)
-#define FUNCTION_ENTRY() AcpiUtTrackStackPtr()
+#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
/*
* Function exit tracing.
@@ -522,38 +501,39 @@
/* Conditional execution */
-#define DEBUG_EXEC(a) a
-#define NORMAL_EXEC(a)
+#define ACPI_DEBUG_EXEC(a) a
+#define ACPI_NORMAL_EXEC(a)
-#define DEBUG_DEFINE(a) a;
-#define DEBUG_ONLY_MEMBERS(a) a;
+#define ACPI_DEBUG_DEFINE(a) a;
+#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
#define _OPCODE_NAMES
#define _VERBOSE_STRUCTURES
/* Stack and buffer dumping */
-#define DUMP_STACK_ENTRY(a) AcpiExDumpOperand(a)
-#define DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__)
-#define DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b)
-#define DUMP_TABLES(a,b) AcpiNsDumpTables(a,b)
-#define DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d)
-#define DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a)
-#define DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
-#define BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a))
+#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b)
+#define ACPI_DUMP_TABLES(a,b) AcpiNsDumpTables(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a)
+#define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a))
/*
* Generate INT3 on ACPI_ERROR (Debug only!)
*/
-#define ERROR_BREAK
-#ifdef ERROR_BREAK
-#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
+#define ACPI_ERROR_BREAK
+#ifdef ACPI_ERROR_BREAK
+#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
+ AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
#else
-#define BREAK_ON_ERROR(lvl)
+#define ACPI_BREAK_ON_ERROR(lvl)
#endif
/*
@@ -563,8 +543,8 @@
* 2) Debug error level or trace level for the print statement is enabled
*/
-#define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint PARAM_LIST(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl)
#else
@@ -573,33 +553,33 @@
* leaving no executable debug code!
*/
-#define MODULE_NAME(name)
+#define ACPI_MODULE_NAME(name)
#define _THIS_MODULE ""
-#define DEBUG_EXEC(a)
-#define NORMAL_EXEC(a) a;
-
-#define DEBUG_DEFINE(a)
-#define DEBUG_ONLY_MEMBERS(a)
-#define PROC_NAME(a)
-#define FUNCTION_TRACE(a)
-#define FUNCTION_TRACE_PTR(a,b)
-#define FUNCTION_TRACE_U32(a,b)
-#define FUNCTION_TRACE_STR(a,b)
-#define FUNCTION_EXIT
-#define FUNCTION_STATUS_EXIT(s)
-#define FUNCTION_VALUE_EXIT(s)
-#define FUNCTION_ENTRY()
-#define DUMP_STACK_ENTRY(a)
-#define DUMP_OPERANDS(a,b,c,d,e)
-#define DUMP_ENTRY(a,b)
-#define DUMP_TABLES(a,b)
-#define DUMP_PATHNAME(a,b,c,d)
-#define DUMP_RESOURCE_LIST(a)
-#define DUMP_BUFFER(a,b)
+#define ACPI_DEBUG_EXEC(a)
+#define ACPI_NORMAL_EXEC(a) a;
+
+#define ACPI_DEBUG_DEFINE(a)
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
+#define ACPI_FUNCTION_NAME(a)
+#define ACPI_FUNCTION_TRACE(a)
+#define ACPI_FUNCTION_TRACE_PTR(a,b)
+#define ACPI_FUNCTION_TRACE_U32(a,b)
+#define ACPI_FUNCTION_TRACE_STR(a,b)
+#define ACPI_FUNCTION_EXIT
+#define ACPI_FUNCTION_STATUS_EXIT(s)
+#define ACPI_FUNCTION_VALUE_EXIT(s)
+#define ACPI_FUNCTION_ENTRY()
+#define ACPI_DUMP_STACK_ENTRY(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
+#define ACPI_DUMP_ENTRY(a,b)
+#define ACPI_DUMP_TABLES(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a)
+#define ACPI_DUMP_BUFFER(a,b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
-#define BREAK_MSG(a)
+#define ACPI_BREAK_MSG(a)
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
@@ -614,9 +594,9 @@
* DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not.
*/
#ifdef ENABLE_DEBUGGER
-#define DEBUGGER_EXEC(a) a
+#define ACPI_DEBUGGER_EXEC(a) a
#else
-#define DEBUGGER_EXEC(a)
+#define ACPI_DEBUGGER_EXEC(a)
#endif
@@ -625,9 +605,9 @@
* we are using ACPI_DEBUG to get the debug output
*/
#ifdef _IA16
-#undef DEBUG_ONLY_MEMBERS
+#undef ACPI_DEBUG_ONLY_MEMBERS
#undef _VERBOSE_STRUCTURES
-#define DEBUG_ONLY_MEMBERS(a)
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
#endif
@@ -636,11 +616,11 @@
* 1) Set name to blanks
* 2) Copy the object name
*/
-#define ADD_OBJECT_NAME(a,b) MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\
- STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name))
+#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\
+ ACPI_STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name))
#else
-#define ADD_OBJECT_NAME(a,b)
+#define ACPI_ADD_OBJECT_NAME(a,b)
#endif
@@ -652,8 +632,8 @@
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiOsAllocate(a)
-#define ACPI_MEM_CALLOCATE(a) AcpiOsCallocate(a)
+#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
#define ACPI_MEM_FREE(a) AcpiOsFree(a)
#define ACPI_MEM_TRACKING(a)
@@ -662,9 +642,9 @@
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a) AcpiUtFree(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack(a, _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__)
#define ACPI_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h
index 2c94fa4..e45c93a 100644
--- a/sys/contrib/dev/acpica/acnamesp.h
+++ b/sys/contrib/dev/acpica/acnamesp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 115 $
+ * $Revision: 123 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,37 +120,37 @@
/* To search the entire name space, pass this as SearchBase */
-#define NS_ALL ((ACPI_HANDLE)0)
+#define ACPI_NS_ALL ((ACPI_HANDLE)0)
/*
* Elements of AcpiNsProperties are bit significant
* and should be one-to-one with values of ACPI_OBJECT_TYPE
*/
-#define NSP_NORMAL 0
-#define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */
-#define NSP_LOCAL 2 /* suppress search of enclosing scopes */
+#define ACPI_NS_NORMAL 0
+#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
+#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
/* Definitions of the predefined namespace names */
-#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */
-#define ACPI_ROOT_NAME (UINT32) 0x2F202020 /* Root name is "/ " */
-#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */
+#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */
+#define ACPI_ROOT_NAME (UINT32) 0x2F202020 /* Root name is "/ " */
+#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */
-#define NS_ROOT_PATH "\\"
-#define NS_SYSTEM_BUS "_SB_"
+#define ACPI_NS_ROOT_PATH "\\"
+#define ACPI_NS_SYSTEM_BUS "_SB_"
/* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */
-#define NS_NO_UPSEARCH 0
-#define NS_SEARCH_PARENT 0x01
-#define NS_DONT_OPEN_SCOPE 0x02
-#define NS_NO_PEER_SEARCH 0x04
-#define NS_ERROR_IF_FOUND 0x08
+#define ACPI_NS_NO_UPSEARCH 0
+#define ACPI_NS_SEARCH_PARENT 0x01
+#define ACPI_NS_DONT_OPEN_SCOPE 0x02
+#define ACPI_NS_NO_PEER_SEARCH 0x04
+#define ACPI_NS_ERROR_IF_FOUND 0x08
-#define NS_WALK_UNLOCK TRUE
-#define NS_WALK_NO_UNLOCK FALSE
+#define ACPI_NS_WALK_UNLOCK TRUE
+#define ACPI_NS_WALK_NO_UNLOCK FALSE
ACPI_STATUS
@@ -185,7 +185,7 @@ AcpiNsInitOneObject (
ACPI_STATUS
AcpiNsWalkNamespace (
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
BOOLEAN UnlockBeforeCallback,
@@ -195,7 +195,7 @@ AcpiNsWalkNamespace (
ACPI_NAMESPACE_NODE *
AcpiNsGetNextNode (
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE *Parent,
ACPI_NAMESPACE_NODE *Child);
@@ -239,8 +239,8 @@ ACPI_STATUS
AcpiNsLookup (
ACPI_GENERIC_STATE *ScopeInfo,
NATIVE_CHAR *Name,
- ACPI_OBJECT_TYPE8 Type,
- OPERATING_MODE InterpreterMode,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_INTERPRETER_MODE InterpreterMode,
UINT32 Flags,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **RetNode);
@@ -317,7 +317,7 @@ AcpiNsDumpRootDevices (
void
AcpiNsDumpObjects (
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
UINT32 OwnderId,
@@ -373,15 +373,15 @@ AcpiNsExistDownstreamSibling (
/*
- * Scope manipulation - nsscope
+ * Name and Scope manipulation - nsnames
*/
UINT32
AcpiNsOpensScope (
- ACPI_OBJECT_TYPE8 Type);
+ ACPI_OBJECT_TYPE Type);
NATIVE_CHAR *
-AcpiNsGetTablePathname (
+AcpiNsGetExternalPathname (
ACPI_NAMESPACE_NODE *Node);
NATIVE_CHAR *
@@ -390,9 +390,8 @@ AcpiNsNameOfCurrentScope (
ACPI_STATUS
AcpiNsHandleToPathname (
- ACPI_HANDLE ObjHandle,
- UINT32 *BufSize,
- NATIVE_CHAR *UserBuffer);
+ ACPI_HANDLE TargetHandle,
+ ACPI_BUFFER *Buffer);
BOOLEAN
AcpiNsPatternMatch (
@@ -400,25 +399,26 @@ AcpiNsPatternMatch (
NATIVE_CHAR *SearchFor);
ACPI_STATUS
-AcpiNsGetNode (
- NATIVE_CHAR *Pathname,
+AcpiNsGetNodeByPath (
+ NATIVE_CHAR *ExternalPathname,
ACPI_NAMESPACE_NODE *InPrefixNode,
+ UINT32 Flags,
ACPI_NAMESPACE_NODE **OutNode);
-UINT32
+ACPI_SIZE
AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node);
/*
- * Object management for NTEs - nsobject
+ * Object management for namespace nodes - nsobject
*/
ACPI_STATUS
AcpiNsAttachObject (
ACPI_NAMESPACE_NODE *Node,
ACPI_OPERAND_OBJECT *Object,
- ACPI_OBJECT_TYPE8 Type);
+ ACPI_OBJECT_TYPE Type);
ACPI_OPERAND_OBJECT *
AcpiNsGetAttachedObject (
@@ -455,8 +455,8 @@ AcpiNsSearchAndEnter (
UINT32 EntryName,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE *Node,
- OPERATING_MODE InterpreterMode,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ ACPI_OBJECT_TYPE Type,
UINT32 Flags,
ACPI_NAMESPACE_NODE **RetNode);
@@ -464,7 +464,7 @@ ACPI_STATUS
AcpiNsSearchNode (
UINT32 EntryName,
ACPI_NAMESPACE_NODE *Node,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE **RetNode);
void
@@ -472,7 +472,7 @@ AcpiNsInstallNode (
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE *ParentNode, /* Parent */
ACPI_NAMESPACE_NODE *Node, /* New Child*/
- ACPI_OBJECT_TYPE8 Type);
+ ACPI_OBJECT_TYPE Type);
/*
@@ -487,13 +487,13 @@ BOOLEAN
AcpiNsValidPathSeparator (
NATIVE_CHAR Sep);
-ACPI_OBJECT_TYPE8
+ACPI_OBJECT_TYPE
AcpiNsGetType (
ACPI_NAMESPACE_NODE *Node);
UINT32
AcpiNsLocal (
- ACPI_OBJECT_TYPE8 Type);
+ ACPI_OBJECT_TYPE Type);
ACPI_STATUS
AcpiNsBuildInternalName (
@@ -528,7 +528,7 @@ AcpiNsTerminate (
void);
ACPI_NAMESPACE_NODE *
-AcpiNsGetParentObject (
+AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node);
diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h
index edc3375..f5a5a3f 100644
--- a/sys/contrib/dev/acpica/acobject.h
+++ b/sys/contrib/dev/acpica/acobject.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
- * $Revision: 101 $
+ * $Revision: 106 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -150,7 +150,7 @@
#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
- UINT8 DataType; /* To differentiate various internal objs */\
+ UINT8 Descriptor; /* To differentiate various internal objs */\
UINT8 Type; /* ACPI_OBJECT_TYPE */\
UINT16 ReferenceCount; /* For object deletion management */\
union acpi_operand_obj *NextObject; /* Objects linked to parent NS node */\
@@ -158,7 +158,7 @@
/* Defines for flag byte above */
-#define AOPOBJ_STATIC_ALLOCATION 0x01
+#define AOPOBJ_RESERVED 0x01
#define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08
@@ -168,21 +168,19 @@
/*
* Common bitfield for the field objects
- * "Field Datum" -- a datum from the actual field object
- * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
+ * "Field Datum" -- a datum from the actual field object
+ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
*/
#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
UINT8 FieldFlags; /* Access, update, and lock bits */\
- UINT16 BitLength; /* Length of field in bits */\
- UINT32 BaseByteOffset; /* Byte offset within containing object */\
- UINT8 AccessBitWidth; /* Read/Write size in bits (from ASL AccessType)*/\
+ UINT8 Attribute; /* From AccessAs keyword */\
UINT8 AccessByteWidth; /* Read/Write size in bytes */\
- UINT8 Attribute ; /* From AccessAs keyword */\
+ UINT32 BitLength; /* Length of field in bits */\
+ UINT32 BaseByteOffset; /* Byte offset within containing object */\
UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
UINT8 DatumValidBits; /* Valid bit in first "Field datum" */\
UINT8 EndFieldValidBits; /* Valid bits in the last "field datum" */\
UINT8 EndBufferValidBits; /* Valid bits in the last "buffer datum" */\
- UINT8 Reserved; /* Reserved for future use */\
UINT32 Value; /* Value to store into the Bank or Index register */\
ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
@@ -440,7 +438,7 @@ typedef struct /* NOTIFY HANDLER */
/* Flags for address handler */
-#define ADDR_HANDLER_DEFAULT_INSTALLED 0x1
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
typedef struct /* ADDRESS HANDLER */
diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/acoutput.h
index 0bb067a..2bfb7a5 100644
--- a/sys/contrib/dev/acpica/acoutput.h
+++ b/sys/contrib/dev/acpica/acoutput.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
- * $Revision: 84 $
+ * $Revision: 86 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,25 +137,18 @@
#define ACPI_DEBUGGER 0x00000200
#define ACPI_OS_SERVICES 0x00000400
-#define ACPI_BUS 0x00010000
-#define ACPI_SYSTEM 0x00020000
-#define ACPI_POWER 0x00040000
-#define ACPI_EC 0x00080000
-#define ACPI_AC_ADAPTER 0x00100000
-#define ACPI_BATTERY 0x00200000
-#define ACPI_BUTTON 0x00400000
-#define ACPI_PROCESSOR 0x00800000
-#define ACPI_THERMAL 0x01000000
-#define ACPI_FAN 0x02000000
-
-#define ACPI_ALL_COMPONENTS 0x0FFFFFFF
+#define ACPI_ALL_COMPONENTS 0x00000FFF
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
+/* Component IDs for ACPI tools and utilities */
+
+#define ACPI_COMPILER 0x00001000
+#define ACPI_TOOLS 0x00002000
-#define ACPI_COMPILER 0x10000000
-#define ACPI_TOOLS 0x20000000
+/* Component IDs reserved for ACPI drivers */
+#define ACPI_ALL_DRIVERS 0xFFFF0000
/*
* Raw debug output levels, do not use these in the DEBUG_PRINT macros
diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/acparser.h
index 3a321d7..43feb50 100644
--- a/sys/contrib/dev/acpica/acparser.h
+++ b/sys/contrib/dev/acpica/acparser.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 55 $
+ * $Revision: 58 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,10 +125,6 @@
#define ACPI_VAR_ARGS ACPI_UINT32_MAX
-/* maximum virtual address */
-
-#define ACPI_MAX_AML ((UINT8 *)(~0UL))
-
#define ACPI_PARSE_DELETE_TREE 0x0001
#define ACPI_PARSE_NO_TREE_DELETE 0x0000
diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/acpi.h
index fca0cb4..141c7b1d 100644
--- a/sys/contrib/dev/acpica/acpi.h
+++ b/sys/contrib/dev/acpica/acpi.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
- * $Revision: 54 $
+ * $Revision: 55 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h
index 52bc653..e7d3125 100644
--- a/sys/contrib/dev/acpica/acpiosxf.h
+++ b/sys/contrib/dev/acpica/acpiosxf.h
@@ -12,7 +12,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -213,11 +213,7 @@ AcpiOsSignalSemaphore (
void *
AcpiOsAllocate (
- UINT32 Size);
-
-void *
-AcpiOsCallocate (
- UINT32 Size);
+ ACPI_SIZE Size);
void
AcpiOsFree (
@@ -226,13 +222,13 @@ AcpiOsFree (
ACPI_STATUS
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
- UINT32 Length,
+ ACPI_SIZE Size,
void **LogicalAddress);
void
AcpiOsUnmapMemory (
void *LogicalAddress,
- UINT32 Length);
+ ACPI_SIZE Size);
ACPI_STATUS
AcpiOsGetPhysicalAddress (
@@ -364,12 +360,12 @@ AcpiOsSignal (
* Debug print routines
*/
-INT32
+void
AcpiOsPrintf (
const NATIVE_CHAR *Format,
...);
-INT32
+void
AcpiOsVprintf (
const NATIVE_CHAR *Format,
va_list Args);
diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h
index ec03fb4..5a02225 100644
--- a/sys/contrib/dev/acpica/acpixf.h
+++ b/sys/contrib/dev/acpica/acpixf.h
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -356,11 +356,12 @@ AcpiInstallGpeHandler (
ACPI_STATUS
AcpiAcquireGlobalLock (
- void);
+ UINT32 Timeout,
+ UINT32 *Handle);
ACPI_STATUS
AcpiReleaseGlobalLock (
- void);
+ UINT32 Handle);
ACPI_STATUS
AcpiRemoveGpeHandler (
diff --git a/sys/contrib/dev/acpica/acresrc.h b/sys/contrib/dev/acpica/acresrc.h
index 4700c94..a620bdf 100644
--- a/sys/contrib/dev/acpica/acresrc.h
+++ b/sys/contrib/dev/acpica/acresrc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
- * $Revision: 25 $
+ * $Revision: 30 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -147,24 +147,21 @@ AcpiRsSetSrsMethodData (
ACPI_STATUS
AcpiRsCreateResourceList (
ACPI_OPERAND_OBJECT *ByteStreamBuffer,
- UINT8 *OutputBuffer,
- UINT32 *OutputBufferLength);
+ ACPI_BUFFER *OutputBuffer);
ACPI_STATUS
AcpiRsCreateByteStream (
ACPI_RESOURCE *LinkedListBuffer,
- UINT8 *OutputBuffer,
- UINT32 *OutputBufferLength);
+ ACPI_BUFFER *OutputBuffer);
ACPI_STATUS
AcpiRsCreatePciRoutingTable (
- ACPI_OPERAND_OBJECT *MethodReturnObject,
- UINT8 *OutputBuffer,
- UINT32 *OutputBufferLength);
+ ACPI_OPERAND_OBJECT *PackageObject,
+ ACPI_BUFFER *OutputBuffer);
/*
- *Function prototypes called from AcpiRsCreate*APIs
+ *Function prototypes called from AcpiRsCreate*
*/
void
@@ -185,225 +182,224 @@ ACPI_STATUS
AcpiRsCalculateListLength (
UINT8 *ByteStreamBuffer,
UINT32 ByteStreamBufferLength,
- UINT32 *SizeNeeded);
+ ACPI_SIZE *SizeNeeded);
ACPI_STATUS
AcpiRsCalculateByteStreamLength (
ACPI_RESOURCE *LinkedListBuffer,
- UINT32 *SizeNeeded);
+ ACPI_SIZE *SizeNeeded);
ACPI_STATUS
AcpiRsCalculatePciRoutingTableLength (
ACPI_OPERAND_OBJECT *PackageObject,
- UINT32 *BufferSizeNeeded);
+ ACPI_SIZE *BufferSizeNeeded);
ACPI_STATUS
AcpiRsByteStreamToList (
UINT8 *ByteStreamBuffer,
UINT32 ByteStreamBufferLength,
- UINT8 **OutputBuffer);
+ UINT8 *OutputBuffer);
ACPI_STATUS
AcpiRsListToByteStream (
ACPI_RESOURCE *LinkedList,
UINT32 ByteStreamSizeNeeded,
- UINT8 **OutputBuffer);
+ UINT8 *OutputBuffer);
ACPI_STATUS
AcpiRsIoResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsFixedIoResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsIoStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsFixedIoStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsIrqResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsIrqStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsDmaResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsDmaStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsAddress16Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsAddress16Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsAddress32Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsAddress32Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsAddress64Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsAddress64Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
-AcpiRsStartDependentFunctionsResource (
+AcpiRsStartDependFnsResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
-AcpiRsEndDependentFunctionsResource (
+AcpiRsEndDependFnsResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
-AcpiRsStartDependentFunctionsStream (
+AcpiRsStartDependFnsStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
-AcpiRsEndDependentFunctionsStream (
+AcpiRsEndDependFnsStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsMemory24Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsMemory24Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsMemory32RangeResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize
-);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsFixedMemory32Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsMemory32RangeStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsFixedMemory32Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsExtendedIrqResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsExtendedIrqStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsEndTagResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsEndTagStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
ACPI_STATUS
AcpiRsVendorResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize);
+ ACPI_SIZE *StructureSize);
ACPI_STATUS
AcpiRsVendorStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed);
+ ACPI_SIZE *BytesConsumed);
UINT8
AcpiRsGetResourceType (
diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h
index f214ced..4a2592b 100644
--- a/sys/contrib/dev/acpica/acstruct.h
+++ b/sys/contrib/dev/acpica/acstruct.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 12 $
+ * $Revision: 16 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,18 +125,17 @@
****************************************************************************/
-
/*
* Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
* the tree (for whatever reason), and for control method execution.
*/
-#define NEXT_OP_DOWNWARD 1
-#define NEXT_OP_UPWARD 2
+#define ACPI_NEXT_OP_DOWNWARD 1
+#define ACPI_NEXT_OP_UPWARD 2
-#define WALK_NON_METHOD 0
-#define WALK_METHOD 1
-#define WALK_METHOD_RESTART 2
+#define ACPI_WALK_NON_METHOD 0
+#define ACPI_WALK_METHOD 1
+#define ACPI_WALK_METHOD_RESTART 2
typedef struct acpi_walk_state
{
@@ -153,6 +152,7 @@ typedef struct acpi_walk_state
UINT32 AmlOffset;
UINT32 ArgTypes;
UINT32 MethodBreakpoint; /* For single stepping */
+ UINT32 UserBreakpoint; /* User AML breakpoint */
UINT32 ParseFlags;
UINT32 PrevArgTypes;
@@ -177,11 +177,8 @@ typedef struct acpi_walk_state
union acpi_operand_obj *ReturnDesc; /* Return object, if any */
ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
-/* TBD: Obsolete with removal of WALK procedure ? */
ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
-
-
ACPI_PARSE_DOWNWARDS DescendingCallback;
ACPI_PARSE_UPWARDS AscendingCallback;
ACPI_THREAD_STATE *Thread;
@@ -191,7 +188,6 @@ typedef struct acpi_walk_state
} ACPI_WALK_STATE;
-
/* Info used by AcpiPsInitObjects */
typedef struct acpi_init_walk_info
@@ -207,7 +203,7 @@ typedef struct acpi_init_walk_info
} ACPI_INIT_WALK_INFO;
-/* Info used by TBD */
+/* Info used by AcpiNsInitializeDevices */
typedef struct acpi_device_walk_info
{
diff --git a/sys/contrib/dev/acpica/actables.h b/sys/contrib/dev/acpica/actables.h
index a9695a2..02181d6 100644
--- a/sys/contrib/dev/acpica/actables.h
+++ b/sys/contrib/dev/acpica/actables.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 32 $
+ * $Revision: 35 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -210,6 +210,11 @@ AcpiTbInstallTable (
ACPI_TABLE_DESC *TableInfo);
ACPI_STATUS
+AcpiTbMatchSignature (
+ NATIVE_CHAR *Signature,
+ ACPI_TABLE_DESC *TableInfo);
+
+ACPI_STATUS
AcpiTbRecognizeTable (
ACPI_TABLE_HEADER *TablePtr,
ACPI_TABLE_DESC *TableInfo);
@@ -269,6 +274,13 @@ AcpiTbFindRsdp (
*/
ACPI_STATUS
+AcpiTbFindTable (
+ NATIVE_CHAR *Signature,
+ NATIVE_CHAR *OemId,
+ NATIVE_CHAR *OemTableId,
+ ACPI_TABLE_HEADER **TablePtr);
+
+ACPI_STATUS
AcpiTbMapAcpiTable (
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
UINT32 *Size,
diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/actbl.h
index fe81c96..ac83e45 100644
--- a/sys/contrib/dev/acpica/actbl.h
+++ b/sys/contrib/dev/acpica/actbl.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
- * $Revision: 46 $
+ * $Revision: 52 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,6 @@
/*
* Values for description table header signatures
*/
-
#define RSDP_NAME "RSDP"
#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
#define APIC_SIG "APIC" /* Multiple APIC Description Table */
@@ -133,7 +132,7 @@
#define XSDT_SIG "XSDT" /* Extended System Description Table */
#define SSDT_SIG "SSDT" /* Secondary System Description Table */
#define SBST_SIG "SBST" /* Smart Battery Specification Table */
-#define SPIC_SIG "SPIC" /* iosapic table */
+#define SPIC_SIG "SPIC" /* IOSAPIC table */
#define BOOT_SIG "BOOT" /* Boot table */
@@ -166,29 +165,27 @@
* Architecture-independent tables
* The architecture dependent tables are in separate files
*/
-
typedef struct /* Root System Descriptor Pointer */
{
- NATIVE_CHAR Signature [8]; /* contains "RSD PTR " */
- UINT8 Checksum; /* to make sum of struct == 0 */
+ NATIVE_CHAR Signature [8]; /* ACPI signature, contains "RSD PTR " */
+ UINT8 Checksum; /* To make sum of struct == 0 */
NATIVE_CHAR OemId [6]; /* OEM identification */
UINT8 Revision; /* Must be 0 for 1.0, 2 for 2.0 */
UINT32 RsdtPhysicalAddress; /* 32-bit physical address of RSDT */
UINT32 Length; /* XSDT Length in bytes including hdr */
UINT64 XsdtPhysicalAddress; /* 64-bit physical address of XSDT */
UINT8 ExtendedChecksum; /* Checksum of entire table */
- NATIVE_CHAR Reserved [3]; /* reserved field must be 0 */
+ NATIVE_CHAR Reserved [3]; /* Reserved field must be 0 */
} RSDP_DESCRIPTOR;
typedef struct /* ACPI common table header */
{
- NATIVE_CHAR Signature [4]; /* identifies type of table */
- UINT32 Length; /* length of table, in bytes,
- * including header */
- UINT8 Revision; /* specification minor version # */
- UINT8 Checksum; /* to make sum of entire table == 0 */
+ NATIVE_CHAR Signature [4]; /* ACPI signature (4 ASCII characters) */
+ UINT32 Length; /* Length of table, in bytes, including header */
+ UINT8 Revision; /* ACPI Specification minor version # */
+ UINT8 Checksum; /* To make sum of entire table == 0 */
NATIVE_CHAR OemId [6]; /* OEM identification */
NATIVE_CHAR OemTableId [8]; /* OEM table identification */
UINT32 OemRevision; /* OEM revision number */
@@ -209,7 +206,7 @@ typedef struct /* Common FACS for internal use */
typedef struct /* APIC Table */
{
- ACPI_TABLE_HEADER header; /* table header */
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
UINT32 LocalApicAddress; /* Physical address for accessing local APICs */
UINT32_BIT PCATCompat : 1; /* a one indicates system also has dual 8259s */
UINT32_BIT Reserved1 : 31;
@@ -227,9 +224,9 @@ typedef struct /* APIC Header */
typedef struct /* Processor APIC */
{
- APIC_HEADER header;
+ APIC_HEADER Header;
UINT8 ProcessorApicId; /* ACPI processor id */
- UINT8 LocalApicId; /* processor's local APIC id */
+ UINT8 LocalApicId; /* Processor's local APIC id */
UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */
UINT32_BIT Reserved1 : 31;
@@ -238,26 +235,26 @@ typedef struct /* Processor APIC */
typedef struct /* IO APIC */
{
- APIC_HEADER header;
+ APIC_HEADER Header;
UINT8 IoApicId; /* I/O APIC ID */
- UINT8 Reserved; /* reserved - must be zero */
+ UINT8 Reserved; /* Reserved - must be zero */
UINT32 IoApicAddress; /* APIC's physical address */
- UINT32 Vector; /* interrupt vector index where INTI
+ UINT32 Vector; /* Interrupt vector index where INTI
* lines start */
} IO_APIC;
/*
-** IA64 TODO: Add SAPIC Tables
-*/
+ * IA64 TBD: Add SAPIC Tables
+ */
/*
-** IA64 TODO: Modify Smart Battery Description to comply with ACPI IA64
-** extensions.
-*/
+ * IA64 TBD: Modify Smart Battery Description to comply with ACPI IA64
+ * extensions.
+ */
typedef struct /* Smart Battery Description Table */
{
- ACPI_TABLE_HEADER header;
+ ACPI_TABLE_HEADER Header;
UINT32 WarningLevel;
UINT32 LowLevel;
UINT32 CriticalLevel;
@@ -273,7 +270,6 @@ typedef struct /* Smart Battery Description Table */
* and type of memory allocation (mapped or allocated) for each
* table for 1) when we exit, and 2) if a new table is installed
*/
-
#define ACPI_MEM_NOT_ALLOCATED 0
#define ACPI_MEM_ALLOCATED 1
#define ACPI_MEM_MAPPED 2
@@ -282,7 +278,7 @@ typedef struct /* Smart Battery Description Table */
#define ACPI_TABLE_SINGLE 0
#define ACPI_TABLE_MULTIPLE 1
-
+#define ACPI_TABLE_EXECUTABLE 2
/* Data about each known table type */
@@ -290,19 +286,17 @@ typedef struct _AcpiTableSupport
{
NATIVE_CHAR *Name;
NATIVE_CHAR *Signature;
+ void **GlobalPtr;
UINT8 SigLength;
UINT8 Flags;
- UINT16 Status;
- void **GlobalPtr;
} ACPI_TABLE_SUPPORT;
+
/*
* Get the architecture-specific tables
*/
-
-#include "actbl1.h" /* Acpi 1.0 table defintions */
-#include "actbl71.h" /* Acpi 0.71 IA-64 Extension table defintions */
+#include "actbl1.h" /* Acpi 1.0 table definitions */
#include "actbl2.h" /* Acpi 2.0 table definitions */
#endif /* __ACTBL_H__ */
diff --git a/sys/contrib/dev/acpica/actbl1.h b/sys/contrib/dev/acpica/actbl1.h
index 2468221..c99792c 100644
--- a/sys/contrib/dev/acpica/actbl1.h
+++ b/sys/contrib/dev/acpica/actbl1.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
- * $Revision: 17 $
+ * $Revision: 21 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,53 +119,50 @@
#pragma pack(1)
-/*************************************/
-/* ACPI Specification Rev 1.0 for */
-/* the Root System Description Table */
-/*************************************/
+/*
+ * ACPI 1.0 Root System Description Table (RSDT)
+ */
typedef struct
{
- ACPI_TABLE_HEADER header; /* Table header */
+ ACPI_TABLE_HEADER Header; /* ACPI Table header */
UINT32 TableOffsetEntry [1]; /* Array of pointers to other */
/* ACPI tables */
} RSDT_DESCRIPTOR_REV1;
-/***************************************/
-/* ACPI Specification Rev 1.0 for */
-/* the Firmware ACPI Control Structure */
-/***************************************/
+/*
+ * ACPI 1.0 Firmware ACPI Control Structure (FACS)
+ */
typedef struct
{
- NATIVE_CHAR Signature[4]; /* signature "FACS" */
- UINT32 Length; /* length of structure, in bytes */
- UINT32 HardwareSignature; /* hardware configuration signature */
+ NATIVE_CHAR Signature[4]; /* ACPI Signature */
+ UINT32 Length; /* Length of structure, in bytes */
+ UINT32 HardwareSignature; /* Hardware configuration signature */
UINT32 FirmwareWakingVector; /* ACPI OS waking vector */
UINT32 GlobalLock; /* Global Lock */
UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */
- UINT32_BIT Reserved1 : 31; /* must be 0 */
- UINT8 Resverved3 [40]; /* reserved - must be zero */
+ UINT32_BIT Reserved1 : 31; /* Must be 0 */
+ UINT8 Resverved3 [40]; /* Reserved - must be zero */
} FACS_DESCRIPTOR_REV1;
-/************************************/
-/* ACPI Specification Rev 1.0 for */
-/* the Fixed ACPI Description Table */
-/************************************/
+/*
+ * ACPI 1.0 Fixed ACPI Description Table (FADT)
+ */
typedef struct
{
- ACPI_TABLE_HEADER header; /* table header */
+ ACPI_TABLE_HEADER Header; /* ACPI Table header */
UINT32 FirmwareCtrl; /* Physical address of FACS */
UINT32 Dsdt; /* Physical address of DSDT */
UINT8 Model; /* System Interrupt Model */
- UINT8 Reserved1; /* reserved */
+ UINT8 Reserved1; /* Reserved */
UINT16 SciInt; /* System vector of SCI interrupt */
UINT32 SmiCmd; /* Port address of SMI command port */
- UINT8 AcpiEnable; /* value to write to smi_cmd to enable ACPI */
- UINT8 AcpiDisable; /* value to write to smi_cmd to disable ACPI */
+ UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
- UINT8 Reserved2; /* reserved - must be zero */
+ UINT8 Reserved2; /* Reserved - must be zero */
UINT32 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
UINT32 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
UINT32 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
@@ -180,30 +177,30 @@ typedef struct
UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
- UINT8 Gpe1Base; /* offset in gpe model where gpe1 events start */
- UINT8 Reserved3; /* reserved */
- UINT16 Plvl2Lat; /* worst case HW latency to enter/exit C2 state */
- UINT16 Plvl3Lat; /* worst case HW latency to enter/exit C3 state */
+ UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
+ UINT8 Reserved3; /* Reserved */
+ UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
+ UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
UINT16 FlushSize; /* Size of area read to flush caches */
UINT16 FlushStride; /* Stride used in flushing caches */
- UINT8 DutyOffset; /* bit location of duty cycle field in p_cnt reg */
- UINT8 DutyWidth; /* bit width of duty cycle field in p_cnt reg */
- UINT8 DayAlrm; /* index to day-of-month alarm in RTC CMOS RAM */
- UINT8 MonAlrm; /* index to month-of-year alarm in RTC CMOS RAM */
- UINT8 Century; /* index to century in RTC CMOS RAM */
- UINT8 Reserved4; /* reserved */
- UINT8 Reserved4a; /* reserved */
- UINT8 Reserved4b; /* reserved */
- UINT32_BIT WbInvd : 1; /* wbinvd instruction works properly */
- UINT32_BIT WbInvdFlush : 1; /* wbinvd flushes but does not invalidate */
- UINT32_BIT ProcC1 : 1; /* all processors support C1 state */
+ UINT8 DutyOffset; /* Bit location of duty cycle field in p_cnt reg */
+ UINT8 DutyWidth; /* Bit width of duty cycle field in p_cnt reg */
+ UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ UINT8 Century; /* Index to century in RTC CMOS RAM */
+ UINT8 Reserved4; /* Reserved */
+ UINT8 Reserved4a; /* Reserved */
+ UINT8 Reserved4b; /* Reserved */
+ UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
+ UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
+ UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- UINT32_BIT TmrValExt : 1; /* tmr_val is 32 bits */
- UINT32_BIT Reserved5 : 23; /* reserved - must be zero */
+ UINT32_BIT TmrValExt : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
+ UINT32_BIT Reserved5 : 23; /* Reserved - must be zero */
} FADT_DESCRIPTOR_REV1;
diff --git a/sys/contrib/dev/acpica/actbl2.h b/sys/contrib/dev/acpica/actbl2.h
index 3c17cc1..e0f9c68 100644
--- a/sys/contrib/dev/acpica/actbl2.h
+++ b/sys/contrib/dev/acpica/actbl2.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- * $Revision: 24 $
+ * $Revision: 27 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -140,48 +140,48 @@
#pragma pack(1)
/*
- * ACPI Specification Rev 2.0 for the Root System Description Table
+ * ACPI 2.0 Root System Description Table (RSDT)
*/
typedef struct
{
- ACPI_TABLE_HEADER header; /* Table header */
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
UINT32 TableOffsetEntry [1]; /* Array of pointers to */
- /* other tables' headers */
+ /* ACPI table headers */
} RSDT_DESCRIPTOR_REV2;
/*
- * ACPI Specification Rev 2.0 for the Extended System Description Table (XSDT)
+ * ACPI 2.0 Extended System Description Table (XSDT)
*/
typedef struct
{
- ACPI_TABLE_HEADER Header; /* Table header */
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
UINT64 TableOffsetEntry [1]; /* Array of pointers to */
- /* other tables' headers */
+ /* ACPI table headers */
} XSDT_DESCRIPTOR_REV2;
/*
- * ACPI Specification Rev 2.0 for the Firmware ACPI Control Structure
+ * ACPI 2.0 Firmware ACPI Control Structure (FACS)
*/
typedef struct
{
- NATIVE_CHAR Signature[4]; /* signature "FACS" */
- UINT32 Length; /* length of structure, in bytes */
- UINT32 HardwareSignature; /* hardware configuration signature */
+ NATIVE_CHAR Signature[4]; /* ACPI signature */
+ UINT32 Length; /* Length of structure, in bytes */
+ UINT32 HardwareSignature; /* Hardware configuration signature */
UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */
UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */
- UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */
- UINT32_BIT Reserved1 : 31; /* must be 0 */
+ UINT32 S4Bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */
+ UINT32_BIT Reserved1 : 31; /* Must be 0 */
UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */
UINT8 Version; /* Version of this table */
- UINT8 Reserved3 [31]; /* reserved - must be zero */
+ UINT8 Reserved3 [31]; /* Reserved - must be zero */
} FACS_DESCRIPTOR_REV2;
/*
- * ACPI Specification Rev 2.0 for the Generic Address Structure (GAS)
+ * ACPI 2.0 Generic Address Structure (GAS)
*/
typedef struct
{
@@ -195,21 +195,21 @@ typedef struct
/*
- * ACPI Specification Rev 2.0 for the Fixed ACPI Description Table
+ * ACPI 2.0 Fixed ACPI Description Table (FADT)
*/
typedef struct
{
- ACPI_TABLE_HEADER header; /* table header */
+ ACPI_TABLE_HEADER Header; /* ACPI table header */
UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */
UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */
UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/
UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */
UINT16 SciInt; /* System vector of SCI interrupt */
UINT32 SmiCmd; /* Port address of SMI command port */
- UINT8 AcpiEnable; /* value to write to smi_cmd to enable ACPI */
- UINT8 AcpiDisable; /* value to write to smi_cmd to disable ACPI */
+ UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
- UINT8 PstateCnt; /* processor performance state control*/
+ UINT8 PstateCnt; /* Processor performance state control*/
UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
@@ -224,35 +224,35 @@ typedef struct
UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
- UINT8 Gpe1Base; /* offset in gpe model where gpe1 events start */
+ UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/
- UINT16 Plvl2Lat; /* worst case HW latency to enter/exit C2 state */
- UINT16 Plvl3Lat; /* worst case HW latency to enter/exit C3 state */
- UINT16 FlushSize; /* number of flush strides that need to be read */
+ UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
+ UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
+ UINT16 FlushSize; /* Number of flush strides that need to be read */
UINT16 FlushStride; /* Processor's memory cache line width, in bytes */
UINT8 DutyOffset; /* Processor’s duty cycle index in processor's P_CNT reg*/
UINT8 DutyWidth; /* Processor’s duty cycle value bit width in P_CNT register.*/
- UINT8 DayAlrm; /* index to day-of-month alarm in RTC CMOS RAM */
- UINT8 MonAlrm; /* index to month-of-year alarm in RTC CMOS RAM */
- UINT8 Century; /* index to century in RTC CMOS RAM */
+ UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ UINT8 Century; /* Index to century in RTC CMOS RAM */
UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
- UINT8 Reserved2; /* reserved */
- UINT32_BIT WbInvd : 1; /* wbinvd instruction works properly */
- UINT32_BIT WbInvdFlush : 1; /* wbinvd flushes but does not invalidate */
- UINT32_BIT ProcC1 : 1; /* all processors support C1 state */
+ UINT8 Reserved2; /* Reserved */
+ UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
+ UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
+ UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- UINT32_BIT TmrValExt : 1; /* tmr_val is 32 bits */
+ UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits*/
UINT32_BIT DockCap : 1; /* Supports Docking */
UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/
UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */
UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/
UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */
- /* must be executed after writing the SLP_TYPx register. */
- UINT32_BIT Reserved6 : 18; /* reserved - must be zero */
+ /* Must be executed after writing the SLP_TYPx register. */
+ UINT32_BIT Reserved6 : 18; /* Reserved - must be zero */
ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
diff --git a/sys/contrib/dev/acpica/actbl71.h b/sys/contrib/dev/acpica/actbl71.h
index a8d4392..6a84009 100644
--- a/sys/contrib/dev/acpica/actbl71.h
+++ b/sys/contrib/dev/acpica/actbl71.h
@@ -3,7 +3,7 @@
* Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
* This file includes tables specific to this
* specification revision.
- * $Revision: 11 $
+ * $Revision: 12 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h
index 31e1b6c..a8d88c3 100644
--- a/sys/contrib/dev/acpica/actypes.h
+++ b/sys/contrib/dev/acpica/actypes.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 199 $
+ * $Revision: 223 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -136,7 +136,6 @@
* UINT64 64-bit (8 byte) unsigned value
* NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
* NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
- * UCHAR Character. 1 byte unsigned value.
*/
@@ -146,21 +145,22 @@
*/
typedef unsigned char UINT8;
typedef unsigned char BOOLEAN;
-typedef unsigned char UCHAR;
typedef unsigned short UINT16;
typedef int INT32;
typedef unsigned int UINT32;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
typedef UINT64 NATIVE_UINT;
-typedef INT64 NATIVE_INT;
+typedef UINT64 NATIVE_INT;
typedef NATIVE_UINT ACPI_TBLPTR;
typedef UINT64 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
+typedef UINT64 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
+#define ACPI_MAX_PTR 0xFFFFFFFFFFFFFFFF
#elif _IA16
@@ -169,7 +169,6 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS;
*/
typedef unsigned char UINT8;
typedef unsigned char BOOLEAN;
-typedef unsigned char UCHAR;
typedef unsigned int UINT16;
typedef long INT32;
typedef int INT16;
@@ -188,10 +187,12 @@ typedef INT16 NATIVE_INT;
typedef UINT32 ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef char *ACPI_PHYSICAL_ADDRESS;
+typedef UINT32 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
#define _HW_ALIGNMENT_SUPPORT
#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
+#define ACPI_MAX_PTR 0xFFFF
/*
* (16-bit only) internal integers must be 32-bits, so
@@ -206,7 +207,6 @@ typedef char *ACPI_PHYSICAL_ADDRESS;
*/
typedef unsigned char UINT8;
typedef unsigned char BOOLEAN;
-typedef unsigned char UCHAR;
typedef unsigned short UINT16;
typedef int INT32;
typedef unsigned int UINT32;
@@ -218,9 +218,11 @@ typedef INT32 NATIVE_INT;
typedef NATIVE_UINT ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
+typedef UINT32 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
#define _HW_ALIGNMENT_SUPPORT
+#define ACPI_MAX_PTR 0xFFFFFFFF
#endif
@@ -242,11 +244,13 @@ typedef char NATIVE_CHAR;
#define ACPI_UINT16_MAX (UINT16) 0xFFFF
#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF
#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF
+#define ACPI_ASCII_MAX 0x7F
#ifdef DEFINE_ALTERNATE_TYPES
/*
- * Types used only in translated source
+ * Types used only in translated source, defined here to enable
+ * cross-platform compilation only.
*/
typedef INT32 s32;
typedef UINT8 u8;
@@ -342,7 +346,7 @@ typedef UINT64 ACPI_INTEGER;
* Constants with special meanings
*/
-#define ACPI_ROOT_OBJECT (ACPI_HANDLE)(-1)
+#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_UINT32_MAX)
/*
@@ -352,9 +356,10 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
#define ACPI_NO_HARDWARE_INIT 0x02
#define ACPI_NO_EVENT_INIT 0x04
-#define ACPI_NO_ACPI_ENABLE 0x08
-#define ACPI_NO_DEVICE_INIT 0x10
-#define ACPI_NO_OBJECT_INIT 0x20
+#define ACPI_NO_HANDLER_INIT 0x08
+#define ACPI_NO_ACPI_ENABLE 0x10
+#define ACPI_NO_DEVICE_INIT 0x20
+#define ACPI_NO_OBJECT_INIT 0x40
/*
* Initialization state
@@ -383,6 +388,13 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_D_STATES_MAX ACPI_STATE_D3
#define ACPI_D_STATE_COUNT 4
+#define ACPI_STATE_C0 (UINT8) 0
+#define ACPI_STATE_C1 (UINT8) 1
+#define ACPI_STATE_C2 (UINT8) 2
+#define ACPI_STATE_C3 (UINT8) 3
+#define ACPI_C_STATES_MAX ACPI_STATE_C3
+#define ACPI_C_STATE_COUNT 4
+
/*
* Sleep type invalid value
*/
@@ -423,15 +435,13 @@ typedef UINT32 ACPI_TABLE_TYPE;
* Types associated with names. The first group of
* values correspond to the definition of the ACPI
* ObjectType operator (See the ACPI Spec). Therefore,
- * only add to the first group if the spec changes!
+ * only add to the first group if the spec changes.
*
* Types must be kept in sync with the AcpiNsProperties
* and AcpiNsTypeNames arrays
*/
typedef UINT32 ACPI_OBJECT_TYPE;
-typedef UINT8 ACPI_OBJECT_TYPE8;
-
#define ACPI_TYPE_ANY 0x00
#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
@@ -534,49 +544,40 @@ typedef UINT8 ACPI_OBJECT_TYPE8;
/*
- * AcpiEvent Types:
- * ------------
- * Fixed & general purpose...
+ * AcpiEvent Types: Fixed & General Purpose
*/
typedef UINT32 ACPI_EVENT_TYPE;
-#define ACPI_EVENT_FIXED (ACPI_EVENT_TYPE) 0
-#define ACPI_EVENT_GPE (ACPI_EVENT_TYPE) 1
+#define ACPI_EVENT_FIXED 0
+#define ACPI_EVENT_GPE 1
/*
* Fixed events
*/
-#define ACPI_EVENT_PMTIMER (ACPI_EVENT_TYPE) 0
- /*
- * There's no bus master event so index 1 is used for IRQ's that are not
- * handled by the SCI handler
- */
-#define ACPI_EVENT_NOT_USED (ACPI_EVENT_TYPE) 1
-#define ACPI_EVENT_GLOBAL (ACPI_EVENT_TYPE) 2
-#define ACPI_EVENT_POWER_BUTTON (ACPI_EVENT_TYPE) 3
-#define ACPI_EVENT_SLEEP_BUTTON (ACPI_EVENT_TYPE) 4
-#define ACPI_EVENT_RTC (ACPI_EVENT_TYPE) 5
-#define ACPI_EVENT_GENERAL (ACPI_EVENT_TYPE) 6
-#define ACPI_EVENT_MAX 6
-#define ACPI_NUM_FIXED_EVENTS (ACPI_EVENT_TYPE) 7
+#define ACPI_EVENT_PMTIMER 0
+#define ACPI_EVENT_GLOBAL 1
+#define ACPI_EVENT_POWER_BUTTON 2
+#define ACPI_EVENT_SLEEP_BUTTON 3
+#define ACPI_EVENT_RTC 4
+#define ACPI_EVENT_MAX 4
+#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
#define ACPI_GPE_INVALID 0xFF
#define ACPI_GPE_MAX 0xFF
#define ACPI_NUM_GPE 256
-#define ACPI_EVENT_LEVEL_TRIGGERED (ACPI_EVENT_TYPE) 1
-#define ACPI_EVENT_EDGE_TRIGGERED (ACPI_EVENT_TYPE) 2
+#define ACPI_EVENT_LEVEL_TRIGGERED 1
+#define ACPI_EVENT_EDGE_TRIGGERED 2
/*
* GPEs
*/
-#define ACPI_EVENT_ENABLE 0x1
-#define ACPI_EVENT_WAKE_ENABLE 0x2
-#define ACPI_EVENT_DISABLE 0x1
-#define ACPI_EVENT_WAKE_DISABLE 0x2
+#define ACPI_EVENT_WAKE_ENABLE 0x1
+
+#define ACPI_EVENT_WAKE_DISABLE 0x1
/*
@@ -608,7 +609,7 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_DEVICE_NOTIFY 1
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1
-#define MAX_SYS_NOTIFY 0x7f
+#define ACPI_MAX_SYS_NOTIFY 0x7f
/* Address Space (Operation Region) Types */
@@ -622,6 +623,7 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4
#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
+#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7
/*
@@ -680,7 +682,7 @@ typedef union AcpiObj
UINT32 ResourceOrder;
} PowerResource;
-} ACPI_OBJECT, *PACPI_OBJECT;
+} ACPI_OBJECT;
/*
@@ -692,16 +694,20 @@ typedef struct AcpiObjList
UINT32 Count;
ACPI_OBJECT *Pointer;
-} ACPI_OBJECT_LIST, *PACPI_OBJECT_LIST;
+} ACPI_OBJECT_LIST;
/*
* Miscellaneous common Data Structures used by the interfaces
*/
+#define ACPI_NO_BUFFER 0
+#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1)
+#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2)
+
typedef struct
{
- UINT32 Length; /* Length in bytes of the buffer */
+ ACPI_SIZE Length; /* Length in bytes of the buffer */
void *Pointer; /* pointer to buffer */
} ACPI_BUFFER;
@@ -720,10 +726,10 @@ typedef struct
* Structure and flags for AcpiGetSystemInfo
*/
-#define SYS_MODE_UNKNOWN 0x0000
-#define SYS_MODE_ACPI 0x0001
-#define SYS_MODE_LEGACY 0x0002
-#define SYS_MODES_MASK 0x0003
+#define ACPI_SYS_MODE_UNKNOWN 0x0000
+#define ACPI_SYS_MODE_ACPI 0x0001
+#define ACPI_SYS_MODE_LEGACY 0x0002
+#define ACPI_SYS_MODES_MASK 0x0003
/*
@@ -791,7 +797,7 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
void *HandlerContext,
void *RegionContext);
-#define ACPI_DEFAULT_HANDLER ((ACPI_ADR_SPACE_HANDLER) NULL)
+#define ACPI_DEFAULT_HANDLER ((ACPI_ADR_SPACE_HANDLER) NULL)
typedef
@@ -814,8 +820,8 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) (
/* Interrupt handler return values */
-#define INTERRUPT_NOT_HANDLED 0x00
-#define INTERRUPT_HANDLED 0x01
+#define ACPI_INTERRUPT_NOT_HANDLED 0x00
+#define ACPI_INTERRUPT_HANDLED 0x01
/* Structure and flags for AcpiGetDeviceInfo */
@@ -880,78 +886,78 @@ typedef struct
/*
* Memory Attributes
*/
-#define READ_ONLY_MEMORY (UINT8) 0x00
-#define READ_WRITE_MEMORY (UINT8) 0x01
+#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00
+#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01
-#define NON_CACHEABLE_MEMORY (UINT8) 0x00
-#define CACHABLE_MEMORY (UINT8) 0x01
-#define WRITE_COMBINING_MEMORY (UINT8) 0x02
-#define PREFETCHABLE_MEMORY (UINT8) 0x03
+#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00
+#define ACPI_CACHABLE_MEMORY (UINT8) 0x01
+#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02
+#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03
/*
* IO Attributes
* The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
* The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
*/
-#define NON_ISA_ONLY_RANGES (UINT8) 0x01
-#define ISA_ONLY_RANGES (UINT8) 0x02
-#define ENTIRE_RANGE (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
+#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01
+#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
+#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
/*
* IO Port Descriptor Decode
*/
-#define DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
-#define DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
+#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
+#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
/*
* IRQ Attributes
*/
-#define EDGE_SENSITIVE (UINT8) 0x00
-#define LEVEL_SENSITIVE (UINT8) 0x01
+#define ACPI_EDGE_SENSITIVE (UINT8) 0x00
+#define ACPI_LEVEL_SENSITIVE (UINT8) 0x01
-#define ACTIVE_HIGH (UINT8) 0x00
-#define ACTIVE_LOW (UINT8) 0x01
+#define ACPI_ACTIVE_HIGH (UINT8) 0x00
+#define ACPI_ACTIVE_LOW (UINT8) 0x01
-#define EXCLUSIVE (UINT8) 0x00
-#define SHARED (UINT8) 0x01
+#define ACPI_EXCLUSIVE (UINT8) 0x00
+#define ACPI_SHARED (UINT8) 0x01
/*
* DMA Attributes
*/
-#define COMPATIBILITY (UINT8) 0x00
-#define TYPE_A (UINT8) 0x01
-#define TYPE_B (UINT8) 0x02
-#define TYPE_F (UINT8) 0x03
+#define ACPI_COMPATIBILITY (UINT8) 0x00
+#define ACPI_TYPE_A (UINT8) 0x01
+#define ACPI_TYPE_B (UINT8) 0x02
+#define ACPI_TYPE_F (UINT8) 0x03
-#define NOT_BUS_MASTER (UINT8) 0x00
-#define BUS_MASTER (UINT8) 0x01
+#define ACPI_NOT_BUS_MASTER (UINT8) 0x00
+#define ACPI_BUS_MASTER (UINT8) 0x01
-#define TRANSFER_8 (UINT8) 0x00
-#define TRANSFER_8_16 (UINT8) 0x01
-#define TRANSFER_16 (UINT8) 0x02
+#define ACPI_TRANSFER_8 (UINT8) 0x00
+#define ACPI_TRANSFER_8_16 (UINT8) 0x01
+#define ACPI_TRANSFER_16 (UINT8) 0x02
/*
* Start Dependent Functions Priority definitions
*/
-#define GOOD_CONFIGURATION (UINT8) 0x00
-#define ACCEPTABLE_CONFIGURATION (UINT8) 0x01
-#define SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
+#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00
+#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
+#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
/*
* 16, 32 and 64-bit Address Descriptor resource types
*/
-#define MEMORY_RANGE (UINT8) 0x00
-#define IO_RANGE (UINT8) 0x01
-#define BUS_NUMBER_RANGE (UINT8) 0x02
+#define ACPI_MEMORY_RANGE (UINT8) 0x00
+#define ACPI_IO_RANGE (UINT8) 0x01
+#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02
-#define ADDRESS_NOT_FIXED (UINT8) 0x00
-#define ADDRESS_FIXED (UINT8) 0x01
+#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00
+#define ACPI_ADDRESS_FIXED (UINT8) 0x01
-#define POS_DECODE (UINT8) 0x00
-#define SUB_DECODE (UINT8) 0x01
+#define ACPI_POS_DECODE (UINT8) 0x00
+#define ACPI_SUB_DECODE (UINT8) 0x01
-#define PRODUCER (UINT8) 0x00
-#define CONSUMER (UINT8) 0x01
+#define ACPI_PRODUCER (UINT8) 0x00
+#define ACPI_CONSUMER (UINT8) 0x01
/*
@@ -1015,6 +1021,12 @@ typedef struct
typedef struct
{
+ UINT8 Checksum;
+
+} ACPI_RESOURCE_END_TAG;
+
+typedef struct
+{
UINT32 ReadWriteAttribute;
UINT32 MinBaseAddress;
UINT32 MaxBaseAddress;
@@ -1160,7 +1172,7 @@ typedef struct
#define ACPI_RSTYPE_ADDRESS64 13
#define ACPI_RSTYPE_EXT_IRQ 14
-typedef UINT32 ACPI_RESOURCE_TYPE;
+typedef UINT32 ACPI_RESOURCE_TYPE;
typedef union
{
@@ -1170,6 +1182,7 @@ typedef union
ACPI_RESOURCE_IO Io;
ACPI_RESOURCE_FIXED_IO FixedIo;
ACPI_RESOURCE_VENDOR VendorSpecific;
+ ACPI_RESOURCE_END_TAG EndTag;
ACPI_RESOURCE_MEM24 Memory24;
ACPI_RESOURCE_MEM32 Memory32;
ACPI_RESOURCE_FIXED_MEM32 FixedMemory32;
@@ -1188,20 +1201,25 @@ typedef struct AcpiResource
} ACPI_RESOURCE;
-#define ACPI_RESOURCE_LENGTH 12
-#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
+#define ACPI_RESOURCE_LENGTH 12
+#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
-#define SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type))
+#define ACPI_SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type))
-#define NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->length)
+#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->length)
+#ifdef _HW_ALIGNMENT_SUPPORT
+#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length)
+#else
+#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length)
+#endif
/*
- * END: Definitions for Resource Attributes
+ * END: of definitions for Resource Attributes
*/
-typedef struct pci_routing_table
+typedef struct acpi_pci_routing_table
{
UINT32 Length;
UINT32 Pin;
@@ -1209,11 +1227,11 @@ typedef struct pci_routing_table
UINT32 SourceIndex;
NATIVE_CHAR Source[4]; /* pad to 64 bits so sizeof() works in all cases */
-} PCI_ROUTING_TABLE;
-
+} ACPI_PCI_ROUTING_TABLE;
/*
- * END: Definitions for PCI Routing tables
+ * END: of definitions for PCI Routing tables
*/
+
#endif /* __ACTYPES_H__ */
diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h
index f526376..651d180 100644
--- a/sys/contrib/dev/acpica/acutils.h
+++ b/sys/contrib/dev/acpica/acutils.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 119 $
+ * $Revision: 129 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,7 +137,7 @@ AcpiUtWalkPackageTree (
typedef struct acpi_pkg_info
{
UINT8 *FreeSpace;
- UINT32 Length;
+ ACPI_SIZE Length;
UINT32 ObjectSpace;
UINT32 NumPackages;
} ACPI_PKG_INFO;
@@ -193,14 +193,18 @@ AcpiUtGetMutexName (
NATIVE_CHAR *
AcpiUtGetTypeName (
- UINT32 Type);
+ ACPI_OBJECT_TYPE Type);
+
+#endif
+
NATIVE_CHAR *
AcpiUtGetRegionName (
UINT8 SpaceId);
-#endif
-
+NATIVE_CHAR *
+AcpiUtGetEventName (
+ UINT32 EventId);
UINT8
AcpiUtHexToAsciiChar (
@@ -209,7 +213,7 @@ AcpiUtHexToAsciiChar (
BOOLEAN
AcpiUtValidObjectType (
- UINT32 Type);
+ ACPI_OBJECT_TYPE Type);
ACPI_OWNER_ID
AcpiUtAllocateOwnerId (
@@ -335,6 +339,17 @@ AcpiUtCopyIpackageToIpackage (
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState);
+ACPI_STATUS
+AcpiUtCopySimpleObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc);
+
+ACPI_STATUS
+AcpiUtCopyIobjectToIobject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **DestDesc,
+ ACPI_WALK_STATE *WalkState);
+
/*
* UtCreate - Object creation
@@ -549,7 +564,7 @@ AcpiUtCreateInternalObjectDbg (
NATIVE_CHAR *ModuleName,
UINT32 LineNumber,
UINT32 ComponentId,
- ACPI_OBJECT_TYPE8 Type);
+ ACPI_OBJECT_TYPE Type);
void *
AcpiUtAllocateObjectDescDbg (
@@ -588,17 +603,17 @@ AcpiUtRemoveReference (
ACPI_STATUS
AcpiUtGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *Obj,
- UINT32 *ObjLength);
+ ACPI_SIZE *ObjLength);
ACPI_STATUS
AcpiUtGetPackageObjectSize (
ACPI_OPERAND_OBJECT *Obj,
- UINT32 *ObjLength);
+ ACPI_SIZE *ObjLength);
ACPI_STATUS
AcpiUtGetObjectSize(
ACPI_OPERAND_OBJECT *Obj,
- UINT32 *ObjLength);
+ ACPI_SIZE *ObjLength);
/*
@@ -697,6 +712,14 @@ ACPI_STATUS
AcpiUtResolvePackageReferences (
ACPI_OPERAND_OBJECT *ObjDesc);
+UINT8 *
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+UINT8
+AcpiUtGenerateChecksum (
+ UINT8 *Buffer,
+ UINT32 Length);
#ifdef ACPI_DEBUG
void
@@ -724,31 +747,73 @@ void
AcpiUtDeleteGenericCache (
UINT32 ListId);
+ACPI_STATUS
+AcpiUtValidateBuffer (
+ ACPI_BUFFER *Buffer);
-/* Debug Memory allocation functions */
+ACPI_STATUS
+AcpiUtInitializeBuffer (
+ ACPI_BUFFER *Buffer,
+ ACPI_SIZE RequiredLength);
+
+
+/* Memory allocation functions */
void *
AcpiUtAllocate (
- UINT32 Size,
+ ACPI_SIZE Size,
UINT32 Component,
NATIVE_CHAR *Module,
UINT32 Line);
void *
AcpiUtCallocate (
- UINT32 Size,
+ ACPI_SIZE Size,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line);
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+void *
+AcpiUtAllocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line);
+
+void *
+AcpiUtCallocateAndTrack (
+ ACPI_SIZE Size,
UINT32 Component,
NATIVE_CHAR *Module,
UINT32 Line);
void
-AcpiUtFree (
+AcpiUtFreeAndTrack (
void *Address,
UINT32 Component,
NATIVE_CHAR *Module,
UINT32 Line);
+ACPI_STATUS
+AcpiUtTrackAllocation (
+ UINT32 ListId,
+ ACPI_DEBUG_MEM_BLOCK *Address,
+ ACPI_SIZE Size,
+ UINT8 AllocType,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line);
+
+ACPI_STATUS
+AcpiUtRemoveAllocation (
+ UINT32 ListId,
+ ACPI_DEBUG_MEM_BLOCK *Address,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line);
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
void
AcpiUtDumpAllocationInfo (
void);
diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h
index effe2ca..bb08120 100644
--- a/sys/contrib/dev/acpica/amlcode.h
+++ b/sys/contrib/dev/acpica/amlcode.h
@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 62 $
+ * $Revision: 66 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -309,6 +309,9 @@
* Resolved argument types for the AML Interpreter
* Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
+ *
+ * Note: If and when 5 bits becomes insufficient, it would probably be best
+ * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
*/
/* "Standard" ACPI types are 1-15 (0x0F) */
@@ -338,6 +341,7 @@
#define ARGI_FIXED_TARGET 0x1B /* Target, no implicit conversion */
#define ARGI_SIMPLE_TARGET 0x1C /* Name, Local, Arg -- no implicit conversion */
#define ARGI_BUFFERSTRING 0x1D
+#define ARGI_REF_OR_STRING 0x1E /* Reference or String (Used by DEREFOF op only) */
#define ARGI_INVALID_OPCODE 0xFFFFFFFF
@@ -460,7 +464,8 @@ typedef enum
REGION_SMBUS,
REGION_CMOS,
REGION_PCI_BAR,
- REGION_FIXED_HW = 0x7F,
+ REGION_DATA_TABLE, /* Internal use only */
+ REGION_FIXED_HW = 0x7F
} AML_REGION_TYPES;
@@ -508,7 +513,7 @@ typedef enum
AML_FIELD_ACCESS_WORD = 0x02,
AML_FIELD_ACCESS_DWORD = 0x03,
AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
- AML_FIELD_ACCESS_BUFFER = 0x05, /* ACPI 2.0 */
+ AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
} AML_ACCESS_TYPE;
@@ -518,7 +523,7 @@ typedef enum
typedef enum
{
AML_FIELD_LOCK_NEVER = 0x00,
- AML_FIELD_LOCK_ALWAYS = 0x10,
+ AML_FIELD_LOCK_ALWAYS = 0x10
} AML_LOCK_RULE;
@@ -529,15 +534,15 @@ typedef enum
{
AML_FIELD_UPDATE_PRESERVE = 0x00,
AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
- AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40,
+ AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
} AML_UPDATE_RULE;
-/*
+/*
* Field Access Attributes.
* This byte is extracted from the AML via the
- * AccessAs keyword
+ * AccessAs keyword
*/
typedef enum
{
@@ -546,7 +551,7 @@ typedef enum
AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
AML_FIELD_ATTRIB_SMB_WORD = 0x08,
AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
- AML_FIELD_ATTRIB_SMB_CALL = 0x0E,
+ AML_FIELD_ATTRIB_SMB_CALL = 0x0E
} AML_ACCESS_ATTRIBUTE;
diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c
index 89002d7..467546d 100644
--- a/sys/contrib/dev/acpica/dbcmds.c
+++ b/sys/contrib/dev/acpica/dbcmds.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 67 $
+ * $Revision: 79 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,7 +130,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbcmds")
+ ACPI_MODULE_NAME ("dbcmds")
/*
@@ -171,6 +171,8 @@ ARGUMENT_INFO AcpiDbObjectTypes [] =
* DESCRIPTION: Check if this namespace object refers to the target object
* that is passed in as the context value.
*
+ * Note: Currently doesn't check subobjects within the Node's object
+ *
******************************************************************************/
ACPI_STATUS
@@ -198,14 +200,6 @@ AcpiDbWalkForReferences (
AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, &Node->Name);
}
- /* Check first child for a match */
- /* TBD: [Investigate] probably now obsolete with new datastructure */
-
- if (Node->Child == (void *) ObjDesc)
- {
- AcpiOsPrintf ("Reference at Node->Child %p [%4.4s]\n", Node, &Node->Name);
- }
-
return (AE_OK);
}
@@ -231,7 +225,7 @@ AcpiDbFindReferences (
/* Convert string to object pointer */
- ObjDesc = (ACPI_OPERAND_OBJECT *) STRTOUL (ObjectArg, NULL, 16);
+ ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
/* Search all nodes in namespace */
@@ -326,7 +320,7 @@ AcpiDbUnloadAcpiTable (
for (i = 0; i < NUM_ACPI_TABLES; i++)
{
- if (!STRNCMP (TableArg, AcpiGbl_AcpiTableData[i].Signature,
+ if (!ACPI_STRNCMP (TableArg, AcpiGbl_AcpiTableData[i].Signature,
AcpiGbl_AcpiTableData[i].SigLength))
{
/* Found the table, unload it */
@@ -382,7 +376,7 @@ AcpiDbSetMethodBreakpoint (
/* Get and verify the breakpoint address */
- Address = STRTOUL (Location, NULL, 16);
+ Address = ACPI_STRTOUL (Location, NULL, 16);
if (Address <= Op->AmlOffset)
{
AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->AmlOffset);
@@ -390,7 +384,7 @@ AcpiDbSetMethodBreakpoint (
/* Save breakpoint in current walk */
- WalkState->MethodBreakpoint = Address;
+ WalkState->UserBreakpoint = Address;
AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
}
@@ -455,10 +449,9 @@ AcpiDbDisassembleAml (
if (Statements)
{
- NumStatements = STRTOUL (Statements, NULL, 0);
+ NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
}
-
AcpiDbDisplayOp (NULL, Op, NumStatements);
}
@@ -494,14 +487,14 @@ AcpiDbDumpNamespace (
if ((StartArg[0] >= 0x30) && (StartArg[0] <= 0x39))
{
- SubtreeEntry = (ACPI_HANDLE) STRTOUL (StartArg, NULL, 16);
+ SubtreeEntry = ACPI_TO_POINTER (ACPI_STRTOUL (StartArg, NULL, 16));
if (!AcpiOsReadable (SubtreeEntry, sizeof (ACPI_NAMESPACE_NODE)))
{
AcpiOsPrintf ("Address %p is invalid in this address space\n", SubtreeEntry);
return;
}
- if (!VALID_DESCRIPTOR_TYPE ((SubtreeEntry), ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf ("Address %p is not a valid Named object\n", SubtreeEntry);
return;
@@ -525,19 +518,18 @@ AcpiDbDumpNamespace (
if (DepthArg)
{
- MaxDepth = STRTOUL (DepthArg, NULL, 0);
+ MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
}
}
-
- AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("ACPI Namespace (from %p subtree):\n", SubtreeEntry);
/* Display the subtree */
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, ACPI_UINT32_MAX, SubtreeEntry);
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -564,25 +556,23 @@ AcpiDbDumpNamespaceByOwner (
UINT16 OwnerId;
- OwnerId = (UINT16) STRTOUL (OwnerArg, NULL, 0);
-
+ OwnerId = (UINT16) ACPI_STRTOUL (OwnerArg, NULL, 0);
/* Now we can check for the depth argument */
if (DepthArg)
{
- MaxDepth = STRTOUL (DepthArg, NULL, 0);
+ MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
}
-
- AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
/* Display the subtree */
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, SubtreeEntry);
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -666,7 +656,7 @@ AcpiDbSetMethodData (
/* Validate TypeArg */
- STRUPR (TypeArg);
+ ACPI_STRUPR (TypeArg);
Type = TypeArg[0];
if ((Type != 'L') &&
(Type != 'A'))
@@ -677,8 +667,8 @@ AcpiDbSetMethodData (
/* Get the index and value */
- Index = STRTOUL (IndexArg, NULL, 16);
- Value = STRTOUL (ValueArg, NULL, 16);
+ Index = ACPI_STRTOUL (IndexArg, NULL, 16);
+ Value = ACPI_STRTOUL (ValueArg, NULL, 16);
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
if (!WalkState)
@@ -765,24 +755,23 @@ AcpiDbWalkForSpecificObjects (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- UINT32 BufSize;
- NATIVE_CHAR Buffer[64];
+ ACPI_BUFFER Buffer;
ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle);
- BufSize = sizeof (Buffer) / sizeof (*Buffer);
/* Get and display the full pathname to this object */
- Status = AcpiNsHandleToPathname (ObjHandle, &BufSize, Buffer);
-
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
return (AE_OK);
}
- AcpiOsPrintf ("%32s", Buffer);
+ AcpiOsPrintf ("%32s", Buffer.Pointer);
+ ACPI_MEM_FREE (Buffer.Pointer);
/* Display short information about the object */
@@ -840,7 +829,7 @@ AcpiDbDisplayObjects (
NATIVE_CHAR *ObjTypeArg,
NATIVE_CHAR *DisplayCountArg)
{
- ACPI_OBJECT_TYPE8 Type;
+ ACPI_OBJECT_TYPE Type;
/* Get the object type */
@@ -852,17 +841,17 @@ AcpiDbDisplayObjects (
return (AE_OK);
}
- AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n", AcpiUtGetTypeName (Type));
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
/* Walk the namespace from the root */
AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForSpecificObjects, (void *) &Type, NULL);
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
@@ -890,8 +879,7 @@ AcpiDbWalkAndMatchName (
ACPI_STATUS Status;
NATIVE_CHAR *RequestedName = (NATIVE_CHAR *) Context;
UINT32 i;
- UINT32 BufSize;
- NATIVE_CHAR Buffer[96];
+ ACPI_BUFFER Buffer;
/* Check for a name match */
@@ -912,18 +900,17 @@ AcpiDbWalkAndMatchName (
/* Get the full pathname to this object */
- BufSize = sizeof (Buffer) / sizeof (*Buffer);
-
- Status = AcpiNsHandleToPathname (ObjHandle, &BufSize, Buffer);
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
}
-
else
{
- AcpiOsPrintf ("%32s (%p) - %s\n", Buffer, ObjHandle,
+ AcpiOsPrintf ("%32s (%p) - %s\n", Buffer.Pointer, ObjHandle,
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type));
+ ACPI_MEM_FREE (Buffer.Pointer);
}
return (AE_OK);
@@ -948,7 +935,7 @@ AcpiDbFindNameInNamespace (
NATIVE_CHAR *NameArg)
{
- if (STRLEN (NameArg) > 4)
+ if (ACPI_STRLEN (NameArg) > 4)
{
AcpiOsPrintf ("Name must be no longer than 4 characters\n");
return (AE_OK);
@@ -959,7 +946,7 @@ AcpiDbFindNameInNamespace (
AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkAndMatchName, NameArg, NULL);
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
@@ -981,6 +968,9 @@ void
AcpiDbSetScope (
NATIVE_CHAR *Name)
{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
if (!Name || Name[0] == 0)
{
@@ -990,21 +980,42 @@ AcpiDbSetScope (
AcpiDbPrepNamestring (Name);
- /* TBD: [Future] Validate scope here */
if (Name[0] == '\\')
{
- STRCPY (AcpiGbl_DbScopeBuf, Name);
- STRCAT (AcpiGbl_DbScopeBuf, "\\");
- }
+ /* Validate new scope from the root */
+ Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, ACPI_NS_NO_UPSEARCH, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ }
else
{
- STRCAT (AcpiGbl_DbScopeBuf, Name);
- STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ /* Validate new scope relative to old scope */
+
+ Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, ACPI_NS_NO_UPSEARCH, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
}
+ AcpiGbl_DbScopeNode = Node;
AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
+ return;
+
+
+ErrorExit:
+
+ AcpiOsPrintf ("Could not attach scope: %s, %s\n", Name, AcpiFormatException (Status));
}
@@ -1030,18 +1041,18 @@ AcpiDbDisplayResources (
ACPI_BUFFER ReturnObj;
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiDbgLevel |= ACPI_LV_RESOURCES;
/* Convert string to object pointer */
- ObjDesc = (ACPI_OPERAND_OBJECT *) STRTOUL (ObjectArg, NULL, 16);
+ ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
/* Prepare for a return object of arbitrary size */
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
-
/* _PRT */
AcpiOsPrintf ("Evaluating _PRT\n");
@@ -1090,6 +1101,7 @@ GetCrs:
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status));
+ goto GetPrs;
}
else
@@ -1097,6 +1109,13 @@ GetCrs:
AcpiRsDumpResourceList ((ACPI_RESOURCE *) AcpiGbl_DbBuffer);
}
+ Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", AcpiFormatException (Status));
+ goto GetPrs;
+ }
+
/* _PRS */
@@ -1130,7 +1149,7 @@ GetPrs:
Cleanup:
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return;
#endif
diff --git a/sys/contrib/dev/acpica/dbdisasm.c b/sys/contrib/dev/acpica/dbdisasm.c
index dc24edc..b4f7f73 100644
--- a/sys/contrib/dev/acpica/dbdisasm.c
+++ b/sys/contrib/dev/acpica/dbdisasm.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
- * $Revision: 53 $
+ * $Revision: 61 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,10 +125,9 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbdisasm")
+ ACPI_MODULE_NAME ("dbdisasm")
-#define MAX_SHOW_ENTRY 128
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define DB_NO_OP_INFO " [%2.2d] "
@@ -159,14 +158,12 @@ AcpiDbBlockType (
{
case AML_METHOD_OP:
return (BLOCK_BRACE);
- break;
default:
break;
}
return (BLOCK_PAREN);
-
}
@@ -193,11 +190,26 @@ AcpiPsDisplayObjectPathname (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *TargetOp;
+ char *Name;
+
+ if (Op->Flags & ACPI_PARSEOP_GENERIC)
+ {
+ Name = Op->Value.Name;
+ if (Name[0] == '\\')
+ {
+ AcpiOsPrintf (" (Fully Qualified Pathname)");
+ return (AE_OK);
+ }
+ }
+ else
+ {
+ Name = (char *) &((ACPI_PARSE2_OBJECT *) Op)->Name;
+ }
/* Search parent tree up to the root if necessary */
- TargetOp = AcpiPsFind (Op, Op->Value.Name, 0, 0);
+ TargetOp = AcpiPsFind (Op, Name, 0, 0);
if (!TargetOp)
{
/*
@@ -229,8 +241,7 @@ AcpiPsDisplayObjectPathname (
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
- NATIVE_CHAR Buffer[MAX_SHOW_ENTRY];
- UINT32 BufferSize = MAX_SHOW_ENTRY;
+ ACPI_BUFFER Buffer;
UINT32 DebugLevel;
@@ -247,7 +258,7 @@ AcpiPsDisplayObjectPathname (
/* Node not defined in this scope, look it up */
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, ACPI_TYPE_ANY,
- IMODE_EXECUTE, NS_SEARCH_PARENT, WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
@@ -267,14 +278,16 @@ AcpiPsDisplayObjectPathname (
/* Convert NamedDesc/handle to a full pathname */
- Status = AcpiNsHandleToPathname (Node, &BufferSize, Buffer);
+ 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);
+ AcpiOsPrintf (" (Path %s)", Buffer.Pointer);
+ ACPI_MEM_FREE (Buffer.Pointer);
Exit:
@@ -465,7 +478,6 @@ AcpiDbDisplayNamestring (
NATIVE_CHAR *Name)
{
UINT32 SegCount;
- BOOLEAN DoDot = FALSE;
if (!Name)
@@ -474,23 +486,29 @@ AcpiDbDisplayNamestring (
return;
}
- if (AcpiPsIsPrefixChar (GET8 (Name)))
+ /* Handle all Scope Prefix operators */
+
+ while (AcpiPsIsPrefixChar (ACPI_GET8 (Name)))
{
- /* append prefix character */
+ /* Append prefix character */
- AcpiOsPrintf ("%1c", GET8 (Name));
+ AcpiOsPrintf ("%1c", ACPI_GET8 (Name));
Name++;
}
- switch (GET8 (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) GET8 (Name + 1);
+ SegCount = (UINT32) ACPI_GET8 (Name + 1);
Name += 2;
break;
@@ -499,21 +517,20 @@ AcpiDbDisplayNamestring (
break;
}
- while (SegCount--)
+ while (SegCount)
{
- /* append Name segment */
+ /* Append Name segment */
- if (DoDot)
+ AcpiOsPrintf ("%4.4s", Name);
+
+ SegCount--;
+ if (SegCount)
{
- /* append dot */
+ /* Not last name, append dot separator */
AcpiOsPrintf (".");
}
-
- AcpiOsPrintf ("%4.4s", Name);
- DoDot = TRUE;
-
- Name += 4;
+ Name += ACPI_NAME_SIZE;
}
}
diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c
index df43e85..b049511 100644
--- a/sys/contrib/dev/acpica/dbdisply.c
+++ b/sys/contrib/dev/acpica/dbdisply.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 60 $
+ * $Revision: 66 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,7 +130,7 @@
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbdisply")
+ ACPI_MODULE_NAME ("dbdisply")
/******************************************************************************
@@ -167,7 +167,7 @@ AcpiDbGetPointer (
/* Simple flat pointer */
- ObjPtr = (void *) STRTOUL (Target, NULL, 16);
+ ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
#endif
return (ObjPtr);
@@ -198,7 +198,7 @@ AcpiDbDumpParserDescriptor (
AcpiOsPrintf ("Parser Op Descriptor:\n");
AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode);
- DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
+ ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value);
AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent);
@@ -244,7 +244,7 @@ AcpiDbDecodeAndDisplayObject (
if (OutputType)
{
- STRUPR (OutputType);
+ ACPI_STRUPR (OutputType);
if (OutputType[0] == 'W')
{
Display = DB_WORD_DISPLAY;
@@ -275,9 +275,11 @@ AcpiDbDecodeAndDisplayObject (
/* Decode the object type */
- if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_NAMED))
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
{
- /* This is a Node */
+ case ACPI_DESC_TYPE_NAMED:
+
+ /* This is a namespace Node */
if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
{
@@ -287,11 +289,11 @@ AcpiDbDecodeAndDisplayObject (
Node = ObjPtr;
goto DumpNte;
- }
- else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_INTERNAL))
- {
- /* This is an ACPI OBJECT */
+
+ case ACPI_DESC_TYPE_INTERNAL:
+
+ /* This is a ACPI OPERAND OBJECT */
if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
{
@@ -301,11 +303,12 @@ AcpiDbDecodeAndDisplayObject (
AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
AcpiExDumpObjectDescriptor (ObjPtr, 1);
- }
+ break;
- else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_PARSER))
- {
- /* This is an Parser Op object */
+
+ case ACPI_DESC_TYPE_PARSER:
+
+ /* This is a Parser Op object */
if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
{
@@ -315,10 +318,13 @@ AcpiDbDecodeAndDisplayObject (
AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
- }
+ break;
+
+
+ default:
+
+ /* Is not a recognizeable object */
- else
- {
Size = 16;
if (AcpiOsReadable (ObjPtr, 64))
{
@@ -328,12 +334,12 @@ AcpiDbDecodeAndDisplayObject (
/* Just dump some memory */
AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
+ break;
}
return;
}
-
/* The parameter is a name string that must be resolved to a Named obj */
Node = AcpiDbLocalNsLookup (Target);
@@ -412,8 +418,8 @@ AcpiDbDecodeInternalObject (
{
case ACPI_TYPE_INTEGER:
- AcpiOsPrintf (" %.8X%.8X", HIDWORD (ObjDesc->Integer.Value),
- LODWORD (ObjDesc->Integer.Value));
+ AcpiOsPrintf (" %.8X%.8X", ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
@@ -476,13 +482,16 @@ AcpiDbDisplayInternalObject (
/* Decode the object type */
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_PARSER))
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
+ case ACPI_DESC_TYPE_PARSER:
+
AcpiOsPrintf ("<Parser> ");
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_NAMED:
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
AcpiOsPrintf ("<Node> Name %4.4s Type-%s",
&((ACPI_NAMESPACE_NODE *)ObjDesc)->Name,
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type));
@@ -495,10 +504,11 @@ AcpiDbDisplayInternalObject (
{
AcpiOsPrintf (" [Method Local]");
}
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_INTERNAL:
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
- {
Type = ObjDesc->Common.Type;
if (Type > INTERNAL_TYPE_MAX)
{
@@ -554,7 +564,7 @@ AcpiDbDisplayInternalObject (
break;
case AML_INDEX_OP:
- AcpiOsPrintf ("[Index] ");
+ AcpiOsPrintf ("[Index] ");
AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
break;
@@ -570,13 +580,16 @@ AcpiDbDisplayInternalObject (
AcpiDbDecodeInternalObject (ObjDesc);
break;
}
- }
+ break;
+
+
+ default:
- else
- {
AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> ");
+ break;
}
+
AcpiOsPrintf ("\n");
}
@@ -882,6 +895,10 @@ AcpiDbDisplayCallingTree (void)
*
* DESCRIPTION: Display the result of an AML opcode
*
+ * Note: Curently only displays the result object if we are single stepping.
+ * However, this output may be useful in other contexts and could be enabled
+ * to do so if needed.
+ *
******************************************************************************/
void
@@ -890,10 +907,8 @@ AcpiDbDisplayResultObject (
ACPI_WALK_STATE *WalkState)
{
- /* TBD: [Future] We don't always want to display the result.
- * For now, only display if single stepping
- * however, this output is very useful in other contexts also
- */
+ /* Only display if single stepping */
+
if (!AcpiGbl_CmSingleStep)
{
return;
diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c
index 25cad77..d8505ab 100644
--- a/sys/contrib/dev/acpica/dbexec.c
+++ b/sys/contrib/dev/acpica/dbexec.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 34 $
+ * $Revision: 38 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,10 +129,10 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbexec")
+ ACPI_MODULE_NAME ("dbexec")
-DB_METHOD_INFO AcpiGbl_DbMethodInfo;
+ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo;
/*******************************************************************************
@@ -150,7 +150,7 @@ DB_METHOD_INFO AcpiGbl_DbMethodInfo;
ACPI_STATUS
AcpiDbExecuteMethod (
- DB_METHOD_INFO *Info,
+ ACPI_DB_METHOD_INFO *Info,
ACPI_BUFFER *ReturnObj)
{
ACPI_STATUS Status;
@@ -171,13 +171,12 @@ AcpiDbExecuteMethod (
for (i = 0; Info->Args[i] && i < MTH_NUM_ARGS; i++)
{
Params[i].Type = ACPI_TYPE_INTEGER;
- Params[i].Integer.Value = STRTOUL (Info->Args[i], NULL, 16);
+ Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
}
ParamObjects.Pointer = Params;
ParamObjects.Count = i;
}
-
else
{
/* Setup default parameters */
@@ -198,7 +197,6 @@ AcpiDbExecuteMethod (
ReturnObj->Pointer = AcpiGbl_DbBuffer;
ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE;
-
/* Do the actual method execution */
Status = AcpiEvaluateObject (NULL, Info->Pathname, &ParamObjects, ReturnObj);
@@ -224,7 +222,7 @@ AcpiDbExecuteMethod (
void
AcpiDbExecuteSetup (
- DB_METHOD_INFO *Info)
+ ACPI_DB_METHOD_INFO *Info)
{
/* Catenate the current scope to the supplied name */
@@ -233,26 +231,26 @@ AcpiDbExecuteSetup (
if ((Info->Name[0] != '\\') &&
(Info->Name[0] != '/'))
{
- STRCAT (Info->Pathname, AcpiGbl_DbScopeBuf);
+ ACPI_STRCAT (Info->Pathname, AcpiGbl_DbScopeBuf);
}
- STRCAT (Info->Pathname, Info->Name);
+ ACPI_STRCAT (Info->Pathname, Info->Name);
AcpiDbPrepNamestring (Info->Pathname);
- AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("Executing %s\n", Info->Pathname);
if (Info->Flags & EX_SINGLE_STEP)
{
AcpiGbl_CmSingleStep = TRUE;
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
else
{
/* No single step, allow redirection to a file */
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
}
}
@@ -274,11 +272,11 @@ AcpiDbExecuteSetup (
UINT32
AcpiDbGetOutstandingAllocations (void)
{
- UINT32 i;
UINT32 Outstanding = 0;
-
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 i;
+
for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++)
{
@@ -347,7 +345,7 @@ AcpiDbExecute (
Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations;
- AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
if (Allocations > 0)
{
@@ -374,7 +372,7 @@ AcpiDbExecute (
}
}
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -396,7 +394,7 @@ AcpiDbMethodThread (
void *Context)
{
ACPI_STATUS Status;
- DB_METHOD_INFO *Info = Context;
+ ACPI_DB_METHOD_INFO *Info = Context;
UINT32 i;
ACPI_BUFFER ReturnObj;
@@ -450,8 +448,8 @@ AcpiDbCreateExecutionThreads (
/* Get the arguments */
- NumThreads = STRTOUL (NumThreadsArg, NULL, 0);
- NumLoops = STRTOUL (NumLoopsArg, NULL, 0);
+ NumThreads = ACPI_STRTOUL (NumThreadsArg, NULL, 0);
+ NumLoops = ACPI_STRTOUL (NumLoopsArg, NULL, 0);
if (!NumThreads || !NumLoops)
{
@@ -459,7 +457,6 @@ AcpiDbCreateExecutionThreads (
return;
}
-
/* Create the synchronization semaphore */
Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate);
@@ -479,7 +476,6 @@ AcpiDbCreateExecutionThreads (
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
-
/* Create the threads */
AcpiOsPrintf ("Creating %X threads to execute %X times each\n", NumThreads, NumLoops);
@@ -489,7 +485,6 @@ AcpiDbCreateExecutionThreads (
AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo);
}
-
/* Wait for all threads to complete */
i = NumThreads;
@@ -503,9 +498,9 @@ AcpiDbCreateExecutionThreads (
AcpiOsDeleteSemaphore (ThreadGate);
- AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads);
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c
index 1ab4dbf..a5c3221 100644
--- a/sys/contrib/dev/acpica/dbfileio.c
+++ b/sys/contrib/dev/acpica/dbfileio.c
@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 54 $
+ * $Revision: 59 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,7 +126,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbfileio")
+ ACPI_MODULE_NAME ("dbfileio")
/*
@@ -155,7 +155,7 @@ ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr = NULL;
*
******************************************************************************/
-ACPI_OBJECT_TYPE8
+ACPI_OBJECT_TYPE
AcpiDbMatchArgument (
NATIVE_CHAR *UserArgument,
ARGUMENT_INFO *Arguments)
@@ -170,9 +170,9 @@ AcpiDbMatchArgument (
for (i = 0; Arguments[i].Name; i++)
{
- if (STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name)
+ if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name)
{
- return ((ACPI_OBJECT_TYPE8) i);
+ return (i);
}
}
@@ -237,7 +237,7 @@ AcpiDbOpenDebugFile (
if (AcpiGbl_DebugFile)
{
AcpiOsPrintf ("Debug output file %s opened\n", Name);
- STRCPY (AcpiGbl_DbDebugFilename, Name);
+ ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
AcpiGbl_DbOutputToFile = TRUE;
}
else
@@ -299,12 +299,12 @@ AcpiDbLoadTable(
/* We only support a limited number of table types */
- if (STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
- STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
- STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
+ if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
{
AcpiOsPrintf ("Table signature is invalid\n");
- DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
+ ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
return (AE_ERROR);
}
@@ -325,7 +325,7 @@ AcpiDbLoadTable(
/* Copy the header to the buffer */
- MEMCPY (*TablePtr, &TableHeader, sizeof (TableHeader));
+ ACPI_MEMCPY (*TablePtr, &TableHeader, sizeof (TableHeader));
/* Get the rest of the table */
@@ -378,7 +378,7 @@ AeLocalLoadTable (
ACPI_TABLE_DESC TableInfo;
- FUNCTION_TRACE ("AeLocalLoadTable");
+ ACPI_FUNCTION_TRACE ("AeLocalLoadTable");
if (!TablePtr)
{
@@ -474,7 +474,6 @@ AcpiDbLoadAcpiTable (
AcpiFormatException (Status));
}
- AcpiOsFree (AcpiGbl_DbTablePtr);
return (Status);
}
diff --git a/sys/contrib/dev/acpica/dbhistry.c b/sys/contrib/dev/acpica/dbhistry.c
index 147c6f5..1aceadc 100644
--- a/sys/contrib/dev/acpica/dbhistry.c
+++ b/sys/contrib/dev/acpica/dbhistry.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
- * $Revision: 19 $
+ * $Revision: 22 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,7 +129,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbhistry")
+ ACPI_MODULE_NAME ("dbhistry")
#define HI_NO_HISTORY 0
@@ -169,10 +169,9 @@ AcpiDbAddToHistory (
NATIVE_CHAR *CommandLine)
{
-
/* Put command into the next available slot */
- STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine);
+ ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = AcpiGbl_NextCmdNum;
@@ -194,13 +193,11 @@ AcpiDbAddToHistory (
AcpiGbl_NextHistoryIndex = 0;
}
-
AcpiGbl_NextCmdNum++;
if (AcpiGbl_NumHistory < HISTORY_SIZE)
{
AcpiGbl_NumHistory++;
}
-
}
@@ -270,10 +267,9 @@ AcpiDbGetFromHistory (
else
{
- CmdNum = STRTOUL (CommandNumArg, NULL, 0);
+ CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0);
}
-
/* Search history buffer */
HistoryIndex = AcpiGbl_LoHistory;
diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c
index 5e85c98..e5e938b 100644
--- a/sys/contrib/dev/acpica/dbinput.c
+++ b/sys/contrib/dev/acpica/dbinput.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 72 $
+ * $Revision: 80 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,56 +126,14 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbinput")
+ ACPI_MODULE_NAME ("dbinput")
/*
- * Globals that are specific to the debugger
- */
-
-NATIVE_CHAR AcpiGbl_DbLineBuf[80];
-NATIVE_CHAR AcpiGbl_DbParsedBuf[80];
-NATIVE_CHAR AcpiGbl_DbScopeBuf[40];
-NATIVE_CHAR AcpiGbl_DbDebugFilename[40];
-NATIVE_CHAR *AcpiGbl_DbArgs[DB_MAX_ARGS];
-NATIVE_CHAR *AcpiGbl_DbBuffer = NULL;
-NATIVE_CHAR *AcpiGbl_DbFilename = NULL;
-BOOLEAN AcpiGbl_DbOutputToFile = FALSE;
-
-UINT32 AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2;
-UINT32 AcpiGbl_DbConsoleDebugLevel = NORMAL_DEFAULT | ACPI_LV_TABLES;
-UINT8 AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT;
-
-
-BOOLEAN AcpiGbl_DbOpt_tables = FALSE;
-BOOLEAN AcpiGbl_DbOpt_disasm = FALSE;
-BOOLEAN AcpiGbl_DbOpt_stats = FALSE;
-BOOLEAN AcpiGbl_DbOpt_parse_jit = FALSE;
-BOOLEAN AcpiGbl_DbOpt_verbose = TRUE;
-BOOLEAN AcpiGbl_DbOpt_ini_methods = TRUE;
-
-/*
- * Statistic globals
- */
-UINT16 AcpiGbl_ObjTypeCount[INTERNAL_TYPE_NODE_MAX+1];
-UINT16 AcpiGbl_NodeTypeCount[INTERNAL_TYPE_NODE_MAX+1];
-UINT16 AcpiGbl_ObjTypeCountMisc;
-UINT16 AcpiGbl_NodeTypeCountMisc;
-UINT32 AcpiGbl_NumNodes;
-UINT32 AcpiGbl_NumObjects;
-
-
-UINT32 AcpiGbl_SizeOfParseTree;
-UINT32 AcpiGbl_SizeOfMethodTrees;
-UINT32 AcpiGbl_SizeOfNodeEntries;
-UINT32 AcpiGbl_SizeOfAcpiObjects;
-
-/*
* Top-level debugger commands.
*
* This list of commands must match the string table below it
*/
-
enum AcpiExDebuggerCommands
{
CMD_NOT_FOUND = 0,
@@ -316,13 +274,11 @@ AcpiDbDisplayHelp (
}
-
/*
* Parameter is the command class
*
* The idea here is to keep each class of commands smaller than a screenful
*/
-
switch (HelpType[0])
{
case 'G':
@@ -413,6 +369,7 @@ AcpiDbGetNextToken (
{
NATIVE_CHAR *Start;
+
/* At end of buffer? */
if (!String || !(*String))
@@ -420,7 +377,6 @@ AcpiDbGetNextToken (
return (NULL);
}
-
/* Get rid of any spaces at the beginning */
if (*String == ' ')
@@ -445,12 +401,10 @@ AcpiDbGetNextToken (
String++;
}
-
if (!(*String))
{
*Next = NULL;
}
-
else
{
*String = 0;
@@ -484,11 +438,11 @@ AcpiDbGetLine (
NATIVE_CHAR *This;
- STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
- STRUPR (AcpiGbl_DbParsedBuf);
+ ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
+ ACPI_STRUPR (AcpiGbl_DbParsedBuf);
This = AcpiGbl_DbParsedBuf;
- for (i = 0; i < DB_MAX_ARGS; i++)
+ for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
{
AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next);
if (!AcpiGbl_DbArgs[i])
@@ -499,12 +453,11 @@ AcpiDbGetLine (
This = Next;
}
-
/* Uppercase the actual command */
if (AcpiGbl_DbArgs[0])
{
- STRUPR (AcpiGbl_DbArgs[0]);
+ ACPI_STRUPR (AcpiGbl_DbArgs[0]);
}
Count = i;
@@ -543,7 +496,8 @@ AcpiDbMatchCommand (
for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
{
- if (STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == AcpiGbl_DbCommands[i].Name)
+ if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
+ AcpiGbl_DbCommands[i].Name)
{
return (i);
}
@@ -693,7 +647,6 @@ AcpiDbCommandDispatch (
Status = AE_CTRL_TRUE;
}
return (Status);
- break;
case CMD_HISTORY_LAST:
CommandLine = AcpiDbGetFromHistory (NULL);
@@ -717,9 +670,6 @@ AcpiDbCommandDispatch (
if (Op)
{
AcpiGbl_CmSingleStep = TRUE;
-
-/* TBD: Must get current walk state */
- /* AcpiGbl_MethodBreakpoint = 0; */
return (AE_OK);
}
break;
@@ -733,13 +683,13 @@ AcpiDbCommandDispatch (
else if (ParamCount == 2)
{
Temp = AcpiGbl_DbConsoleDebugLevel;
- AcpiGbl_DbConsoleDebugLevel = STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
+ AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
AcpiOsPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel);
}
else
{
Temp = AcpiGbl_DbDebugLevel;
- AcpiGbl_DbDebugLevel = STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
+ AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel);
}
break;
@@ -773,12 +723,12 @@ AcpiDbCommandDispatch (
break;
case CMD_NOTIFY:
- Temp = STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
+ Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
break;
case CMD_OBJECT:
- AcpiDbDisplayObjects (STRUPR (AcpiGbl_DbArgs[1]), AcpiGbl_DbArgs[2]);
+ AcpiDbDisplayObjects (ACPI_STRUPR (AcpiGbl_DbArgs[1]), AcpiGbl_DbArgs[2]);
break;
case CMD_OPEN:
@@ -815,14 +765,13 @@ AcpiDbCommandDispatch (
case CMD_STOP:
return (AE_AML_ERROR);
- break;
case CMD_TABLES:
AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
break;
case CMD_TERMINATE:
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiUtSubsystemShutdown ();
/* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
@@ -895,6 +844,7 @@ AcpiDbExecuteThread (
void *Context)
{
ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS MStatus;
while (Status != AE_CTRL_TERMINATE)
@@ -902,9 +852,19 @@ AcpiDbExecuteThread (
AcpiGbl_MethodExecuting = FALSE;
AcpiGbl_StepToNextCall = FALSE;
- AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (MStatus))
+ {
+ return;
+ }
+
Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
- AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+
+ MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (MStatus))
+ {
+ return;
+ }
}
}
@@ -926,7 +886,7 @@ void
AcpiDbSingleThread (
void)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
AcpiGbl_MethodExecuting = FALSE;
@@ -964,17 +924,17 @@ AcpiDbUserCommands (
{
/* Force output to console until a command is entered */
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */
if (!AcpiGbl_MethodExecuting)
{
- AcpiOsPrintf ("%1c ", DB_COMMAND_PROMPT);
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
}
else
{
- AcpiOsPrintf ("%1c ", DB_EXECUTE_PROMPT);
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
}
/* Get the user input line */
@@ -990,10 +950,18 @@ AcpiDbUserCommands (
* Signal the debug thread that we have a command to execute,
* and wait for the command to complete.
*/
- AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
- AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
-
else
{
/* Just call to the command line interpreter */
@@ -1002,7 +970,6 @@ AcpiDbUserCommands (
}
}
-
/*
* Only this thread (the original thread) should actually terminate the subsystem,
* because all the semaphores are deleted during termination
diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c
index 566e57d..ae09193 100644
--- a/sys/contrib/dev/acpica/dbstats.c
+++ b/sys/contrib/dev/acpica/dbstats.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 49 $
+ * $Revision: 55 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbstats")
+ ACPI_MODULE_NAME ("dbstats")
/*
* Statistics subcommands
@@ -159,9 +159,8 @@ ARGUMENT_INFO AcpiDbStatTypes [] =
* RETURN: None
*
* DESCRIPTION: Add this object to the global counts, by object type.
- * Recursively handles subobjects and packages.
- *
- * [TBD] Restructure - remove recursion.
+ * Limited recursion handles subobjects and packages, and this
+ * is probably acceptable within the AML debugger only.
*
******************************************************************************/
@@ -169,8 +168,6 @@ void
AcpiDbEnumerateObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
- ACPI_OPERAND_OBJECT *ObjDesc2;
- UINT32 Type;
UINT32 i;
@@ -184,22 +181,21 @@ AcpiDbEnumerateObject (
AcpiGbl_NumObjects++;
- Type = ObjDesc->Common.Type;
- if (Type > INTERNAL_TYPE_NODE_MAX)
+ if (ObjDesc->Common.Type > INTERNAL_TYPE_NODE_MAX)
{
AcpiGbl_ObjTypeCountMisc++;
}
else
{
- AcpiGbl_ObjTypeCount [Type]++;
+ AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
}
/* Count the sub-objects */
- switch (Type)
+ switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
- for (i = 0; i< ObjDesc->Package.Count; i++)
+ for (i = 0; i < ObjDesc->Package.Count; i++)
{
AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
}
@@ -212,15 +208,14 @@ AcpiDbEnumerateObject (
break;
case ACPI_TYPE_BUFFER_FIELD:
- ObjDesc2 = AcpiNsGetSecondaryObject (ObjDesc);
- if (ObjDesc2)
+ if (AcpiNsGetSecondaryObject (ObjDesc))
{
- AcpiGbl_ObjTypeCount [INTERNAL_TYPE_EXTRA]++;
+ AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
}
break;
case ACPI_TYPE_REGION:
- AcpiGbl_ObjTypeCount [INTERNAL_TYPE_EXTRA]++;
+ AcpiGbl_ObjTypeCount [INTERNAL_TYPE_REGION_FIELD ]++;
AcpiDbEnumerateObject (ObjDesc->Region.AddrHandler);
break;
@@ -373,8 +368,10 @@ AcpiDbDisplayStatistics (
{
UINT32 i;
UINT32 Type;
- UINT32 Outstanding;
UINT32 Size;
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Outstanding;
+#endif
if (!AcpiGbl_DSDT)
@@ -388,7 +385,7 @@ AcpiDbDisplayStatistics (
return (AE_OK);
}
- STRUPR (TypeArg);
+ ACPI_STRUPR (TypeArg);
Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
if (Type == (UINT32) -1)
{
@@ -470,11 +467,11 @@ AcpiDbDisplayStatistics (
if (AcpiGbl_MemoryLists[i].ObjectSize)
{
- Size = ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
+ Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
}
else
{
- Size = ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
+ Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
}
AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c
index 75dbac5..648cb90 100644
--- a/sys/contrib/dev/acpica/dbutils.c
+++ b/sys/contrib/dev/acpica/dbutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 45 $
+ * $Revision: 51 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,7 +129,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbutils")
+ ACPI_MODULE_NAME ("dbutils")
/*******************************************************************************
@@ -152,12 +152,9 @@ AcpiDbSetOutputDestination (
AcpiGbl_DbOutputFlags = (UINT8) OutputFlags;
- if (OutputFlags & DB_REDIRECTABLE_OUTPUT)
+ if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile)
{
- if (AcpiGbl_DbOutputToFile)
- {
- AcpiDbgLevel = AcpiGbl_DbDebugLevel;
- }
+ AcpiDbgLevel = AcpiGbl_DbDebugLevel;
}
else
{
@@ -186,7 +183,7 @@ AcpiDbDumpBuffer (
AcpiOsPrintf ("\nLocation %X:\n", Address);
AcpiDbgLevel |= ACPI_LV_TABLES;
- AcpiUtDumpBuffer ((UINT8 *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+ AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
}
@@ -232,8 +229,9 @@ AcpiDbDumpObject (
case ACPI_TYPE_INTEGER:
- AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", HIDWORD (ObjDesc->Integer.Value),
- LODWORD (ObjDesc->Integer.Value));
+ AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
@@ -315,7 +313,7 @@ AcpiDbPrepNamestring (
return;
}
- STRUPR (Name);
+ ACPI_STRUPR (Name);
/* Convert a leading forward slash to a backslash */
@@ -372,7 +370,7 @@ AcpiDbSecondPassParse (
ACPI_WALK_STATE *WalkState;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("Pass two parse ....\n");
@@ -449,6 +447,9 @@ AcpiDbSecondPassParse (
*
* DESCRIPTION: Lookup a name in the ACPI namespace
*
+ * Note: Currently begins search from the root. Could be enhanced to use
+ * the current prefix (scope) node as the search beginning point.
+ *
******************************************************************************/
ACPI_NAMESPACE_NODE *
@@ -471,22 +472,18 @@ AcpiDbLocalNsLookup (
return (NULL);
}
- /* Lookup the name */
-
- /* TBD: [Investigate] what scope do we use? */
- /* Use the root scope for the start of the search */
-
- Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &Node);
-
+ /*
+ * Lookup the name.
+ * (Uses root node as the search starting point)
+ */
+ Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiFormatException (Status));
}
-
ACPI_MEM_FREE (InternalPath);
-
return (Node);
}
diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c
index 1833c97..9225aff 100644
--- a/sys/contrib/dev/acpica/dbxface.c
+++ b/sys/contrib/dev/acpica/dbxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 46 $
+ * $Revision: 55 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,7 +128,7 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbxface")
+ ACPI_MODULE_NAME ("dbxface")
/*******************************************************************************
@@ -155,27 +155,35 @@ AcpiDbSingleStep (
ACPI_STATUS Status = AE_OK;
UINT32 OriginalDebugLevel;
ACPI_PARSE_OBJECT *DisplayOp;
+ ACPI_PARSE_OBJECT *ParentOp;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /* Is there a breakpoint set? */
+ /* Check for single-step breakpoint */
- if (WalkState->MethodBreakpoint)
+ if (WalkState->MethodBreakpoint && (WalkState->MethodBreakpoint <= Op->AmlOffset))
{
/* Check if the breakpoint has been reached or passed */
+ /* Hit the breakpoint, resume single step, reset breakpoint */
- if (WalkState->MethodBreakpoint <= Op->AmlOffset)
- {
- /* Hit the breakpoint, resume single step, reset breakpoint */
+ AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->AmlOffset);
+ AcpiGbl_CmSingleStep = TRUE;
+ AcpiGbl_StepToNextCall = FALSE;
+ WalkState->MethodBreakpoint = 0;
+ }
- AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->AmlOffset);
- AcpiGbl_CmSingleStep = TRUE;
- AcpiGbl_StepToNextCall = FALSE;
- WalkState->MethodBreakpoint = 0;
- }
+ /* Check for user breakpoint (Must be on exact Aml offset) */
+
+ else if (WalkState->UserBreakpoint && (WalkState->UserBreakpoint == Op->AmlOffset))
+ {
+ AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", Op->AmlOffset);
+ AcpiGbl_CmSingleStep = TRUE;
+ AcpiGbl_StepToNextCall = FALSE;
+ WalkState->MethodBreakpoint = 0;
}
+
/*
* Check if this is an opcode that we are interested in --
* namely, opcodes that have arguments
@@ -190,7 +198,6 @@ AcpiDbSingleStep (
case AML_CLASS_UNKNOWN:
case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
return (AE_OK);
- break;
}
/*
@@ -218,12 +225,43 @@ AcpiDbSingleStep (
DisplayOp = Op;
- if (Op->Parent)
+ ParentOp = Op->Parent;
+ if (ParentOp)
{
- if ((Op->Parent->Opcode == AML_IF_OP) ||
- (Op->Parent->Opcode == AML_WHILE_OP))
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING))
+ {
+ /*
+ * We are executing the predicate of an IF or WHILE statement
+ * Search upwards for the containing IF or WHILE so that the
+ * entire predicate can be displayed.
+ */
+ while (ParentOp)
+ {
+ if ((ParentOp->Opcode == AML_IF_OP) ||
+ (ParentOp->Opcode == AML_WHILE_OP))
+ {
+ DisplayOp = ParentOp;
+ break;
+ }
+ ParentOp = ParentOp->Parent;
+ }
+ }
+ else
{
- DisplayOp = Op->Parent;
+ while (ParentOp)
+ {
+ if ((ParentOp->Opcode == AML_IF_OP) ||
+ (ParentOp->Opcode == AML_ELSE_OP) ||
+ (ParentOp->Opcode == AML_SCOPE_OP) ||
+ (ParentOp->Opcode == AML_METHOD_OP) ||
+ (ParentOp->Opcode == AML_WHILE_OP))
+ {
+ break;
+ }
+ DisplayOp = ParentOp;
+ ParentOp = ParentOp->Parent;
+ }
}
}
@@ -236,17 +274,17 @@ AcpiDbSingleStep (
{
if (WalkState->ControlState->Common.Value)
{
- AcpiOsPrintf ("Predicate was TRUE, executed block\n");
+ AcpiOsPrintf ("Predicate = [True], IF block was executed\n");
}
else
{
- AcpiOsPrintf ("Predicate is FALSE, skipping block\n");
+ AcpiOsPrintf ("Predicate = [False], Skipping IF block\n");
}
}
else if (Op->Opcode == AML_ELSE_OP)
{
- /* TBD */
+ AcpiOsPrintf ("Predicate = [False], ELSE block was executed\n");
}
/* Restore everything */
@@ -263,7 +301,6 @@ AcpiDbSingleStep (
return (AE_OK);
}
-
/*
* If we are executing a step-to-call command,
* Check if this is a method call.
@@ -282,7 +319,6 @@ AcpiDbSingleStep (
AcpiGbl_StepToNextCall = FALSE;
}
-
/*
* If the next opcode is a method call, we will "step over" it
* by default.
@@ -291,11 +327,9 @@ AcpiDbSingleStep (
{
AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */
- /* Set the breakpoint on the call, it will stop execution as soon as we return */
+ /* Set the breakpoint on/before the call, it will stop execution as soon as we return */
- /* TBD: [Future] don't kill the user breakpoint! */
-
- WalkState->MethodBreakpoint = /* Op->AmlOffset + */ 1; /* Must be non-zero! */
+ WalkState->MethodBreakpoint = 1; /* Must be non-zero! */
}
@@ -313,8 +347,16 @@ AcpiDbSingleStep (
{
/* Handshake with the front-end that gets user command lines */
- AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
- AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
else
@@ -323,17 +365,17 @@ AcpiDbSingleStep (
/* Force output to console until a command is entered */
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */
if (!AcpiGbl_MethodExecuting)
{
- AcpiOsPrintf ("%1c ", DB_COMMAND_PROMPT);
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
}
else
{
- AcpiOsPrintf ("%1c ", DB_EXECUTE_PROMPT);
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
}
/* Get the user input line */
@@ -368,16 +410,34 @@ int
AcpiDbInitialize (void)
{
-
/* Init globals */
- AcpiGbl_DbBuffer = AcpiOsCallocate (ACPI_DEBUG_BUFFER_SIZE);
+ AcpiGbl_DbBuffer = NULL;
+ AcpiGbl_DbFilename = NULL;
+ AcpiGbl_DbOutputToFile = FALSE;
+
+ AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2;
+ AcpiGbl_DbConsoleDebugLevel = NORMAL_DEFAULT | ACPI_LV_TABLES;
+ AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
+
+ AcpiGbl_DbOpt_tables = FALSE;
+ AcpiGbl_DbOpt_disasm = FALSE;
+ AcpiGbl_DbOpt_stats = FALSE;
+ AcpiGbl_DbOpt_verbose = TRUE;
+ AcpiGbl_DbOpt_ini_methods = TRUE;
+
+ AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE);
+ if (!AcpiGbl_DbBuffer)
+ {
+ return 0;
+ }
+ ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE);
/* Initial scope is the root */
AcpiGbl_DbScopeBuf [0] = '\\';
AcpiGbl_DbScopeBuf [1] = 0;
-
+ AcpiGbl_DbScopeNode = AcpiGbl_RootNode;
/*
* If configured for multi-thread support, the debug executor runs in
diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c
index e58f1be..87dd8c0 100644
--- a/sys/contrib/dev/acpica/dsfield.c
+++ b/sys/contrib/dev/acpica/dsfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 56 $
+ * $Revision: 62 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsfield")
+ ACPI_MODULE_NAME ("dsfield")
/*******************************************************************************
@@ -161,7 +161,7 @@ AcpiDsCreateBufferField (
UINT32 Flags;
- FUNCTION_TRACE ("DsCreateBufferField");
+ ACPI_FUNCTION_TRACE ("DsCreateBufferField");
/* Get the NameString argument */
@@ -189,20 +189,19 @@ AcpiDsCreateBufferField (
*/
if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE)
{
- Flags = NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE;
+ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
}
else
{
- Flags = NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE | NS_ERROR_IF_FOUND;
+ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND;
}
/*
* Enter the NameString into the namespace
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
- Flags,
- WalkState, &(Node));
+ INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1,
+ Flags, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -291,7 +290,7 @@ AcpiDsGetFieldNames (
ACPI_STATUS Status;
- FUNCTION_TRACE_U32 ("DsGetFieldNames", Info);
+ ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info);
/* First field starts at bit zero */
@@ -312,6 +311,13 @@ AcpiDsGetFieldNames (
{
case AML_INT_RESERVEDFIELD_OP:
+ if (((ACPI_INTEGER) Info->FieldBitPosition + Arg->Value.Size) >
+ ACPI_UINT32_MAX)
+ {
+ ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
Info->FieldBitPosition += Arg->Value.Size;
break;
@@ -337,8 +343,8 @@ AcpiDsGetFieldNames (
Status = AcpiNsLookup (WalkState->ScopeInfo,
(NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
- Info->FieldType, IMODE_EXECUTE, NS_DONT_OPEN_SCOPE,
- NULL, &Info->FieldNode);
+ Info->FieldType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Info->FieldNode);
if (ACPI_FAILURE (Status))
{
if (Status != AE_ALREADY_EXISTS)
@@ -346,7 +352,7 @@ AcpiDsGetFieldNames (
return_ACPI_STATUS (Status);
}
- REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
+ ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
&((ACPI_PARSE2_OBJECT *)Arg)->Name));
}
else
@@ -365,6 +371,14 @@ AcpiDsGetFieldNames (
/* Keep track of bit position for the next field */
+ if (((ACPI_INTEGER) Info->FieldBitPosition + Arg->Value.Size) >
+ ACPI_UINT32_MAX)
+ {
+ ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
+ &Info->FieldNode->Name));
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
Info->FieldBitPosition += Info->FieldBitLength;
break;
@@ -374,7 +388,6 @@ AcpiDsGetFieldNames (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
Arg->Opcode));
return_ACPI_STATUS (AE_AML_ERROR);
- break;
}
Arg = Arg->Next;
@@ -409,7 +422,7 @@ AcpiDsCreateField (
ACPI_CREATE_FIELD_INFO Info;
- FUNCTION_TRACE_PTR ("DsCreateField", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateField", Op);
/* First arg is the name of the parent OpRegion (must already exist) */
@@ -418,8 +431,8 @@ AcpiDsCreateField (
if (!RegionNode)
{
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState, &RegionNode);
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -469,7 +482,7 @@ AcpiDsInitFieldObjects (
UINT8 Type = 0;
- FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op);
switch (WalkState->Opcode)
@@ -501,9 +514,9 @@ AcpiDsInitFieldObjects (
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
(NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
- Type, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE | NS_ERROR_IF_FOUND,
- NULL, &Node);
+ Type, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
+ WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status != AE_ALREADY_EXISTS)
@@ -511,14 +524,14 @@ AcpiDsInitFieldObjects (
return_ACPI_STATUS (Status);
}
- REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
+ ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
&((ACPI_PARSE2_OBJECT *)Arg)->Name));
}
Arg->Node = Node;
}
- /* Move on to next field in the list */
+ /* Move to next field in the list */
Arg = Arg->Next;
}
@@ -552,7 +565,7 @@ AcpiDsCreateBankField (
ACPI_CREATE_FIELD_INFO Info;
- FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
/* First arg is the name of the parent OpRegion (must already exist) */
@@ -561,8 +574,8 @@ AcpiDsCreateBankField (
if (!RegionNode)
{
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState, &RegionNode);
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -573,8 +586,8 @@ AcpiDsCreateBankField (
Arg = Arg->Next;
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
+ INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -626,15 +639,15 @@ AcpiDsCreateIndexField (
ACPI_CREATE_FIELD_INFO Info;
- FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
/* First arg is the name of the Index register (must already exist) */
Arg = Op->Value.Arg;
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -644,8 +657,8 @@ AcpiDsCreateIndexField (
Arg = Arg->Next;
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
+ INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c
index 147a4ee..099372d 100644
--- a/sys/contrib/dev/acpica/dsmethod.c
+++ b/sys/contrib/dev/acpica/dsmethod.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 73 $
+ * $Revision: 79 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsmethod")
+ ACPI_MODULE_NAME ("dsmethod")
/*******************************************************************************
@@ -160,7 +160,7 @@ AcpiDsParseMethod (
ACPI_WALK_STATE *WalkState;
- FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle);
+ ACPI_FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle);
/* Parameter Validation */
@@ -171,8 +171,7 @@ AcpiDsParseMethod (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** NamedObj=%p\n",
- (char*)&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle));
-
+ (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle));
/* Extract the method object from the method Node */
@@ -212,9 +211,17 @@ AcpiDsParseMethod (
AcpiPsSetName (Op, Node->Name);
Op->Node = Node;
+ /*
+ * Get a new OwnerId for objects created by this method. Namespace
+ * objects (such as Operation Regions) can be created during the
+ * first pass parse.
+ */
+ OwnerId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+ ObjDesc->Method.OwningId = OwnerId;
+
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
+ WalkState = AcpiDsCreateWalkState (OwnerId,
NULL, NULL, NULL);
if (!WalkState)
{
@@ -245,16 +252,10 @@ AcpiDsParseMethod (
return_ACPI_STATUS (Status);
}
- /* Get a new OwnerId for objects created by this method */
-
- OwnerId = AcpiUtAllocateOwnerId (OWNER_TYPE_METHOD);
- ObjDesc->Method.OwningId = OwnerId;
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
- (char*)&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle, Op));
+ (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle, Op));
AcpiPsDeleteParseTree (Op);
-
return_ACPI_STATUS (Status);
}
@@ -286,7 +287,7 @@ AcpiDsBeginMethodExecution (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
+ ACPI_FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
if (!MethodNode)
@@ -294,7 +295,6 @@ AcpiDsBeginMethodExecution (
return_ACPI_STATUS (AE_NULL_ENTRY);
}
-
/*
* If there is a concurrency limit on this method, we need to
* obtain a unit from the method semaphore.
@@ -325,13 +325,11 @@ AcpiDsBeginMethodExecution (
WAIT_FOREVER);
}
-
/*
* Increment the method parse tree thread count since it has been
* reentered one more time (even if it is the same thread)
*/
ObjDesc->Method.ThreadCount++;
-
return_ACPI_STATUS (Status);
}
@@ -353,7 +351,7 @@ ACPI_STATUS
AcpiDsCallControlMethod (
ACPI_THREAD_STATE *Thread,
ACPI_WALK_STATE *ThisWalkState,
- ACPI_PARSE_OBJECT *Op) /* TBD: This operand is obsolete */
+ ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *MethodNode;
@@ -362,7 +360,7 @@ AcpiDsCallControlMethod (
UINT32 i;
- FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
ThisWalkState->PrevOp, ThisWalkState));
@@ -391,7 +389,6 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (Status);
}
-
/* 1) Parse: Create a new walk state for the preempting walk */
NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
@@ -399,7 +396,6 @@ AcpiDsCallControlMethod (
if (!NextWalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
- goto Cleanup;
}
/* Create and init a Root Node */
@@ -425,7 +421,6 @@ AcpiDsCallControlMethod (
Status = AcpiPsParseAml (NextWalkState);
AcpiPsDeleteParseTree (Op);
-
/* 2) Execute: Create a new state for the preempting walk */
NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
@@ -503,7 +498,7 @@ AcpiDsRestartControlMethod (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("DsRestartControlMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsRestartControlMethod", WalkState);
if (ReturnDesc)
@@ -521,7 +516,6 @@ AcpiDsRestartControlMethod (
return_ACPI_STATUS (Status);
}
}
-
else
{
/*
@@ -530,7 +524,6 @@ AcpiDsRestartControlMethod (
*/
AcpiUtRemoveReference (ReturnDesc);
}
-
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@@ -563,12 +556,13 @@ AcpiDsTerminateControlMethod (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *MethodNode;
+ ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
- /* The method object should be stored in the walk state */
+ /* The current method object was saved in the walk state */
ObjDesc = WalkState->MethodDesc;
if (!ObjDesc)
@@ -585,8 +579,11 @@ AcpiDsTerminateControlMethod (
* If this is the last thread executing the method,
* we have additional cleanup to perform
*/
- AcpiUtAcquireMutex (ACPI_MTX_PARSER);
-
+ Status = AcpiUtAcquireMutex (ACPI_MTX_PARSER);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Signal completion of the execution of this method if necessary */
@@ -613,7 +610,12 @@ AcpiDsTerminateControlMethod (
* Delete any namespace entries created immediately underneath
* the method
*/
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
if (MethodNode->Child)
{
AcpiNsDeleteNamespaceSubtree (MethodNode);
@@ -624,11 +626,15 @@ AcpiDsTerminateControlMethod (
* the namespace
*/
AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
- AcpiUtReleaseMutex (ACPI_MTX_PARSER);
- return_ACPI_STATUS (AE_OK);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_PARSER);
+ return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c
index e597976..3f8d3c2 100644
--- a/sys/contrib/dev/acpica/dsmthdat.c
+++ b/sys/contrib/dev/acpica/dsmthdat.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 53 $
+ * $Revision: 58 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsmthdat")
+ ACPI_MODULE_NAME ("dsmthdat")
/*******************************************************************************
@@ -156,32 +156,32 @@ AcpiDsMethodDataInit (
UINT32 i;
- FUNCTION_TRACE ("DsMethodDataInit");
+ ACPI_FUNCTION_TRACE ("DsMethodDataInit");
/* Init the method arguments */
for (i = 0; i < MTH_NUM_ARGS; i++)
{
- MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
NAMEOF_ARG_NTE);
- WalkState->Arguments[i].Name |= (i << 24);
- WalkState->Arguments[i].DataType = ACPI_DESC_TYPE_NAMED;
- WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
- WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
+ WalkState->Arguments[i].Name |= (i << 24);
+ WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
+ WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
+ WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
for (i = 0; i < MTH_NUM_LOCALS; i++)
{
- MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
NAMEOF_LOCAL_NTE);
- WalkState->LocalVariables[i].Name |= (i << 24);
- WalkState->LocalVariables[i].DataType = ACPI_DESC_TYPE_NAMED;
- WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
- WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
+ WalkState->LocalVariables[i].Name |= (i << 24);
+ WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
+ WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
+ WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_ACPI_STATUS (AE_OK);
@@ -208,7 +208,7 @@ AcpiDsMethodDataDeleteAll (
UINT32 Index;
- FUNCTION_TRACE ("DsMethodDataDeleteAll");
+ ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
/* Detach the locals */
@@ -271,7 +271,7 @@ AcpiDsMethodDataInitArgs (
UINT32 Index = 0;
- FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
+ ACPI_FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
if (!Params)
@@ -323,7 +323,7 @@ AcpiDsMethodDataGetNode (
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
{
- FUNCTION_TRACE ("DsMethodDataGetNode");
+ ACPI_FUNCTION_TRACE ("DsMethodDataGetNode");
/*
@@ -362,7 +362,6 @@ AcpiDsMethodDataGetNode (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
- break;
}
return_ACPI_STATUS (AE_OK);
@@ -395,7 +394,7 @@ AcpiDsMethodDataSetValue (
ACPI_NAMESPACE_NODE *Node;
- FUNCTION_TRACE ("DsMethodDataSetValue");
+ ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
/* Get the namespace node for the arg/local */
@@ -430,7 +429,7 @@ AcpiDsMethodDataSetValue (
*
******************************************************************************/
-ACPI_OBJECT_TYPE8
+ACPI_OBJECT_TYPE
AcpiDsMethodDataGetType (
UINT16 Opcode,
UINT32 Index,
@@ -441,7 +440,7 @@ AcpiDsMethodDataGetType (
ACPI_OPERAND_OBJECT *Object;
- FUNCTION_TRACE ("DsMethodDataGetType");
+ ACPI_FUNCTION_TRACE ("DsMethodDataGetType");
/* Get the namespace node for the arg/local */
@@ -498,7 +497,7 @@ AcpiDsMethodDataGetValue (
ACPI_OPERAND_OBJECT *Object;
- FUNCTION_TRACE ("DsMethodDataGetValue");
+ ACPI_FUNCTION_TRACE ("DsMethodDataGetValue");
/* Validate the object descriptor */
@@ -540,7 +539,6 @@ AcpiDsMethodDataGetValue (
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
- break;
case AML_LOCAL_OP:
@@ -548,7 +546,6 @@ AcpiDsMethodDataGetValue (
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
- break;
}
}
@@ -589,7 +586,7 @@ AcpiDsMethodDataDeleteValue (
ACPI_OPERAND_OBJECT *Object;
- FUNCTION_TRACE ("DsMethodDataDeleteValue");
+ ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
/* Get the namespace node for the arg/local */
@@ -612,7 +609,7 @@ AcpiDsMethodDataDeleteValue (
Node->Object = NULL;
if ((Object) &&
- (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL)))
+ (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_INTERNAL))
{
/*
* There is a valid object.
@@ -655,7 +652,7 @@ AcpiDsStoreObjectToLocal (
ACPI_OPERAND_OBJECT *CurrentObjDesc;
- FUNCTION_TRACE ("DsStoreObjectToLocal");
+ ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n",
Opcode, Index, ObjDesc));
@@ -707,7 +704,7 @@ AcpiDsStoreObjectToLocal (
* Weird, but true.
*/
if ((Opcode == AML_ARG_OP) &&
- (VALID_DESCRIPTOR_TYPE (CurrentObjDesc, ACPI_DESC_TYPE_NAMED)))
+ (ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_NAMED))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an ObjRef(Node), storing in node %p\n",
@@ -721,7 +718,7 @@ AcpiDsStoreObjectToLocal (
* Store this object into the Node
* (perform the indirect store)
*/
- Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
+ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
ObjDesc, ObjDesc->Common.Type);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c
index 6264038..d56125f 100644
--- a/sys/contrib/dev/acpica/dsobject.c
+++ b/sys/contrib/dev/acpica/dsobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 85 $
+ * $Revision: 90 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsobject")
+ ACPI_MODULE_NAME ("dsobject")
/*******************************************************************************
@@ -154,13 +154,13 @@ AcpiDsInitOneObject (
void *Context,
void **ReturnValue)
{
- ACPI_OBJECT_TYPE8 Type;
+ ACPI_OBJECT_TYPE Type;
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
UINT8 TableRevision;
- PROC_NAME ("DsInitOneObject");
+ ACPI_FUNCTION_NAME ("DsInitOneObject");
Info->ObjectCount++;
@@ -183,7 +183,6 @@ AcpiDsInitOneObject (
switch (Type)
{
-
case ACPI_TYPE_REGION:
AcpiDsInitializeRegion (ObjHandle);
@@ -218,7 +217,7 @@ AcpiDsInitOneObject (
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
- ObjHandle, (char*)&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name,
+ ObjHandle, (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name,
AcpiFormatException (Status)));
/* This parse failed, but we will continue parsing more methods */
@@ -231,6 +230,7 @@ AcpiDsInitOneObject (
* for every execution since there isn't much overhead
*/
AcpiNsDeleteNamespaceSubtree (ObjHandle);
+ AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
break;
default:
@@ -267,7 +267,7 @@ AcpiDsInitializeObjects (
ACPI_INIT_WALK_INFO Info;
- FUNCTION_TRACE ("DsInitializeObjects");
+ ACPI_FUNCTION_TRACE ("DsInitializeObjects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@@ -333,7 +333,7 @@ AcpiDsInitObjectFromOp (
ACPI_OPERAND_OBJECT *ObjDesc;
- PROC_NAME ("DsInitObjectFromOp");
+ ACPI_FUNCTION_NAME ("DsInitObjectFromOp");
ObjDesc = *RetObjDesc;
@@ -390,7 +390,7 @@ AcpiDsInitObjectFromOp (
if (ObjDesc->Buffer.Length == 0)
{
ObjDesc->Buffer.Pointer = NULL;
- REPORT_WARNING (("Buffer created with zero length in AML\n"));
+ ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
break;
}
@@ -421,8 +421,8 @@ AcpiDsInitObjectFromOp (
return (AE_TYPE);
}
- MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data,
- ObjDesc->Buffer.Length);
+ ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data,
+ ObjDesc->Buffer.Length);
}
break;
@@ -448,7 +448,7 @@ AcpiDsInitObjectFromOp (
case ACPI_TYPE_STRING:
ObjDesc->String.Pointer = Op->Value.String;
- ObjDesc->String.Length = STRLEN (Op->Value.String);
+ ObjDesc->String.Length = ACPI_STRLEN (Op->Value.String);
/*
* The string is contained in the ACPI table, don't ever try
@@ -534,11 +534,10 @@ AcpiDsBuildInternalSimpleObj (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- UINT32 Length;
char *Name;
- FUNCTION_TRACE ("DsBuildInternalSimpleObj");
+ ACPI_FUNCTION_TRACE ("DsBuildInternalSimpleObj");
if (Op->Opcode == AML_INT_NAMEPATH_OP)
@@ -551,27 +550,27 @@ AcpiDsBuildInternalSimpleObj (
if (!Op->Node)
{
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String,
- ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL,
- (ACPI_NAMESPACE_NODE **)&(Op->Node));
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
+ (ACPI_NAMESPACE_NODE **) &(Op->Node));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
Name = NULL;
- AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, &Length, &Name);
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, NULL, &Name);
if (Name)
{
- REPORT_WARNING (("Reference %s at AML %X not found\n",
+ ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
Name, Op->AmlOffset));
ACPI_MEM_FREE (Name);
}
else
{
- REPORT_WARNING (("Reference %s at AML %X not found\n",
+ ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
Op->Value.String, Op->AmlOffset));
}
@@ -632,7 +631,7 @@ AcpiDsBuildInternalPackageObj (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("DsBuildInternalPackageObj");
+ ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
@@ -763,7 +762,7 @@ AcpiDsCreateNode (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE_PTR ("DsCreateNode", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
/*
@@ -797,7 +796,7 @@ AcpiDsCreateNode (
/* Init obj */
- Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Node->Type);
+ Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
/* Remove local reference to the object */
diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c
index 1787efd..bee7bde 100644
--- a/sys/contrib/dev/acpica/dsopcode.c
+++ b/sys/contrib/dev/acpica/dsopcode.c
@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 66 $
+ * $Revision: 73 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#include "actables.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsopcode")
+ ACPI_MODULE_NAME ("dsopcode")
/*****************************************************************************
@@ -154,7 +154,7 @@ AcpiDsExecuteArguments (
ACPI_PARSE_OBJECT *Arg;
- FUNCTION_TRACE ("AcpiDsExecuteArguments");
+ ACPI_FUNCTION_TRACE ("AcpiDsExecuteArguments");
/*
@@ -169,7 +169,7 @@ AcpiDsExecuteArguments (
/* Save the Node for use in AcpiPsParseAml */
- Op->Node = AcpiNsGetParentObject (Node);
+ Op->Node = AcpiNsGetParentNode (Node);
/* Create and initialize a new parser state */
@@ -213,7 +213,7 @@ AcpiDsExecuteArguments (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Op->Node = AcpiNsGetParentObject (Node);
+ Op->Node = AcpiNsGetParentNode (Node);
/* Create and initialize a new parser state */
@@ -233,7 +233,6 @@ AcpiDsExecuteArguments (
Status = AcpiPsParseAml (WalkState);
AcpiPsDeleteParseTree (Op);
-
return_ACPI_STATUS (Status);
}
@@ -260,7 +259,7 @@ AcpiDsGetBufferFieldArguments (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -273,7 +272,7 @@ AcpiDsGetBufferFieldArguments (
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
Node = ObjDesc->BufferField.Node;
- DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]"));
+ ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n",
(char *) &Node->Name));
@@ -306,7 +305,7 @@ AcpiDsGetRegionArguments (
ACPI_OPERAND_OBJECT *RegionObj2;
- FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
@@ -324,14 +323,13 @@ AcpiDsGetRegionArguments (
Node = ObjDesc->Region.Node;
- DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]"));
+ ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n",
(char *) &Node->Name, RegionObj2->Extra.AmlStart));
Status = AcpiDsExecuteArguments (Node, RegionObj2);
-
return_ACPI_STATUS (Status);
}
@@ -361,7 +359,6 @@ AcpiDsInitializeRegion (
/* Namespace is NOT locked */
Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
-
return (Status);
}
@@ -398,7 +395,7 @@ AcpiDsEvalBufferFieldOperands (
ACPI_OPERAND_OBJECT *SrcDesc = NULL;
- FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
/*
@@ -427,8 +424,8 @@ AcpiDsEvalBufferFieldOperands (
/* Resolve the operands */
- Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
+ Status = AcpiExResolveOperands (Op->Opcode, ACPI_WALK_OPERANDS, WalkState);
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
WalkState->NumOperands, "after AcpiExResolveOperands");
if (ACPI_FAILURE (Status))
@@ -459,9 +456,9 @@ AcpiDsEvalBufferFieldOperands (
* If ResDesc is a Name, it will be a direct name pointer after
* AcpiExResolveOperands()
*/
- if (!VALID_DESCRIPTOR_TYPE (ResDesc, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (ResDesc) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a Node\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n",
AcpiPsGetOpcodeName (Op->Opcode)));
Status = AE_AML_OPERAND_TYPE;
@@ -473,7 +470,6 @@ AcpiDsEvalBufferFieldOperands (
*/
switch (Op->Opcode)
{
-
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
@@ -587,7 +583,6 @@ AcpiDsEvalBufferFieldOperands (
"Tried to create field in invalid object type %X\n",
SrcDesc->Common.Type));
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -627,7 +622,6 @@ Cleanup:
{
AcpiUtRemoveReference (ResDesc); /* Result descriptor */
}
-
else
{
/* Now the address and length are valid for this BufferField */
@@ -664,7 +658,7 @@ AcpiDsEvalRegionOperands (
ACPI_PARSE_OBJECT *NextOp;
- FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
/*
@@ -690,17 +684,16 @@ AcpiDsEvalRegionOperands (
/* Resolve the length and address operands to numbers */
- Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
+ Status = AcpiExResolveOperands (Op->Opcode, ACPI_WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (Op->Opcode),
1, "after AcpiExResolveOperands");
-
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
@@ -725,9 +718,9 @@ AcpiDsEvalRegionOperands (
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Integer.Value;
AcpiUtRemoveReference (OperandDesc);
-
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
- ObjDesc, HIDWORD(ObjDesc->Region.Address), LODWORD(ObjDesc->Region.Address),
+ ObjDesc,
+ ACPI_HIDWORD (ObjDesc->Region.Address), ACPI_LODWORD (ObjDesc->Region.Address),
ObjDesc->Region.Length));
/* Now the address and length are valid for this opregion */
@@ -761,7 +754,7 @@ AcpiDsExecBeginControlOp (
ACPI_GENERIC_STATE *ControlState;
- PROC_NAME ("DsExecBeginControlOp");
+ ACPI_FUNCTION_NAME ("DsExecBeginControlOp");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
@@ -783,15 +776,18 @@ AcpiDsExecBeginControlOp (
Status = AE_NO_MEMORY;
break;
}
-
- AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
-
/*
* Save a pointer to the predicate for multiple executions
* of a loop
*/
- WalkState->ControlState->Control.AmlPredicateStart =
- WalkState->ParserState.Aml - 1;
+ ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
+ ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
+ ControlState->Control.Opcode = Op->Opcode;
+
+
+ /* Push the control state on this walk's control stack */
+
+ AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
break;
case AML_ELSE_OP:
@@ -841,7 +837,7 @@ AcpiDsExecEndControlOp (
ACPI_GENERIC_STATE *ControlState;
- PROC_NAME ("DsExecEndControlOp");
+ ACPI_FUNCTION_NAME ("DsExecEndControlOp");
switch (Op->Opcode)
@@ -931,7 +927,6 @@ AcpiDsExecEndControlOp (
*/
WalkState->ReturnDesc = WalkState->Operands[0];
}
-
else if ((WalkState->Results) &&
(WalkState->Results->Results.NumResults > 0))
{
@@ -944,7 +939,7 @@ AcpiDsExecEndControlOp (
*
* Allow references created by the Index operator to return unchanged.
*/
- if (VALID_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc [0], ACPI_DESC_TYPE_INTERNAL) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_INTERNAL) &&
((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) &&
((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
{
@@ -957,7 +952,6 @@ AcpiDsExecEndControlOp (
WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
}
-
else
{
/* No return operand */
@@ -1001,30 +995,39 @@ AcpiDsExecEndControlOp (
case AML_BREAK_OP:
+ case AML_CONTINUE_OP: /* ACPI 2.0 */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Break to end of current package, Op=%p\n", Op));
- /* TBD: update behavior for ACPI 2.0 */
+ /* Pop and delete control states until we find a while */
- /*
- * As per the ACPI specification:
- * "The break operation causes the current package
- * execution to complete"
- * "Break -- Stop executing the current code package
- * at this point"
- *
- * Returning AE_FALSE here will cause termination of
- * the current package, and execution will continue one
- * level up, starting with the completion of the parent Op.
- */
- Status = AE_CTRL_FALSE;
- break;
+ while (WalkState->ControlState &&
+ (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
+ {
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+ AcpiUtDeleteGenericState (ControlState);
+ }
+ /* No while found? */
- case AML_CONTINUE_OP: /* ACPI 2.0 */
+ if (!WalkState->ControlState)
+ {
+ return (AE_AML_NO_WHILE);
+ }
- Status = AE_NOT_IMPLEMENTED;
+ /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
+
+ WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;
+
+ /* Return status depending on opcode */
+
+ if (Op->Opcode == AML_BREAK_OP)
+ {
+ Status = AE_CTRL_BREAK;
+ }
+ else
+ {
+ Status = AE_CTRL_CONTINUE;
+ }
break;
diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c
index 68a2ff8..9164573 100644
--- a/sys/contrib/dev/acpica/dsutils.c
+++ b/sys/contrib/dev/acpica/dsutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 84 $
+ * $Revision: 88 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dsutils")
+ ACPI_MODULE_NAME ("dsutils")
/*******************************************************************************
@@ -150,7 +150,7 @@ AcpiDsIsResultUsed (
const ACPI_OPCODE_INFO *ParentInfo;
- FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
+ ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
/* Must have both an Op and a Result Object */
@@ -199,7 +199,6 @@ AcpiDsIsResultUsed (
/* Never delete the return value associated with a return opcode */
goto ResultUsed;
- break;
case AML_IF_OP:
case AML_WHILE_OP:
@@ -208,7 +207,7 @@ AcpiDsIsResultUsed (
* If we are executing the predicate AND this is the predicate op,
* we will use the return value
*/
- if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) &&
+ if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) &&
(WalkState->ControlState->Control.PredicateOp == Op))
{
goto ResultUsed;
@@ -218,7 +217,6 @@ AcpiDsIsResultUsed (
/* The general control opcode returns no result */
goto ResultNotUsed;
- break;
case AML_CLASS_CREATE:
@@ -228,7 +226,6 @@ AcpiDsIsResultUsed (
* the operands can be method calls. The result is used.
*/
goto ResultUsed;
- break;
case AML_CLASS_NAMED_OBJECT:
@@ -244,7 +241,6 @@ AcpiDsIsResultUsed (
}
goto ResultNotUsed;
- break;
/*
@@ -253,7 +249,6 @@ AcpiDsIsResultUsed (
*/
default:
goto ResultUsed;
- break;
}
@@ -302,7 +297,7 @@ AcpiDsDeleteResultIfNotUsed (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
+ ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
if (!Op)
@@ -361,11 +356,12 @@ AcpiDsCreateOperand (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *ParentOp;
UINT16 Opcode;
- OPERATING_MODE InterpreterMode;
+ ACPI_INTERPRETER_MODE InterpreterMode;
const ACPI_OPCODE_INFO *OpInfo;
+ char *Name;
- FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
/* A valid name must be looked up in the namespace */
@@ -405,26 +401,21 @@ AcpiDsCreateOperand (
{
/* Enter name into namespace if not found */
- InterpreterMode = IMODE_LOAD_PASS2;
+ InterpreterMode = ACPI_IMODE_LOAD_PASS2;
}
else
{
/* Return a failure if name not found */
- InterpreterMode = IMODE_EXECUTE;
+ InterpreterMode = ACPI_IMODE_EXECUTE;
}
Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
ACPI_TYPE_ANY, InterpreterMode,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState,
(ACPI_NAMESPACE_NODE **) &ObjDesc);
-
- /* Free the namestring created above */
-
- ACPI_MEM_FREE (NameString);
-
/*
* The only case where we pass through (ignore) a NOT_FOUND
* error is for the CondRefOf opcode.
@@ -451,13 +442,18 @@ AcpiDsCreateOperand (
*/
Status = AE_AML_NAME_NOT_FOUND;
- /* TBD: Externalize NameString and print */
-
+ Name = NULL;
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, NameString, NULL, &Name);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Object name was not found in namespace\n"));
+ "Object name [%s] was not found in namespace\n", Name));
+ ACPI_MEM_FREE (Name);
}
}
+ /* Free the namestring created above */
+
+ ACPI_MEM_FREE (NameString);
+
/* Check status from the lookup */
if (ACPI_FAILURE (Status))
@@ -472,7 +468,7 @@ AcpiDsCreateOperand (
{
return_ACPI_STATUS (Status);
}
- DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
}
@@ -511,7 +507,8 @@ AcpiDsCreateOperand (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Argument previously created, already stacked \n"));
- DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
+ WalkState->Operands [WalkState->NumOperands - 1], WalkState));
/*
* Use value that was already previously returned
@@ -559,7 +556,7 @@ AcpiDsCreateOperand (
return_ACPI_STATUS (Status);
}
- DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
}
return_ACPI_STATUS (AE_OK);
@@ -590,7 +587,7 @@ AcpiDsCreateOperands (
UINT32 ArgCount = 0;
- FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
+ ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
/* For all arguments in the list... */
@@ -652,7 +649,7 @@ AcpiDsResolveOperands (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
/*
diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c
index 26aa247..5f71274 100644
--- a/sys/contrib/dev/acpica/dswexec.c
+++ b/sys/contrib/dev/acpica/dswexec.c
@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 82 $
+ * $Revision: 89 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswexec")
+ ACPI_MODULE_NAME ("dswexec")
/*
* Dispatch table for opcode classes
@@ -160,18 +160,18 @@ ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
ACPI_STATUS
AcpiDsGetPredicateValue (
ACPI_WALK_STATE *WalkState,
- UINT32 HasResultObj)
+ ACPI_OPERAND_OBJECT *ResultObj)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
WalkState->ControlState->Common.State = 0;
- if (HasResultObj)
+ if (ResultObj)
{
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
@@ -252,7 +252,7 @@ Cleanup:
/* Break to debugger to display result */
- DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
/*
* Delete the predicate result object (we know that
@@ -260,7 +260,7 @@ Cleanup:
*/
AcpiUtRemoveReference (ObjDesc);
- WalkState->ControlState->Common.State = CONTROL_NORMAL;
+ WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
return_ACPI_STATUS (Status);
}
@@ -290,7 +290,7 @@ AcpiDsExecBeginOp (
UINT32 OpcodeClass;
- FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
Op = WalkState->Op;
@@ -306,6 +306,13 @@ AcpiDsExecBeginOp (
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
+
+ if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+ AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
+ AcpiDsScopeStackPop (WalkState);
+ }
}
if (Op == WalkState->Origin)
@@ -325,12 +332,12 @@ AcpiDsExecBeginOp (
*/
if ((WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
- CONTROL_CONDITIONAL_EXECUTING))
+ ACPI_CONTROL_CONDITIONAL_EXECUTING))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
Op, WalkState));
- WalkState->ControlState->Common.State = CONTROL_PREDICATE_EXECUTING;
+ WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING;
/* Save start of predicate */
@@ -366,7 +373,7 @@ AcpiDsExecBeginOp (
case AML_CLASS_NAMED_OBJECT:
- if (WalkState->WalkType == WALK_METHOD)
+ if (WalkState->WalkType == ACPI_WALK_METHOD)
{
/*
* Found a named object declaration during method
@@ -434,7 +441,7 @@ AcpiDsExecEndOp (
UINT32 i;
- FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
Op = WalkState->Op;
@@ -457,8 +464,8 @@ AcpiDsExecEndOp (
/* Call debugger for single step support (DEBUG build only) */
- DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
- DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
+ ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
+ ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
/* Decode the Opcode Class */
@@ -467,7 +474,7 @@ AcpiDsExecEndOp (
case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
break;
-
+
case AML_CLASS_EXECUTE: /* most operators with arguments */
/* Build resolved operand stack */
@@ -493,7 +500,7 @@ AcpiDsExecEndOp (
WalkState);
if (ACPI_SUCCESS (Status))
{
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (WalkState->Opcode),
WalkState->NumOperands, "after ExResolveOperands");
@@ -506,9 +513,9 @@ AcpiDsExecEndOp (
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"[%s]: Could not resolve operands, %s\n",
- AcpiPsGetOpcodeName (WalkState->Opcode),
+ AcpiPsGetOpcodeName (WalkState->Opcode),
AcpiFormatException (Status)));
}
@@ -578,8 +585,8 @@ AcpiDsExecEndOp (
}
/*
- * Since the operands will be passed to another control method,
- * we must resolve all local references here (Local variables,
+ * Since the operands will be passed to another control method,
+ * we must resolve all local references here (Local variables,
* arguments to *this* method, etc.)
*/
Status = AcpiDsResolveOperands (WalkState);
@@ -599,7 +606,6 @@ AcpiDsExecEndOp (
* especially the operand count!
*/
return_ACPI_STATUS (Status);
- break;
case AML_TYPE_CREATE_FIELD:
@@ -620,6 +626,7 @@ AcpiDsExecEndOp (
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
+ case AML_TYPE_NAMED_NO_OBJ:
Status = AcpiDsLoad2EndOp (WalkState);
if (ACPI_FAILURE (Status))
@@ -648,12 +655,11 @@ AcpiDsExecEndOp (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", Op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- break;
case AML_TYPE_BOGUS:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Internal opcode=%X type Op=%p\n",
WalkState->Opcode, Op));
break;
@@ -671,7 +677,7 @@ AcpiDsExecEndOp (
}
/*
- * ACPI 2.0 support for 64-bit integers: Truncate numeric
+ * ACPI 2.0 support for 64-bit integers: Truncate numeric
* result value if we are executing from a 32-bit ACPI table
*/
AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState);
@@ -683,10 +689,10 @@ AcpiDsExecEndOp (
if ((WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
- CONTROL_PREDICATE_EXECUTING) &&
+ ACPI_CONTROL_PREDICATE_EXECUTING) &&
(WalkState->ControlState->Control.PredicateOp == Op))
{
- Status = AcpiDsGetPredicateValue (WalkState, (UINT32) WalkState->ResultObj);
+ Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
WalkState->ResultObj = NULL;
}
@@ -696,7 +702,7 @@ Cleanup:
{
/* Break to debugger to display result */
- DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
/*
* Delete the result op if and only if:
@@ -708,10 +714,7 @@ Cleanup:
/* Always clear the object stack */
- /* TBD: [Investigate] Clear stack of return value,
- but don't delete it */
WalkState->NumOperands = 0;
-
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c
index c18e251..6479744 100644
--- a/sys/contrib/dev/acpica/dswload.c
+++ b/sys/contrib/dev/acpica/dswload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 54 $
+ * $Revision: 60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,7 +126,7 @@
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswload")
+ ACPI_MODULE_NAME ("dswload")
/*******************************************************************************
@@ -170,7 +170,6 @@ AcpiDsInitCallbacks (
default:
return (AE_BAD_PARAMETER);
- break;
}
return (AE_OK);
@@ -199,11 +198,11 @@ AcpiDsLoad1BeginOp (
ACPI_PARSE_OBJECT *Op;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
- ACPI_OBJECT_TYPE8 ObjectType;
+ ACPI_OBJECT_TYPE ObjectType;
NATIVE_CHAR *Path;
- PROC_NAME ("DsLoad1BeginOp");
+ ACPI_FUNCTION_NAME ("DsLoad1BeginOp");
Op = WalkState->Op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
@@ -248,7 +247,7 @@ AcpiDsLoad1BeginOp (
* arguments to the opcode must be created as we go back up the parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
@@ -302,10 +301,10 @@ AcpiDsLoad1EndOp (
ACPI_WALK_STATE *WalkState)
{
ACPI_PARSE_OBJECT *Op;
- ACPI_OBJECT_TYPE8 ObjectType;
+ ACPI_OBJECT_TYPE ObjectType;
- PROC_NAME ("DsLoad1EndOp");
+ ACPI_FUNCTION_NAME ("DsLoad1EndOp");
Op = WalkState->Op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
@@ -388,30 +387,23 @@ AcpiDsLoad2BeginOp (
ACPI_PARSE_OBJECT *Op;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
- ACPI_OBJECT_TYPE8 ObjectType;
+ ACPI_OBJECT_TYPE ObjectType;
NATIVE_CHAR *BufferPtr;
void *Original = NULL;
- PROC_NAME ("DsLoad2BeginOp");
+ ACPI_FUNCTION_NAME ("DsLoad2BeginOp");
+
Op = WalkState->Op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
-
if (Op)
{
/* We only care about Namespace opcodes here */
- if (!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
- WalkState->Opcode != AML_INT_NAMEPATH_OP)
- {
- return (AE_OK);
- }
-
- /* TBD: [Restructure] Temp! same code as in psparse */
-
- if (!(WalkState->OpInfo->Flags & AML_NAMED))
+ if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
+ (!(WalkState->OpInfo->Flags & AML_NAMED)))
{
return (AE_OK);
}
@@ -440,11 +432,12 @@ AcpiDsLoad2BeginOp (
}
else
{
+ /* Get the namestring from the raw AML */
+
BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
}
-
- /* Map the raw opcode into an internal object type */
+ /* Map the opcode into an internal object type */
ObjectType = WalkState->OpInfo->ObjectType;
@@ -459,7 +452,6 @@ AcpiDsLoad2BeginOp (
Node = NULL;
Status = AE_OK;
}
-
else if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
{
/*
@@ -467,9 +459,8 @@ AcpiDsLoad2BeginOp (
* name into the namespace, but look it up for use later
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- IMODE_EXECUTE, NS_SEARCH_PARENT, WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
}
-
else
{
if (Op && Op->Node)
@@ -495,7 +486,7 @@ AcpiDsLoad2BeginOp (
* arguments to the opcode must be created as we go back up the parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node));
}
if (ACPI_SUCCESS (Status))
@@ -510,7 +501,7 @@ AcpiDsLoad2BeginOp (
return (AE_NO_MEMORY);
}
- /* Initialize */
+ /* Initialize the new op */
((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
*OutOp = Op;
@@ -559,18 +550,18 @@ AcpiDsLoad2EndOp (
{
ACPI_PARSE_OBJECT *Op;
ACPI_STATUS Status = AE_OK;
- ACPI_OBJECT_TYPE8 ObjectType;
+ ACPI_OBJECT_TYPE ObjectType;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *Arg;
ACPI_NAMESPACE_NODE *NewNode;
UINT32 i;
- PROC_NAME ("DsLoad2EndOp");
+ ACPI_FUNCTION_NAME ("DsLoad2EndOp");
Op = WalkState->Op;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
-
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%4.4X] Op %p State %p\n",
+ Op->Opcode, Op, WalkState));
/* Only interested in opcodes that have namespace objects */
@@ -584,7 +575,7 @@ AcpiDsLoad2EndOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Ending scope Op=%p State=%p\n", Op, WalkState));
- if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
+ if (((ACPI_PARSE2_OBJECT *)Op)->Name == ACPI_UINT16_MAX)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
Op, WalkState));
@@ -733,7 +724,6 @@ AcpiDsLoad2EndOp (
Status = AE_OK;
goto Cleanup;
- break;
}
/* Delete operands */
@@ -823,12 +813,12 @@ AcpiDsLoad2EndOp (
* Lookup the method name and save the Node
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
+ ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &(NewNode));
if (ACPI_SUCCESS (Status))
{
- /*
+ /*
* Make sure that what we found is indeed a method
* We didn't search for a method on purpose, to see if the name would resolve
*/
diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dswscope.c
index 57571e8..d34808e 100644
--- a/sys/contrib/dev/acpica/dswscope.c
+++ b/sys/contrib/dev/acpica/dswscope.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
- * $Revision: 49 $
+ * $Revision: 52 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswscope")
+ ACPI_MODULE_NAME ("dswscope")
#define STACK_POP(head) head
@@ -145,7 +145,7 @@ AcpiDsScopeStackClear (
{
ACPI_GENERIC_STATE *ScopeInfo;
- PROC_NAME ("DsScopeStackClear");
+ ACPI_FUNCTION_NAME ("DsScopeStackClear");
while (WalkState->ScopeInfo)
@@ -177,20 +177,20 @@ AcpiDsScopeStackClear (
ACPI_STATUS
AcpiDsScopeStackPush (
ACPI_NAMESPACE_NODE *Node,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *ScopeInfo;
- FUNCTION_TRACE ("DsScopeStackPush");
+ ACPI_FUNCTION_TRACE ("DsScopeStackPush");
if (!Node)
{
/* Invalid scope */
- REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
+ ACPI_REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -198,7 +198,7 @@ AcpiDsScopeStackPush (
if (!AcpiExValidateObjectType (Type))
{
- REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
+ ACPI_REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
}
@@ -248,7 +248,7 @@ AcpiDsScopeStackPop (
ACPI_GENERIC_STATE *ScopeInfo;
- FUNCTION_TRACE ("DsScopeStackPop");
+ ACPI_FUNCTION_TRACE ("DsScopeStackPop");
/*
diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c
index 0de7fa3..faa1f6e 100644
--- a/sys/contrib/dev/acpica/dswstate.c
+++ b/sys/contrib/dev/acpica/dswstate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 57 $
+ * $Revision: 59 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
- MODULE_NAME ("dswstate")
+ ACPI_MODULE_NAME ("dswstate")
/*******************************************************************************
@@ -150,7 +150,7 @@ AcpiDsResultInsert (
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultInsert");
+ ACPI_FUNCTION_NAME ("DsResultInsert");
State = WalkState->Results;
@@ -212,7 +212,7 @@ AcpiDsResultRemove (
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultRemove");
+ ACPI_FUNCTION_NAME ("DsResultRemove");
State = WalkState->Results;
@@ -280,7 +280,7 @@ AcpiDsResultPop (
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultPop");
+ ACPI_FUNCTION_NAME ("DsResultPop");
State = WalkState->Results;
@@ -344,7 +344,7 @@ AcpiDsResultPopFromBottom (
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultPopFromBottom");
+ ACPI_FUNCTION_NAME ("DsResultPopFromBottom");
State = WalkState->Results;
@@ -414,7 +414,7 @@ AcpiDsResultPush (
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultPush");
+ ACPI_FUNCTION_NAME ("DsResultPush");
State = WalkState->Results;
@@ -470,7 +470,7 @@ AcpiDsResultStackPush (
{
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultStackPush");
+ ACPI_FUNCTION_NAME ("DsResultStackPush");
State = AcpiUtCreateGenericState ();
@@ -507,7 +507,7 @@ AcpiDsResultStackPop (
{
ACPI_GENERIC_STATE *State;
- PROC_NAME ("DsResultStackPop");
+ ACPI_FUNCTION_NAME ("DsResultStackPop");
/* Check for stack underflow */
@@ -552,7 +552,7 @@ AcpiDsObjStackDeleteAll (
UINT32 i;
- FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
/* The stack size is configurable, but fixed */
@@ -588,7 +588,7 @@ AcpiDsObjStackPush (
void *Object,
ACPI_WALK_STATE *WalkState)
{
- PROC_NAME ("DsObjStackPush");
+ ACPI_FUNCTION_NAME ("DsObjStackPush");
/* Check for stack overflow */
@@ -634,7 +634,7 @@ AcpiDsObjStackPopObject (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
- PROC_NAME ("DsObjStackPopObject");
+ ACPI_FUNCTION_NAME ("DsObjStackPopObject");
/* Check for stack underflow */
@@ -697,7 +697,7 @@ AcpiDsObjStackPop (
{
UINT32 i;
- PROC_NAME ("DsObjStackPop");
+ ACPI_FUNCTION_NAME ("DsObjStackPop");
for (i = 0; i < PopCount; i++)
@@ -747,7 +747,7 @@ AcpiDsObjStackPopAndDelete (
UINT32 i;
ACPI_OPERAND_OBJECT *ObjDesc;
- PROC_NAME ("DsObjStackPopAndDelete");
+ ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete");
for (i = 0; i < PopCount; i++)
@@ -801,7 +801,7 @@ AcpiDsObjStackGetValue (
ACPI_WALK_STATE *WalkState)
{
- FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
/* Can't do it if the stack is empty */
@@ -842,7 +842,7 @@ AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread)
{
- PROC_NAME ("DsGetCurrentWalkState");
+ ACPI_FUNCTION_NAME ("DsGetCurrentWalkState");
if (!Thread)
@@ -876,7 +876,7 @@ AcpiDsPushWalkState (
ACPI_WALK_STATE *WalkState,
ACPI_THREAD_STATE *Thread)
{
- FUNCTION_TRACE ("DsPushWalkState");
+ ACPI_FUNCTION_TRACE ("DsPushWalkState");
WalkState->Next = Thread->WalkStateList;
@@ -907,7 +907,7 @@ AcpiDsPopWalkState (
ACPI_WALK_STATE *WalkState;
- FUNCTION_TRACE ("DsPopWalkState");
+ ACPI_FUNCTION_TRACE ("DsPopWalkState");
WalkState = Thread->WalkStateList;
@@ -938,7 +938,7 @@ AcpiDsPopWalkState (
*
* RETURN: Pointer to the new walk state.
*
- * DESCRIPTION: Allocate and initialize a new walk state. The current walk
+ * DESCRIPTION: Allocate and initialize a new walk state. The current walk
* state is set to this new state.
*
******************************************************************************/
@@ -954,7 +954,7 @@ AcpiDsCreateWalkState (
ACPI_STATUS Status;
- FUNCTION_TRACE ("DsCreateWalkState");
+ ACPI_FUNCTION_TRACE ("DsCreateWalkState");
WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
@@ -1022,7 +1022,7 @@ AcpiDsInitAmlWalk (
ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
- FUNCTION_TRACE ("DsInitAmlWalk");
+ ACPI_FUNCTION_TRACE ("DsInitAmlWalk");
WalkState->ParserState.Aml =
@@ -1045,7 +1045,7 @@ AcpiDsInitAmlWalk (
if (MethodNode)
{
WalkState->ParserState.StartNode = MethodNode;
- WalkState->WalkType = WALK_METHOD;
+ WalkState->WalkType = ACPI_WALK_METHOD;
WalkState->MethodNode = MethodNode;
WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
@@ -1107,7 +1107,7 @@ AcpiDsDeleteWalkState (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
if (!WalkState)
@@ -1179,7 +1179,7 @@ void
AcpiDsDeleteWalkStateCache (
void)
{
- FUNCTION_TRACE ("DsDeleteWalkStateCache");
+ ACPI_FUNCTION_TRACE ("DsDeleteWalkStateCache");
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c
index 20c9953..b11adce 100644
--- a/sys/contrib/dev/acpica/evevent.c
+++ b/sys/contrib/dev/acpica/evevent.c
@@ -1,8 +1,7 @@
/******************************************************************************
*
- * Module Name: evevent - Fixed and General Purpose AcpiEvent
- * handling and dispatch
- * $Revision: 54 $
+ * Module Name: evevent - Fixed and General Purpose Even handling and dispatch
+ * $Revision: 69 $
*
*****************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +120,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evevent")
+ ACPI_MODULE_NAME ("evevent")
/*******************************************************************************
@@ -132,9 +131,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Ensures that the system control interrupt (SCI) is properly
- * configured, disables SCI event sources, installs the SCI
- * handler
+ * DESCRIPTION: Initialize global data structures for events.
*
******************************************************************************/
@@ -145,7 +142,7 @@ AcpiEvInitialize (
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvInitialize");
+ ACPI_FUNCTION_TRACE ("EvInitialize");
/* Make sure we have ACPI tables */
@@ -164,23 +161,55 @@ AcpiEvInitialize (
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize fixed events.\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize fixed events, %s\n",
+ AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
Status = AcpiEvGpeInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize general purpose events.\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize general purpose events, %s\n",
+ AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvHandlerInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install handlers for the SCI, Global Lock, and GPEs.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvHandlerInitialize (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvInitialize");
+
+
/* Install the SCI handler */
Status = AcpiEvInstallSciHandler ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to install System Control Interrupt Handler\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to install System Control Interrupt Handler, %s\n",
+ AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
@@ -189,7 +218,9 @@ AcpiEvInitialize (
Status = AcpiEvInitGpeControlMethods ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Gpe control methods\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize GPE control methods, %s\n",
+ AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
@@ -198,7 +229,9 @@ AcpiEvInitialize (
Status = AcpiEvInitGlobalLockHandler ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Unable to initialize Global Lock handler\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_FATAL,
+ "Unable to initialize Global Lock handler, %s\n",
+ AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
@@ -214,29 +247,34 @@ AcpiEvInitialize (
*
* RETURN: Status
*
- * DESCRIPTION: Initialize the Fixed AcpiEvent data structures
+ * DESCRIPTION: Install the fixed event handlers and enable the fixed events.
*
******************************************************************************/
ACPI_STATUS
-AcpiEvFixedEventInitialize(void)
+AcpiEvFixedEventInitialize (
+ void)
{
NATIVE_UINT i;
- /* Initialize the structure that keeps track of fixed event handlers */
-
+ /*
+ * Initialize the structure that keeps track of fixed event handlers
+ * and enable the fixed events.
+ */
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
AcpiGbl_FixedEventHandlers[i].Handler = NULL;
AcpiGbl_FixedEventHandlers[i].Context = NULL;
- }
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, TMR_EN, 0);
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, GBL_EN, 0);
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, PWRBTN_EN, 0);
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, SLPBTN_EN, 0);
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RTC_EN, 0);
+ /* Enable the fixed event */
+
+ if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
+ {
+ AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[i].EnableRegisterId,
+ 0, ACPI_MTX_LOCK);
+ }
+ }
return (AE_OK);
}
@@ -255,57 +293,43 @@ AcpiEvFixedEventInitialize(void)
******************************************************************************/
UINT32
-AcpiEvFixedEventDetect (void)
+AcpiEvFixedEventDetect (
+ void)
{
- UINT32 IntStatus = INTERRUPT_NOT_HANDLED;
- UINT32 StatusRegister;
- UINT32 EnableRegister;
+ UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
+ UINT32 GpeStatus;
+ UINT32 GpeEnable;
+ NATIVE_UINT i;
- PROC_NAME ("EvFixedEventDetect");
+ ACPI_FUNCTION_NAME ("EvFixedEventDetect");
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values.
*/
- StatusRegister = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
- EnableRegister = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
+ GpeStatus = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS);
+ GpeEnable = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed AcpiEvent Block: Enable %08X Status %08X\n",
- EnableRegister, StatusRegister));
-
- /* Power management timer roll over */
+ GpeEnable, GpeStatus));
- if ((StatusRegister & ACPI_STATUS_PMTIMER) &&
- (EnableRegister & ACPI_ENABLE_PMTIMER))
- {
- IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_PMTIMER);
- }
-
- /* Global event (BIOS wants the global lock) */
-
- if ((StatusRegister & ACPI_STATUS_GLOBAL) &&
- (EnableRegister & ACPI_ENABLE_GLOBAL))
- {
- IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_GLOBAL);
- }
-
- /* Power button event */
-
- if ((StatusRegister & ACPI_STATUS_POWER_BUTTON) &&
- (EnableRegister & ACPI_ENABLE_POWER_BUTTON))
+ /*
+ * Check for all possible Fixed Events and dispatch those that are active
+ */
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
- IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_POWER_BUTTON);
- }
+ /* Both the status and enable bits must be on for this event */
- /* Sleep button event */
+ if ((GpeStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) &&
+ (GpeEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask))
+ {
+ /* Found an active (signalled) event */
- if ((StatusRegister & ACPI_STATUS_SLEEP_BUTTON) &&
- (EnableRegister & ACPI_ENABLE_SLEEP_BUTTON))
- {
- IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_SLEEP_BUTTON);
+ IntStatus |= AcpiEvFixedEventDispatch (i);
+ }
}
return (IntStatus);
@@ -329,42 +353,15 @@ UINT32
AcpiEvFixedEventDispatch (
UINT32 Event)
{
- UINT32 RegisterId;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Clear the status bit */
- switch (Event)
- {
- case ACPI_EVENT_PMTIMER:
- RegisterId = TMR_STS;
- break;
-
- case ACPI_EVENT_GLOBAL:
- RegisterId = GBL_STS;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- RegisterId = PWRBTN_STS;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- RegisterId = SLPBTN_STS;
- break;
-
- case ACPI_EVENT_RTC:
- RegisterId = RTC_STS;
- break;
-
- default:
- return 0;
- break;
- }
-
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, RegisterId, 1);
+ AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ 1, ACPI_MTX_DO_NOT_LOCK);
/*
* Make sure we've got a handler. If not, report an error.
@@ -372,19 +369,17 @@ AcpiEvFixedEventDispatch (
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
{
- RegisterId = (PM1_EN | REGISTER_BIT_ID(RegisterId));
+ AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 0, ACPI_MTX_DO_NOT_LOCK);
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK,
- RegisterId, 0);
-
- REPORT_ERROR (
+ ACPI_REPORT_ERROR (
("EvGpeDispatch: No installed handler for fixed event [%08X]\n",
Event));
- return (INTERRUPT_NOT_HANDLED);
+ return (ACPI_INTERRUPT_NOT_HANDLED);
}
- /* Invoke the handler */
+ /* Invoke the Fixed Event handler */
return ((AcpiGbl_FixedEventHandlers[Event].Handler)(
AcpiGbl_FixedEventHandlers[Event].Context));
@@ -406,145 +401,181 @@ AcpiEvFixedEventDispatch (
ACPI_STATUS
AcpiEvGpeInitialize (void)
{
- UINT32 i;
- UINT32 j;
- UINT32 RegisterIndex;
+ NATIVE_UINT i;
+ NATIVE_UINT j;
+ NATIVE_UINT GpeBlock;
+ UINT32 GpeRegister;
+ UINT32 GpeNumberIndex;
UINT32 GpeNumber;
- UINT16 Gpe0RegisterCount;
- UINT16 Gpe1RegisterCount;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+
+ ACPI_FUNCTION_TRACE ("EvGpeInitialize");
- FUNCTION_TRACE ("EvGpeInitialize");
/*
- * Set up various GPE counts
+ * Initialize the GPE Block globals
*
- * You may ask,why are the GPE register block lengths divided by 2?
- * From the ACPI 2.0 Spec, section, 4.7.1.6 General-Purpose Event
- * Registers, we have,
+ * Why the GPE register block lengths divided by 2: From the ACPI Spec,
+ * section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
- * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
- * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
- * The length of the GPE1_STS and GPE1_EN registers is equal to
- * half the GPE1_LEN. If a generic register block is not supported
- * then its respective block pointer and block length values in the
- * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
- * to be the same size."
+ * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
+ * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
+ * The length of the GPE1_STS and GPE1_EN registers is equal to
+ * half the GPE1_LEN. If a generic register block is not supported
+ * then its respective block pointer and block length values in the
+ * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
+ * to be the same size."
*/
- Gpe0RegisterCount = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
- Gpe1RegisterCount = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
- AcpiGbl_GpeRegisterCount = Gpe0RegisterCount + Gpe1RegisterCount;
+ AcpiGbl_GpeBlockInfo[0].RegisterCount = (UINT16) ACPI_DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
+ AcpiGbl_GpeBlockInfo[1].RegisterCount = (UINT16) ACPI_DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
+ AcpiGbl_GpeBlockInfo[0].BlockAddress = (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address);
+ AcpiGbl_GpeBlockInfo[1].BlockAddress = (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address);
+
+ AcpiGbl_GpeBlockInfo[0].BlockBaseNumber = 0;
+ AcpiGbl_GpeBlockInfo[1].BlockBaseNumber = AcpiGbl_FADT->Gpe1Base;
+
+ AcpiGbl_GpeRegisterCount = AcpiGbl_GpeBlockInfo[0].RegisterCount +
+ AcpiGbl_GpeBlockInfo[1].RegisterCount;
if (!AcpiGbl_GpeRegisterCount)
{
- REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
+ ACPI_REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
- /*
- * Allocate the Gpe information block
- */
- AcpiGbl_GpeRegisters = ACPI_MEM_CALLOCATE (AcpiGbl_GpeRegisterCount *
- sizeof (ACPI_GPE_REGISTERS));
- if (!AcpiGbl_GpeRegisters)
+ /* Determine the maximum GPE number for this machine */
+
+ AcpiGbl_GpeNumberMax = ACPI_MUL_8 (AcpiGbl_GpeBlockInfo[0].RegisterCount) - 1;
+
+ if (AcpiGbl_GpeBlockInfo[1].RegisterCount)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not allocate the GpeRegisters block\n"));
- return_ACPI_STATUS (AE_NO_MEMORY);
+ /* Check for GPE0/GPE1 overlap */
+
+ if (AcpiGbl_GpeNumberMax >= AcpiGbl_FADT->Gpe1Base)
+ {
+ ACPI_REPORT_ERROR (("GPE0 block overlaps the GPE1 block\n"));
+ return_ACPI_STATUS (AE_BAD_VALUE);
+ }
+
+ /* GPE0 and GPE1 do not have to be contiguous in the GPE number space */
+
+ AcpiGbl_GpeNumberMax = AcpiGbl_FADT->Gpe1Base + (ACPI_MUL_8 (AcpiGbl_GpeBlockInfo[1].RegisterCount) - 1);
+ }
+
+ /* Check for Max GPE number out-of-range */
+
+ if (AcpiGbl_GpeNumberMax > ACPI_GPE_MAX)
+ {
+ ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n", AcpiGbl_GpeNumberMax));
+ return_ACPI_STATUS (AE_BAD_VALUE);
}
/*
- * Allocate the Gpe dispatch handler block
- * There are eight distinct GP events per register.
- * Initialization to zeros is sufficient
+ * Allocate the GPE number-to-index translation table
*/
- AcpiGbl_GpeInfo = ACPI_MEM_CALLOCATE (MUL_8 (AcpiGbl_GpeRegisterCount) *
- sizeof (ACPI_GPE_LEVEL_INFO));
- if (!AcpiGbl_GpeInfo)
+ AcpiGbl_GpeNumberToIndex = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_INDEX_INFO) *
+ (AcpiGbl_GpeNumberMax + 1));
+ if (!AcpiGbl_GpeNumberToIndex)
{
- ACPI_MEM_FREE (AcpiGbl_GpeRegisters);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the GpeInfo block\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not allocate the GpeNumberToIndex table\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Set the Gpe validation table to GPE_INVALID */
+ /* Set the Gpe index table to GPE_INVALID */
- MEMSET (AcpiGbl_GpeValid, (int) ACPI_GPE_INVALID, ACPI_NUM_GPE);
+ ACPI_MEMSET (AcpiGbl_GpeNumberToIndex, (int) ACPI_GPE_INVALID,
+ sizeof (ACPI_GPE_INDEX_INFO) * (AcpiGbl_GpeNumberMax + 1));
/*
- * Initialize the Gpe information and validation blocks. A goal of these
- * blocks is to hide the fact that there are two separate GPE register sets
- * In a given block, the status registers occupy the first half, and
- * the enable registers occupy the second half.
+ * Allocate the GPE register information block
*/
-
- /* GPE Block 0 */
-
- RegisterIndex = 0;
-
- for (i = 0; i < Gpe0RegisterCount; i++)
+ AcpiGbl_GpeRegisterInfo = ACPI_MEM_CALLOCATE (AcpiGbl_GpeRegisterCount *
+ sizeof (ACPI_GPE_REGISTER_INFO));
+ if (!AcpiGbl_GpeRegisterInfo)
{
- AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr =
- (UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + i);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not allocate the GpeRegisterInfo table\n"));
+ goto ErrorExit1;
+ }
- AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr =
- (UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + i + Gpe0RegisterCount);
+ /*
+ * Allocate the GPE dispatch handler block. There are eight distinct GPEs
+ * per register. Initialization to zeros is sufficient.
+ */
+ AcpiGbl_GpeNumberInfo = ACPI_MEM_CALLOCATE (ACPI_MUL_8 (AcpiGbl_GpeRegisterCount) *
+ sizeof (ACPI_GPE_NUMBER_INFO));
+ if (!AcpiGbl_GpeNumberInfo)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the GpeNumberInfo table\n"));
+ goto ErrorExit2;
+ }
- AcpiGbl_GpeRegisters[RegisterIndex].GpeBase = (UINT8) MUL_8 (i);
+ /*
+ * Initialize the GPE information and validation tables. A goal of these
+ * tables is to hide the fact that there are two separate GPE register sets
+ * in a given gpe hardware block, the status registers occupy the first half,
+ * and the enable registers occupy the second half. Another goal is to hide
+ * the fact that there may be multiple GPE hardware blocks.
+ */
+ GpeRegister = 0;
+ GpeNumberIndex = 0;
- for (j = 0; j < 8; j++)
+ for (GpeBlock = 0; GpeBlock < ACPI_MAX_GPE_BLOCKS; GpeBlock++)
+ {
+ for (i = 0; i < AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount; i++)
{
- GpeNumber = AcpiGbl_GpeRegisters[RegisterIndex].GpeBase + j;
- AcpiGbl_GpeValid[GpeNumber] = (UINT8) RegisterIndex;
- }
+ GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[GpeRegister];
- /*
- * Clear the status/enable registers. Note that status registers
- * are cleared by writing a '1', while enable registers are cleared
- * by writing a '0'.
- */
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8);
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8);
+ /* Init the Register info for this entire GPE register (8 GPEs) */
- RegisterIndex++;
- }
+ GpeRegisterInfo->BaseGpeNumber = (UINT8) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber + (ACPI_MUL_8 (i)));
+ GpeRegisterInfo->StatusAddr = (UINT16) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress + i);
+ GpeRegisterInfo->EnableAddr = (UINT16) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress + i +
+ AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount);
- /* GPE Block 1 */
+ /* Init the Index mapping info for each GPE number within this register */
- for (i = 0; i < Gpe1RegisterCount; i++)
- {
- AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr =
- (UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + i);
+ for (j = 0; j < 8; j++)
+ {
+ GpeNumber = GpeRegisterInfo->BaseGpeNumber + j;
+ AcpiGbl_GpeNumberToIndex[GpeNumber].NumberIndex = (UINT8) GpeNumberIndex;
- AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr =
- (UINT16) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + i + Gpe1RegisterCount);
+ AcpiGbl_GpeNumberInfo[GpeNumberIndex].BitMask = AcpiGbl_DecodeTo8bit[i];
+ GpeNumberIndex++;
+ }
- AcpiGbl_GpeRegisters[RegisterIndex].GpeBase =
- (UINT8) (AcpiGbl_FADT->Gpe1Base + MUL_8 (i));
+ /*
+ * Clear the status/enable registers. Note that status registers
+ * are cleared by writing a '1', while enable registers are cleared
+ * by writing a '0'.
+ */
+ AcpiOsWritePort (GpeRegisterInfo->EnableAddr, 0x00, 8);
+ AcpiOsWritePort (GpeRegisterInfo->StatusAddr, 0xFF, 8);
- for (j = 0; j < 8; j++)
- {
- GpeNumber = AcpiGbl_GpeRegisters[RegisterIndex].GpeBase + j;
- AcpiGbl_GpeValid[GpeNumber] = (UINT8) RegisterIndex;
+ GpeRegister++;
}
-
- /*
- * Clear the status/enable registers. Note that status registers
- * are cleared by writing a '1', while enable registers are cleared
- * by writing a '0'.
- */
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8);
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8);
-
- RegisterIndex++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%8.8X%8.8X (Blk0) %X@%8.8X%8.8X (Blk1)\n",
- Gpe0RegisterCount, HIDWORD(AcpiGbl_FADT->XGpe0Blk.Address), LODWORD(AcpiGbl_FADT->XGpe0Blk.Address),
- Gpe1RegisterCount, HIDWORD(AcpiGbl_FADT->XGpe1Blk.Address), LODWORD(AcpiGbl_FADT->XGpe1Blk.Address)));
+ AcpiGbl_GpeBlockInfo[0].RegisterCount,
+ ACPI_HIDWORD (AcpiGbl_FADT->XGpe0Blk.Address), ACPI_LODWORD (AcpiGbl_FADT->XGpe0Blk.Address),
+ AcpiGbl_GpeBlockInfo[1].RegisterCount,
+ ACPI_HIDWORD (AcpiGbl_FADT->XGpe1Blk.Address), ACPI_LODWORD (AcpiGbl_FADT->XGpe1Blk.Address)));
return_ACPI_STATUS (AE_OK);
+
+
+ /* Error cleanup */
+
+ErrorExit2:
+ ACPI_MEM_FREE (AcpiGbl_GpeRegisterInfo);
+
+ErrorExit1:
+ ACPI_MEM_FREE (AcpiGbl_GpeNumberToIndex);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -566,7 +597,7 @@ AcpiEvGpeInitialize (void)
* Where:
* L - means that the GPE is level triggered
* E - means that the GPE is edge triggered
- * nn - is the GPE number
+ * nn - is the GPE number [in HEX]
*
******************************************************************************/
@@ -578,31 +609,34 @@ AcpiEvSaveMethodInfo (
void **ReturnValue)
{
UINT32 GpeNumber;
+ UINT32 GpeNumberIndex;
NATIVE_CHAR Name[ACPI_NAME_SIZE + 1];
UINT8 Type;
- PROC_NAME ("EvSaveMethodInfo");
+ ACPI_FUNCTION_NAME ("EvSaveMethodInfo");
/* Extract the name from the object and convert to a string */
- MOVE_UNALIGNED32_TO_32 (Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name);
+ ACPI_MOVE_UNALIGNED32_TO_32 (Name,
+ &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name);
Name[ACPI_NAME_SIZE] = 0;
/*
- * Edge/Level determination is based on the 2nd INT8 of the method name
+ * Edge/Level determination is based on the 2nd character of the method name
*/
- if (Name[1] == 'L')
+ switch (Name[1])
{
+ case 'L':
Type = ACPI_EVENT_LEVEL_TRIGGERED;
- }
- else if (Name[1] == 'E')
- {
+ break;
+
+ case 'E':
Type = ACPI_EVENT_EDGE_TRIGGERED;
- }
- else
- {
+ break;
+
+ default:
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -611,9 +645,9 @@ AcpiEvSaveMethodInfo (
return (AE_OK);
}
- /* Convert the last two characters of the name to the Gpe Number */
+ /* Convert the last two characters of the name to the GPE Number */
- GpeNumber = STRTOUL (&Name[2], NULL, 16);
+ GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
if (GpeNumber == ACPI_UINT32_MAX)
{
/* Conversion failed; invalid method, just ignore it */
@@ -624,9 +658,10 @@ AcpiEvSaveMethodInfo (
return (AE_OK);
}
- /* Ensure that we have a valid GPE number */
+ /* Get GPE index and ensure that we have a valid GPE number */
- if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
+ GpeNumberIndex = AcpiEvGetGpeNumberIndex (GpeNumber);
+ if (GpeNumberIndex == ACPI_GPE_INVALID)
{
/* Not valid, all we can do here is ignore it */
@@ -637,8 +672,8 @@ AcpiEvSaveMethodInfo (
* Now we can add this information to the GpeInfo block
* for use during dispatch of this GPE.
*/
- AcpiGbl_GpeInfo [GpeNumber].Type = Type;
- AcpiGbl_GpeInfo [GpeNumber].MethodHandle = ObjHandle;
+ AcpiGbl_GpeNumberInfo [GpeNumberIndex].Type = Type;
+ AcpiGbl_GpeNumberInfo [GpeNumberIndex].MethodHandle = ObjHandle;
/*
* Enable the GPE (SCIs should be disabled at this point)
@@ -657,10 +692,9 @@ AcpiEvSaveMethodInfo (
*
* PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Obtain the control methods associated with the GPEs.
- *
* NOTE: Must be called AFTER namespace initialization!
*
******************************************************************************/
@@ -671,7 +705,7 @@ AcpiEvInitGpeControlMethods (void)
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvInitGpeControlMethods");
+ ACPI_FUNCTION_TRACE ("EvInitGpeControlMethods");
/* Get a permanent handle to the _GPE object */
@@ -700,21 +734,23 @@ AcpiEvInitGpeControlMethods (void)
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
- * DESCRIPTION: Detect if any GP events have occurred
+ * DESCRIPTION: Detect if any GP events have occurred. This function is
+ * executed at interrupt level.
*
******************************************************************************/
UINT32
AcpiEvGpeDetect (void)
{
- UINT32 IntStatus = INTERRUPT_NOT_HANDLED;
+ UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
UINT32 i;
UINT32 j;
UINT8 EnabledStatusByte;
UINT8 BitMask;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
- PROC_NAME ("EvGpeDetect");
+ ACPI_FUNCTION_NAME ("EvGpeDetect");
/*
@@ -724,23 +760,24 @@ AcpiEvGpeDetect (void)
*/
for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
{
- AcpiOsReadPort (AcpiGbl_GpeRegisters[i].StatusAddr,
- &AcpiGbl_GpeRegisters[i].Status, 8);
+ GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i];
- AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr,
- &AcpiGbl_GpeRegisters[i].Enable, 8);
+ AcpiOsReadPort (GpeRegisterInfo->StatusAddr,
+ &GpeRegisterInfo->Status, 8);
+
+ AcpiOsReadPort (GpeRegisterInfo->EnableAddr,
+ &GpeRegisterInfo->Enable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %X - Enable %08X Status %08X\n",
- AcpiGbl_GpeRegisters[i].EnableAddr,
- AcpiGbl_GpeRegisters[i].Status,
- AcpiGbl_GpeRegisters[i].Enable));
+ GpeRegisterInfo->EnableAddr,
+ GpeRegisterInfo->Status,
+ GpeRegisterInfo->Enable));
/* First check if there is anything active at all in this register */
- EnabledStatusByte = (UINT8) (AcpiGbl_GpeRegisters[i].Status &
- AcpiGbl_GpeRegisters[i].Enable);
-
+ EnabledStatusByte = (UINT8) (GpeRegisterInfo->Status &
+ GpeRegisterInfo->Enable);
if (!EnabledStatusByte)
{
/* No active GPEs in this register, move on */
@@ -761,7 +798,7 @@ AcpiEvGpeDetect (void)
* or method.
*/
IntStatus |= AcpiEvGpeDispatch (
- AcpiGbl_GpeRegisters[i].GpeBase + j);
+ GpeRegisterInfo->BaseGpeNumber + j);
}
}
}
@@ -774,7 +811,7 @@ AcpiEvGpeDetect (void)
*
* FUNCTION: AcpiEvAsynchExecuteGpeMethod
*
- * PARAMETERS: GpeNumber - The 0-based Gpe number
+ * PARAMETERS: GpeNumber - The 0-based GPE number
*
* RETURN: None
*
@@ -790,37 +827,50 @@ static void
AcpiEvAsynchExecuteGpeMethod (
void *Context)
{
- UINT32 GpeNumber = (UINT32) Context;
- ACPI_GPE_LEVEL_INFO GpeInfo;
+ UINT32 GpeNumber = (UINT32) ACPI_TO_INTEGER (Context);
+ UINT32 GpeNumberIndex;
+ ACPI_GPE_NUMBER_INFO GpeInfo;
- FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
+ ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
- /*
- * Take a snapshot of the GPE info for this level
- */
- AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
- GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
- AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ GpeNumberIndex = AcpiEvGetGpeNumberIndex (GpeNumber);
+ if (GpeNumberIndex == ACPI_GPE_INVALID)
+ {
+ return_VOID;
+ }
/*
- * Method Handler (_Lxx, _Exx):
- * ----------------------------
- * Evaluate the _Lxx/_Exx control method that corresponds to this GPE.
+ * Take a snapshot of the GPE info for this level - we copy the
+ * info to prevent a race condition with RemoveHandler.
*/
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_EVENTS)))
+ {
+ return_VOID;
+ }
+
+ GpeInfo = AcpiGbl_GpeNumberInfo [GpeNumberIndex];
+ if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_EVENTS)))
+ {
+ return_VOID;
+ }
+
if (GpeInfo.MethodHandle)
{
+ /*
+ * Invoke the GPE Method (_Lxx, _Exx):
+ * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
+ */
AcpiNsEvaluateByHandle (GpeInfo.MethodHandle, NULL, NULL);
}
- /*
- * Level-Triggered?
- * ----------------
- * If level-triggered we clear the GPE status bit after handling the event.
- */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
+ /*
+ * GPE is level-triggered, we clear the GPE status bit after handling
+ * the event.
+ */
AcpiHwClearGpe (GpeNumber);
}
@@ -828,7 +878,6 @@ AcpiEvAsynchExecuteGpeMethod (
* Enable the GPE.
*/
AcpiHwEnableGpe (GpeNumber);
-
return_VOID;
}
@@ -837,18 +886,13 @@ AcpiEvAsynchExecuteGpeMethod (
*
* FUNCTION: AcpiEvGpeDispatch
*
- * PARAMETERS: GpeNumber - The 0-based Gpe number
+ * PARAMETERS: GpeNumber - The 0-based GPE number
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
- * DESCRIPTION: Handle and dispatch a General Purpose AcpiEvent.
- * Clears the status bit for the requested event.
- *
- * TBD: [Investigate] is this still valid or necessary:
- * The Gpe handler differs from the fixed events in that it clears the enable
- * bit rather than the status bit to clear the interrupt. This allows
- * software outside of interrupt context to determine what caused the SCI and
- * dispatch the correct AML.
+ * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
+ * or method (e.g. _Lxx/_Exx) handler. This function executes
+ * at interrupt level.
*
******************************************************************************/
@@ -856,90 +900,86 @@ UINT32
AcpiEvGpeDispatch (
UINT32 GpeNumber)
{
- ACPI_GPE_LEVEL_INFO GpeInfo;
+ UINT32 GpeNumberIndex;
+ ACPI_GPE_NUMBER_INFO *GpeInfo;
- FUNCTION_TRACE ("EvGpeDispatch");
+ ACPI_FUNCTION_TRACE ("EvGpeDispatch");
- /*
- * Valid GPE number?
- */
- if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
+ GpeNumberIndex = AcpiEvGetGpeNumberIndex (GpeNumber);
+ if (GpeNumberIndex == ACPI_GPE_INVALID)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid GPE bit [%X].\n", GpeNumber));
- return_VALUE (INTERRUPT_NOT_HANDLED);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid event, GPE[%X].\n", GpeNumber));
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
- * Disable the GPE.
+ * We don't have to worry about mutex on GpeInfo because we are
+ * executing at interrupt level.
*/
- AcpiHwDisableGpe (GpeNumber);
-
- GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
+ GpeInfo = &AcpiGbl_GpeNumberInfo [GpeNumberIndex];
/*
- * Edge-Triggered?
- * ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
- if (GpeInfo.Type & ACPI_EVENT_EDGE_TRIGGERED)
+ if (GpeInfo->Type & ACPI_EVENT_EDGE_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
- /*
- * Function Handler (e.g. EC)?
- */
- if (GpeInfo.Handler)
- {
- /* Invoke function handler (at interrupt level). */
-
- GpeInfo.Handler (GpeInfo.Context);
-
- /* Level-Triggered? */
-
- if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
- {
- AcpiHwClearGpe (GpeNumber);
- }
-
- /* Enable GPE */
-
- AcpiHwEnableGpe (GpeNumber);
- }
/*
- * Method Handler (e.g. _Exx/_Lxx)?
+ * Dispatch the GPE to either an installed handler, or the control
+ * method associated with this GPE (_Lxx or _Exx).
+ * If a handler exists, we invoke it and do not attempt to run the method.
+ * If there is neither a handler nor a method, we disable the level to
+ * prevent further events from coming in here.
*/
- else if (GpeInfo.MethodHandle)
+ if (GpeInfo->Handler)
+ {
+ /* Invoke the installed handler (at interrupt level) */
+
+ GpeInfo->Handler (GpeInfo->Context);
+ }
+ else if (GpeInfo->MethodHandle)
{
- if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
- AcpiEvAsynchExecuteGpeMethod, (void*) GpeNumber)))
+ /*
+ * Execute the method associated with the GPE.
+ */
+ if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
+ AcpiEvAsynchExecuteGpeMethod,
+ ACPI_TO_POINTER (GpeNumber))))
{
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE[%X], disabling event\n", GpeNumber));
+
/*
- * Shoudn't occur, but if it does report an error. Note that
- * the GPE will remain disabled until the ACPI Core Subsystem
- * is restarted, or the handler is removed/reinstalled.
+ * Disable the GPE on error. The GPE will remain disabled until the ACPI
+ * Core Subsystem is restarted, or the handler is reinstalled.
*/
- REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber));
+ AcpiHwDisableGpe (GpeNumber);
}
}
-
- /*
- * No Handler? Report an error and leave the GPE disabled.
- */
else
{
- REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber));
+ /* No handler or method to run! */
- /* Level-Triggered? */
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: No handler or method for GPE[%X], disabling event\n", GpeNumber));
- if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
- {
- AcpiHwClearGpe (GpeNumber);
- }
+ /*
+ * Disable the GPE. The GPE will remain disabled until the ACPI
+ * Core Subsystem is restarted, or the handler is reinstalled.
+ */
+ AcpiHwDisableGpe (GpeNumber);
+ }
+
+ /*
+ * It is now safe to clear level-triggered evnets.
+ */
+ if (GpeInfo->Type & ACPI_EVENT_LEVEL_TRIGGERED)
+ {
+ AcpiHwClearGpe (GpeNumber);
}
- return_VALUE (INTERRUPT_HANDLED);
+ return_VALUE (ACPI_INTERRUPT_HANDLED);
}
diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c
index 7e1ecda..05aac5e 100644
--- a/sys/contrib/dev/acpica/evmisc.c
+++ b/sys/contrib/dev/acpica/evmisc.c
@@ -2,7 +2,7 @@
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
- * $Revision: 36 $
+ * $Revision: 46 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,61 @@
#include "achware.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evmisc")
+ ACPI_MODULE_NAME ("evmisc")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGetGpeRegisterIndex
+ *
+ * PARAMETERS: GpeNumber - Raw GPE number
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Returns the register index (index into the GPE register info
+ * table) associated with this GPE.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvGetGpeRegisterIndex (
+ UINT32 GpeNumber)
+{
+
+ if (GpeNumber > AcpiGbl_GpeNumberMax)
+ {
+ return (ACPI_GPE_INVALID);
+ }
+
+ return (ACPI_DIV_8 (AcpiGbl_GpeNumberToIndex[GpeNumber].NumberIndex));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGetGpeNumberIndex
+ *
+ * PARAMETERS: GpeNumber - Raw GPE number
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Returns the number index (index into the GPE number info table)
+ * associated with this GPE.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvGetGpeNumberIndex (
+ UINT32 GpeNumber)
+{
+
+ if (GpeNumber > AcpiGbl_GpeNumberMax)
+ {
+ return (ACPI_GPE_INVALID);
+ }
+
+ return (AcpiGbl_GpeNumberToIndex[GpeNumber].NumberIndex);
+}
/*******************************************************************************
@@ -149,7 +203,7 @@ AcpiEvQueueNotifyRequest (
ACPI_STATUS Status = AE_OK;
- PROC_NAME ("EvQueueNotifyRequest");
+ ACPI_FUNCTION_NAME ("EvQueueNotifyRequest");
/*
@@ -184,20 +238,19 @@ AcpiEvQueueNotifyRequest (
break;
}
-
/*
* Get the notify object attached to the device Node
*/
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
-
/* We have the notify object, Get the right handler */
switch (Node->Type)
{
case ACPI_TYPE_DEVICE:
- if (NotifyValue <= MAX_SYS_NOTIFY)
+
+ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
HandlerObj = ObjDesc->Device.SysHandler;
}
@@ -207,8 +260,10 @@ AcpiEvQueueNotifyRequest (
}
break;
+
case ACPI_TYPE_THERMAL:
- if (NotifyValue <= MAX_SYS_NOTIFY)
+
+ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
HandlerObj = ObjDesc->ThermalZone.SysHandler;
}
@@ -222,11 +277,10 @@ AcpiEvQueueNotifyRequest (
/* If there is any handler to run, schedule the dispatcher */
- if ((AcpiGbl_SysNotify.Handler && (NotifyValue <= MAX_SYS_NOTIFY)) ||
- (AcpiGbl_DrvNotify.Handler && (NotifyValue > MAX_SYS_NOTIFY)) ||
+ if ((AcpiGbl_SysNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
+ (AcpiGbl_DrvNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
HandlerObj)
{
-
NotifyInfo = AcpiUtCreateGenericState ();
if (!NotifyInfo)
{
@@ -280,14 +334,14 @@ AcpiEvNotifyDispatch (
ACPI_OPERAND_OBJECT *HandlerObj;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached to the device.
*/
- if (NotifyInfo->Notify.Value <= MAX_SYS_NOTIFY)
+ if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
{
/* Global system notification handler */
@@ -376,7 +430,6 @@ AcpiEvGlobalLockHandler (
void *Context)
{
BOOLEAN Acquired = FALSE;
- void *GlobalLock;
/*
@@ -384,8 +437,7 @@ AcpiEvGlobalLockHandler (
* If we don't get it now, it will be marked pending and we will
* take another interrupt when it becomes free.
*/
- GlobalLock = AcpiGbl_FACS->GlobalLock;
- ACPI_ACQUIRE_GLOBAL_LOCK (GlobalLock, Acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
if (Acquired)
{
/* Got the lock, now wake all threads waiting for it */
@@ -398,7 +450,7 @@ AcpiEvGlobalLockHandler (
Context);
}
- return (INTERRUPT_HANDLED);
+ return (ACPI_INTERRUPT_HANDLED);
}
@@ -418,7 +470,7 @@ AcpiEvInitGlobalLockHandler (void)
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvInitGlobalLockHandler");
+ ACPI_FUNCTION_TRACE ("EvInitGlobalLockHandler");
AcpiGbl_GlobalLockPresent = TRUE;
@@ -427,7 +479,7 @@ AcpiEvInitGlobalLockHandler (void)
/*
* If the global lock does not exist on this platform, the attempt
- * to enable GBL_STS will fail (the GBL_EN bit will not stick)
+ * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
* Map to AE_OK, but mark global lock as not present.
* Any attempt to actually use the global lock will be flagged
* with an error.
@@ -453,14 +505,15 @@ AcpiEvInitGlobalLockHandler (void)
*****************************************************************************/
ACPI_STATUS
-AcpiEvAcquireGlobalLock(void)
+AcpiEvAcquireGlobalLock (
+ UINT32 Timeout)
{
ACPI_STATUS Status = AE_OK;
BOOLEAN Acquired = FALSE;
- void *GlobalLock;
- FUNCTION_TRACE ("EvAcquireGlobalLock");
+ ACPI_FUNCTION_TRACE ("EvAcquireGlobalLock");
+
/* Make sure that we actually have a global lock */
@@ -473,29 +526,21 @@ AcpiEvAcquireGlobalLock(void)
AcpiGbl_GlobalLockThreadCount++;
- /* If we (OS side) have the hardware lock already, we are done */
+ /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */
if (AcpiGbl_GlobalLockAcquired)
{
return_ACPI_STATUS (AE_OK);
}
- /* Only if the FACS is valid */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
/* We must acquire the actual hardware lock */
- GlobalLock = AcpiGbl_FACS->GlobalLock;
- ACPI_ACQUIRE_GLOBAL_LOCK (GlobalLock, Acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
if (Acquired)
{
/* We got the lock */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the Global Lock\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the HW Global Lock\n"));
AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
@@ -507,12 +552,12 @@ AcpiEvAcquireGlobalLock(void)
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for the HW Global Lock\n"));
- /*
- * Acquire the global lock semaphore first.
- * Since this wait will block, we must release the interpreter
- */
+ /*
+ * Acquire the global lock semaphore first.
+ * Since this wait will block, we must release the interpreter
+ */
Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
- ACPI_UINT32_MAX);
+ Timeout);
return_ACPI_STATUS (Status);
}
@@ -529,44 +574,87 @@ void
AcpiEvReleaseGlobalLock (void)
{
BOOLEAN Pending = FALSE;
- void *GlobalLock;
- FUNCTION_TRACE ("EvReleaseGlobalLock");
+ ACPI_FUNCTION_TRACE ("EvReleaseGlobalLock");
if (!AcpiGbl_GlobalLockThreadCount)
{
- REPORT_WARNING(("Global Lock has not be acquired, cannot release\n"));
+ ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
return_VOID;
}
- /* One fewer thread has the global lock */
+ /* One fewer thread has the global lock */
AcpiGbl_GlobalLockThreadCount--;
+ if (AcpiGbl_GlobalLockThreadCount)
+ {
+ /* There are still some threads holding the lock, cannot release */
- /* Have all threads released the lock? */
+ return_VOID;
+ }
- if (!AcpiGbl_GlobalLockThreadCount)
+ /*
+ * No more threads holding lock, we can do the actual hardware
+ * release
+ */
+ ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Pending);
+ AcpiGbl_GlobalLockAcquired = FALSE;
+
+ /*
+ * If the pending bit was set, we must write GBL_RLS to the control
+ * register
+ */
+ if (Pending)
{
- /*
- * No more threads holding lock, we can do the actual hardware
- * release
- */
- GlobalLock = AcpiGbl_FACS->GlobalLock;
- ACPI_RELEASE_GLOBAL_LOCK (GlobalLock, Pending);
- AcpiGbl_GlobalLockAcquired = FALSE;
-
- /*
- * If the pending bit was set, we must write GBL_RLS to the control
- * register
- */
- if (Pending)
- {
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK,
- GBL_RLS, 1);
- }
+ AcpiHwBitRegisterWrite (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
+ }
+
+ return_VOID;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEvTerminate
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: free memory allocated for table storage.
+ *
+ ******************************************************************************/
+
+void
+AcpiEvTerminate (void)
+{
+
+ ACPI_FUNCTION_TRACE ("EvTerminate");
+
+
+ /*
+ * Free global tables, etc.
+ */
+ if (AcpiGbl_GpeRegisterInfo)
+ {
+ ACPI_MEM_FREE (AcpiGbl_GpeRegisterInfo);
+ AcpiGbl_GpeRegisterInfo = NULL;
+ }
+
+ if (AcpiGbl_GpeNumberInfo)
+ {
+ ACPI_MEM_FREE (AcpiGbl_GpeNumberInfo);
+ AcpiGbl_GpeNumberInfo = NULL;
+ }
+
+ if (AcpiGbl_GpeNumberToIndex)
+ {
+ ACPI_MEM_FREE (AcpiGbl_GpeNumberToIndex);
+ AcpiGbl_GpeNumberToIndex = NULL;
}
return_VOID;
}
+
diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c
index 544e7fb..32410e9 100644
--- a/sys/contrib/dev/acpica/evregion.c
+++ b/sys/contrib/dev/acpica/evregion.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
- * $Revision: 120 $
+ * $Revision: 128 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evregion")
+ ACPI_MODULE_NAME ("evregion")
/*******************************************************************************
@@ -146,7 +146,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers (
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvInstallDefaultAddressSpaceHandlers");
+ ACPI_FUNCTION_TRACE ("EvInstallDefaultAddressSpaceHandlers");
/*
@@ -164,7 +164,8 @@ AcpiEvInstallDefaultAddressSpaceHandlers (
* NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
* has already been installed (via AcpiInstallAddressSpaceHandler)
*/
- Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
+
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if ((ACPI_FAILURE (Status)) &&
@@ -173,7 +174,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers (
return_ACPI_STATUS (Status);
}
- Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if ((ACPI_FAILURE (Status)) &&
@@ -182,7 +183,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers (
return_ACPI_STATUS (Status);
}
- Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if ((ACPI_FAILURE (Status)) &&
@@ -191,6 +192,14 @@ AcpiEvInstallDefaultAddressSpaceHandlers (
return_ACPI_STATUS (Status);
}
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
+ ACPI_ADR_SPACE_DATA_TABLE,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if ((ACPI_FAILURE (Status)) &&
+ (Status != AE_ALREADY_EXISTS))
+ {
+ return_ACPI_STATUS (Status);
+ }
return_ACPI_STATUS (AE_OK);
}
@@ -219,7 +228,7 @@ AcpiEvExecuteRegMethod (
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvExecuteRegMethod");
+ ACPI_FUNCTION_TRACE ("EvExecuteRegMethod");
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -265,7 +274,7 @@ AcpiEvExecuteRegMethod (
/*
* Execute the method, no return value
*/
- DEBUG_EXEC(AcpiUtDisplayInitPathname (RegionObj2->Extra.Method_REG, " [Method]"));
+ ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (RegionObj2->Extra.Method_REG, " [Method]"));
Status = AcpiNsEvaluateByHandle (RegionObj2->Extra.Method_REG, Params, NULL);
AcpiUtRemoveReference (Params[1]);
@@ -311,7 +320,7 @@ AcpiEvAddressSpaceDispatch (
void *RegionContext = NULL;
- FUNCTION_TRACE ("EvAddressSpaceDispatch");
+ ACPI_FUNCTION_TRACE ("EvAddressSpaceDispatch");
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -392,10 +401,10 @@ AcpiEvAddressSpaceDispatch (
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Addrhandler %p (%p), Address %8.8X%8.8X\n",
- &RegionObj->Region.AddrHandler->AddrHandler, Handler, HIDWORD(Address),
- LODWORD(Address)));
+ &RegionObj->Region.AddrHandler->AddrHandler, Handler,
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
- if (!(HandlerDesc->AddrHandler.Flags & ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddrHandler.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* For handlers other than the default (supplied) handlers, we must
@@ -414,12 +423,12 @@ AcpiEvAddressSpaceDispatch (
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region handler: %s [%s]\n",
- AcpiFormatException (Status),
- AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n",
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId),
+ AcpiFormatException (Status)));
}
- if (!(HandlerDesc->AddrHandler.Flags & ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddrHandler.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* We just returned from a non-default handler, we must re-enter the
@@ -459,7 +468,7 @@ AcpiEvDisassociateRegionFromHandler(
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvDisassociateRegionFromHandler");
+ ACPI_FUNCTION_TRACE ("EvDisassociateRegionFromHandler");
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -506,7 +515,11 @@ AcpiEvDisassociateRegionFromHandler(
if (AcpiNsIsLocked)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
}
/*
@@ -516,7 +529,11 @@ AcpiEvDisassociateRegionFromHandler(
if (AcpiNsIsLocked)
{
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
}
/*
@@ -596,7 +613,7 @@ AcpiEvAssociateRegionAndHandler (
ACPI_STATUS Status;
- FUNCTION_TRACE ("EvAssociateRegionAndHandler");
+ ACPI_FUNCTION_TRACE ("EvAssociateRegionAndHandler");
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
@@ -628,7 +645,7 @@ AcpiEvAssociateRegionAndHandler (
if (AcpiNsIsLocked)
{
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
}
return_ACPI_STATUS (Status);
@@ -668,7 +685,7 @@ AcpiEvAddrHandlerHelper (
ACPI_STATUS Status;
- PROC_NAME ("EvAddrHandlerHelper");
+ ACPI_FUNCTION_NAME ("EvAddrHandlerHelper");
HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
@@ -713,7 +730,7 @@ AcpiEvAddrHandlerHelper (
/*
* Devices are handled different than regions
*/
- if (IS_THIS_OBJECT_TYPE (ObjDesc, ACPI_TYPE_DEVICE))
+ if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE)
{
/*
* See if this guy has any handlers
diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c
index 23e0c2b..cf801a8 100644
--- a/sys/contrib/dev/acpica/evrgnini.c
+++ b/sys/contrib/dev/acpica/evrgnini.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
- * $Revision: 51 $
+ * $Revision: 56 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "amlcode.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evrgnini")
+ ACPI_MODULE_NAME ("evrgnini")
/*******************************************************************************
@@ -149,7 +149,7 @@ AcpiEvSystemMemoryRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- FUNCTION_TRACE ("EvSystemMemoryRegionSetup");
+ ACPI_FUNCTION_TRACE ("EvSystemMemoryRegionSetup");
if (Function == ACPI_REGION_DEACTIVATE)
@@ -197,7 +197,7 @@ AcpiEvIoSpaceRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- FUNCTION_TRACE ("EvIoSpaceRegionSetup");
+ ACPI_FUNCTION_TRACE ("EvIoSpaceRegionSetup");
if (Function == ACPI_REGION_DEACTIVATE)
@@ -246,7 +246,7 @@ AcpiEvPciConfigRegionSetup (
ACPI_DEVICE_ID ObjectHID;
- FUNCTION_TRACE ("EvPciConfigRegionSetup");
+ ACPI_FUNCTION_TRACE ("EvPciConfigRegionSetup");
HandlerObj = RegionObj->Region.AddrHandler;
@@ -290,7 +290,7 @@ AcpiEvPciConfigRegionSetup (
* First get device and function numbers from the _ADR object
* in the parent's scope.
*/
- Node = AcpiNsGetParentObject (RegionObj->Region.Node);
+ Node = AcpiNsGetParentNode (RegionObj->Region.Node);
/* AcpiEvaluate the _ADR object */
@@ -303,8 +303,8 @@ AcpiEvPciConfigRegionSetup (
*/
if (ACPI_SUCCESS (Status))
{
- PciId->Device = HIWORD (Temp);
- PciId->Function = LOWORD (Temp);
+ PciId->Device = ACPI_HIWORD (Temp);
+ PciId->Function = ACPI_LOWORD (Temp);
}
/*
@@ -330,17 +330,17 @@ AcpiEvPciConfigRegionSetup (
Status = AcpiUtExecute_HID (Node, &ObjectHID);
if (ACPI_SUCCESS (Status))
{
- if (!(STRNCMP (ObjectHID.Buffer, PCI_ROOT_HID_STRING,
+ if (!(ACPI_STRNCMP (ObjectHID.Buffer, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING))))
{
- AcpiInstallAddressSpaceHandler (Node,
+ AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) Node,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
break;
}
}
- Node = AcpiNsGetParentObject (Node);
+ Node = AcpiNsGetParentNode (Node);
}
}
else
@@ -354,7 +354,7 @@ AcpiEvPciConfigRegionSetup (
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, Node, &Temp);
if (ACPI_SUCCESS (Status))
{
- PciId->Segment = LOWORD (Temp);
+ PciId->Segment = ACPI_LOWORD (Temp);
}
/*
@@ -363,7 +363,7 @@ AcpiEvPciConfigRegionSetup (
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, Node, &Temp);
if (ACPI_SUCCESS (Status))
{
- PciId->Bus = LOWORD (Temp);
+ PciId->Bus = ACPI_LOWORD (Temp);
}
*RegionContext = PciId;
@@ -396,7 +396,7 @@ AcpiEvPciBarRegionSetup (
void **RegionContext)
{
- FUNCTION_TRACE ("EvPciBarRegionSetup");
+ ACPI_FUNCTION_TRACE ("EvPciBarRegionSetup");
return_ACPI_STATUS (AE_OK);
@@ -428,7 +428,7 @@ AcpiEvCmosRegionSetup (
void **RegionContext)
{
- FUNCTION_TRACE ("EvCmosRegionSetup");
+ ACPI_FUNCTION_TRACE ("EvCmosRegionSetup");
return_ACPI_STATUS (AE_OK);
@@ -457,7 +457,7 @@ AcpiEvDefaultRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- FUNCTION_TRACE ("EvDefaultRegionSetup");
+ ACPI_FUNCTION_TRACE ("EvDefaultRegionSetup");
if (Function == ACPI_REGION_DEACTIVATE)
@@ -509,7 +509,7 @@ AcpiEvInitializeRegion (
ACPI_OPERAND_OBJECT *RegionObj2;
- FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked);
+ ACPI_FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked);
if (!RegionObj)
@@ -527,7 +527,7 @@ AcpiEvInitializeRegion (
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
- Node = AcpiNsGetParentObject (RegionObj->Region.Node);
+ Node = AcpiNsGetParentNode (RegionObj->Region.Node);
SpaceId = RegionObj->Region.SpaceId;
@@ -616,7 +616,7 @@ AcpiEvInitializeRegion (
* This one does not have the handler we need
* Pop up one level
*/
- Node = AcpiNsGetParentObject (Node);
+ Node = AcpiNsGetParentNode (Node);
} /* while Node != ROOT */
diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c
index 9c674be..76f0529 100644
--- a/sys/contrib/dev/acpica/evsci.c
+++ b/sys/contrib/dev/acpica/evsci.c
@@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 74 $
+ * $Revision: 82 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,17 +123,7 @@
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evsci")
-
-
-/*
- * Elements correspond to counts for TMR, NOT_USED, GBL, PWR_BTN, SLP_BTN, RTC,
- * and GENERAL respectively. These counts are modified by the ACPI interrupt
- * handler.
- *
- * TBD: [Investigate] Note that GENERAL should probably be split out into
- * one element for each bit in the GPE registers
- */
+ ACPI_MODULE_NAME ("evsci")
/*******************************************************************************
@@ -151,23 +141,24 @@
******************************************************************************/
static UINT32
-AcpiEvSciHandler (void *Context)
+AcpiEvSciHandler (
+ void *Context)
{
- UINT32 InterruptHandled = INTERRUPT_NOT_HANDLED;
+ UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
- FUNCTION_TRACE("EvSciHandler");
+ ACPI_FUNCTION_TRACE("EvSciHandler");
/*
* Make sure that ACPI is enabled by checking SCI_EN. Note that we are
* required to treat the SCI interrupt as sharable, level, active low.
*/
- if (!AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN))
+ if (!AcpiHwBitRegisterRead (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_DO_NOT_LOCK))
{
/* ACPI is not enabled; this interrupt cannot be for us */
- return_VALUE (INTERRUPT_NOT_HANDLED);
+ return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
@@ -206,7 +197,7 @@ AcpiEvInstallSciHandler (void)
UINT32 Status = AE_OK;
- FUNCTION_TRACE ("EvInstallSciHandler");
+ ACPI_FUNCTION_TRACE ("EvInstallSciHandler");
Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
@@ -216,7 +207,6 @@ AcpiEvInstallSciHandler (void)
/******************************************************************************
-
*
* FUNCTION: AcpiEvRemoveSciHandler
*
@@ -225,48 +215,23 @@ AcpiEvInstallSciHandler (void)
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
* installed to begin with
*
- * DESCRIPTION: Restores original status of all fixed event enable bits and
- * removes SCI handler.
+ * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
+ * taken.
+ *
+ * Note: It doesn't seem important to disable all events or set the event
+ * enable registers to their original values. The OS should disable
+ * the SCI interrupt level when the handler is removed, so no more
+ * events will come in.
*
******************************************************************************/
ACPI_STATUS
AcpiEvRemoveSciHandler (void)
{
- FUNCTION_TRACE ("EvRemoveSciHandler");
-
-
-#if 0
- /* TBD:[Investigate] Figure this out!! Disable all events first ??? */
-
- if (OriginalFixedEnableBitStatus ^ 1 << AcpiEventIndex (TMR_FIXED_EVENT))
- {
- AcpiEventDisableEvent (TMR_FIXED_EVENT);
- }
-
- if (OriginalFixedEnableBitStatus ^ 1 << AcpiEventIndex (GBL_FIXED_EVENT))
- {
- AcpiEventDisableEvent (GBL_FIXED_EVENT);
- }
-
- if (OriginalFixedEnableBitStatus ^ 1 << AcpiEventIndex (PWR_BTN_FIXED_EVENT))
- {
- AcpiEventDisableEvent (PWR_BTN_FIXED_EVENT);
- }
-
- if (OriginalFixedEnableBitStatus ^ 1 << AcpiEventIndex (SLP_BTN_FIXED_EVENT))
- {
- AcpiEventDisableEvent (SLP_BTN_FIXED_EVENT);
- }
-
- if (OriginalFixedEnableBitStatus ^ 1 << AcpiEventIndex (RTC_FIXED_EVENT))
- {
- AcpiEventDisableEvent (RTC_FIXED_EVENT);
- }
+ ACPI_FUNCTION_TRACE ("EvRemoveSciHandler");
- OriginalFixedEnableBitStatus = 0;
-#endif
+ /* Just let the OS remove the handler and disable the level */
AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
AcpiEvSciHandler);
@@ -275,116 +240,3 @@ AcpiEvRemoveSciHandler (void)
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvRestoreAcpiState
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: Restore the original ACPI state of the machine
- *
- ******************************************************************************/
-
-void
-AcpiEvRestoreAcpiState (void)
-{
- UINT32 Index;
-
-
- FUNCTION_TRACE ("EvRestoreAcpiState");
-
-
- /* Restore the state of the chipset enable bits. */
-
- if (AcpiGbl_RestoreAcpiChipset == TRUE)
- {
- /* Restore the fixed events */
-
- if (AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_EN) !=
- AcpiGbl_Pm1EnableRegisterSave)
- {
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1_EN,
- AcpiGbl_Pm1EnableRegisterSave);
- }
-
-
- /* Ensure that all status bits are clear */
-
- AcpiHwClearAcpiStatus ();
-
-
- /* Now restore the GPEs */
-
- for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
- {
- if (AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index) !=
- AcpiGbl_Gpe0EnableRegisterSave[Index])
- {
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index,
- AcpiGbl_Gpe0EnableRegisterSave[Index]);
- }
- }
-
- /* GPE 1 present? */
-
- if (AcpiGbl_FADT->Gpe1BlkLen)
- {
- for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
- {
- if (AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index) !=
- AcpiGbl_Gpe1EnableRegisterSave[Index])
- {
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index,
- AcpiGbl_Gpe1EnableRegisterSave[Index]);
- }
- }
- }
-
- if (AcpiHwGetMode() != AcpiGbl_OriginalMode)
- {
- AcpiHwSetMode (AcpiGbl_OriginalMode);
- }
- }
-
- return_VOID;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiEvTerminate
- *
- * PARAMETERS: none
- *
- * RETURN: none
- *
- * DESCRIPTION: free memory allocated for table storage.
- *
- ******************************************************************************/
-
-void
-AcpiEvTerminate (void)
-{
-
- FUNCTION_TRACE ("EvTerminate");
-
-
- /*
- * Free global tables, etc.
- */
- if (AcpiGbl_GpeRegisters)
- {
- ACPI_MEM_FREE (AcpiGbl_GpeRegisters);
- }
-
- if (AcpiGbl_GpeInfo)
- {
- ACPI_MEM_FREE (AcpiGbl_GpeInfo);
- }
-
- return_VOID;
-}
-
-
diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c
index 42828ac..7eb5506 100644
--- a/sys/contrib/dev/acpica/evxface.c
+++ b/sys/contrib/dev/acpica/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 118 $
+ * $Revision: 125 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evxface")
+ ACPI_MODULE_NAME ("evxface")
/*******************************************************************************
@@ -153,7 +153,7 @@ AcpiInstallFixedEventHandler (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
+ ACPI_FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
/* Parameter validation */
@@ -163,7 +163,11 @@ AcpiInstallFixedEventHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Don't allow two handlers. */
@@ -180,7 +184,7 @@ AcpiInstallFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Context = Context;
Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED, 0);
- if (!ACPI_SUCCESS (Status))
+ if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
@@ -189,7 +193,6 @@ AcpiInstallFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
AcpiGbl_FixedEventHandlers[Event].Context = NULL;
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
@@ -198,7 +201,7 @@ AcpiInstallFixedEventHandler (
Cleanup:
- AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -224,7 +227,7 @@ AcpiRemoveFixedEventHandler (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
+ ACPI_FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
/* Parameter validation */
@@ -234,7 +237,11 @@ AcpiRemoveFixedEventHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Disable the event before removing the handler */
@@ -245,7 +252,7 @@ AcpiRemoveFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Handler = NULL;
AcpiGbl_FixedEventHandlers[Event].Context = NULL;
- if (!ACPI_SUCCESS (Status))
+ if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
"Could not write to fixed event enable register.\n"));
@@ -255,7 +262,7 @@ AcpiRemoveFixedEventHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", Event));
}
- AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -287,10 +294,10 @@ AcpiInstallNotifyHandler (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *NotifyObj;
ACPI_NAMESPACE_NODE *DeviceNode;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiInstallNotifyHandler");
+ ACPI_FUNCTION_TRACE ("AcpiInstallNotifyHandler");
/* Parameter validation */
@@ -301,7 +308,11 @@ AcpiInstallNotifyHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Convert and validate the device handle */
@@ -383,7 +394,6 @@ AcpiInstallNotifyHandler (
goto UnlockAndExit;
}
}
-
else
{
/* Create a new object */
@@ -397,7 +407,7 @@ AcpiInstallNotifyHandler (
/* Attach new object to the Node */
- Status = AcpiNsAttachObject (Device, ObjDesc, (UINT8) DeviceNode->Type);
+ Status = AcpiNsAttachObject (Device, ObjDesc, DeviceNode->Type);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -422,7 +432,6 @@ AcpiInstallNotifyHandler (
{
ObjDesc->Device.SysHandler = NotifyObj;
}
-
else /* ACPI_DEVICE_NOTIFY */
{
ObjDesc->Device.DrvHandler = NotifyObj;
@@ -431,7 +440,7 @@ AcpiInstallNotifyHandler (
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@@ -460,10 +469,10 @@ AcpiRemoveNotifyHandler (
ACPI_OPERAND_OBJECT *NotifyObj;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *DeviceNode;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
+ ACPI_FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
/* Parameter validation */
@@ -474,7 +483,11 @@ AcpiRemoveNotifyHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Convert and validate the device handle */
@@ -575,7 +588,7 @@ AcpiRemoveNotifyHandler (
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@@ -604,31 +617,37 @@ AcpiInstallGpeHandler (
ACPI_GPE_HANDLER Handler,
void *Context)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
+ UINT32 GpeNumberIndex;
- FUNCTION_TRACE ("AcpiInstallGpeHandler");
+ ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler");
/* Parameter validation */
- if (!Handler || (GpeNumber > ACPI_GPE_MAX))
+ if (!Handler)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Ensure that we have a valid GPE number */
- if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
+ GpeNumberIndex = AcpiEvGetGpeNumberIndex (GpeNumber);
+ if (GpeNumberIndex == ACPI_GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Make sure that there isn't a handler there already */
- if (AcpiGbl_GpeInfo[GpeNumber].Handler)
+ if (AcpiGbl_GpeNumberInfo[GpeNumberIndex].Handler)
{
Status = AE_ALREADY_EXISTS;
goto Cleanup;
@@ -636,9 +655,9 @@ AcpiInstallGpeHandler (
/* Install the handler */
- AcpiGbl_GpeInfo[GpeNumber].Handler = Handler;
- AcpiGbl_GpeInfo[GpeNumber].Context = Context;
- AcpiGbl_GpeInfo[GpeNumber].Type = (UINT8) Type;
+ AcpiGbl_GpeNumberInfo[GpeNumberIndex].Handler = Handler;
+ AcpiGbl_GpeNumberInfo[GpeNumberIndex].Context = Context;
+ AcpiGbl_GpeNumberInfo[GpeNumberIndex].Type = (UINT8) Type;
/* Clear the GPE (of stale events), the enable it */
@@ -647,7 +666,7 @@ AcpiInstallGpeHandler (
Cleanup:
- AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -670,22 +689,24 @@ AcpiRemoveGpeHandler (
UINT32 GpeNumber,
ACPI_GPE_HANDLER Handler)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
+ UINT32 GpeNumberIndex;
- FUNCTION_TRACE ("AcpiRemoveGpeHandler");
+ ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler");
/* Parameter validation */
- if (!Handler || (GpeNumber > ACPI_GPE_MAX))
+ if (!Handler)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Ensure that we have a valid GPE number */
- if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID)
+ GpeNumberIndex = AcpiEvGetGpeNumberIndex (GpeNumber);
+ if (GpeNumberIndex == ACPI_GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -694,11 +715,15 @@ AcpiRemoveGpeHandler (
AcpiHwDisableGpe (GpeNumber);
- AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Make sure that the installed handler is the same */
- if (AcpiGbl_GpeInfo[GpeNumber].Handler != Handler)
+ if (AcpiGbl_GpeNumberInfo[GpeNumberIndex].Handler != Handler)
{
AcpiHwEnableGpe (GpeNumber);
Status = AE_BAD_PARAMETER;
@@ -707,12 +732,12 @@ AcpiRemoveGpeHandler (
/* Remove the handler */
- AcpiGbl_GpeInfo[GpeNumber].Handler = NULL;
- AcpiGbl_GpeInfo[GpeNumber].Context = NULL;
+ AcpiGbl_GpeNumberInfo[GpeNumberIndex].Handler = NULL;
+ AcpiGbl_GpeNumberInfo[GpeNumberIndex].Context = NULL;
Cleanup:
- AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -732,24 +757,32 @@ Cleanup:
ACPI_STATUS
AcpiAcquireGlobalLock (
- void)
+ UINT32 Timeout,
+ UINT32 *Handle)
{
ACPI_STATUS Status;
+ if (!Handle)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
Status = AcpiExEnterInterpreter ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
- /*
- * TBD: [Restructure] add timeout param to internal interface, and
- * perhaps INTERPRETER_LOCKED
- */
- Status = AcpiEvAcquireGlobalLock ();
+ Status = AcpiEvAcquireGlobalLock (Timeout);
AcpiExExitInterpreter ();
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiGbl_GlobalLockHandle++;
+ *Handle = AcpiGbl_GlobalLockHandle;
+ }
+
return (Status);
}
@@ -768,9 +801,14 @@ AcpiAcquireGlobalLock (
ACPI_STATUS
AcpiReleaseGlobalLock (
- void)
+ UINT32 Handle)
{
+ if (Handle != AcpiGbl_GlobalLockHandle)
+ {
+ return (AE_NOT_ACQUIRED);
+ }
+
AcpiEvReleaseGlobalLock ();
return (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c
index 3e123ea..533219d 100644
--- a/sys/contrib/dev/acpica/evxfevnt.c
+++ b/sys/contrib/dev/acpica/evxfevnt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 42 $
+ * $Revision: 51 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evxfevnt")
+ ACPI_MODULE_NAME ("evxfevnt")
/*******************************************************************************
@@ -146,7 +146,7 @@ AcpiEnable (void)
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("AcpiEnable");
+ ACPI_FUNCTION_TRACE ("AcpiEnable");
/* Make sure we have ACPI tables */
@@ -159,16 +159,15 @@ AcpiEnable (void)
AcpiGbl_OriginalMode = AcpiHwGetMode ();
- if (AcpiGbl_OriginalMode == SYS_MODE_ACPI)
+ if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_ACPI)
{
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Already in ACPI mode.\n"));
}
-
else
{
/* Transition to ACPI mode */
- Status = AcpiHwSetMode (SYS_MODE_ACPI);
+ Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n"));
@@ -201,13 +200,13 @@ AcpiDisable (void)
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("AcpiDisable");
+ ACPI_FUNCTION_TRACE ("AcpiDisable");
if (AcpiHwGetMode () != AcpiGbl_OriginalMode)
{
/* Restore original mode */
-
+
Status = AcpiHwSetMode (AcpiGbl_OriginalMode);
if (ACPI_FAILURE (Status))
{
@@ -219,8 +218,6 @@ AcpiDisable (void)
/* Unload the SCI interrupt handler */
AcpiEvRemoveSciHandler ();
- AcpiEvRestoreAcpiState ();
-
return_ACPI_STATUS (Status);
}
@@ -246,61 +243,40 @@ AcpiEnableEvent (
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
- UINT32 RegisterId;
- FUNCTION_TRACE ("AcpiEnableEvent");
+ ACPI_FUNCTION_TRACE ("AcpiEnableEvent");
- /* The Type must be either Fixed AcpiEvent or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (Type)
{
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed AcpiEvent */
+ /* Decode the Fixed Event */
- switch (Event)
+ if (Event > ACPI_NUM_FIXED_EVENTS)
{
- case ACPI_EVENT_PMTIMER:
- RegisterId = TMR_EN;
- break;
-
- case ACPI_EVENT_GLOBAL:
- RegisterId = GBL_EN;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- RegisterId = PWRBTN_EN;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- RegisterId = SLPBTN_EN;
- break;
-
- case ACPI_EVENT_RTC:
- RegisterId = RTC_EN;
- break;
-
- default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/*
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 1);
+ AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 1, ACPI_MTX_LOCK);
- if (1 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId))
+ /* Make sure that the hardware responded */
+
+ if (1 != AcpiHwBitRegisterRead (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ ACPI_MTX_LOCK))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Fixed event bit clear when it should be set\n"));
+ "Could not enable %s event\n", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
-
break;
@@ -308,24 +284,19 @@ AcpiEnableEvent (
/* Ensure that we have a valid GPE number */
- if ((Event > ACPI_GPE_MAX) ||
- (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID))
+ if (AcpiEvGetGpeNumberIndex (Event) == ACPI_GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Enable the requested GPE number */
- if (Flags & ACPI_EVENT_ENABLE)
- {
- AcpiHwEnableGpe (Event);
- }
+ AcpiHwEnableGpe (Event);
+
if (Flags & ACPI_EVENT_WAKE_ENABLE)
{
AcpiHwEnableGpeForWakeup (Event);
}
-
break;
@@ -334,7 +305,6 @@ AcpiEnableEvent (
Status = AE_BAD_PARAMETER;
}
-
return_ACPI_STATUS (Status);
}
@@ -360,61 +330,38 @@ AcpiDisableEvent (
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
- UINT32 RegisterId;
- FUNCTION_TRACE ("AcpiDisableEvent");
+ ACPI_FUNCTION_TRACE ("AcpiDisableEvent");
- /* The Type must be either Fixed AcpiEvent or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (Type)
{
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed AcpiEvent */
+ /* Decode the Fixed Event */
- switch (Event)
+ if (Event > ACPI_NUM_FIXED_EVENTS)
{
- case ACPI_EVENT_PMTIMER:
- RegisterId = TMR_EN;
- break;
-
- case ACPI_EVENT_GLOBAL:
- RegisterId = GBL_EN;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- RegisterId = PWRBTN_EN;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- RegisterId = SLPBTN_EN;
- break;
-
- case ACPI_EVENT_RTC:
- RegisterId = RTC_EN;
- break;
-
- default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/*
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 0);
+ AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 0, ACPI_MTX_LOCK);
- if (0 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId))
+ if (0 != AcpiHwBitRegisterRead (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ ACPI_MTX_LOCK))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Fixed event bit set when it should be clear,\n"));
+ "Could not disable %s events\n", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
-
break;
@@ -422,23 +369,24 @@ AcpiDisableEvent (
/* Ensure that we have a valid GPE number */
- if ((Event > ACPI_GPE_MAX) ||
- (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID))
+ if (AcpiEvGetGpeNumberIndex (Event) == ACPI_GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Disable the requested GPE number */
+ /*
+ * Only disable the requested GPE number for wake if specified.
+ * Otherwise, turn it totally off
+ */
- if (Flags & ACPI_EVENT_DISABLE)
- {
- AcpiHwDisableGpe (Event);
- }
if (Flags & ACPI_EVENT_WAKE_DISABLE)
{
AcpiHwDisableGpeForWakeup (Event);
}
-
+ else
+ {
+ AcpiHwDisableGpe (Event);
+ }
break;
@@ -469,53 +417,30 @@ AcpiClearEvent (
UINT32 Type)
{
ACPI_STATUS Status = AE_OK;
- UINT32 RegisterId;
- FUNCTION_TRACE ("AcpiClearEvent");
+ ACPI_FUNCTION_TRACE ("AcpiClearEvent");
- /* The Type must be either Fixed AcpiEvent or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (Type)
{
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed AcpiEvent */
+ /* Decode the Fixed Event */
- switch (Event)
+ if (Event > ACPI_NUM_FIXED_EVENTS)
{
- case ACPI_EVENT_PMTIMER:
- RegisterId = TMR_STS;
- break;
-
- case ACPI_EVENT_GLOBAL:
- RegisterId = GBL_STS;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- RegisterId = PWRBTN_STS;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- RegisterId = SLPBTN_STS;
- break;
-
- case ACPI_EVENT_RTC:
- RegisterId = RTC_STS;
- break;
-
- default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/*
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, RegisterId, 1);
+ AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ 1, ACPI_MTX_LOCK);
break;
@@ -523,13 +448,11 @@ AcpiClearEvent (
/* Ensure that we have a valid GPE number */
- if ((Event > ACPI_GPE_MAX) ||
- (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID))
+ if (AcpiEvGetGpeNumberIndex (Event) == ACPI_GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
AcpiHwClearGpe (Event);
break;
@@ -566,10 +489,9 @@ AcpiGetEventStatus (
ACPI_EVENT_STATUS *EventStatus)
{
ACPI_STATUS Status = AE_OK;
- UINT32 RegisterId;
- FUNCTION_TRACE ("AcpiGetEventStatus");
+ ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");
if (!EventStatus)
@@ -578,45 +500,23 @@ AcpiGetEventStatus (
}
- /* The Type must be either Fixed AcpiEvent or GPE */
+ /* The Type must be either Fixed Event or GPE */
switch (Type)
{
-
case ACPI_EVENT_FIXED:
- /* Decode the Fixed AcpiEvent */
+ /* Decode the Fixed Event */
- switch (Event)
+ if (Event > ACPI_NUM_FIXED_EVENTS)
{
- case ACPI_EVENT_PMTIMER:
- RegisterId = TMR_STS;
- break;
-
- case ACPI_EVENT_GLOBAL:
- RegisterId = GBL_STS;
- break;
-
- case ACPI_EVENT_POWER_BUTTON:
- RegisterId = PWRBTN_STS;
- break;
-
- case ACPI_EVENT_SLEEP_BUTTON:
- RegisterId = SLPBTN_STS;
- break;
-
- case ACPI_EVENT_RTC:
- RegisterId = RTC_STS;
- break;
-
- default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
- break;
}
/* Get the status of the requested fixed event */
- *EventStatus = AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, RegisterId);
+ *EventStatus = AcpiHwBitRegisterRead (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ ACPI_MTX_LOCK);
break;
@@ -624,13 +524,11 @@ AcpiGetEventStatus (
/* Ensure that we have a valid GPE number */
- if ((Event > ACPI_GPE_MAX) ||
- (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID))
+ if (AcpiEvGetGpeNumberIndex (Event) == ACPI_GPE_INVALID)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Obtain status on the requested GPE number */
AcpiHwGetGpeStatus (Event, EventStatus);
diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c
index 5b8e728..9db190e 100644
--- a/sys/contrib/dev/acpica/evxfregn.c
+++ b/sys/contrib/dev/acpica/evxfregn.c
@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 41 $
+ * $Revision: 48 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
- MODULE_NAME ("evxfregn")
+ ACPI_MODULE_NAME ("evxfregn")
/*******************************************************************************
@@ -155,24 +155,26 @@ AcpiInstallAddressSpaceHandler (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status = AE_OK;
- ACPI_OBJECT_TYPE8 Type;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE Type;
UINT16 Flags = 0;
- FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler");
+ ACPI_FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler");
/* Parameter validation */
- if ((!Device) ||
- ((!Handler) && (Handler != ACPI_DEFAULT_HANDLER)) ||
- (SpaceId > ACPI_MAX_ADDRESS_SPACE))
+ if (!Device)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Convert and validate the device handle */
@@ -199,7 +201,7 @@ AcpiInstallAddressSpaceHandler (
if (Handler == ACPI_DEFAULT_HANDLER)
{
- Flags = ADDR_HANDLER_DEFAULT_INSTALLED;
+ Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
switch (SpaceId)
{
@@ -228,10 +230,14 @@ AcpiInstallAddressSpaceHandler (
Setup = AcpiEvPciBarRegionSetup;
break;
+ case ACPI_ADR_SPACE_DATA_TABLE:
+ Handler = AcpiExDataTableSpaceHandler;
+ Setup = NULL;
+ break;
+
default:
Status = AE_NOT_EXIST;
goto UnlockAndExit;
- break;
}
}
@@ -275,7 +281,6 @@ AcpiInstallAddressSpaceHandler (
HandlerObj = HandlerObj->AddrHandler.Next;
}
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
@@ -305,7 +310,7 @@ AcpiInstallAddressSpaceHandler (
/* Attach the new object to the Node */
- Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Type);
+ Status = AcpiNsAttachObject (Node, ObjDesc, Type);
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ObjDesc);
@@ -353,7 +358,7 @@ AcpiInstallAddressSpaceHandler (
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device,
- ACPI_UINT32_MAX, NS_WALK_UNLOCK,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
AcpiEvAddrHandlerHelper,
HandlerObj, NULL);
@@ -367,7 +372,7 @@ AcpiInstallAddressSpaceHandler (
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@@ -396,22 +401,24 @@ AcpiRemoveAddressSpaceHandler (
ACPI_OPERAND_OBJECT *RegionObj;
ACPI_OPERAND_OBJECT **LastObjPtr;
ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler");
+ ACPI_FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler");
/* Parameter validation */
- if ((!Device) ||
- ((!Handler) && (Handler != ACPI_DEFAULT_HANDLER)) ||
- (SpaceId > ACPI_MAX_ADDRESS_SPACE))
+ if (!Device)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Convert and validate the device handle */
@@ -422,7 +429,6 @@ AcpiRemoveAddressSpaceHandler (
goto UnlockAndExit;
}
-
/* Make sure the internal object exists */
ObjDesc = AcpiNsGetAttachedObject (Node);
@@ -509,7 +515,7 @@ AcpiRemoveAddressSpaceHandler (
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c
index f8c1a1c..0908575 100644
--- a/sys/contrib/dev/acpica/exconfig.c
+++ b/sys/contrib/dev/acpica/exconfig.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 47 $
+ * $Revision: 59 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,156 +128,385 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exconfig")
+ ACPI_MODULE_NAME ("exconfig")
-/*****************************************************************************
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExAddTable
+ *
+ * PARAMETERS: Table - Pointer to raw table
+ * ParentNode - Where to load the table (scope)
+ * DdbHandle - Where to return the table handle.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common function to Install and Load an ACPI table with a
+ * returned table handle.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExAddTable (
+ ACPI_TABLE_HEADER *Table,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_OPERAND_OBJECT **DdbHandle)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ ACPI_FUNCTION_TRACE ("ExAddTable");
+
+
+ /* Create an object to be the table handle */
+
+ ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Install the new table into the local data structures */
+
+ TableInfo.Pointer = Table;
+ TableInfo.Length = Table->Length;
+ TableInfo.Allocation = ACPI_MEM_ALLOCATED;
+ TableInfo.BasePointer = Table;
+
+ Status = AcpiTbInstallTable (NULL, &TableInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Add the table to the namespace */
+
+ Status = AcpiNsLoadTable (TableInfo.InstalledDesc, ParentNode);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Uninstall table on error */
+
+ AcpiTbUninstallTable (TableInfo.InstalledDesc);
+ goto Cleanup;
+ }
+
+ /* Init the table handle */
+
+ ObjDesc->Reference.Opcode = AML_LOAD_OP;
+ ObjDesc->Reference.Object = TableInfo.InstalledDesc;
+ *DdbHandle = ObjDesc;
+ return_ACPI_STATUS (AE_OK);
+
+
+Cleanup:
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiExLoadTableOp
*
- * PARAMETERS: RgnDesc - Op region where the table will be obtained
- * DdbHandle - Where a handle to the table will be returned
+ * PARAMETERS: WalkState - Current state with operands
+ * ReturnDesc - Where to store the return object
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
-AcpiExLoadOp (
- ACPI_OPERAND_OBJECT *RgnDesc,
- ACPI_OPERAND_OBJECT *DdbHandle)
+AcpiExLoadTableOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT **ReturnDesc)
{
ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *TableDesc = NULL;
- UINT8 *TablePtr;
- UINT8 *TableDataPtr;
- ACPI_TABLE_HEADER TableHeader;
- ACPI_TABLE_DESC TableInfo;
- UINT32 i;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_TABLE_HEADER *Table;
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *StartNode;
+ ACPI_NAMESPACE_NODE *ParameterNode = NULL;
+ ACPI_OPERAND_OBJECT *DdbHandle;
+
+
+ ACPI_FUNCTION_TRACE ("ExLoadTableOp");
+
+
+ /*
+ * Make sure that the signature does not match one of the tables that
+ * is already loaded.
+ */
+ Status = AcpiTbMatchSignature (Operand[0]->String.Pointer, NULL);
+ if (Status == AE_OK)
+ {
+ /* Signature matched -- don't allow override */
+
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
+ /* Find the ACPI table */
+
+ Status = AcpiTbFindTable (Operand[0]->String.Pointer,
+ Operand[1]->String.Pointer,
+ Operand[2]->String.Pointer, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
+ /* Not found, return an Integer=0 and AE_OK */
- FUNCTION_TRACE ("ExLoadOp");
+ DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!DdbHandle)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- /* Object can be either a field or an opregion */
+ DdbHandle->Integer.Value = 0;
+ *ReturnDesc = DdbHandle;
- /* TBD: Handle field vs. Opregion *?
+ return_ACPI_STATUS (AE_OK);
+ }
+ /* Default nodes */
- /* Get the table header */
+ StartNode = WalkState->ScopeInfo->Scope.Node;
+ ParentNode = AcpiGbl_RootNode;
- TableHeader.Length = 0;
- for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
+ /* RootPath (optional parameter) */
+
+ if (Operand[3]->String.Length > 0)
{
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ,
- (ACPI_PHYSICAL_ADDRESS) i, 8,
- (ACPI_INTEGER *) ((UINT8 *) &TableHeader + i));
+ /*
+ * Find the node referenced by the RootPathString. This is the
+ * location within the namespace where the table will be loaded.
+ */
+ Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
+ ACPI_NS_SEARCH_PARENT, &ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
- /* Allocate a buffer for the entire table */
+ /* ParameterPath (optional parameter) */
- TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
- if (!TablePtr)
+ if (Operand[4]->String.Length > 0)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ if ((Operand[4]->String.Pointer[0] != '\\') &&
+ (Operand[4]->String.Pointer[0] != '^'))
+ {
+ /*
+ * Path is not absolute, so it will be relative to the node
+ * referenced by the RootPathString (or the NS root if omitted)
+ */
+ StartNode = ParentNode;
+ }
+
+ /*
+ * Find the node referenced by the ParameterPathString
+ */
+ Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
+ ACPI_NS_SEARCH_PARENT, &ParameterNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Load the table into the namespace */
+
+ Status = AcpiExAddTable (Table, ParentNode, &DdbHandle);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Parameter Data (optional) */
+
+ if (ParameterNode)
+ {
+ /* Store the parameter data into the optional parameter object */
+
+ Status = AcpiExStore (Operand[5], (ACPI_OPERAND_OBJECT *) ParameterNode,
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiExUnloadTable (DdbHandle);
+ }
}
- /* Copy the header to the buffer */
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExLoadOp
+ *
+ * PARAMETERS: ObjDesc - Region or Field where the table will be
+ * obtained
+ * Target - Where a handle to the table will be stored
+ * WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table from a field or operation region
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExLoadOp (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *Target,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *DdbHandle;
+ ACPI_OPERAND_OBJECT *BufferDesc = NULL;
+ ACPI_TABLE_HEADER *TablePtr = NULL;
+ UINT8 *TableDataPtr;
+ ACPI_TABLE_HEADER TableHeader;
+ UINT32 i;
+
- MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
- TableDataPtr = TablePtr + sizeof (ACPI_TABLE_HEADER);
+ ACPI_FUNCTION_TRACE ("ExLoadOp");
- /* Get the table from the op region */
+ /* Object can be either an OpRegion or a Field */
- for (i = 0; i < TableHeader.Length; i++)
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ,
- (ACPI_PHYSICAL_ADDRESS) i, 8,
- (ACPI_INTEGER *) (TableDataPtr + i));
+ case ACPI_TYPE_REGION:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
+ ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type)));
+
+ /* Get the table header */
+
+ TableHeader.Length = 0;
+ for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
+ {
+ Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
+ (ACPI_PHYSICAL_ADDRESS) i, 8,
+ (ACPI_INTEGER *) ((UINT8 *) &TableHeader + i));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Allocate a buffer for the entire table */
+
+ TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
+ if (!TablePtr)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the header to the buffer */
+
+ ACPI_MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
+ TableDataPtr = ACPI_PTR_ADD (UINT8, TablePtr, sizeof (ACPI_TABLE_HEADER));
+
+ /* Get the table from the op region */
+
+ for (i = 0; i < TableHeader.Length; i++)
+ {
+ Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
+ (ACPI_PHYSICAL_ADDRESS) i, 8,
+ (ACPI_INTEGER *) (TableDataPtr + i));
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ case INTERNAL_TYPE_REGION_FIELD:
+ case INTERNAL_TYPE_BANK_FIELD:
+ case INTERNAL_TYPE_INDEX_FIELD:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
+ ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type)));
+
+ /*
+ * The length of the field must be at least as large as the table.
+ * Read the entire field and thus the entire table. Buffer is
+ * allocated during the read.
+ */
+ Status = AcpiExReadDataFromField (ObjDesc, &BufferDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
+
+ TablePtr = (ACPI_TABLE_HEADER *) BufferDesc->Buffer.Pointer;
+ break;
+
+
+ default:
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
- /* Table must be either an SSDT or a PSDT */
+ /* The table must be either an SSDT or a PSDT */
- if ((!STRNCMP (TableHeader.Signature,
+ if ((!ACPI_STRNCMP (TablePtr->Signature,
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature,
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) &&
- (!STRNCMP (TableHeader.Signature,
+ (!ACPI_STRNCMP (TablePtr->Signature,
AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature,
AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength)))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
- (char*)TableHeader.Signature));
+ (char *) &TablePtr->Signature));
Status = AE_BAD_SIGNATURE;
goto Cleanup;
}
- /* Create an object to be the table handle */
-
- TableDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
- if (!TableDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
/* Install the new table into the local data structures */
- TableInfo.Pointer = (ACPI_TABLE_HEADER *) TablePtr;
- TableInfo.Length = TableHeader.Length;
- TableInfo.Allocation = ACPI_MEM_ALLOCATED;
- TableInfo.BasePointer = TablePtr;
-
- Status = AcpiTbInstallTable (NULL, &TableInfo);
+ Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
- /* Add the table to the namespace */
+ /* Store the DdbHandle into the Target operand */
- Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
+ Status = AcpiExStore (DdbHandle, Target, WalkState);
if (ACPI_FAILURE (Status))
{
- /* Uninstall table and free the buffer */
-
- AcpiTbUninstallTable (TableInfo.InstalledDesc);
- goto Cleanup;
+ AcpiExUnloadTable (DdbHandle);
}
-
- /* We need a pointer to the table desc */
-
- /* Init the table handle */
-
- TableDesc->Reference.Opcode = AML_LOAD_OP;
- TableDesc->Reference.Object = TableInfo.InstalledDesc;
-
- /* Store the tabledesc into the DdbHandle target */
- /* DdbHandle = TableDesc; */
-
return_ACPI_STATUS (Status);
Cleanup:
- ACPI_MEM_FREE (TableDesc);
- ACPI_MEM_FREE (TablePtr);
+ if (BufferDesc)
+ {
+ AcpiUtRemoveReference (BufferDesc);
+ }
+ else
+ {
+ ACPI_MEM_FREE (TablePtr);
+ }
return_ACPI_STATUS (Status);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExUnloadTable
*
@@ -287,7 +516,7 @@ Cleanup:
*
* DESCRIPTION: Unload an ACPI table
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExUnloadTable (
@@ -298,7 +527,7 @@ AcpiExUnloadTable (
ACPI_TABLE_DESC *TableInfo;
- FUNCTION_TRACE ("ExUnloadTable");
+ ACPI_FUNCTION_TRACE ("ExUnloadTable");
/*
@@ -308,7 +537,7 @@ AcpiExUnloadTable (
* validated here.
*/
if ((!DdbHandle) ||
- (!VALID_DESCRIPTOR_TYPE (DdbHandle, ACPI_DESC_TYPE_INTERNAL)) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_INTERNAL) ||
(((ACPI_OPERAND_OBJECT *)DdbHandle)->Common.Type !=
INTERNAL_TYPE_REFERENCE))
{
@@ -336,7 +565,6 @@ AcpiExUnloadTable (
/* Delete the table descriptor (DdbHandle) */
AcpiUtRemoveReference (TableDesc);
-
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c
index 46159ce..8612789 100644
--- a/sys/contrib/dev/acpica/exconvrt.c
+++ b/sys/contrib/dev/acpica/exconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 24 $
+ * $Revision: 30 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exconvrt")
+ ACPI_MODULE_NAME ("exconvrt")
/*******************************************************************************
@@ -158,14 +158,14 @@ AcpiExConvertToInteger (
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
*ResultDesc = ObjDesc;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_STRING:
Pointer = ObjDesc->String.Pointer;
@@ -178,7 +178,7 @@ AcpiExConvertToInteger (
break;
default:
- return (AE_TYPE);
+ return_ACPI_STATUS (AE_TYPE);
}
/*
@@ -187,10 +187,9 @@ AcpiExConvertToInteger (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
@@ -202,7 +201,6 @@ AcpiExConvertToInteger (
IntegerSize = sizeof (UINT32);
}
-
/*
* Convert the buffer/string to an integer. Note that both buffers and
* strings are treated as raw data - we don't convert ascii to hex for
@@ -228,13 +226,13 @@ AcpiExConvertToInteger (
{
case ACPI_TYPE_STRING:
- /* TBD: Need to use 64-bit STRTOUL */
+ /* TBD: Need to use 64-bit ACPI_STRTOUL */
/*
* Convert string to an integer
* String must be hexadecimal as per the ACPI specification
*/
- Result = STRTOUL (Pointer, NULL, 16);
+ Result = ACPI_STRTOUL (Pointer, NULL, 16);
break;
@@ -253,7 +251,6 @@ AcpiExConvertToInteger (
*/
Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
}
-
break;
}
@@ -270,7 +267,7 @@ AcpiExConvertToInteger (
}
*ResultDesc = RetDesc;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -300,7 +297,7 @@ AcpiExConvertToBuffer (
UINT8 *NewBuf;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
switch (ObjDesc->Common.Type)
@@ -313,7 +310,7 @@ AcpiExConvertToBuffer (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
@@ -328,16 +325,16 @@ AcpiExConvertToBuffer (
IntegerSize = sizeof (UINT32);
}
- /* Need enough space for one integers */
+ /* Need enough space for one integer */
RetDesc->Buffer.Length = IntegerSize;
NewBuf = ACPI_MEM_CALLOCATE (IntegerSize);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExConvertToBuffer: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the integer to the buffer */
@@ -350,14 +347,6 @@ AcpiExConvertToBuffer (
/* Return the new buffer descriptor */
- if (*ResultDesc == ObjDesc)
- {
- if (WalkState->Opcode != AML_STORE_OP)
- {
- AcpiUtRemoveReference (ObjDesc);
- }
- }
-
*ResultDesc = RetDesc;
break;
@@ -373,11 +362,10 @@ AcpiExConvertToBuffer (
default:
- return (AE_TYPE);
- break;
- }
+ return_ACPI_STATUS (AE_TYPE);
+ }
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -409,7 +397,7 @@ AcpiExConvertToAscii (
BOOLEAN LeadingZero = TRUE;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (Base)
@@ -436,7 +424,7 @@ AcpiExConvertToAscii (
if (!LeadingZero)
{
- String[k] = (UINT8) (ASCII_ZERO + Remainder);
+ String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
k++;
}
}
@@ -450,7 +438,7 @@ AcpiExConvertToAscii (
{
HexDigit = AcpiUtHexToAsciiChar (Integer, (j * 4));
- if (HexDigit != ASCII_ZERO)
+ if (HexDigit != ACPI_ASCII_ZERO)
{
LeadingZero = FALSE;
}
@@ -475,7 +463,7 @@ AcpiExConvertToAscii (
*/
if (!k)
{
- String [0] = ASCII_ZERO;
+ String [0] = ACPI_ASCII_ZERO;
k = 1;
}
String [k] = 0;
@@ -515,7 +503,7 @@ AcpiExConvertToString (
UINT8 *Pointer;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
switch (ObjDesc->Common.Type)
@@ -546,7 +534,7 @@ AcpiExConvertToString (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Need enough space for one ASCII integer plus null terminator */
@@ -554,10 +542,10 @@ AcpiExConvertToString (
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExConvertToString: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -606,7 +594,7 @@ AcpiExConvertToString (
{
if (StringLength > ACPI_MAX_STRING_CONVERSION)
{
- return (AE_AML_STRING_LIMIT);
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
}
@@ -616,7 +604,7 @@ AcpiExConvertToString (
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
if (!RetDesc)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* String length is the lesser of the Max or the actual length */
@@ -629,10 +617,10 @@ AcpiExConvertToString (
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExConvertToString: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
@@ -652,7 +640,7 @@ AcpiExConvertToString (
NewBuf [Index-1] = 0;
RetDesc->Buffer.Pointer = NewBuf;
- RetDesc->String.Length = STRLEN ((char *) NewBuf);
+ RetDesc->String.Length = ACPI_STRLEN ((char *) NewBuf);
/* Return the new buffer descriptor */
@@ -680,17 +668,16 @@ AcpiExConvertToString (
{
/* Must copy the string first and then truncate it */
- return (AE_NOT_IMPLEMENTED);
+ return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
break;
default:
- return (AE_TYPE);
- break;
- }
+ return_ACPI_STATUS (AE_TYPE);
+ }
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -698,26 +685,32 @@ AcpiExConvertToString (
*
* FUNCTION: AcpiExConvertToTargetType
*
- * PARAMETERS: *ObjDesc - Object to be converted.
- * WalkState - Current method state
+ * PARAMETERS: DestinationType - Current type of the destination
+ * SourceDesc - Source object to be converted.
+ * WalkState - Current method state
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Implements "implicit conversion" rules for storing an object.
*
******************************************************************************/
ACPI_STATUS
AcpiExConvertToTargetType (
- ACPI_OBJECT_TYPE8 DestinationType,
- ACPI_OPERAND_OBJECT **ObjDesc,
+ ACPI_OBJECT_TYPE DestinationType,
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **ResultDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExConvertToTargetType");
+ ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
+
+
+ /* Default behavior */
+ *ResultDesc = SourceDesc;
/*
* If required by the target,
@@ -740,11 +733,11 @@ AcpiExConvertToTargetType (
default:
/* No conversion allowed for these types */
- if (DestinationType != (*ObjDesc)->Common.Type)
+ if (DestinationType != SourceDesc->Common.Type)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target does not allow conversion of type %s to %s\n",
- AcpiUtGetTypeName ((*ObjDesc)->Common.Type),
+ AcpiUtGetTypeName ((SourceDesc)->Common.Type),
AcpiUtGetTypeName (DestinationType)));
Status = AE_TYPE;
}
@@ -764,7 +757,7 @@ AcpiExConvertToTargetType (
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
- Status = AcpiExConvertToInteger (*ObjDesc, ObjDesc, WalkState);
+ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, WalkState);
break;
@@ -774,17 +767,17 @@ AcpiExConvertToTargetType (
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
- Status = AcpiExConvertToString (*ObjDesc, ObjDesc, 16, ACPI_UINT32_MAX, WalkState);
+ Status = AcpiExConvertToString (SourceDesc, ResultDesc, 16, ACPI_UINT32_MAX, WalkState);
break;
case ACPI_TYPE_BUFFER:
/*
- * The operand must be a String. We can convert an
- * Integer or Buffer if necessary
+ * The operand must be a Buffer. We can convert an
+ * Integer or String if necessary
*/
- Status = AcpiExConvertToBuffer (*ObjDesc, ObjDesc, WalkState);
+ Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState);
break;
}
break;
diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c
index 0410fe5..e14b28d 100644
--- a/sys/contrib/dev/acpica/excreate.c
+++ b/sys/contrib/dev/acpica/excreate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 79 $
+ * $Revision: 89 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,10 +124,11 @@
#include "acnamesp.h"
#include "acevents.h"
#include "acdispat.h"
+#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("excreate")
+ ACPI_MODULE_NAME ("excreate")
/*****************************************************************************
@@ -151,7 +152,7 @@ AcpiExCreateAlias (
ACPI_STATUS Status;
- FUNCTION_TRACE ("ExCreateAlias");
+ ACPI_FUNCTION_TRACE ("ExCreateAlias");
/* Get the source/alias operands (both namespace nodes) */
@@ -198,7 +199,7 @@ AcpiExCreateEvent (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE ("ExCreateEvent");
+ ACPI_FUNCTION_TRACE ("ExCreateEvent");
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
@@ -208,7 +209,7 @@ AcpiExCreateEvent (
goto Cleanup;
}
- /*
+ /*
* Create the actual OS semaphore, with zero initial units -- meaning
* that the event is created in an unsignalled state
*/
@@ -222,7 +223,7 @@ AcpiExCreateEvent (
/* Attach object to the Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
- ObjDesc, (UINT8) ACPI_TYPE_EVENT);
+ ObjDesc, ACPI_TYPE_EVENT);
Cleanup:
/*
@@ -256,7 +257,7 @@ AcpiExCreateMutex (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE_PTR ("ExCreateMutex", WALK_OPERANDS);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS);
/* Create the new mutex object */
@@ -268,7 +269,7 @@ AcpiExCreateMutex (
goto Cleanup;
}
- /*
+ /*
* Create the actual OS semaphore.
* One unit max to make it a mutex, with one initial unit to allow
* the mutex to be acquired.
@@ -284,7 +285,7 @@ AcpiExCreateMutex (
ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
- ObjDesc, (UINT8) ACPI_TYPE_MUTEX);
+ ObjDesc, ACPI_TYPE_MUTEX);
Cleanup:
@@ -322,10 +323,10 @@ AcpiExCreateRegion (
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT *RegionObj2 = NULL;
+ ACPI_OPERAND_OBJECT *RegionObj2;
- FUNCTION_TRACE ("ExCreateRegion");
+ ACPI_FUNCTION_TRACE ("ExCreateRegion");
/* Get the Node from the object stack */
@@ -348,7 +349,7 @@ AcpiExCreateRegion (
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
(RegionSpace < ACPI_USER_REGION_BEGIN))
{
- REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
+ ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
@@ -382,7 +383,7 @@ AcpiExCreateRegion (
/* Install the new region object in the parent Node */
- Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) ACPI_TYPE_REGION);
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
Cleanup:
@@ -410,24 +411,88 @@ ACPI_STATUS
AcpiExCreateTableRegion (
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OPERAND_OBJECT *RegionObj2;
- FUNCTION_TRACE ("ExCreateTableRegion");
+ ACPI_FUNCTION_TRACE ("ExCreateTableRegion");
+
+ /* Get the Node from the object stack */
+
+ Node = WalkState->Op->Node;
+
+ /*
+ * If the region object is already attached to this node,
+ * just return
+ */
+ if (AcpiNsGetAttachedObject (Node))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Find the ACPI table */
+
+ Status = AcpiTbFindTable (Operand[1]->String.Pointer,
+ Operand[2]->String.Pointer,
+ Operand[3]->String.Pointer, &Table);
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Create the region descriptor */
-/*
- ACPI_OPERAND_OBJECT *ObjDesc;
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
if (!ObjDesc)
{
- Status = AE_NO_MEMORY;
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2->Extra.RegionContext = NULL;
+
+ /* Init the region from the operands */
+
+ ObjDesc->Region.SpaceId = REGION_DATA_TABLE;
+ ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
+ ObjDesc->Region.Length = Table->Length;
+ ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
+
+ /* Install the new region object in the parent Node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
+ if (ACPI_FAILURE (Status))
+ {
goto Cleanup;
}
+ Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_EXIST)
+ {
+ Status = AE_OK;
+ }
+ else
+ {
+ goto Cleanup;
+ }
+ }
+
+ ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
+
Cleanup:
-*/
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
@@ -457,7 +522,7 @@ AcpiExCreateProcessor (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
/* Create the processor object */
@@ -478,7 +543,7 @@ AcpiExCreateProcessor (
/* Install the processor object in the parent Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
- ObjDesc, (UINT8) ACPI_TYPE_PROCESSOR);
+ ObjDesc, ACPI_TYPE_PROCESSOR);
/* Remove local reference to the object */
@@ -513,7 +578,7 @@ AcpiExCreatePowerResource (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
/* Create the power resource object */
@@ -532,7 +597,7 @@ AcpiExCreatePowerResource (
/* Install the power resource object in the parent Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
- ObjDesc, (UINT8) ACPI_TYPE_POWER);
+ ObjDesc, ACPI_TYPE_POWER);
/* Remove local reference to the object */
@@ -569,7 +634,7 @@ AcpiExCreateMethod (
UINT8 MethodFlags;
- FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
/* Create a new method object */
@@ -614,7 +679,7 @@ AcpiExCreateMethod (
/* Attach the new object to the method Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
- ObjDesc, (UINT8) ACPI_TYPE_METHOD);
+ ObjDesc, ACPI_TYPE_METHOD);
/* Remove local reference to the object */
diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c
index 6b0a455..d3b23a5 100644
--- a/sys/contrib/dev/acpica/exdump.c
+++ b/sys/contrib/dev/acpica/exdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 138 $
+ * $Revision: 145 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exdump")
+ ACPI_MODULE_NAME ("exdump")
/*
@@ -161,7 +161,7 @@ AcpiExShowHexValue (
UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */
- FUNCTION_TRACE ("ExShowHexValue");
+ ACPI_FUNCTION_TRACE ("ExShowHexValue");
if (!((ACPI_LV_LOAD & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@@ -171,7 +171,7 @@ AcpiExShowHexValue (
if (!AmlStart)
{
- REPORT_ERROR (("ExShowHexValue: null pointer\n"));
+ ACPI_REPORT_ERROR (("ExShowHexValue: null pointer\n"));
return;
}
@@ -231,24 +231,24 @@ AcpiExShowHexValue (
*
* FUNCTION: AcpiExDumpOperand
*
- * PARAMETERS: *EntryDesc - Pointer to entry to be dumped
+ * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
*
* RETURN: Status
*
- * DESCRIPTION: Dump a stack entry
+ * DESCRIPTION: Dump an operand object
*
****************************************************************************/
ACPI_STATUS
AcpiExDumpOperand (
- ACPI_OPERAND_OBJECT *EntryDesc)
+ ACPI_OPERAND_OBJECT *ObjDesc)
{
UINT8 *Buf = NULL;
UINT32 Length;
UINT32 i;
- PROC_NAME ("ExDumpOperand")
+ ACPI_FUNCTION_NAME ("ExDumpOperand")
if (!((ACPI_LV_INFO & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@@ -256,7 +256,7 @@ AcpiExDumpOperand (
return (AE_OK);
}
- if (!EntryDesc)
+ if (!ObjDesc)
{
/*
* This usually indicates that something serious is wrong --
@@ -267,29 +267,29 @@ AcpiExDumpOperand (
return (AE_OK);
}
- if (VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", EntryDesc));
- DUMP_ENTRY (EntryDesc, ACPI_LV_INFO);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", ObjDesc));
+ ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_INFO);
return (AE_OK);
}
- if (!VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_INTERNAL))
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p Is not a local object \n", EntryDesc));
- DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is not a local object\n", ObjDesc));
+ ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
return (AE_OK);
}
- /* EntryDesc is a valid object */
+ /* ObjDesc is a valid object */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", EntryDesc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", ObjDesc));
- switch (EntryDesc->Common.Type)
+ switch (ObjDesc->Common.Type)
{
case INTERNAL_TYPE_REFERENCE:
- switch (EntryDesc->Reference.Opcode)
+ switch (ObjDesc->Reference.Opcode)
{
case AML_ZERO_OP:
@@ -323,31 +323,31 @@ AcpiExDumpOperand (
case AML_NAME_OP:
- DUMP_PATHNAME (EntryDesc->Reference.Object, "Reference: Name: ",
+ ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object, "Reference: Name: ",
ACPI_LV_INFO, _COMPONENT);
- DUMP_ENTRY (EntryDesc->Reference.Object, ACPI_LV_INFO);
+ ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
break;
case AML_INDEX_OP:
AcpiOsPrintf ("Reference: Index %p\n",
- EntryDesc->Reference.Object);
+ ObjDesc->Reference.Object);
break;
case AML_ARG_OP:
AcpiOsPrintf ("Reference: Arg%d",
- EntryDesc->Reference.Offset);
+ ObjDesc->Reference.Offset);
- if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
+ if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type)
{
/* Value is a Number */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
- HIDWORD(EntryDesc->Integer.Value),
- LODWORD(EntryDesc->Integer.Value));
+ ACPI_HIDWORD(ObjDesc->Integer.Value),
+ ACPI_LODWORD(ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
@@ -357,16 +357,16 @@ AcpiExDumpOperand (
case AML_LOCAL_OP:
AcpiOsPrintf ("Reference: Local%d",
- EntryDesc->Reference.Offset);
+ ObjDesc->Reference.Offset);
- if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
+ if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type)
{
/* Value is a Number */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
- HIDWORD(EntryDesc->Integer.Value),
- LODWORD(EntryDesc->Integer.Value));
+ ACPI_HIDWORD(ObjDesc->Integer.Value),
+ ACPI_LODWORD(ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
@@ -375,7 +375,7 @@ AcpiExDumpOperand (
case AML_INT_NAMEPATH_OP:
AcpiOsPrintf ("Reference.Node->Name %X\n",
- EntryDesc->Reference.Node->Name);
+ ObjDesc->Reference.Node->Name);
break;
default:
@@ -383,7 +383,7 @@ AcpiExDumpOperand (
/* unknown opcode */
AcpiOsPrintf ("Unknown opcode=%X\n",
- EntryDesc->Reference.Opcode);
+ ObjDesc->Reference.Opcode);
break;
}
@@ -394,10 +394,10 @@ AcpiExDumpOperand (
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("Buffer len %X @ %p \n",
- EntryDesc->Buffer.Length,
- EntryDesc->Buffer.Pointer);
+ ObjDesc->Buffer.Length,
+ ObjDesc->Buffer.Pointer);
- Length = EntryDesc->Buffer.Length;
+ Length = ObjDesc->Buffer.Length;
if (Length > 64)
{
@@ -406,11 +406,11 @@ AcpiExDumpOperand (
/* Debug only -- dump the buffer contents */
- if (EntryDesc->Buffer.Pointer)
+ if (ObjDesc->Buffer.Pointer)
{
AcpiOsPrintf ("Buffer Contents: ");
- for (Buf = EntryDesc->Buffer.Pointer; Length--; ++Buf)
+ for (Buf = ObjDesc->Buffer.Pointer; Length--; ++Buf)
{
AcpiOsPrintf (" %02x", *Buf);
}
@@ -423,45 +423,45 @@ AcpiExDumpOperand (
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("Integer %8.8X%8.8X\n",
- HIDWORD (EntryDesc->Integer.Value),
- LODWORD (EntryDesc->Integer.Value));
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case INTERNAL_TYPE_IF:
AcpiOsPrintf ("If [Integer] %8.8X%8.8X\n",
- HIDWORD (EntryDesc->Integer.Value),
- LODWORD (EntryDesc->Integer.Value));
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case INTERNAL_TYPE_WHILE:
AcpiOsPrintf ("While [Integer] %8.8X%8.8X\n",
- HIDWORD (EntryDesc->Integer.Value),
- LODWORD (EntryDesc->Integer.Value));
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("Package count %X @ %p\n",
- EntryDesc->Package.Count, EntryDesc->Package.Elements);
+ ObjDesc->Package.Count, ObjDesc->Package.Elements);
/*
* If elements exist, package vector pointer is valid,
* and debug_level exceeds 1, dump package's elements.
*/
- if (EntryDesc->Package.Count &&
- EntryDesc->Package.Elements &&
+ if (ObjDesc->Package.Count &&
+ ObjDesc->Package.Elements &&
AcpiDbgLevel > 1)
{
ACPI_OPERAND_OBJECT**Element;
UINT16 ElementIndex;
- for (ElementIndex = 0, Element = EntryDesc->Package.Elements;
- ElementIndex < EntryDesc->Package.Count;
+ for (ElementIndex = 0, Element = ObjDesc->Package.Elements;
+ ElementIndex < ObjDesc->Package.Count;
++ElementIndex, ++Element)
{
AcpiExDumpOperand (*Element);
@@ -476,23 +476,23 @@ AcpiExDumpOperand (
case ACPI_TYPE_REGION:
AcpiOsPrintf ("Region %s (%X)",
- AcpiUtGetRegionName (EntryDesc->Region.SpaceId),
- EntryDesc->Region.SpaceId);
+ AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
+ ObjDesc->Region.SpaceId);
/*
* If the address and length have not been evaluated,
* don't print them.
*/
- if (!(EntryDesc->Region.Flags & AOPOBJ_DATA_VALID))
+ if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
{
AcpiOsPrintf ("\n");
}
else
{
AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
- HIDWORD(EntryDesc->Region.Address),
- LODWORD(EntryDesc->Region.Address),
- EntryDesc->Region.Length);
+ ACPI_HIDWORD (ObjDesc->Region.Address),
+ ACPI_LODWORD (ObjDesc->Region.Address),
+ ObjDesc->Region.Length);
}
break;
@@ -500,12 +500,12 @@ AcpiExDumpOperand (
case ACPI_TYPE_STRING:
AcpiOsPrintf ("String length %X @ %p \"",
- EntryDesc->String.Length, EntryDesc->String.Pointer);
+ ObjDesc->String.Length, ObjDesc->String.Pointer);
- for (i = 0; i < EntryDesc->String.Length; i++)
+ for (i = 0; i < ObjDesc->String.Length; i++)
{
AcpiOsPrintf ("%c",
- EntryDesc->String.Pointer[i]);
+ ObjDesc->String.Pointer[i]);
}
AcpiOsPrintf ("\"\n");
@@ -521,12 +521,12 @@ AcpiExDumpOperand (
case INTERNAL_TYPE_REGION_FIELD:
AcpiOsPrintf (
- "RegionField: Bits=%X BitAccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
- EntryDesc->Field.BitLength, EntryDesc->Field.AccessBitWidth,
- EntryDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
- EntryDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
- EntryDesc->Field.BaseByteOffset, EntryDesc->Field.StartFieldBitOffset);
- DUMP_STACK_ENTRY (EntryDesc->Field.RegionObj);
+ "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
+ ObjDesc->Field.BitLength, ObjDesc->Field.AccessByteWidth,
+ ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
+ ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
+ ObjDesc->Field.BaseByteOffset, ObjDesc->Field.StartFieldBitOffset);
+ ACPI_DUMP_STACK_ENTRY (ObjDesc->Field.RegionObj);
break;
@@ -540,23 +540,23 @@ AcpiExDumpOperand (
AcpiOsPrintf (
"BufferField: %X bits at byte %X bit %X of \n",
- EntryDesc->BufferField.BitLength, EntryDesc->BufferField.BaseByteOffset,
- EntryDesc->BufferField.StartFieldBitOffset);
+ ObjDesc->BufferField.BitLength, ObjDesc->BufferField.BaseByteOffset,
+ ObjDesc->BufferField.StartFieldBitOffset);
- if (!EntryDesc->BufferField.BufferObj)
+ if (!ObjDesc->BufferField.BufferObj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
}
else if (ACPI_TYPE_BUFFER !=
- EntryDesc->BufferField.BufferObj->Common.Type)
+ ObjDesc->BufferField.BufferObj->Common.Type)
{
AcpiOsPrintf ("*not a Buffer* \n");
}
else
{
- DUMP_STACK_ENTRY (EntryDesc->BufferField.BufferObj);
+ ACPI_DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj);
}
break;
@@ -572,8 +572,8 @@ AcpiExDumpOperand (
AcpiOsPrintf (
"Method(%X) @ %p:%X\n",
- EntryDesc->Method.ParamCount,
- EntryDesc->Method.AmlStart, EntryDesc->Method.AmlLength);
+ ObjDesc->Method.ParamCount,
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength);
break;
@@ -608,9 +608,9 @@ AcpiExDumpOperand (
default:
- /* unknown EntryDesc->Common.Type value */
+ /* unknown ObjDesc->Common.Type value */
- AcpiOsPrintf ("Unknown Type %X\n", EntryDesc->Common.Type);
+ AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
break;
}
@@ -634,7 +634,7 @@ AcpiExDumpOperand (
void
AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **Operands,
- OPERATING_MODE InterpreterMode,
+ ACPI_INTERPRETER_MODE InterpreterMode,
NATIVE_CHAR *Ident,
UINT32 NumLevels,
NATIVE_CHAR *Note,
@@ -642,10 +642,10 @@ AcpiExDumpOperands (
UINT32 LineNumber)
{
NATIVE_UINT i;
- ACPI_OPERAND_OBJECT **EntryDesc;
+ ACPI_OPERAND_OBJECT **ObjDesc;
- PROC_NAME ("ExDumpOperands");
+ ACPI_FUNCTION_NAME ("ExDumpOperands");
if (!Ident)
@@ -672,9 +672,9 @@ AcpiExDumpOperands (
for (i = 0; NumLevels > 0; i--, NumLevels--)
{
- EntryDesc = &Operands[i];
+ ObjDesc = &Operands[i];
- if (ACPI_FAILURE (AcpiExDumpOperand (*EntryDesc)))
+ if (ACPI_FAILURE (AcpiExDumpOperand (*ObjDesc)))
{
break;
}
@@ -733,7 +733,7 @@ AcpiExOutAddress (
AcpiOsPrintf ("%20s : %p\n", Title, Value);
#else
AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title,
- HIDWORD (Value), LODWORD (Value));
+ ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
#endif
}
@@ -755,7 +755,7 @@ AcpiExDumpNode (
UINT32 Flags)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!Flags)
@@ -767,15 +767,15 @@ AcpiExDumpNode (
}
- AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char*)&Node->Name);
- AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
+ AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char *) &Node->Name);
+ AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutInteger ("Flags", Node->Flags);
AcpiExOutInteger ("Owner Id", Node->OwnerId);
AcpiExOutInteger ("Reference Count", Node->ReferenceCount);
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("ChildList", Node->Child);
AcpiExOutPointer ("NextPeer", Node->Peer);
- AcpiExOutPointer ("Parent", AcpiNsGetParentObject (Node));
+ AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
}
@@ -798,7 +798,7 @@ AcpiExDumpObjectDescriptor (
UINT32 i;
- FUNCTION_TRACE ("ExDumpObjectDescriptor");
+ ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
if (!Flags)
@@ -809,7 +809,7 @@ AcpiExDumpObjectDescriptor (
}
}
- if (!(VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)))
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
{
AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not a valid ACPI object\n", ObjDesc);
return;
@@ -827,8 +827,9 @@ AcpiExDumpObjectDescriptor (
{
case ACPI_TYPE_INTEGER:
- AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", HIDWORD (ObjDesc->Integer.Value),
- LODWORD (ObjDesc->Integer.Value));
+ AcpiOsPrintf ("%20s : %X%8.8X\n", "Value",
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
@@ -890,6 +891,7 @@ AcpiExDumpObjectDescriptor (
AcpiExOutInteger ("ParamCount", ObjDesc->Method.ParamCount);
AcpiExOutInteger ("Concurrency", ObjDesc->Method.Concurrency);
AcpiExOutPointer ("Semaphore", ObjDesc->Method.Semaphore);
+ AcpiExOutInteger ("OwningId", ObjDesc->Method.OwningId);
AcpiExOutInteger ("AmlLength", ObjDesc->Method.AmlLength);
AcpiExOutPointer ("AmlStart", ObjDesc->Method.AmlStart);
break;
@@ -949,7 +951,6 @@ AcpiExDumpObjectDescriptor (
case INTERNAL_TYPE_INDEX_FIELD:
AcpiExOutInteger ("FieldFlags", ObjDesc->CommonField.FieldFlags);
- AcpiExOutInteger ("AccessBitWidth", ObjDesc->CommonField.AccessBitWidth);
AcpiExOutInteger ("AccessByteWidth", ObjDesc->CommonField.AccessByteWidth);
AcpiExOutInteger ("BitLength", ObjDesc->CommonField.BitLength);
AcpiExOutInteger ("FldBitOffset", ObjDesc->CommonField.StartFieldBitOffset);
diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c
index d6a75a5..4a6e628 100644
--- a/sys/contrib/dev/acpica/exfield.c
+++ b/sys/contrib/dev/acpica/exfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 101 $
+ * $Revision: 105 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exfield")
+ ACPI_MODULE_NAME ("exfield")
/*******************************************************************************
@@ -156,7 +156,7 @@ AcpiExReadDataFromField (
BOOLEAN Locked;
- FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
/* Parameter validation */
@@ -192,7 +192,7 @@ AcpiExReadDataFromField (
*
* Note: Field.length is in bits.
*/
- Length = ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
+ Length = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
if (Length > sizeof (ACPI_INTEGER))
{
@@ -289,7 +289,7 @@ AcpiExWriteDataToField (
BOOLEAN Locked;
- FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
/* Parameter validation */
@@ -337,17 +337,16 @@ AcpiExWriteDataToField (
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- break;
}
/*
* We must have a buffer that is at least as long as the field
- * we are writing to. This is because individual fields are
+ * we are writing to. This is because individual fields are
* indivisible and partial writes are not supported -- as per
* the ACPI specification.
*/
NewBuffer = NULL;
- RequiredLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+ RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (Length < RequiredLength)
{
@@ -364,7 +363,7 @@ AcpiExWriteDataToField (
* at Byte zero. All unused (upper) bytes of the
* buffer will be 0.
*/
- MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
+ ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
Buffer = NewBuffer;
Length = RequiredLength;
}
diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c
index 7e60ea8..1bd79e7 100644
--- a/sys/contrib/dev/acpica/exfldio.c
+++ b/sys/contrib/dev/acpica/exfldio.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 75 $
+ * $Revision: 82 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exfldio")
+ ACPI_MODULE_NAME ("exfldio")
/*******************************************************************************
@@ -154,7 +154,7 @@ AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *RgnDesc;
- FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
+ ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
@@ -196,8 +196,9 @@ AcpiExSetupRegion (
* byte, and a field with Dword access specified.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field access width (%d bytes) too large for region size (%X)\n",
- ObjDesc->CommonField.AccessByteWidth, RgnDesc->Region.Length));
+ "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+ (char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.AccessByteWidth,
+ (char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length));
}
/*
@@ -205,10 +206,10 @@ AcpiExSetupRegion (
* exceeds region length, indicate an error
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field Base+Offset+Width %X+%X+%X exceeds region size (%X bytes) field=%p region=%p\n",
- ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset,
- ObjDesc->CommonField.AccessByteWidth,
- RgnDesc->Region.Length, ObjDesc, RgnDesc));
+ "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+ (char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.BaseByteOffset,
+ FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
+ (char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT);
}
@@ -245,7 +246,7 @@ AcpiExAccessRegion (
ACPI_PHYSICAL_ADDRESS Address;
- FUNCTION_TRACE ("AcpiExAccessRegion");
+ ACPI_FUNCTION_TRACE ("AcpiExAccessRegion");
/*
@@ -270,18 +271,18 @@ AcpiExAccessRegion (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
- " Region[%s-%X] Width %X Base:Off %X:%X at %8.8X%8.8X\n",
+ " Region[%s-%X] Access %X Base:Off %X:%X at %8.8X%8.8X\n",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId,
- ObjDesc->CommonField.AccessBitWidth,
+ ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
- HIDWORD (Address), LODWORD (Address)));
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Invoke the appropriate AddressSpace/OpRegion handler */
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ReadWrite,
- Address, ObjDesc->CommonField.AccessBitWidth, Value);
+ Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
{
@@ -329,15 +330,26 @@ AcpiExRegisterOverflow (
ACPI_INTEGER Value)
{
- /*
- * Is the Value larger than the maximum value that can fit into
- * the field?
- */
+ if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE)
+ {
+ /*
+ * The field is large enough to hold the maximum integer, so we can
+ * never overflow it.
+ */
+ return (FALSE);
+ }
+
if (Value >= (ACPI_INTEGER) (1 << ObjDesc->CommonField.BitLength))
{
+ /*
+ * The Value is larger than the maximum value that can fit into
+ * the register.
+ */
return (TRUE);
}
+ /* The Value will fit into the field with no truncation */
+
return (FALSE);
}
@@ -371,7 +383,7 @@ AcpiExFieldDatumIo (
ACPI_INTEGER LocalValue;
- FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
+ ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
if (ReadWrite == ACPI_READ)
@@ -417,7 +429,7 @@ AcpiExFieldDatumIo (
* Copy the data from the source buffer.
* Length is the field width in bytes.
*/
- MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ACPI_MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ObjDesc->BufferField.BaseByteOffset
+ FieldDatumByteOffset,
ObjDesc->CommonField.AccessByteWidth);
@@ -428,7 +440,7 @@ AcpiExFieldDatumIo (
* Copy the data to the target buffer.
* Length is the field width in bytes.
*/
- MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ObjDesc->BufferField.BaseByteOffset
+ FieldDatumByteOffset,
Value, ObjDesc->CommonField.AccessByteWidth);
@@ -535,12 +547,12 @@ AcpiExFieldDatumIo (
if (ReadWrite == ACPI_READ)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
- HIDWORD(*Value), LODWORD(*Value)));
+ ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
- HIDWORD(*Value), LODWORD(*Value)));
+ ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
}
}
@@ -573,7 +585,7 @@ AcpiExWriteWithUpdateRule (
ACPI_INTEGER CurrentValue;
- FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
+ ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
/* Start with the new bits */
@@ -593,8 +605,8 @@ AcpiExWriteWithUpdateRule (
* Check if update rule needs to be applied (not if mask is all
* ones) The left shift drops the bits we want to ignore.
*/
- if ((~Mask << (sizeof (Mask) * 8 -
- ObjDesc->CommonField.AccessBitWidth)) != 0)
+ if ((~Mask << (ACPI_MUL_8 (sizeof (Mask)) -
+ ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0)
{
/*
* Read the current contents of the byte/word/dword containing
@@ -625,7 +637,6 @@ AcpiExWriteWithUpdateRule (
"WriteWithUpdateRule: Unknown UpdateRule setting: %x\n",
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- break;
}
}
@@ -636,10 +647,10 @@ AcpiExWriteWithUpdateRule (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Mask %8.8X%8.8X DatumOffset %X Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n",
- HIDWORD(Mask), LODWORD(Mask),
+ ACPI_HIDWORD (Mask), ACPI_LODWORD (Mask),
FieldDatumByteOffset,
- HIDWORD(FieldValue), LODWORD(FieldValue),
- HIDWORD(MergedValue),LODWORD(MergedValue)));
+ ACPI_HIDWORD (FieldValue), ACPI_LODWORD (FieldValue),
+ ACPI_HIDWORD (MergedValue),ACPI_LODWORD (MergedValue)));
return_ACPI_STATUS (Status);
}
@@ -670,25 +681,29 @@ AcpiExGetBufferDatum(
UINT32 Offset)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
+
*Datum = ((UINT8 *) Buffer) [Offset];
break;
case ACPI_FIELD_WORD_GRANULARITY:
- MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
+
+ ACPI_MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
break;
case ACPI_FIELD_DWORD_GRANULARITY:
- MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
+
+ ACPI_MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
break;
case ACPI_FIELD_QWORD_GRANULARITY:
- MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
+
+ ACPI_MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
break;
}
}
@@ -719,25 +734,29 @@ AcpiExSetBufferDatum (
UINT32 Offset)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
+
((UINT8 *) Buffer) [Offset] = (UINT8) MergedDatum;
break;
case ACPI_FIELD_WORD_GRANULARITY:
- MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
+
+ ACPI_MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
break;
case ACPI_FIELD_DWORD_GRANULARITY:
- MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
+
+ ACPI_MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
break;
case ACPI_FIELD_QWORD_GRANULARITY:
- MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
+
+ ACPI_MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
break;
}
}
@@ -772,16 +791,16 @@ AcpiExExtractFromField (
UINT32 DatumCount;
- FUNCTION_TRACE ("ExExtractFromField");
+ ACPI_FUNCTION_TRACE ("ExExtractFromField");
/*
* The field must fit within the caller's buffer
*/
- ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+ ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (ByteFieldLength > BufferLength)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Field size %X (bytes) too large for buffer (%X)\n",
ByteFieldLength, BufferLength));
@@ -790,20 +809,19 @@ AcpiExExtractFromField (
/* Convert field byte count to datum count, round up if necessary */
- DatumCount = ROUND_UP_TO (ByteFieldLength,
+ DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength,
ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n",
- ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth,
- ObjDesc->CommonField.AccessByteWidth));
+ "ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
+ ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth));
/*
* Clear the caller's buffer (the whole buffer length as given)
* This is very important, especially in the cases where a byte is read,
* but the buffer is really a UINT32 (4 bytes).
*/
- MEMSET (Buffer, 0, BufferLength);
+ ACPI_MEMSET (Buffer, 0, BufferLength);
/* Read the first raw datum to prime the loop */
@@ -831,7 +849,7 @@ AcpiExExtractFromField (
if (ObjDesc->CommonField.EndBufferValidBits)
{
- MergedDatum &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
+ MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
/* Store the datum to the caller buffer */
@@ -854,7 +872,7 @@ AcpiExExtractFromField (
* to perform a final read, since this would potentially read
* past the end of the region.
*
- * We could just split the aligned and non-aligned cases since the
+ * We could just split the aligned and non-aligned cases since the
* aligned case is so very simple, but this would require more code.
*/
if ((ObjDesc->CommonField.StartFieldBitOffset != 0) ||
@@ -907,7 +925,7 @@ AcpiExExtractFromField (
if (ObjDesc->CommonField.EndBufferValidBits)
{
MergedDatum &=
- MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
+ ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
}
}
@@ -916,7 +934,7 @@ AcpiExExtractFromField (
* Store the merged field datum in the caller's buffer, according to
* the granularity of the field (size of each datum).
*/
- AcpiExSetBufferDatum (MergedDatum, Buffer,
+ AcpiExSetBufferDatum (MergedDatum, Buffer,
ObjDesc->CommonField.AccessByteWidth, DatumOffset);
/*
@@ -961,7 +979,7 @@ AcpiExInsertIntoField (
UINT32 DatumCount;
- FUNCTION_TRACE ("ExInsertIntoField");
+ ACPI_FUNCTION_TRACE ("ExInsertIntoField");
/*
@@ -970,7 +988,7 @@ AcpiExInsertIntoField (
* larger than the field, this typically happens when an integer is
* written to a field that is actually smaller than an integer.
*/
- ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+ ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (BufferLength < ByteFieldLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
@@ -981,12 +999,11 @@ AcpiExInsertIntoField (
/* Convert byte count to datum count, round up if necessary */
- DatumCount = ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
+ DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n",
- ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth,
- ObjDesc->CommonField.AccessByteWidth));
+ "ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
+ ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth));
/*
* Break the request into up to three parts (similar to an I/O request):
@@ -1012,7 +1029,7 @@ AcpiExInsertIntoField (
*
* Mask off bits that are "below" the field (if any)
*/
- Mask = MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
+ Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
/* If the field fits in one datum, may need to mask upper bits */
@@ -1021,7 +1038,7 @@ AcpiExInsertIntoField (
{
/* There are bits above the field, mask them off also */
- Mask &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
+ Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
}
/* Shift and mask the value into the field position */
@@ -1108,7 +1125,7 @@ AcpiExInsertIntoField (
*
* Mask off the unused bits above (after) the end-of-field
*/
- Mask = MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
+ Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
MergedDatum &= Mask;
/* Write the last datum with the update rule */
diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c
index ac9b819..410fb88 100644
--- a/sys/contrib/dev/acpica/exmisc.c
+++ b/sys/contrib/dev/acpica/exmisc.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 94 $
+ * $Revision: 100 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,7 +126,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exmisc")
+ ACPI_MODULE_NAME ("exmisc")
/*******************************************************************************
@@ -152,11 +152,13 @@ AcpiExGetObjectReference (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
+ case ACPI_DESC_TYPE_INTERNAL:
+
if (ObjDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
{
*ReturnDesc = NULL;
@@ -186,20 +188,22 @@ AcpiExGetObjectReference (
Status = AE_AML_INTERNAL;
goto Cleanup;
}
+ break;
- }
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
+ case ACPI_DESC_TYPE_NAMED:
+
/* Must be a named object; Just return the Node */
*ReturnDesc = ObjDesc;
- }
+ break;
+
+
+ default:
- else
- {
*ReturnDesc = NULL;
Status = AE_TYPE;
+ break;
}
@@ -212,7 +216,7 @@ Cleanup:
/*******************************************************************************
*
- * FUNCTION: AcpiExDoConcatenate
+ * FUNCTION: AcpiExConcatTemplate
*
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
@@ -220,13 +224,109 @@ Cleanup:
*
* RETURN: Status
*
+ * DESCRIPTION: Concatenate two resource templates
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExConcatTemplate (
+ ACPI_OPERAND_OBJECT *ObjDesc1,
+ ACPI_OPERAND_OBJECT *ObjDesc2,
+ ACPI_OPERAND_OBJECT **ActualReturnDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ReturnDesc;
+ NATIVE_CHAR *NewBuf;
+ UINT8 *EndTag1;
+ UINT8 *EndTag2;
+ ACPI_SIZE Length1;
+ ACPI_SIZE Length2;
+
+
+ ACPI_FUNCTION_TRACE ("ExConcatTemplate");
+
+
+ /* Find the EndTags in each resource template */
+
+ EndTag1 = AcpiUtGetResourceEndTag (ObjDesc1);
+ EndTag2 = AcpiUtGetResourceEndTag (ObjDesc2);
+ if (!EndTag1 || !EndTag2)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /* Create a new buffer object for the result */
+
+ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!ReturnDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Allocate a new buffer for the result */
+
+ Length1 = ACPI_PTR_DIFF (EndTag1, ObjDesc1->Buffer.Pointer);
+ Length2 = ACPI_PTR_DIFF (EndTag2, ObjDesc2->Buffer.Pointer) +
+ 2; /* Size of END_TAG */
+
+ NewBuf = ACPI_MEM_ALLOCATE (Length1 + Length2);
+ if (!NewBuf)
+ {
+ ACPI_REPORT_ERROR
+ (("ExConcatTemplate: Buffer allocation failure\n"));
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Copy the templates to the new descriptor */
+
+ ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1);
+ ACPI_MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2);
+
+ /*
+ * Point the return object to the new buffer
+ */
+ ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf;
+ ReturnDesc->Buffer.Length = Length1 + Length2;
+
+ /* Compute the new checksum */
+
+ NewBuf[ReturnDesc->Buffer.Length - 1] =
+ AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
+ (ReturnDesc->Buffer.Length - 1));
+
+ /* Return the completed template descriptor */
+
+ *ActualReturnDesc = ReturnDesc;
+ return_ACPI_STATUS (AE_OK);
+
+
+Cleanup:
+
+ AcpiUtRemoveReference (ReturnDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoConcatenate
+ *
+ * PARAMETERS: ObjDesc1 - First source object
+ * ObjDesc2 - Second source object
+ * ActualReturnDesc - Where to place the return object
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
* DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
*
******************************************************************************/
ACPI_STATUS
AcpiExDoConcatenate (
- ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *ObjDesc1,
ACPI_OPERAND_OBJECT *ObjDesc2,
ACPI_OPERAND_OBJECT **ActualReturnDesc,
ACPI_WALK_STATE *WalkState)
@@ -239,7 +339,7 @@ AcpiExDoConcatenate (
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -248,7 +348,7 @@ AcpiExDoConcatenate (
* 2) Two Strings concatenated to produce a string
* 3) Two Buffers concatenated to produce a buffer
*/
- switch (ObjDesc->Common.Type)
+ switch (ObjDesc1->Common.Type)
{
case ACPI_TYPE_INTEGER:
@@ -278,7 +378,7 @@ AcpiExDoConcatenate (
NewBuf = ACPI_MEM_CALLOCATE (ReturnDesc->Buffer.Length);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExDoConcatenate: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
@@ -288,7 +388,7 @@ AcpiExDoConcatenate (
/* Convert the first integer */
- ThisInteger = ObjDesc->Integer.Value;
+ ThisInteger = ObjDesc1->Integer.Value;
for (i = 0; i < IntegerSize; i++)
{
NewBuf[i] = (UINT8) ThisInteger;
@@ -317,25 +417,25 @@ AcpiExDoConcatenate (
/* Operand0 is string */
- NewBuf = ACPI_MEM_ALLOCATE (ObjDesc->String.Length +
+ NewBuf = ACPI_MEM_ALLOCATE (ObjDesc1->String.Length +
ObjDesc2->String.Length + 1);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExDoConcatenate: String allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
- STRCPY (NewBuf, ObjDesc->String.Pointer);
- STRCPY (NewBuf + ObjDesc->String.Length,
- ObjDesc2->String.Pointer);
+ ACPI_STRCPY (NewBuf, ObjDesc1->String.Pointer);
+ ACPI_STRCPY (NewBuf + ObjDesc1->String.Length,
+ ObjDesc2->String.Pointer);
/* Point the return object to the new string */
ReturnDesc->String.Pointer = NewBuf;
- ReturnDesc->String.Length = ObjDesc->String.Length +=
- ObjDesc2->String.Length;
+ ReturnDesc->String.Length = ObjDesc1->String.Length +
+ ObjDesc2->String.Length;
break;
@@ -349,28 +449,28 @@ AcpiExDoConcatenate (
return (AE_NO_MEMORY);
}
- NewBuf = ACPI_MEM_ALLOCATE (ObjDesc->Buffer.Length +
+ NewBuf = ACPI_MEM_ALLOCATE (ObjDesc1->Buffer.Length +
ObjDesc2->Buffer.Length);
if (!NewBuf)
{
- REPORT_ERROR
+ ACPI_REPORT_ERROR
(("ExDoConcatenate: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
- MEMCPY (NewBuf, ObjDesc->Buffer.Pointer,
- ObjDesc->Buffer.Length);
- MEMCPY (NewBuf + ObjDesc->Buffer.Length, ObjDesc2->Buffer.Pointer,
+ ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer,
+ ObjDesc1->Buffer.Length);
+ ACPI_MEMCPY (NewBuf + ObjDesc1->Buffer.Length, ObjDesc2->Buffer.Pointer,
ObjDesc2->Buffer.Length);
/*
* Point the return object to the new buffer
*/
- ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf;
- ReturnDesc->Buffer.Length = ObjDesc->Buffer.Length +
- ObjDesc2->Buffer.Length;
+ ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf;
+ ReturnDesc->Buffer.Length = ObjDesc1->Buffer.Length +
+ ObjDesc2->Buffer.Length;
break;
@@ -379,7 +479,6 @@ AcpiExDoConcatenate (
ReturnDesc = NULL;
}
-
*ActualReturnDesc = ReturnDesc;
return (AE_OK);
@@ -397,7 +496,7 @@ Cleanup:
*
* PARAMETERS: Opcode - AML opcode
* Operand0 - Integer operand #0
- * Operand0 - Integer operand #1
+ * Operand1 - Integer operand #1
*
* RETURN: Integer result of the operation
*
@@ -479,7 +578,7 @@ AcpiExDoMathOp (
*
* PARAMETERS: Opcode - AML opcode
* Operand0 - Integer operand #0
- * Operand0 - Integer operand #1
+ * Operand1 - Integer operand #1
*
* RETURN: TRUE/FALSE result of the operation
*
diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/exmutex.c
index a9f2d72..ae1ab35 100644
--- a/sys/contrib/dev/acpica/exmutex.c
+++ b/sys/contrib/dev/acpica/exmutex.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
- * $Revision: 8 $
+ * $Revision: 10 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exmutex")
+ ACPI_MODULE_NAME ("exmutex")
/*******************************************************************************
@@ -230,7 +230,7 @@ AcpiExAcquireMutex (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
if (!ObjDesc)
{
@@ -304,7 +304,7 @@ AcpiExReleaseMutex (
ACPI_STATUS Status;
- FUNCTION_TRACE ("ExReleaseMutex");
+ ACPI_FUNCTION_TRACE ("ExReleaseMutex");
if (!ObjDesc)
@@ -383,7 +383,7 @@ AcpiExReleaseAllMutexes (
ACPI_OPERAND_OBJECT *This;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c
index 7df3000..43ab104 100644
--- a/sys/contrib/dev/acpica/exnames.c
+++ b/sys/contrib/dev/acpica/exnames.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
- * $Revision: 83 $
+ * $Revision: 90 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exnames")
+ ACPI_MODULE_NAME ("exnames")
/* AML Package Length encodings */
@@ -159,7 +159,7 @@ AcpiExAllocateNameString (
NATIVE_CHAR *NameString;
UINT32 SizeNeeded;
- FUNCTION_TRACE ("ExAllocateNameString");
+ ACPI_FUNCTION_TRACE ("ExAllocateNameString");
/*
@@ -167,7 +167,7 @@ AcpiExAllocateNameString (
* Also, one byte for the null terminator.
* This may actually be somewhat longer than needed.
*/
- if (PrefixCount == (UINT32) -1)
+ if (PrefixCount == ACPI_UINT32_MAX)
{
/* Special case for root */
@@ -185,7 +185,7 @@ AcpiExAllocateNameString (
NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
if (!NameString)
{
- REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
+ ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
return_PTR (NULL);
}
@@ -193,11 +193,10 @@ AcpiExAllocateNameString (
/* Set up Root or Parent prefixes if needed */
- if (PrefixCount == (UINT32) -1)
+ if (PrefixCount == ACPI_UINT32_MAX)
{
*TempPtr++ = AML_ROOT_PREFIX;
}
-
else
{
while (PrefixCount--)
@@ -216,7 +215,6 @@ AcpiExAllocateNameString (
*TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
*TempPtr++ = (char) NumNameSegs;
}
-
else if (2 == NumNameSegs)
{
/* Set up dual prefixes */
@@ -256,7 +254,7 @@ AcpiExNameSegment (
NATIVE_CHAR CharBuf[5];
- FUNCTION_TRACE ("ExNameSegment");
+ ACPI_FUNCTION_TRACE ("ExNameSegment");
/*
@@ -275,7 +273,7 @@ AcpiExNameSegment (
for (Index = 4;
(Index > 0) && (AcpiUtValidAcpiCharacter (*AmlAddress));
- --Index)
+ Index--)
{
CharBuf[4 - Index] = *AmlAddress++;
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[4 - Index]));
@@ -292,18 +290,16 @@ AcpiExNameSegment (
if (NameString)
{
- STRCAT (NameString, CharBuf);
+ ACPI_STRCAT (NameString, CharBuf);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Appended to - %s \n", NameString));
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"No Name string - %s \n", CharBuf));
}
}
-
else if (4 == Index)
{
/*
@@ -315,7 +311,6 @@ AcpiExNameSegment (
CharBuf[0]));
Status = AE_CTRL_PENDING;
}
-
else
{
/* Segment started with one or more valid characters, but fewer than 4 */
@@ -342,10 +337,9 @@ AcpiExNameSegment (
*
******************************************************************************/
-
ACPI_STATUS
AcpiExGetNameString (
- ACPI_OBJECT_TYPE8 DataType,
+ ACPI_OBJECT_TYPE DataType,
UINT8 *InAmlAddress,
NATIVE_CHAR **OutNameString,
UINT32 *OutNameLength)
@@ -355,11 +349,10 @@ AcpiExGetNameString (
NATIVE_CHAR *NameString = NULL;
UINT32 NumSegments;
UINT32 PrefixCount = 0;
- UINT8 Prefix = 0;
BOOLEAN HasPrefix = FALSE;
- FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
+ ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
if (INTERNAL_TYPE_REGION_FIELD == DataType ||
@@ -378,7 +371,6 @@ AcpiExGetNameString (
Status = AcpiExNameSegment (&AmlAddress, NameString);
}
}
-
else
{
/*
@@ -387,17 +379,16 @@ AcpiExGetNameString (
*/
switch (*AmlAddress)
{
-
case AML_ROOT_PREFIX:
- Prefix = *AmlAddress++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix: %x\n", Prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
/*
* Remember that we have a RootPrefix --
* see comment in AcpiExAllocateNameString()
*/
- PrefixCount = (UINT32) -1;
+ AmlAddress++;
+ PrefixCount = ACPI_UINT32_MAX;
HasPrefix = TRUE;
break;
@@ -408,18 +399,21 @@ AcpiExGetNameString (
do
{
- Prefix = *AmlAddress++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix: %x\n", Prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
- ++PrefixCount;
+ AmlAddress++;
+ PrefixCount++;
} while (*AmlAddress == AML_PARENT_PREFIX);
+
HasPrefix = TRUE;
break;
default:
+ /* Not a prefix character */
+
break;
}
@@ -428,12 +422,11 @@ AcpiExGetNameString (
switch (*AmlAddress)
{
-
case AML_DUAL_NAME_PREFIX:
- Prefix = *AmlAddress++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix: %x\n", Prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
+ AmlAddress++;
NameString = AcpiExAllocateNameString (PrefixCount, 2);
if (!NameString)
{
@@ -455,12 +448,12 @@ AcpiExGetNameString (
case AML_MULTI_NAME_PREFIX_OP:
- Prefix = *AmlAddress++;
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix: %x\n", Prefix));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
/* Fetch count of segments remaining in name path */
- NumSegments = *AmlAddress++;
+ AmlAddress++;
+ NumSegments = *AmlAddress;
NameString = AcpiExAllocateNameString (PrefixCount, NumSegments);
if (!NameString)
@@ -471,12 +464,13 @@ AcpiExGetNameString (
/* Indicate that we processed a prefix */
+ AmlAddress++;
HasPrefix = TRUE;
while (NumSegments &&
(Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK)
{
- --NumSegments;
+ NumSegments--;
}
break;
@@ -486,7 +480,7 @@ AcpiExGetNameString (
/* NullName valid as of 8-12-98 ASL/AML Grammar Update */
- if (-1 == PrefixCount)
+ if (PrefixCount == ACPI_UINT32_MAX)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "NameSeg is \"\\\" followed by NULL\n"));
}
@@ -517,21 +511,18 @@ AcpiExGetNameString (
Status = AcpiExNameSegment (&AmlAddress, NameString);
break;
-
- } /* Switch (PeekOp ()) */
+ }
}
-
if (AE_CTRL_PENDING == Status && HasPrefix)
{
/* Ran out of segments after processing a prefix */
- REPORT_ERROR (
+ ACPI_REPORT_ERROR (
("ExDoName: Malformed Name at %p\n", NameString));
Status = AE_AML_BAD_NAME;
}
-
*OutNameString = NameString;
*OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c
index baa2534..e9b785b 100644
--- a/sys/contrib/dev/acpica/exoparg1.c
+++ b/sys/contrib/dev/acpica/exoparg1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 124 $
+ * $Revision: 134 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,7 +126,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg1")
+ ACPI_MODULE_NAME ("exoparg1")
/*!
@@ -173,7 +173,7 @@ AcpiExOpcode_1A_0T_0R (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -200,13 +200,13 @@ AcpiExOpcode_1A_0T_0R (
case AML_SLEEP_OP: /* Sleep (MsecTime) */
- AcpiExSystemDoSuspend ((UINT32) Operand[0]->Integer.Value);
+ Status = AcpiExSystemDoSuspend ((UINT32) Operand[0]->Integer.Value);
break;
case AML_STALL_OP: /* Stall (UsecTime) */
- AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
+ Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
break;
@@ -218,7 +218,7 @@ AcpiExOpcode_1A_0T_0R (
default: /* Unknown opcode */
- REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -249,7 +249,7 @@ AcpiExOpcode_1A_1T_0R (
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
- FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -258,12 +258,12 @@ AcpiExOpcode_1A_1T_0R (
{
case AML_LOAD_OP:
- Status = AcpiExLoadOp (Operand[0], Operand[1]);
+ Status = AcpiExLoadOp (Operand[0], Operand[1], WalkState);
break;
default: /* Unknown opcode */
- REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -303,7 +303,7 @@ AcpiExOpcode_1A_1T_1R (
ACPI_INTEGER Digit;
- FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Create a return object of type Integer for most opcodes */
@@ -416,7 +416,8 @@ AcpiExOpcode_1A_1T_1R (
if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
- HIDWORD(Operand[0]->Integer.Value), LODWORD(Operand[0]->Integer.Value)));
+ ACPI_HIDWORD(Operand[0]->Integer.Value),
+ ACPI_LODWORD(Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
@@ -437,7 +438,7 @@ AcpiExOpcode_1A_1T_1R (
if (Digit > 0)
{
- ReturnDesc->Integer.Value += (Temp32 << (i * 4));
+ ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4));
}
}
break;
@@ -480,7 +481,6 @@ AcpiExOpcode_1A_1T_1R (
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
goto Cleanup;
- break;
case AML_STORE_OP: /* Store (Source, Target) */
@@ -505,7 +505,6 @@ AcpiExOpcode_1A_1T_1R (
WalkState->ResultObj = Operand[0];
WalkState->Operands[0] = NULL; /* Prevent deletion */
return_ACPI_STATUS (Status);
- break;
/*
@@ -513,8 +512,7 @@ AcpiExOpcode_1A_1T_1R (
*/
case AML_COPY_OP: /* Copy (Source, Target) */
- Status = AE_NOT_IMPLEMENTED;
- goto Cleanup;
+ Status = AcpiUtCopyIobjectToIobject (Operand[0], &ReturnDesc, WalkState);
break;
@@ -552,12 +550,11 @@ AcpiExOpcode_1A_1T_1R (
AcpiPsGetOpcodeName (WalkState->Opcode)));
Status = AE_SUPPORT;
goto Cleanup;
- break;
default: /* Unknown opcode */
- REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -608,7 +605,7 @@ AcpiExOpcode_1A_0T_1R (
ACPI_INTEGER Value;
- FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -633,10 +630,10 @@ AcpiExOpcode_1A_0T_1R (
/*
* Since we are expecting a Reference operand, it
- * can be either a Node or an internal object.
+ * can be either a NS Node or an internal object.
*/
ReturnDesc = Operand[0];
- if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_INTERNAL))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_INTERNAL)
{
/* Internal reference object - prevent deletion */
@@ -731,7 +728,7 @@ AcpiExOpcode_1A_0T_1R (
default:
- REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n",
Operand[0]->Reference.Opcode));
Status = AE_AML_INTERNAL;
goto Cleanup;
@@ -773,7 +770,7 @@ AcpiExOpcode_1A_0T_1R (
case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
TempDesc = Operand[0];
- if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
{
TempDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
}
@@ -836,56 +833,88 @@ AcpiExOpcode_1A_0T_1R (
break;
- case AML_DEREF_OF_OP: /* DerefOf (ObjReference) */
+ case AML_DEREF_OF_OP: /* DerefOf (ObjReference | String) */
- /* Check for a method local or argument */
+ /* Check for a method local or argument, or standalone String */
- if (!VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
{
- /*
- * Must resolve/dereference the local/arg reference first
- */
- switch (Operand[0]->Reference.Opcode)
+ switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
{
- case AML_LOCAL_OP:
- case AML_ARG_OP:
+ case INTERNAL_TYPE_REFERENCE:
+ /*
+ * This is a DerefOf (LocalX | ArgX)
+ *
+ * Must resolve/dereference the local/arg reference first
+ */
+ switch (Operand[0]->Reference.Opcode)
+ {
+ case AML_LOCAL_OP:
+ case AML_ARG_OP:
+
+ /* Set Operand[0] to the value of the local/arg */
+
+ AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
+ Operand[0]->Reference.Offset, WalkState, &TempDesc);
+
+ /*
+ * Delete our reference to the input object and
+ * point to the object just retrieved
+ */
+ AcpiUtRemoveReference (Operand[0]);
+ Operand[0] = TempDesc;
+ break;
+
+ default:
+
+ /* Must be an Index op - handled below */
+ break;
+ }
+ break;
- /* Set Operand[0] to the value of the local/arg */
- AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
- Operand[0]->Reference.Offset, WalkState, &TempDesc);
+ case ACPI_TYPE_STRING:
/*
- * Delete our reference to the input object and
- * point to the object just retrieved
+ * This is a DerefOf (String). The string is a reference to a named ACPI object.
+ *
+ * 1) Find the owning Node
+ * 2) Dereference the node to an actual object. Could be a Field, so we nee
+ * to resolve the node to a value.
*/
- AcpiUtRemoveReference (Operand[0]);
- Operand[0] = TempDesc;
- break;
+ Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer, WalkState->ScopeInfo->Scope.Node,
+ ACPI_NS_SEARCH_PARENT, (ACPI_NAMESPACE_NODE **) &ReturnDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) &ReturnDesc, WalkState);
+ goto Cleanup;
+
default:
- /* Must be an Index op - handled below */
- break;
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
}
}
/* Operand[0] may have changed from the code above */
- if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
{
- /* Get the actual object from the Node (This is the dereference) */
-
+ /*
+ * This is a DerefOf (ObjectReference)
+ * Get the actual object from the Node (This is the dereference).
+ * -- This case may only happen when a LocalX or ArgX is dereferenced above.
+ */
ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
-
- /* Returning a pointer to the object, add another reference! */
-
- AcpiUtAddReference (ReturnDesc);
}
else
{
/*
- * This must be a reference produced by either the Index() or
+ * This must be a reference object produced by either the Index() or
* RefOf() operator
*/
switch (Operand[0]->Reference.Opcode)
@@ -915,7 +944,7 @@ AcpiExOpcode_1A_0T_1R (
goto Cleanup;
}
- /*
+ /*
* Since we are returning the value of the buffer at the
* indexed location, we don't need to add an additional
* reference to the buffer itself.
@@ -924,7 +953,7 @@ AcpiExOpcode_1A_0T_1R (
ReturnDesc->Integer.Value =
TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
break;
-
+
case ACPI_TYPE_PACKAGE:
@@ -977,7 +1006,6 @@ AcpiExOpcode_1A_0T_1R (
Status = AE_TYPE;
goto Cleanup;
- break;
}
}
break;
@@ -985,7 +1013,7 @@ AcpiExOpcode_1A_0T_1R (
default:
- REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/exoparg2.c
index 719116d..71c946b 100644
--- a/sys/contrib/dev/acpica/exoparg2.c
+++ b/sys/contrib/dev/acpica/exoparg2.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- * $Revision: 98 $
+ * $Revision: 104 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg2")
+ ACPI_MODULE_NAME ("exoparg2")
/*!
@@ -177,7 +177,7 @@ AcpiExOpcode_2A_0T_0R (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the opcode */
@@ -191,39 +191,37 @@ AcpiExOpcode_2A_0T_0R (
Node = (ACPI_NAMESPACE_NODE *) Operand[0];
- /* The node must refer to a device or thermal zone */
+ /* The node must refer to a device or thermal zone or processor */
- if (Node && Operand[1]) /* TBD: is this check necessary? */
+ switch (Node->Type)
{
- switch (Node->Type)
- {
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_THERMAL:
+ case ACPI_TYPE_PROCESSOR:
- /*
- * Dispatch the notify to the appropriate handler
- * NOTE: the request is queued for execution after this method
- * completes. The notify handlers are NOT invoked synchronously
- * from this thread -- because handlers may in turn run other
- * control methods.
- */
- Status = AcpiEvQueueNotifyRequest (Node,
- (UINT32) Operand[1]->Integer.Value);
- break;
+ /*
+ * Dispatch the notify to the appropriate handler
+ * NOTE: the request is queued for execution after this method
+ * completes. The notify handlers are NOT invoked synchronously
+ * from this thread -- because handlers may in turn run other
+ * control methods.
+ */
+ Status = AcpiEvQueueNotifyRequest (Node,
+ (UINT32) Operand[1]->Integer.Value);
+ break;
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
- Node->Type));
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
+ Node->Type));
- Status = AE_AML_OPERAND_TYPE;
- break;
- }
+ Status = AE_AML_OPERAND_TYPE;
+ break;
}
break;
default:
- REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n", WalkState->Opcode));
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n", WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
}
@@ -254,7 +252,7 @@ AcpiExOpcode_2A_2T_1R (
ACPI_STATUS Status;
- FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/*
@@ -291,11 +289,10 @@ AcpiExOpcode_2A_2T_1R (
default:
- REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
- break;
}
@@ -360,7 +357,7 @@ AcpiExOpcode_2A_1T_1R (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/*
@@ -453,7 +450,7 @@ AcpiExOpcode_2A_1T_1R (
case AML_CONCAT_RES_OP: /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
- Status = AE_NOT_IMPLEMENTED;
+ Status = AcpiExConcatTemplate (Operand[0], Operand[1], &ReturnDesc, WalkState);
break;
@@ -540,12 +537,11 @@ AcpiExOpcode_2A_1T_1R (
WalkState->ResultObj = ReturnDesc;
goto Cleanup;
- break;
default:
- REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -605,7 +601,7 @@ AcpiExOpcode_2A_0T_1R (
BOOLEAN LogicalResult = FALSE;
- FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Create the internal return object */
@@ -655,10 +651,9 @@ AcpiExOpcode_2A_0T_1R (
default:
- REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n", WalkState->Opcode));
+ ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n", WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
- break;
}
diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/exoparg3.c
index 5251202..4646fd9 100644
--- a/sys/contrib/dev/acpica/exoparg3.c
+++ b/sys/contrib/dev/acpica/exoparg3.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- * $Revision: 5 $
+ * $Revision: 9 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg3")
+ ACPI_MODULE_NAME ("exoparg3")
/*!
@@ -172,7 +172,7 @@ AcpiExOpcode_3A_0T_0R (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
@@ -207,11 +207,10 @@ AcpiExOpcode_3A_0T_0R (
default:
- REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
- break;
}
@@ -245,7 +244,7 @@ AcpiExOpcode_3A_1T_1R (
UINT32 Length;
- FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
@@ -294,25 +293,23 @@ AcpiExOpcode_3A_1T_1R (
/* Copy the portion requested */
- MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
- Length);
+ ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
+ Length);
/* Set the length of the new String/Buffer */
ReturnDesc->String.Pointer = Buffer;
ReturnDesc->String.Length = Length;
}
-
break;
default:
- REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
- break;
}
/* Store the result in the target */
diff --git a/sys/contrib/dev/acpica/exoparg6.c b/sys/contrib/dev/acpica/exoparg6.c
index 15baa18..b6c0b59 100644
--- a/sys/contrib/dev/acpica/exoparg6.c
+++ b/sys/contrib/dev/acpica/exoparg6.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
- * $Revision: 6 $
+ * $Revision: 10 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exoparg6")
+ ACPI_MODULE_NAME ("exoparg6")
/*!
@@ -257,7 +257,7 @@ AcpiExOpcode_6A_0T_1R (
ACPI_OPERAND_OBJECT *ThisElement;
- FUNCTION_TRACE_STR ("ExOpcode_6A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR ("ExOpcode_6A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
@@ -348,18 +348,16 @@ AcpiExOpcode_6A_0T_1R (
case AML_LOAD_TABLE_OP:
- Status = AE_NOT_IMPLEMENTED;
- goto Cleanup;
+ Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
break;
default:
- REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
+ ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
- break;
}
diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c
index 98660e1..24d73c7 100644
--- a/sys/contrib/dev/acpica/exprep.c
+++ b/sys/contrib/dev/acpica/exprep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 109 $
+ * $Revision: 113 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exprep")
+ ACPI_MODULE_NAME ("exprep")
/*******************************************************************************
@@ -149,12 +149,12 @@ AcpiExDecodeFieldAccess (
UINT32 *ReturnByteAlignment)
{
UINT32 Access;
- UINT16 Length;
+ UINT32 Length;
UINT8 ByteAlignment;
UINT8 BitLength;
- PROC_NAME ("ExDecodeFieldAccess");
+ ACPI_FUNCTION_NAME ("ExDecodeFieldAccess");
Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
@@ -188,7 +188,7 @@ AcpiExDecodeFieldAccess (
{
/* Larger than Qword - just use byte-size chunks */
- BitLength = 8;
+ BitLength = 8;
}
break;
@@ -274,14 +274,8 @@ AcpiExPrepCommonFieldObject (
UINT32 NearestByteAddress;
- FUNCTION_TRACE ("ExPrepCommonFieldObject");
-
+ ACPI_FUNCTION_TRACE ("ExPrepCommonFieldObject");
- if (FieldBitLength > ACPI_UINT16_MAX)
- {
- REPORT_ERROR (("Field size too long (> 0xFFFF), not supported\n"));
- return_ACPI_STATUS (AE_SUPPORT);
- }
/*
* Note: the structure being initialized is the
@@ -290,20 +284,20 @@ AcpiExPrepCommonFieldObject (
*/
ObjDesc->CommonField.FieldFlags = FieldFlags;
ObjDesc->CommonField.Attribute = FieldAttribute;
- ObjDesc->CommonField.BitLength = (UINT16) FieldBitLength;
+ ObjDesc->CommonField.BitLength = FieldBitLength;
/*
* Decode the access type so we can compute offsets. The access type gives
* two pieces of information - the width of each field access and the
- * necessary ByteAlignment (address granularity) of the access.
- *
+ * necessary ByteAlignment (address granularity) of the access.
+ *
* For AnyAcc, the AccessBitWidth is the largest width that is both necessary
* and possible in an attempt to access the whole field in one
- * I/O operation. However, for AnyAcc, the ByteAlignment is always one byte.
- *
+ * I/O operation. However, for AnyAcc, the ByteAlignment is always one byte.
+ *
* For all Buffer Fields, the ByteAlignment is always one byte.
*
- * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is the
+ * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is the
* same (equivalent) as the ByteAlignment.
*/
AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags, &ByteAlignment);
@@ -314,8 +308,7 @@ AcpiExPrepCommonFieldObject (
/* Setup width (access granularity) fields */
- ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth; /* 8, 16, 32, 64 */
- ObjDesc->CommonField.AccessByteWidth = (UINT8) DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
+ ObjDesc->CommonField.AccessByteWidth = (UINT8) ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
/*
* BaseByteOffset is the address of the start of the field within the region. It is
@@ -324,14 +317,14 @@ AcpiExPrepCommonFieldObject (
* Note: ByteAlignment is always either equal to the AccessBitWidth or 8 (Byte access),
* and it defines the addressing granularity of the parent region or buffer.
*/
- NearestByteAddress = ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
- ObjDesc->CommonField.BaseByteOffset = ROUND_DOWN (NearestByteAddress, ByteAlignment);
+ NearestByteAddress = ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
+ ObjDesc->CommonField.BaseByteOffset = ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
/*
* StartFieldBitOffset is the offset of the first bit of the field within a field datum.
*/
- ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (FieldBitPosition -
- MUL_8 (ObjDesc->CommonField.BaseByteOffset));
+ ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (FieldBitPosition -
+ ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
/*
* Valid bits -- the number of bits that compose a partial datum,
@@ -388,7 +381,7 @@ AcpiExPrepFieldValue (
ACPI_STATUS Status;
- FUNCTION_TRACE ("ExPrepFieldValue");
+ ACPI_FUNCTION_TRACE ("ExPrepFieldValue");
/* Parameter validation */
@@ -404,7 +397,7 @@ AcpiExPrepFieldValue (
Type = AcpiNsGetType (Info->RegionNode);
if (Type != ACPI_TYPE_REGION)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed Region, found type %X %s\n",
Type, AcpiUtGetTypeName (Type)));
@@ -423,7 +416,7 @@ AcpiExPrepFieldValue (
/* Initialize areas of the object that are common to all fields */
ObjDesc->CommonField.Node = Info->FieldNode;
- Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags,
+ Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags,
Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength);
if (ACPI_FAILURE (Status))
{
@@ -443,10 +436,10 @@ AcpiExPrepFieldValue (
AcpiUtAddReference (ObjDesc->Field.RegionObj);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RegionField: Bitoff=%X Off=%X Gran=%X Region %p\n",
ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
- ObjDesc->Field.AccessBitWidth, ObjDesc->Field.RegionObj));
+ ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
break;
@@ -463,7 +456,7 @@ AcpiExPrepFieldValue (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bank Field: BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n",
ObjDesc->BankField.StartFieldBitOffset, ObjDesc->BankField.BaseByteOffset,
- ObjDesc->Field.AccessBitWidth, ObjDesc->BankField.RegionObj,
+ ObjDesc->Field.AccessByteWidth, ObjDesc->BankField.RegionObj,
ObjDesc->BankField.BankObj));
break;
@@ -473,7 +466,7 @@ AcpiExPrepFieldValue (
ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (Info->RegisterNode);
ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (Info->DataRegisterNode);
ObjDesc->IndexField.Value = (UINT32) (Info->FieldBitPosition /
- ObjDesc->Field.AccessBitWidth);
+ ACPI_MUL_8 (ObjDesc->Field.AccessByteWidth));
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
{
@@ -488,7 +481,7 @@ AcpiExPrepFieldValue (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "IndexField: bitoff=%X off=%X gran=%X Index %p Data %p\n",
ObjDesc->IndexField.StartFieldBitOffset, ObjDesc->IndexField.BaseByteOffset,
- ObjDesc->Field.AccessBitWidth, ObjDesc->IndexField.IndexObj,
+ ObjDesc->Field.AccessByteWidth, ObjDesc->IndexField.IndexObj,
ObjDesc->IndexField.DataObj));
break;
}
@@ -498,10 +491,10 @@ AcpiExPrepFieldValue (
* preserving the current type of that NamedObj.
*/
Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
- (UINT8) AcpiNsGetType (Info->FieldNode));
+ AcpiNsGetType (Info->FieldNode));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set NamedObj %p (%4.4s) val = %p\n",
- Info->FieldNode, (char*)&(Info->FieldNode->Name), ObjDesc));
+ Info->FieldNode, (char *) &(Info->FieldNode->Name), ObjDesc));
/* Remove local reference to the object */
diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c
index ac53967..4e8dedd 100644
--- a/sys/contrib/dev/acpica/exregion.c
+++ b/sys/contrib/dev/acpica/exregion.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
- * $Revision: 64 $
+ * $Revision: 71 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exregion")
+ ACPI_MODULE_NAME ("exregion")
/*******************************************************************************
@@ -163,7 +163,7 @@ AcpiExSystemMemorySpaceHandler (
UINT32 Length;
- FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
+ ACPI_FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
/* Validate and translate the bit width */
@@ -190,7 +190,6 @@ AcpiExSystemMemorySpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid SystemMemory width %d\n",
BitWidth));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- break;
}
@@ -242,7 +241,7 @@ AcpiExSystemMemorySpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
- HIDWORD (Address), LODWORD (Address)));
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Perform the memory read or write */
@@ -250,6 +249,7 @@ AcpiExSystemMemorySpaceHandler (
{
case ACPI_READ:
+ *Value = 0;
switch (BitWidth)
{
case 8:
@@ -257,15 +257,15 @@ AcpiExSystemMemorySpaceHandler (
break;
case 16:
- MOVE_UNALIGNED16_TO_32 (Value, LogicalAddrPtr);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Value, LogicalAddrPtr);
break;
case 32:
- MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr);
+ ACPI_MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr);
break;
case 64:
- MOVE_UNALIGNED64_TO_64 (Value, LogicalAddrPtr);
+ ACPI_MOVE_UNALIGNED64_TO_64 (Value, LogicalAddrPtr);
break;
}
break;
@@ -279,15 +279,15 @@ AcpiExSystemMemorySpaceHandler (
break;
case 16:
- MOVE_UNALIGNED16_TO_16 (LogicalAddrPtr, Value);
+ ACPI_MOVE_UNALIGNED16_TO_16 (LogicalAddrPtr, Value);
break;
case 32:
- MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value);
+ ACPI_MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value);
break;
case 64:
- MOVE_UNALIGNED64_TO_64 (LogicalAddrPtr, Value);
+ ACPI_MOVE_UNALIGNED64_TO_64 (LogicalAddrPtr, Value);
break;
}
break;
@@ -331,12 +331,12 @@ AcpiExSystemIoSpaceHandler (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExSystemIoSpaceHandler");
+ ACPI_FUNCTION_TRACE ("ExSystemIoSpaceHandler");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
- HIDWORD (Address), LODWORD (Address)));
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Decode the function parameter */
@@ -394,7 +394,7 @@ AcpiExPciConfigSpaceHandler (
UINT16 PciRegister;
- FUNCTION_TRACE ("ExPciConfigSpaceHandler");
+ ACPI_FUNCTION_TRACE ("ExPciConfigSpaceHandler");
/*
@@ -410,7 +410,7 @@ AcpiExPciConfigSpaceHandler (
*
*/
PciId = (ACPI_PCI_ID *) RegionContext;
- PciRegister = (UINT16) Address;
+ PciRegister = (UINT16) (ACPI_SIZE) Address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"PciConfig %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
@@ -470,7 +470,7 @@ AcpiExCmosSpaceHandler (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExCmosSpaceHandler");
+ ACPI_FUNCTION_TRACE ("ExCmosSpaceHandler");
return_ACPI_STATUS (Status);
@@ -507,9 +507,70 @@ AcpiExPciBarSpaceHandler (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExPciBarSpaceHandler");
+ ACPI_FUNCTION_TRACE ("ExPciBarSpaceHandler");
+
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDataTableSpaceHandler
+ *
+ * PARAMETERS: Function - Read or Write operation
+ * Address - Where in the space to read or write
+ * BitWidth - Field width in bits (8, 16, or 32)
+ * Value - Pointer to in or out value
+ * HandlerContext - Pointer to Handler's context
+ * RegionContext - Pointer to context specific to the
+ * accessed region
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handler for the Data Table address space (Op Region)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExDataTableSpaceHandler (
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 ByteWidth = ACPI_DIV_8 (BitWidth);
+ UINT32 i;
+ char *LogicalAddrPtr;
+
+
+ ACPI_FUNCTION_TRACE ("ExDataTableSpaceHandler");
+
+
+ LogicalAddrPtr = ACPI_PHYSADDR_TO_PTR (Address);
+
+
+ /* Perform the memory read or write */
+ switch (Function)
+ {
+ case ACPI_READ:
+
+ for (i = 0; i < ByteWidth; i++)
+ {
+ ((char *) Value) [i] = LogicalAddrPtr[i];
+ }
+ break;
+
+ case ACPI_WRITE:
+
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
return_ACPI_STATUS (Status);
}
+
diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c
index 71b56ef..3219f73 100644
--- a/sys/contrib/dev/acpica/exresnte.c
+++ b/sys/contrib/dev/acpica/exresnte.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
- * $Revision: 45 $
+ * $Revision: 49 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,7 +128,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exresnte")
+ ACPI_MODULE_NAME ("exresnte")
/*******************************************************************************
@@ -167,11 +167,11 @@ AcpiExResolveNodeToValue (
ACPI_OPERAND_OBJECT *SourceDesc;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
ACPI_NAMESPACE_NODE *Node;
- ACPI_OBJECT_TYPE8 EntryType;
+ ACPI_OBJECT_TYPE EntryType;
ACPI_INTEGER TempVal;
- FUNCTION_TRACE ("ExResolveNodeToValue");
+ ACPI_FUNCTION_TRACE ("ExResolveNodeToValue");
/*
@@ -310,7 +310,6 @@ AcpiExResolveNodeToValue (
Node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
- break;
/*
diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c
index e2cb52c5..17a0fc7 100644
--- a/sys/contrib/dev/acpica/exresolv.c
+++ b/sys/contrib/dev/acpica/exresolv.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
- * $Revision: 103 $
+ * $Revision: 106 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,8 +128,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exresolv")
-
+ ACPI_MODULE_NAME ("exresolv")
/*******************************************************************************
@@ -155,7 +154,7 @@ AcpiExResolveToValue (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
+ ACPI_FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
if (!StackPtr || !*StackPtr)
@@ -169,7 +168,7 @@ AcpiExResolveToValue (
* 1) A valid ACPI_OPERAND_OBJECT, or
* 2) A ACPI_NAMESPACE_NODE (NamedObj)
*/
- if (VALID_DESCRIPTOR_TYPE (*StackPtr, ACPI_DESC_TYPE_INTERNAL))
+ if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_INTERNAL)
{
Status = AcpiExResolveObjectToValue (StackPtr, WalkState);
if (ACPI_FAILURE (Status))
@@ -182,7 +181,7 @@ AcpiExResolveToValue (
* Object on the stack may have changed if AcpiExResolveObjectToValue()
* was called (i.e., we can't use an _else_ here.)
*/
- if (VALID_DESCRIPTOR_TYPE (*StackPtr, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED)
{
Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) StackPtr,
WalkState);
@@ -224,7 +223,7 @@ AcpiExResolveObjectToValue (
UINT16 Opcode;
- FUNCTION_TRACE ("ExResolveObjectToValue");
+ ACPI_FUNCTION_TRACE ("ExResolveObjectToValue");
StackDesc = *StackPtr;
@@ -397,7 +396,7 @@ AcpiExResolveObjectToValue (
break; /* case INTERNAL_TYPE_REFERENCE */
/*
- * These cases may never happen here, but just in case..
+ * These cases may never happen here, but just in case..
*/
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c
index a9283f2..f513053 100644
--- a/sys/contrib/dev/acpica/exresop.c
+++ b/sys/contrib/dev/acpica/exresop.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 41 $
+ * $Revision: 47 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,7 +128,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exresop")
+ ACPI_MODULE_NAME ("exresop")
/*******************************************************************************
@@ -151,7 +151,7 @@ AcpiExCheckObjectType (
ACPI_OBJECT_TYPE ThisType,
void *Object)
{
- PROC_NAME ("ExCheckObjectType");
+ ACPI_FUNCTION_NAME ("ExCheckObjectType");
if (TypeNeeded == ACPI_TYPE_ANY)
@@ -179,18 +179,21 @@ AcpiExCheckObjectType (
*
* FUNCTION: AcpiExResolveOperands
*
- * PARAMETERS: Opcode Opcode being interpreted
- * StackPtr Top of operand stack
+ * PARAMETERS: Opcode - Opcode being interpreted
+ * StackPtr - Pointer to the operand stack to be
+ * resolved
+ * WalkState - Current stateu
*
* RETURN: Status
*
- * DESCRIPTION: Convert stack entries to required types
+ * DESCRIPTION: Convert multiple input operands to the types required by the
+ * target operator.
*
- * Each nibble in ArgTypes represents one required operand
- * and indicates the required Type:
+ * Each nibble (actually 5 bits) in ArgTypes represents one required
+ * operand and indicates the required Type:
*
- * The corresponding stack entry will be converted to the
- * required type if possible, else return an exception
+ * The corresponding operand will be converted to the required type if
+ * possible, otherwise we abort with an exception.
*
******************************************************************************/
@@ -210,7 +213,7 @@ AcpiExResolveOperands (
ACPI_OBJECT_TYPE TypeNeeded;
- FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
+ ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
@@ -219,7 +222,6 @@ AcpiExResolveOperands (
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
-
ArgTypes = OpInfo->RuntimeArgs;
if (ArgTypes == ARGI_INVALID_OPCODE)
{
@@ -232,7 +234,6 @@ AcpiExResolveOperands (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X OperandTypes=%X \n",
Opcode, ArgTypes));
-
/*
* Normal exit is with (ArgTypes == 0) at end of argument list.
* Function will return an exception from within the loop upon
@@ -256,15 +257,18 @@ AcpiExResolveOperands (
/* Decode the descriptor type */
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
+ case ACPI_DESC_TYPE_NAMED:
+
/* Node */
ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_INTERNAL:
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
- {
/* ACPI internal object */
ObjectType = ObjDesc->Common.Type;
@@ -290,7 +294,6 @@ AcpiExResolveOperands (
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
-
switch (ObjDesc->Reference.Opcode)
{
case AML_ZERO_OP:
@@ -303,28 +306,28 @@ AcpiExResolveOperands (
case AML_LOCAL_OP:
case AML_REVISION_OP:
- DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Reference Opcode: %s\n", OpInfo->Name)));
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Reference Opcode: Unknown [%02x]\n",
ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- break;
}
}
- }
+ break;
+
+
+ default:
- else
- {
/* Invalid descriptor */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad descriptor type %X in Obj %p\n",
- ObjDesc->Common.DataType, ObjDesc));
+ ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -336,25 +339,37 @@ AcpiExResolveOperands (
ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
INCREMENT_ARG_LIST (ArgTypes);
-
/*
* Handle cases where the object does not need to be
* resolved to a value
*/
switch (ThisArgType)
{
+ case ARGI_REF_OR_STRING: /* Can be a String or Reference */
- case ARGI_REFERENCE: /* References */
+ if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_INTERNAL) &&
+ (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
+ {
+ /*
+ * String found - the string references a named object and must be
+ * resolved to a node
+ */
+ goto NextOperand;
+ }
+
+ /* Else not a string - fall through to the normal Reference case below */
+
+ case ARGI_REFERENCE: /* References: */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
- case ARGI_TARGETREF: /* TBD: must implement implicit conversion rules before store */
+ case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
- case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
+ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
/* Need an operand of type INTERNAL_TYPE_REFERENCE */
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) /* direct name ptr OK as-is */
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */
{
goto NextOperand;
}
@@ -366,7 +381,6 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
-
if (AML_NAME_OP == ObjDesc->Reference.Opcode)
{
/*
@@ -377,9 +391,7 @@ AcpiExResolveOperands (
AcpiUtRemoveReference (ObjDesc);
(*StackPtr) = TempNode;
}
-
goto NextOperand;
- break;
case ARGI_ANYTYPE:
@@ -409,7 +421,6 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
-
/*
* Check the resulting object (value) type
*/
@@ -476,7 +487,7 @@ AcpiExResolveOperands (
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
@@ -485,9 +496,7 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
-
goto NextOperand;
- break;
case ARGI_BUFFER:
@@ -501,7 +510,7 @@ AcpiExResolveOperands (
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
@@ -510,9 +519,7 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
-
goto NextOperand;
- break;
case ARGI_STRING:
@@ -526,7 +533,7 @@ AcpiExResolveOperands (
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
@@ -535,87 +542,115 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
-
goto NextOperand;
- break;
case ARGI_COMPUTEDATA:
/* Need an operand of type INTEGER, STRING or BUFFER */
- if ((ACPI_TYPE_INTEGER != (*StackPtr)->Common.Type) &&
- (ACPI_TYPE_STRING != (*StackPtr)->Common.Type) &&
- (ACPI_TYPE_BUFFER != (*StackPtr)->Common.Type))
+ switch ((*StackPtr)->Common.Type)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
goto NextOperand;
- break;
case ARGI_DATAOBJECT:
/*
* ARGI_DATAOBJECT is only used by the SizeOf operator.
+ * Need a buffer, string, package, or Node reference.
*
- * The ACPI specification allows SizeOf to return the size of
- * a Buffer, String or Package. However, the MS ACPI.SYS AML
- * Interpreter also allows an Node reference to return without
- * error with a size of 4.
- */
-
- /* Need a buffer, string, package or Node reference */
-
- if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_STRING) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE) &&
- ((*StackPtr)->Common.Type != INTERNAL_TYPE_REFERENCE))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed [Buf/Str/Pkg/Ref], found [%s] %p\n",
- AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /*
- * If this is a reference, only allow a reference to an Node.
+ * The only reference allowed here is a direct reference to
+ * a namespace node.
*/
if ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE)
{
if (!(*StackPtr)->Reference.Node)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Node Reference], found [%p]\n",
*StackPtr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+
+ /* Get the object attached to the node */
+
+ TempNode = AcpiNsGetAttachedObject ((*StackPtr)->Reference.Node);
+ if (!TempNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Node [%p] has no attached object\n",
+ (*StackPtr)->Reference.Node));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
+ /*
+ * Swap the reference object with the node's object. Must add
+ * a reference to the node object, and remove a reference from
+ * the original reference object.
+ */
+ AcpiUtAddReference (TempNode);
+ AcpiUtRemoveReference (*StackPtr);
+ (*StackPtr) = TempNode;
+ }
+
+ /* Need a buffer, string, package */
+
+ switch ((*StackPtr)->Common.Type)
+ {
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Buf/Str/Pkg], found [%s] %p\n",
+ AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
goto NextOperand;
- break;
case ARGI_COMPLEXOBJ:
/* Need a buffer or package or (ACPI 2.0) String */
- if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_STRING) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE))
+ switch ((*StackPtr)->Common.Type)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed [Buf/Pkg], found [%s] %p\n",
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed [Buf/Str/Pkg], found [%s] %p\n",
AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
goto NextOperand;
- break;
default:
@@ -629,7 +664,6 @@ AcpiExResolveOperands (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Make sure that the original object was resolved to the
* required object type (Simple cases only).
@@ -641,7 +675,6 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
-
NextOperand:
/*
* If more operands needed, decrement StackPtr to point
@@ -654,7 +687,6 @@ NextOperand:
} /* while (*Types) */
-
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c
index a49e29c..9b09a38 100644
--- a/sys/contrib/dev/acpica/exstore.c
+++ b/sys/contrib/dev/acpica/exstore.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 154 $
+ * $Revision: 162 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exstore")
+ ACPI_MODULE_NAME ("exstore")
/*******************************************************************************
@@ -145,7 +145,7 @@
* DESCRIPTION: Store the value described by SourceDesc into the location
* described by DestDesc. Called by various interpreter
* functions to store the result of an operation into
- * the destination operand -- not just simply the actual STORE
+ * the destination operand -- not just simply the actual "Store"
* ASL operator.
*
******************************************************************************/
@@ -160,20 +160,20 @@ AcpiExStore (
ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
- FUNCTION_TRACE_PTR ("ExStore", DestDesc);
+ ACPI_FUNCTION_TRACE_PTR ("ExStore", DestDesc);
/* Validate parameters */
if (!SourceDesc || !DestDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/* DestDesc can be either a namespace node or an ACPI object */
- if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED)
{
/*
* Dest is a namespace node,
@@ -182,8 +182,6 @@ AcpiExStore (
Status = AcpiExStoreObjectToNode (SourceDesc,
(ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
- /* All done, that's it */
-
return_ACPI_STATUS (Status);
}
@@ -196,9 +194,9 @@ AcpiExStore (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Destination is not a ReferenceObj [%p]\n", DestDesc));
- DUMP_STACK_ENTRY (SourceDesc);
- DUMP_STACK_ENTRY (DestDesc);
- DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "ExStore",
+ ACPI_DUMP_STACK_ENTRY (SourceDesc);
+ ACPI_DUMP_STACK_ENTRY (DestDesc);
+ ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore",
2, "Target is not a ReferenceObj");
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -257,15 +255,16 @@ AcpiExStore (
{
case ACPI_TYPE_INTEGER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X (%d)\n",
- (UINT32) SourceDesc->Integer.Value, (UINT32) SourceDesc->Integer.Value));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
+ ACPI_HIWORD (SourceDesc->Integer.Value),
+ ACPI_LOWORD (SourceDesc->Integer.Value)));
break;
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%X\n",
- (UINT32) SourceDesc->Buffer.Length));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length %.2X\n",
+ (UINT32) SourceDesc->Buffer.Length));
break;
@@ -277,14 +276,15 @@ AcpiExStore (
case ACPI_TYPE_PACKAGE:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements - 0x%X\n",
- (UINT32) SourceDesc->Package.Elements));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements Ptr - %p\n",
+ SourceDesc->Package.Elements));
break;
default:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "@0x%p\n", SourceDesc));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n",
+ AcpiUtGetTypeName (SourceDesc->Common.Type), SourceDesc));
break;
}
@@ -298,7 +298,7 @@ AcpiExStore (
case AML_REVISION_OP:
/*
- * Storing to a constant is a no-op according to the ACPI
+ * Storing to a constant is a no-op according to the ACPI
* Specification. (Delete the reference descriptor, however.)
*/
break;
@@ -308,7 +308,7 @@ AcpiExStore (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %02x\n",
RefDesc->Reference.Opcode));
- DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
+ ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
Status = AE_AML_INTERNAL;
break;
@@ -336,22 +336,23 @@ AcpiExStore (
ACPI_STATUS
AcpiExStoreObjectToIndex (
ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_OPERAND_OBJECT *IndexDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *NewDesc;
UINT8 Value = 0;
- FUNCTION_TRACE ("ExStoreObjectToIndex");
+ ACPI_FUNCTION_TRACE ("ExStoreObjectToIndex");
/*
* Destination must be a reference pointer, and
* must point to either a buffer or a package
*/
- switch (DestDesc->Reference.TargetType)
+ switch (IndexDesc->Reference.TargetType)
{
case ACPI_TYPE_PACKAGE:
/*
@@ -360,86 +361,31 @@ AcpiExStoreObjectToIndex (
* source is copied into the destination - we can't just point to the
* source object.
*/
- if (DestDesc->Reference.TargetType == ACPI_TYPE_PACKAGE)
+ /*
+ * The object at *(IndexDesc->Reference.Where) is the
+ * element within the package that is to be modified.
+ */
+ ObjDesc = *(IndexDesc->Reference.Where);
+
+ /* Do the conversion/store */
+
+ Status = AcpiExStoreObjectToObject (SourceDesc, ObjDesc, &NewDesc,
+ WalkState);
+ if (ACPI_FAILURE (Status))
{
- /*
- * The object at *(DestDesc->Reference.Where) is the
- * element within the package that is to be modified.
- */
- ObjDesc = *(DestDesc->Reference.Where);
- if (ObjDesc)
- {
- /*
- * If the Destination element is a package, we will delete
- * that object and construct a new one.
- *
- * TBD: [Investigate] Should both the src and dest be required
- * to be packages?
- * && (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE)
- */
- if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
- {
- /* Take away the reference for being part of a package */
-
- AcpiUtRemoveReference (ObjDesc);
- ObjDesc = NULL;
- }
- }
-
- if (!ObjDesc)
- {
- /*
- * If the ObjDesc is NULL, it means that an uninitialized
- * package element has been used as a destination (this is OK),
- * therefore, we must create the destination element to match
- * the type of the source element NOTE: SourceDesc can be of
- * any type.
- */
- ObjDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * If the source is a package, copy the source to the new dest
- */
- if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
- {
- Status = AcpiUtCopyIpackageToIpackage (SourceDesc, ObjDesc,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtRemoveReference (ObjDesc);
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Install the new descriptor into the package */
-
- *(DestDesc->Reference.Where) = ObjDesc;
- }
-
- if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type)
- {
- /*
- * The destination element is not a package, so we need to
- * convert the contents of the source (SourceDesc) and copy into
- * the destination (ObjDesc)
- */
- Status = AcpiExStoreObjectToObject (SourceDesc, ObjDesc,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- /*
- * An error occurrered when copying the internal object
- * so delete the reference.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unable to copy the internal object\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not store object to indexed package element\n"));
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * If a new object was created, we must install it as the new
+ * package element
+ */
+ if (NewDesc != ObjDesc)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ *(IndexDesc->Reference.Where) = NewDesc;
}
break;
@@ -447,7 +393,7 @@ AcpiExStoreObjectToIndex (
case ACPI_TYPE_BUFFER_FIELD:
/*
- * Store into a Buffer (not actually a real BufferField) at a
+ * Store into a Buffer (not actually a real BufferField) at a
* location defined by an Index.
*
* The first 8-bit element of the source object is written to the
@@ -458,7 +404,7 @@ AcpiExStoreObjectToIndex (
/*
* Make sure the target is a Buffer
*/
- ObjDesc = DestDesc->Reference.Object;
+ ObjDesc = IndexDesc->Reference.Object;
if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER)
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -495,17 +441,16 @@ AcpiExStoreObjectToIndex (
"Source must be Integer/Buffer/String type, not %s\n",
AcpiUtGetTypeName (SourceDesc->Common.Type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- break;
}
/* Store the source value into the target buffer byte */
- ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
+ ObjDesc->Buffer.Pointer[IndexDesc->Reference.Offset] = Value;
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target is not a Package or BufferField\n"));
Status = AE_AML_OPERAND_TYPE;
break;
@@ -548,10 +493,11 @@ AcpiExStoreObjectToNode (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TargetDesc;
- ACPI_OBJECT_TYPE8 TargetType = ACPI_TYPE_ANY;
+ ACPI_OPERAND_OBJECT *NewDesc;
+ ACPI_OBJECT_TYPE TargetType;
- FUNCTION_TRACE ("ExStoreObjectToNode");
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToNode", SourceDesc);
/*
@@ -561,8 +507,8 @@ AcpiExStoreObjectToNode (
TargetDesc = AcpiNsGetAttachedObject (Node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n",
- Node, AcpiUtGetTypeName (SourceDesc->Common.Type),
- SourceDesc, AcpiUtGetTypeName (TargetType)));
+ SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
+ Node, AcpiUtGetTypeName (TargetType)));
/*
* Resolve the source object to an actual value
@@ -601,24 +547,26 @@ AcpiExStoreObjectToNode (
*
* Copy and/or convert the source object to a new target object
*/
- Status = AcpiExStoreObject (SourceDesc, TargetType, &TargetDesc,
- WalkState);
+ Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc, &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /*
- * Store the new TargetDesc as the new value of the Name, and set
- * the Name's type to that of the value being stored in it.
- * SourceDesc reference count is incremented by AttachObject.
- */
- Status = AcpiNsAttachObject (Node, TargetDesc, TargetType);
+ if (NewDesc != TargetDesc)
+ {
+ /*
+ * Store the new NewDesc as the new value of the Name, and set
+ * the Name's type to that of the value being stored in it.
+ * SourceDesc reference count is incremented by AttachObject.
+ */
+ Status = AcpiNsAttachObject (Node, NewDesc, TargetType);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Store %s into %s via Convert/Attach\n",
- AcpiUtGetTypeName (TargetDesc->Common.Type),
- AcpiUtGetTypeName (TargetType)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Store %s into %s via Convert/Attach\n",
+ AcpiUtGetTypeName (SourceDesc->Common.Type),
+ AcpiUtGetTypeName (NewDesc->Common.Type)));
+ }
break;
@@ -638,84 +586,3 @@ AcpiExStoreObjectToNode (
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiExStoreObjectToObject
- *
- * PARAMETERS: SourceDesc - Value to be stored
- * DestDesc - Object to receive the value
- * WalkState - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store an object to another object.
- *
- * The Assignment of an object to another (not named) object
- * is handled here.
- * The val passed in will replace the current value (if any)
- * with the input value.
- *
- * When storing into an object the data is converted to the
- * target object type then stored in the object. This means
- * that the target object type (for an initialized target) will
- * not be changed by a store operation.
- *
- * This module allows destination types of Number, String,
- * and Buffer.
- *
- * Assumes parameters are already validated.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExStoreObjectToObject (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OBJECT_TYPE8 DestinationType = DestDesc->Common.Type;
-
-
- FUNCTION_TRACE ("ExStoreObjectToObject");
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) to %p(%s)\n",
- SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
- DestDesc, AcpiUtGetTypeName (DestDesc->Common.Type)));
-
-
- /*
- * From this interface, we only support Integers/Strings/Buffers
- */
- switch (DestinationType)
- {
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- break;
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into %s not implemented\n",
- AcpiUtGetTypeName (DestDesc->Common.Type)));
-
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
- /*
- * Resolve the source object to an actual value
- * (If it is a reference object)
- */
- Status = AcpiExResolveObject (&SourceDesc, DestinationType, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Copy and/or convert the source object to the destination object
- */
- Status = AcpiExStoreObject (SourceDesc, DestinationType, &DestDesc,
- WalkState);
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c
index e82934a..f9232f0 100644
--- a/sys/contrib/dev/acpica/exstoren.c
+++ b/sys/contrib/dev/acpica/exstoren.c
@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
- * $Revision: 41 $
+ * $Revision: 46 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,7 +128,7 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exstoren")
+ ACPI_MODULE_NAME ("exstoren")
/*******************************************************************************
@@ -149,14 +149,14 @@
ACPI_STATUS
AcpiExResolveObject (
ACPI_OPERAND_OBJECT **SourceDescPtr,
- ACPI_OBJECT_TYPE8 TargetType,
+ ACPI_OBJECT_TYPE TargetType,
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr;
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExResolveObject");
+ ACPI_FUNCTION_TRACE ("ExResolveObject");
/*
@@ -177,39 +177,37 @@ AcpiExResolveObject (
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
- /*
+ /*
* Stores into a Field/Region or into a Integer/Buffer/String
- * are all essentially the same. This case handles the
- * "interchangeable" types Integer, String, and Buffer.
+ * are all essentially the same. This case handles the
+ * "interchangeable" types Integer, String, and Buffer.
*/
+ if (SourceDesc->Common.Type == INTERNAL_TYPE_REFERENCE)
+ {
+ /* Resolve a reference object first */
- /* TBD: FIX - check for source==REF, resolve, then check type */
+ Status = AcpiExResolveToValue (SourceDescPtr, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
/*
- * If SourceDesc is not a valid type, try to resolve it to one.
+ * Must have a Integer, Buffer, or String
*/
if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
(SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(SourceDesc->Common.Type != ACPI_TYPE_STRING))
{
/*
- * Initially not a valid type, convert
+ * Conversion successful but still not a valid type
*/
- Status = AcpiExResolveToValue (SourceDescPtr, WalkState);
- if (ACPI_SUCCESS (Status) &&
- (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
- (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
- (SourceDesc->Common.Type != ACPI_TYPE_STRING))
- {
- /*
- * Conversion successful but still not a valid type
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
- AcpiUtGetTypeName ((*SourceDescPtr)->Common.Type),
- AcpiUtGetTypeName (TargetType)));
- Status = AE_AML_OPERAND_TYPE;
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+ AcpiUtGetTypeName (SourceDesc->Common.Type),
+ AcpiUtGetTypeName (TargetType)));
+ Status = AE_AML_OPERAND_TYPE;
}
break;
@@ -240,11 +238,11 @@ AcpiExResolveObject (
/*******************************************************************************
*
- * FUNCTION: AcpiExStoreObject
+ * FUNCTION: AcpiExStoreObjectToObject
*
* PARAMETERS: SourceDesc - Object to store
- * TargetType - Current type of the target
- * TargetDescPtr - Pointer to the target
+ * DestDesc - Object to recieve a copy of the source
+ * NewDesc - New object if DestDesc is obsoleted
* WalkState - Current walk state
*
* RETURN: Status
@@ -254,95 +252,119 @@ AcpiExResolveObject (
* conversion), and a copy of the value of the source to
* the target.
*
+ * The Assignment of an object to another (not named) object
+ * is handled here.
+ * The Source passed in will replace the current value (if any)
+ * with the input value.
+ *
+ * When storing into an object the data is converted to the
+ * target object type then stored in the object. This means
+ * that the target object type (for an initialized target) will
+ * not be changed by a store operation.
+ *
+ * This module allows destination types of Number, String,
+ * Buffer, and Package.
+ *
+ * Assumes parameters are already validated. NOTE: SourceDesc
+ * resolution (from a reference object) must be performed by
+ * the caller if necessary.
+ *
******************************************************************************/
ACPI_STATUS
-AcpiExStoreObject (
+AcpiExStoreObjectToObject (
ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OBJECT_TYPE8 TargetType,
- ACPI_OPERAND_OBJECT **TargetDescPtr,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_OPERAND_OBJECT **NewDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_OPERAND_OBJECT *TargetDesc = *TargetDescPtr;
+ ACPI_OPERAND_OBJECT *ActualSrcDesc;
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExStoreObject");
+ ACPI_FUNCTION_TRACE_PTR ("AcpiExStoreObjectToObject", SourceDesc);
- /*
- * Perform the "implicit conversion" of the source to the current type
- * of the target - As per the ACPI specification.
- *
- * If no conversion performed, SourceDesc is left alone, otherwise it
- * is updated with a new object.
- */
- Status = AcpiExConvertToTargetType (TargetType, &SourceDesc, WalkState);
- if (ACPI_FAILURE (Status))
+ ActualSrcDesc = SourceDesc;
+ if (!DestDesc)
{
+ /*
+ * There is no destination object (An uninitialized node or
+ * package element), so we can simply copy the source object
+ * creating a new destination object
+ */
+ Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, NewDesc, WalkState);
return_ACPI_STATUS (Status);
}
+ if (SourceDesc->Common.Type != DestDesc->Common.Type)
+ {
+ /*
+ * The source type does not match the type of the destination.
+ * Perform the "implicit conversion" of the source to the current type
+ * of the target as per the ACPI specification.
+ *
+ * If no conversion performed, ActualSrcDesc = SourceDesc.
+ * Otherwise, ActualSrcDesc is a temporary object to hold the
+ * converted object.
+ */
+ Status = AcpiExConvertToTargetType (DestDesc->Common.Type, SourceDesc,
+ &ActualSrcDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
/*
* We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object.
*/
- switch (TargetType)
+ switch (DestDesc->Common.Type)
{
- case ACPI_TYPE_ANY:
- case INTERNAL_TYPE_DEF_ANY:
-
- /*
- * The target namespace node is uninitialized (has no target object),
- * and will take on the type of the source object
- */
- *TargetDescPtr = SourceDesc;
- break;
-
-
case ACPI_TYPE_INTEGER:
- TargetDesc->Integer.Value = SourceDesc->Integer.Value;
+ DestDesc->Integer.Value = ActualSrcDesc->Integer.Value;
/* Truncate value if we are executing from a 32-bit ACPI table */
- AcpiExTruncateFor32bitTable (TargetDesc, WalkState);
+ AcpiExTruncateFor32bitTable (DestDesc, WalkState);
break;
case ACPI_TYPE_STRING:
- Status = AcpiExCopyStringToString (SourceDesc, TargetDesc);
+ Status = AcpiExStoreStringToString (ActualSrcDesc, DestDesc);
break;
-
case ACPI_TYPE_BUFFER:
- Status = AcpiExCopyBufferToBuffer (SourceDesc, TargetDesc);
+ Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
break;
-
case ACPI_TYPE_PACKAGE:
- /*
- * TBD: [Unhandled] Not real sure what to do here
- */
- Status = AE_NOT_IMPLEMENTED;
+ Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc, WalkState);
break;
-
default:
-
/*
* All other types come here.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
- AcpiUtGetTypeName (TargetType)));
+ AcpiUtGetTypeName (DestDesc->Common.Type)));
Status = AE_NOT_IMPLEMENTED;
break;
}
+ if (ActualSrcDesc != SourceDesc)
+ {
+ /* Delete the intermediate (temporary) source object */
+
+ AcpiUtRemoveReference (ActualSrcDesc);
+ }
+ *NewDesc = DestDesc;
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c
index 297a154..84d091c 100644
--- a/sys/contrib/dev/acpica/exstorob.c
+++ b/sys/contrib/dev/acpica/exstorob.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
- * $Revision: 37 $
+ * $Revision: 41 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,12 +127,12 @@
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exstorob")
+ ACPI_MODULE_NAME ("exstorob")
/*******************************************************************************
*
- * FUNCTION: AcpiExCopyBufferToBuffer
+ * FUNCTION: AcpiExStoreBufferToBuffer
*
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
@@ -144,7 +144,7 @@
******************************************************************************/
ACPI_STATUS
-AcpiExCopyBufferToBuffer (
+AcpiExStoreBufferToBuffer (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
@@ -152,7 +152,7 @@ AcpiExCopyBufferToBuffer (
UINT8 *Buffer;
- PROC_NAME ("ExCopyBufferToBuffer");
+ ACPI_FUNCTION_NAME ("ExStoreBufferToBuffer");
/*
@@ -184,8 +184,8 @@ AcpiExCopyBufferToBuffer (
{
/* Clear existing buffer and copy in the new one */
- MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
- MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
+ ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
+ ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
}
else
@@ -193,7 +193,7 @@ AcpiExCopyBufferToBuffer (
/*
* Truncate the source, copy only what will fit
*/
- MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
+ ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Truncating src buffer from %X to %X\n",
@@ -206,7 +206,7 @@ AcpiExCopyBufferToBuffer (
/*******************************************************************************
*
- * FUNCTION: AcpiExCopyStringToString
+ * FUNCTION: AcpiExStoreStringToString
*
* PARAMETERS: SourceDesc - Source object to copy
* TargetDesc - Destination object of the copy
@@ -218,7 +218,7 @@ AcpiExCopyBufferToBuffer (
******************************************************************************/
ACPI_STATUS
-AcpiExCopyStringToString (
+AcpiExStoreStringToString (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
@@ -226,7 +226,7 @@ AcpiExCopyStringToString (
UINT8 *Buffer;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -242,8 +242,8 @@ AcpiExCopyStringToString (
{
/* Clear old string and copy in the new one */
- MEMSET (TargetDesc->String.Pointer, 0, TargetDesc->String.Length);
- MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
+ ACPI_MEMSET (TargetDesc->String.Pointer, 0, TargetDesc->String.Length);
+ ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
else
@@ -268,7 +268,7 @@ AcpiExCopyStringToString (
}
TargetDesc->String.Length = Length;
- MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
+ ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
return (AE_OK);
diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c
index df03448..758567b 100644
--- a/sys/contrib/dev/acpica/exsystem.c
+++ b/sys/contrib/dev/acpica/exsystem.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
- * $Revision: 67 $
+ * $Revision: 71 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exsystem")
+ ACPI_MODULE_NAME ("exsystem")
/*******************************************************************************
@@ -148,9 +148,10 @@ AcpiExSystemWaitSemaphore (
UINT32 Timeout)
{
ACPI_STATUS Status;
+ ACPI_STATUS Status2;
- FUNCTION_TRACE ("ExSystemWaitSemaphore");
+ ACPI_FUNCTION_TRACE ("ExSystemWaitSemaphore");
Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
@@ -172,12 +173,12 @@ AcpiExSystemWaitSemaphore (
/* Reacquire the interpreter */
- Status = AcpiExEnterInterpreter ();
- if (ACPI_SUCCESS (Status))
+ Status2 = AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status2))
{
- /* Restore the timeout exception */
+ /* Report fatal error, could not acquire interpreter */
- Status = AE_TIME;
+ return_ACPI_STATUS (Status2);
}
}
@@ -191,17 +192,20 @@ AcpiExSystemWaitSemaphore (
*
* PARAMETERS: HowLong - The amount of time to stall
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Suspend running thread for specified amount of time.
*
******************************************************************************/
-void
+ACPI_STATUS
AcpiExSystemDoStall (
UINT32 HowLong)
{
- FUNCTION_ENTRY ();
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_ENTRY ();
if (HowLong > 1000) /* 1 millisecond */
@@ -214,13 +218,15 @@ AcpiExSystemDoStall (
/* And now we must get the interpreter again */
- AcpiExEnterInterpreter ();
+ Status = AcpiExEnterInterpreter ();
}
else
{
AcpiOsSleep (0, (HowLong / 1000) + 1);
}
+
+ return (Status);
}
@@ -236,12 +242,14 @@ AcpiExSystemDoStall (
*
******************************************************************************/
-void
+ACPI_STATUS
AcpiExSystemDoSuspend (
UINT32 HowLong)
{
+ ACPI_STATUS Status;
- FUNCTION_ENTRY ();
+
+ ACPI_FUNCTION_ENTRY ();
/* Since this thread will sleep, we must release the interpreter */
@@ -253,7 +261,8 @@ AcpiExSystemDoSuspend (
/* And now we must get the interpreter again */
- AcpiExEnterInterpreter ();
+ Status = AcpiExEnterInterpreter ();
+ return (Status);
}
@@ -280,7 +289,7 @@ AcpiExSystemAcquireMutex (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
if (!ObjDesc)
@@ -293,7 +302,7 @@ AcpiExSystemAcquireMutex (
*/
if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
{
- Status = AcpiEvAcquireGlobalLock ();
+ Status = AcpiEvAcquireGlobalLock ((UINT32) TimeDesc->Integer.Value);
return_ACPI_STATUS (Status);
}
@@ -325,7 +334,7 @@ AcpiExSystemReleaseMutex (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExSystemReleaseMutex");
+ ACPI_FUNCTION_TRACE ("ExSystemReleaseMutex");
if (!ObjDesc)
@@ -367,7 +376,7 @@ AcpiExSystemSignalEvent (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExSystemSignalEvent");
+ ACPI_FUNCTION_TRACE ("ExSystemSignalEvent");
if (ObjDesc)
@@ -402,7 +411,7 @@ AcpiExSystemWaitEvent (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("ExSystemWaitEvent");
+ ACPI_FUNCTION_TRACE ("ExSystemWaitEvent");
if (ObjDesc)
@@ -411,7 +420,6 @@ AcpiExSystemWaitEvent (
(UINT32) TimeDesc->Integer.Value);
}
-
return_ACPI_STATUS (Status);
}
@@ -436,7 +444,7 @@ AcpiExSystemResetEvent (
void *TempSemaphore;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c
index 0bf2ff2..740a91a 100644
--- a/sys/contrib/dev/acpica/exutils.c
+++ b/sys/contrib/dev/acpica/exutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 88 $
+ * $Revision: 93 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -142,7 +142,7 @@
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("exutils")
+ ACPI_MODULE_NAME ("exutils")
/*******************************************************************************
@@ -151,7 +151,8 @@
*
* PARAMETERS: None
*
- * DESCRIPTION: Enter the interpreter execution region
+ * DESCRIPTION: Enter the interpreter execution region. Failure to enter
+ * the interpreter region is a fatal system error
*
******************************************************************************/
@@ -160,10 +161,15 @@ AcpiExEnterInterpreter (void)
{
ACPI_STATUS Status;
- FUNCTION_TRACE ("ExEnterInterpreter");
+ ACPI_FUNCTION_TRACE ("ExEnterInterpreter");
Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n"));
+ }
+
return_ACPI_STATUS (Status);
}
@@ -191,10 +197,13 @@ AcpiExEnterInterpreter (void)
void
AcpiExExitInterpreter (void)
{
- FUNCTION_TRACE ("ExExitInterpreter");
+ ACPI_STATUS Status;
+
+ ACPI_FUNCTION_TRACE ("ExExitInterpreter");
- AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
return_VOID;
}
@@ -215,7 +224,7 @@ AcpiExValidateObjectType (
ACPI_OBJECT_TYPE Type)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if ((Type > ACPI_TYPE_MAX && Type < INTERNAL_TYPE_BEGIN) ||
@@ -249,7 +258,7 @@ AcpiExTruncateFor32bitTable (
ACPI_WALK_STATE *WalkState)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -278,7 +287,7 @@ AcpiExTruncateFor32bitTable (
*
* FUNCTION: AcpiExAcquireGlobalLock
*
- * PARAMETERS: FieldFlags - Flags with Lock rule:
+ * PARAMETERS: FieldFlags - Flags with Lock rule:
* AlwaysLock or NeverLock
*
* RETURN: TRUE/FALSE indicating whether the lock was actually acquired
@@ -297,21 +306,20 @@ AcpiExAcquireGlobalLock (
ACPI_STATUS Status;
- FUNCTION_TRACE ("ExAcquireGlobalLock");
+ ACPI_FUNCTION_TRACE ("ExAcquireGlobalLock");
/* Only attempt lock if the AlwaysLock bit is set */
if (FieldFlags & AML_FIELD_LOCK_RULE_MASK)
{
- /* We should attempt to get the lock */
+ /* We should attempt to get the lock, wait forever */
- Status = AcpiEvAcquireGlobalLock ();
+ Status = AcpiEvAcquireGlobalLock (ACPI_UINT32_MAX);
if (ACPI_SUCCESS (Status))
{
Locked = TRUE;
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n",
@@ -341,7 +349,7 @@ AcpiExReleaseGlobalLock (
BOOLEAN LockedByMe)
{
- FUNCTION_TRACE ("ExReleaseGlobalLock");
+ ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
/* Only attempt unlock if the caller locked it */
@@ -353,7 +361,6 @@ AcpiExReleaseGlobalLock (
AcpiEvReleaseGlobalLock ();
}
-
return_ACPI_STATUS (AE_OK);
}
@@ -377,14 +384,13 @@ AcpiExDigitsNeeded (
UINT32 NumDigits = 0;
- FUNCTION_TRACE ("ExDigitsNeeded");
+ ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
if (Base < 1)
{
- REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n"));
+ ACPI_REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n"));
}
-
else
{
/*
@@ -427,7 +433,7 @@ _ntohl (
} In;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
In.Value = Value;
@@ -460,7 +466,7 @@ AcpiExEisaIdToString (
UINT32 id;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* swap to big-endian to get contiguous bits */
@@ -501,7 +507,7 @@ AcpiExUnsignedIntegerToString (
UINT32 Remainder;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
DigitsNeeded = AcpiExDigitsNeeded (Value, 10);
diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c
index 8139430..e73367f 100644
--- a/sys/contrib/dev/acpica/hwacpi.c
+++ b/sys/contrib/dev/acpica/hwacpi.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 47 $
+ * $Revision: 53 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwacpi")
+ ACPI_MODULE_NAME ("hwacpi")
/******************************************************************************
@@ -141,96 +141,30 @@ ACPI_STATUS
AcpiHwInitialize (
void)
{
- ACPI_STATUS Status = AE_OK;
- UINT32 Index;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("HwInitialize");
+ ACPI_FUNCTION_TRACE ("HwInitialize");
/* We must have the ACPI tables by the time we get here */
if (!AcpiGbl_FADT)
{
- AcpiGbl_RestoreAcpiChipset = FALSE;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT!\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
-
- /*
- * Save the initial state of the ACPI event enable registers, so
- * we can restore them when we exit. We probably won't exit, though.
- *
- * The location of the PM1aEvtBlk enable registers is defined as the
- * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further
- * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset
- * for the enable registers is always 2 from the base. It is hard
- * coded here. If this changes in the spec, this code will need to
- * be modified. The PM1bEvtBlk behaves as expected.
- */
- AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (
- ACPI_MTX_LOCK, PM1_EN);
-
-
- /*
- * The GPEs behave similarly, except that the length of the register
- * block is not fixed, so the buffer must be allocated with malloc
- */
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
- AcpiGbl_FADT->Gpe0BlkLen)
- {
- /* GPE0 specified in FADT */
-
- AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE (
- DIV_2 (AcpiGbl_FADT->Gpe0BlkLen));
- if (!AcpiGbl_Gpe0EnableRegisterSave)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Save state of GPE0 enable bits */
-
- for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++)
- {
- AcpiGbl_Gpe0EnableRegisterSave[Index] =
- (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index);
- }
- }
-
- else
- {
- AcpiGbl_Gpe0EnableRegisterSave = NULL;
- }
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
- AcpiGbl_FADT->Gpe1BlkLen)
- {
- /* GPE1 defined */
-
- AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE (
- DIV_2 (AcpiGbl_FADT->Gpe1BlkLen));
- if (!AcpiGbl_Gpe1EnableRegisterSave)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* save state of GPE1 enable bits */
-
- for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++)
- {
- AcpiGbl_Gpe1EnableRegisterSave[Index] =
- (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index);
- }
- }
+ /* Sanity check the FADT for valid values */
- else
+ Status = AcpiUtValidateFadt ();
+ if (ACPI_FAILURE (Status))
{
- AcpiGbl_Gpe1EnableRegisterSave = NULL;
+ return_ACPI_STATUS (Status);
}
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
@@ -242,8 +176,7 @@ AcpiHwInitialize (
*
* RETURN: Status
*
- * DESCRIPTION: Transitions the system into the requested mode or does nothing
- * if the system is already in that mode.
+ * DESCRIPTION: Transitions the system into the requested mode.
*
******************************************************************************/
@@ -255,18 +188,17 @@ AcpiHwSetMode (
ACPI_STATUS Status = AE_NO_HARDWARE_RESPONSE;
- FUNCTION_TRACE ("HwSetMode");
+ ACPI_FUNCTION_TRACE ("HwSetMode");
- if (Mode == SYS_MODE_ACPI)
+ if (Mode == ACPI_SYS_MODE_ACPI)
{
/* BIOS should have disabled ALL fixed and GP events */
AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
}
-
- else if (Mode == SYS_MODE_LEGACY)
+ else if (Mode == ACPI_SYS_MODE_LEGACY)
{
/*
* BIOS should clear all fixed status bits and restore fixed event
@@ -308,15 +240,15 @@ UINT32
AcpiHwGetMode (void)
{
- FUNCTION_TRACE ("HwGetMode");
+ ACPI_FUNCTION_TRACE ("HwGetMode");
- if (AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, SCI_EN))
+ if (AcpiHwBitRegisterRead (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_LOCK))
{
- return_VALUE (SYS_MODE_ACPI);
+ return_VALUE (ACPI_SYS_MODE_ACPI);
}
else
{
- return_VALUE (SYS_MODE_LEGACY);
+ return_VALUE (ACPI_SYS_MODE_LEGACY);
}
}
diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c
index adcf65f..b6c71cb 100644
--- a/sys/contrib/dev/acpica/hwgpe.c
+++ b/sys/contrib/dev/acpica/hwgpe.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 35 $
+ * $Revision: 39 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,27 @@
#include "acevents.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwgpe")
+ ACPI_MODULE_NAME ("hwgpe")
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwGetGpeBitMask
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: Gpe register bitmask for this gpe level
+ *
+ * DESCRIPTION: Get the bitmask for this GPE
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiHwGetGpeBitMask (
+ UINT32 GpeNumber)
+{
+ return (AcpiGbl_GpeNumberInfo [AcpiEvGetGpeNumberIndex (GpeNumber)].BitMask);
+}
/******************************************************************************
@@ -145,29 +165,28 @@ AcpiHwEnableGpe (
UINT32 BitMask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+ RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = AcpiHwGetGpeBitMask (GpeNumber);
/*
* Read the current value of the register, set the appropriate bit
* to enable the GPE, and write out the new register.
*/
InByte = 0;
- AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8);
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr,
- (InByte | BitMask), 8);
+ AcpiOsReadPort (AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddr, &InByte, 8);
+ AcpiOsWritePort (AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddr,
+ (InByte | BitMask), 8);
}
+
/******************************************************************************
*
* FUNCTION: AcpiHwEnableGpeForWakeup
@@ -189,25 +208,24 @@ AcpiHwEnableGpeForWakeup (
UINT32 BitMask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+ RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = AcpiHwGetGpeBitMask (GpeNumber);
/*
* Set the bit so we will not disable this when sleeping
*/
- AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable |= BitMask;
+ AcpiGbl_GpeRegisterInfo[RegisterIndex].WakeEnable |= BitMask;
}
+
/******************************************************************************
*
* FUNCTION: AcpiHwDisableGpe
@@ -229,31 +247,30 @@ AcpiHwDisableGpe (
UINT32 BitMask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+ RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = AcpiHwGetGpeBitMask (GpeNumber);
/*
* Read the current value of the register, clear the appropriate bit,
* and write out the new register value to disable the GPE.
*/
InByte = 0;
- AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8);
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr,
+ AcpiOsReadPort (AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddr, &InByte, 8);
+ AcpiOsWritePort (AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddr,
(InByte & ~BitMask), 8);
AcpiHwDisableGpeForWakeup(GpeNumber);
}
+
/******************************************************************************
*
* FUNCTION: AcpiHwDisableGpeForWakeup
@@ -275,25 +292,24 @@ AcpiHwDisableGpeForWakeup (
UINT32 BitMask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+ RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = AcpiHwGetGpeBitMask (GpeNumber);
/*
* Clear the bit so we will disable this when sleeping
*/
- AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable &= ~BitMask;
+ AcpiGbl_GpeRegisterInfo[RegisterIndex].WakeEnable &= ~BitMask;
}
+
/******************************************************************************
*
* FUNCTION: AcpiHwClearGpe
@@ -314,24 +330,22 @@ AcpiHwClearGpe (
UINT32 BitMask;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+ RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = AcpiHwGetGpeBitMask (GpeNumber);
/*
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
- AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, BitMask, 8);
+ AcpiOsWritePort (AcpiGbl_GpeRegisterInfo[RegisterIndex].StatusAddr, BitMask, 8);
}
@@ -355,9 +369,10 @@ AcpiHwGetGpeStatus (
UINT32 InByte = 0;
UINT32 RegisterIndex = 0;
UINT32 BitMask = 0;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!EventStatus)
@@ -367,45 +382,42 @@ AcpiHwGetGpeStatus (
(*EventStatus) = 0;
- /*
- * Translate GPE number to index into global registers array.
- */
- RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+ /* Translate GPE number to index into global registers array. */
- /*
- * Figure out the bit offset for this GPE within the target register.
- */
- BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+ RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
+ GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[RegisterIndex];
+
+ /* Get the register bitmask for this GPE */
+
+ BitMask = AcpiHwGetGpeBitMask (GpeNumber);
+
+ /* GPE Enabled? */
- /*
- * Enabled?:
- */
InByte = 0;
- AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8);
+ AcpiOsReadPort (GpeRegisterInfo->EnableAddr, &InByte, 8);
if (BitMask & InByte)
{
(*EventStatus) |= ACPI_EVENT_FLAG_ENABLED;
}
- /*
- * Enabled for wake?:
- */
- if (BitMask & AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable)
+ /* GPE Enabled for wake? */
+
+ if (BitMask & GpeRegisterInfo->WakeEnable)
{
(*EventStatus) |= ACPI_EVENT_FLAG_WAKE_ENABLED;
}
- /*
- * Set?
- */
+ /* GPE active (set)? */
+
InByte = 0;
- AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, &InByte, 8);
+ AcpiOsReadPort (GpeRegisterInfo->StatusAddr, &InByte, 8);
if (BitMask & InByte)
{
(*EventStatus) |= ACPI_EVENT_FLAG_SET;
}
}
+
/******************************************************************************
*
* FUNCTION: AcpiHwDisableNonWakeupGpes
@@ -416,7 +428,7 @@ AcpiHwGetGpeStatus (
*
* DESCRIPTION: Disable all non-wakeup GPEs
* Call with interrupts disabled. The interrupt handler also
- * modifies AcpiGbl_GpeRegisters[i].Enable, so it should not be
+ * modifies AcpiGbl_GpeRegisterInfo[i].Enable, so it should not be
* given the chance to run until after non-wake GPEs are
* re-enabled.
*
@@ -427,26 +439,32 @@ AcpiHwDisableNonWakeupGpes (
void)
{
UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
- FUNCTION_ENTRY ();
for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
{
+ GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i];
+
/*
* Read the enabled status of all GPEs. We
* will be using it to restore all the GPEs later.
*/
- AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr,
- &AcpiGbl_GpeRegisters[i].Enable, 8);
+ AcpiOsReadPort (GpeRegisterInfo->EnableAddr,
+ &GpeRegisterInfo->Enable, 8);
/*
- * Disable all GPEs but wakeup GPEs.
+ * Disable all GPEs except wakeup GPEs.
*/
- AcpiOsWritePort(AcpiGbl_GpeRegisters[i].EnableAddr,
- AcpiGbl_GpeRegisters[i].WakeEnable, 8);
+ AcpiOsWritePort(GpeRegisterInfo->EnableAddr,
+ GpeRegisterInfo->WakeEnable, 8);
}
}
+
/******************************************************************************
*
* FUNCTION: AcpiHwEnableNonWakeupGpes
@@ -464,16 +482,21 @@ AcpiHwEnableNonWakeupGpes (
void)
{
UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+
+
+ ACPI_FUNCTION_ENTRY ();
- FUNCTION_ENTRY ();
for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
{
+ GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i];
+
/*
* We previously stored the enabled status of all GPEs.
* Blast them back in.
*/
- AcpiOsWritePort(AcpiGbl_GpeRegisters[i].EnableAddr,
- AcpiGbl_GpeRegisters[i].Enable, 8);
+ AcpiOsWritePort(GpeRegisterInfo->EnableAddr,
+ GpeRegisterInfo->Enable, 8);
}
}
diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c
index bc74fbe..40107cc 100644
--- a/sys/contrib/dev/acpica/hwregs.c
+++ b/sys/contrib/dev/acpica/hwregs.c
@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 110 $
+ * $Revision: 120 $
*
******************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,37 +123,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwregs")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiHwGetBitShift
- *
- * PARAMETERS: Mask - Input mask to determine bit shift from.
- * Must have at least 1 bit set.
- *
- * RETURN: Bit location of the lsb of the mask
- *
- * DESCRIPTION: Returns the bit number for the low order bit that's set.
- *
- ******************************************************************************/
-
-UINT32
-AcpiHwGetBitShift (
- UINT32 Mask)
-{
- UINT32 Shift;
-
-
- FUNCTION_TRACE ("HwGetBitShift");
-
-
- for (Shift = 0; ((Mask >> Shift) & 1) == 0; Shift++)
- { ; }
-
- return_VALUE (Shift);
-}
+ ACPI_MODULE_NAME ("hwregs")
/*******************************************************************************
@@ -171,94 +141,87 @@ AcpiHwGetBitShift (
void
AcpiHwClearAcpiStatus (void)
{
- UINT16 GpeLength;
- UINT16 Index;
+ NATIVE_UINT i;
+ NATIVE_UINT GpeBlock;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("HwClearAcpiStatus");
+ ACPI_FUNCTION_TRACE ("HwClearAcpiStatus");
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
- ALL_FIXED_STS_BITS,
+ ACPI_BITMASK_ALL_FIXED_STATUS,
(UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
- AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS);
+ AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ ACPI_BITMASK_ALL_FIXED_STATUS);
+ /* Clear the fixed events */
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
{
AcpiOsWritePort ((ACPI_IO_ADDRESS)
ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address),
- ALL_FIXED_STS_BITS, 16);
+ ACPI_BITMASK_ALL_FIXED_STATUS, 16);
}
- /* now clear the GPE Bits */
+ /* Clear the GPE Bits */
- if (AcpiGbl_FADT->Gpe0BlkLen)
+ for (GpeBlock = 0; GpeBlock < ACPI_MAX_GPE_BLOCKS; GpeBlock++)
{
- GpeLength = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
-
- for (Index = 0; Index < GpeLength; Index++)
+ for (i = 0; i < AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount; i++)
{
- AcpiOsWritePort ((ACPI_IO_ADDRESS) (
- ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + Index),
- 0xFF, 8);
- }
- }
-
- if (AcpiGbl_FADT->Gpe1BlkLen)
- {
- GpeLength = (UINT16) DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
-
- for (Index = 0; Index < GpeLength; Index++)
- {
- AcpiOsWritePort ((ACPI_IO_ADDRESS) (
- ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + Index),
+ AcpiOsWritePort ((ACPI_IO_ADDRESS)
+ (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress + i),
0xFF, 8);
}
}
- AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
return_VOID;
}
/*******************************************************************************
*
- * FUNCTION: AcpiHwObtainSleepTypeRegisterData
+ * FUNCTION: AcpiHwGetSleepTypeData
*
- * PARAMETERS: SleepState - Numeric state requested
- * *Slp_TypA - Pointer to byte to receive SLP_TYPa value
- * *Slp_TypB - Pointer to byte to receive SLP_TYPb value
+ * PARAMETERS: SleepState - Numeric sleep state
+ * *SleepTypeA - Where SLP_TYPa is returned
+ * *SleepTypeB - Where SLP_TYPb is returned
*
* RETURN: Status - ACPI status
*
- * DESCRIPTION: AcpiHwObtainSleepTypeRegisterData() obtains the SLP_TYP and
- * SLP_TYPb values for the sleep state requested.
+ * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
+ * state.
*
******************************************************************************/
ACPI_STATUS
-AcpiHwObtainSleepTypeRegisterData (
+AcpiHwGetSleepTypeData (
UINT8 SleepState,
- UINT8 *Slp_TypA,
- UINT8 *Slp_TypB)
+ UINT8 *SleepTypeA,
+ UINT8 *SleepTypeB)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE ("HwObtainSleepTypeRegisterData");
+ ACPI_FUNCTION_TRACE ("HwGetSleepTypeData");
/*
* Validate parameters
*/
if ((SleepState > ACPI_S_STATES_MAX) ||
- !Slp_TypA || !Slp_TypB)
+ !SleepTypeA || !SleepTypeB)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -275,7 +238,7 @@ AcpiHwObtainSleepTypeRegisterData (
if (!ObjDesc)
{
- REPORT_ERROR (("Missing Sleep State object\n"));
+ ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
return_ACPI_STATUS (AE_NOT_EXIST);
}
@@ -286,7 +249,7 @@ AcpiHwObtainSleepTypeRegisterData (
*/
/* Even though AcpiEvaluateObject resolves package references,
- * NsEvaluate dpesn't. So, we do it here.
+ * NsEvaluate doesn't. So, we do it here.
*/
Status = AcpiUtResolvePackageReferences(ObjDesc);
@@ -294,32 +257,26 @@ AcpiHwObtainSleepTypeRegisterData (
{
/* Must have at least two elements */
- REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
- Status = AE_ERROR;
+ ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
+ Status = AE_AML_NO_OPERAND;
}
-
- else if (((ObjDesc->Package.Elements[0])->Common.Type !=
- ACPI_TYPE_INTEGER) ||
- ((ObjDesc->Package.Elements[1])->Common.Type !=
- ACPI_TYPE_INTEGER))
+ else if (((ObjDesc->Package.Elements[0])->Common.Type != ACPI_TYPE_INTEGER) ||
+ ((ObjDesc->Package.Elements[1])->Common.Type != ACPI_TYPE_INTEGER))
{
/* Must have two */
- REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
- Status = AE_ERROR;
+ ACPI_REPORT_ERROR (("Sleep State package elements are not both of type Number\n"));
+ Status = AE_AML_OPERAND_TYPE;
}
-
else
{
/*
* Valid _Sx_ package size, type, and value
*/
- *Slp_TypA = (UINT8) (ObjDesc->Package.Elements[0])->Integer.Value;
-
- *Slp_TypB = (UINT8) (ObjDesc->Package.Elements[1])->Integer.Value;
+ *SleepTypeA = (UINT8) (ObjDesc->Package.Elements[0])->Integer.Value;
+ *SleepTypeB = (UINT8) (ObjDesc->Package.Elements[1])->Integer.Value;
}
-
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %X\n",
@@ -327,362 +284,231 @@ AcpiHwObtainSleepTypeRegisterData (
}
AcpiUtRemoveReference (ObjDesc);
-
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiHwRegisterBitAccess
+ * FUNCTION: AcpiHwGetRegisterBitMask
+ *
+ * PARAMETERS: RegisterId - index of ACPI Register to access
+ *
+ * RETURN: The bit mask to be used when accessing the register
+ *
+ * DESCRIPTION: Map RegisterId into a register bit mask.
+ *
+ ******************************************************************************/
+
+ACPI_BIT_REGISTER_INFO *
+AcpiHwGetBitRegisterInfo (
+ UINT32 RegisterId)
+{
+ ACPI_FUNCTION_NAME ("HwGetBitRegisterInfo");
+
+
+ if (RegisterId > ACPI_BITREG_MAX)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid BitRegister ID: %X\n", RegisterId));
+ return (NULL);
+ }
+
+ return (&AcpiGbl_BitRegisterInfo[RegisterId]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwBitRegisterRead
*
- * PARAMETERS: ReadWrite - Either ACPI_READ or ACPI_WRITE.
+ * PARAMETERS: RegisterId - index of ACPI Register to access
* UseLock - Lock the hardware
- * RegisterId - index of ACPI Register to access
- * Value - (only used on write) value to write to the
- * Register. Shifted all the way right.
*
- * RETURN: Value written to or read from specified Register. This value
- * is shifted all the way right.
+ * RETURN: Value is read from specified Register. Value returned is
+ * normalized to bit0 (is shifted all the way right)
*
- * DESCRIPTION: Generic ACPI Register read/write function.
+ * DESCRIPTION: ACPI BitRegister read function.
*
******************************************************************************/
UINT32
-AcpiHwRegisterBitAccess (
- NATIVE_UINT ReadWrite,
- BOOLEAN UseLock,
+AcpiHwBitRegisterRead (
UINT32 RegisterId,
- ...) /* Value (only used on write) */
+ UINT32 Flags)
{
UINT32 RegisterValue = 0;
- UINT32 Mask = 0;
- UINT32 Value = 0;
- va_list marker;
+ ACPI_BIT_REGISTER_INFO *BitRegInfo;
- FUNCTION_TRACE ("HwRegisterBitAccess");
+ ACPI_FUNCTION_TRACE ("HwBitRegisterRead");
- if (ReadWrite == ACPI_WRITE)
+ if (Flags & ACPI_MTX_LOCK)
{
- va_start (marker, RegisterId);
- Value = va_arg (marker, UINT32);
- va_end (marker);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE)))
+ {
+ return_VALUE (0);
+ }
}
- if (ACPI_MTX_LOCK == UseLock)
+ /* Get the info structure corresponding to the requested ACPI Register */
+
+ BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
+ if (!BitRegInfo)
{
- AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /*
- * Decode the Register ID
- * Register id = Register block id | bit id
- *
- * Check bit id to fine locate Register offset.
- * Check Mask to determine Register offset, and then read-write.
- */
- switch (REGISTER_BLOCK_ID (RegisterId))
+ RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, BitRegInfo->ParentRegister);
+
+ if (Flags & ACPI_MTX_LOCK)
{
- case PM1_STS:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
- switch (RegisterId)
- {
- case TMR_STS:
- Mask = TMR_STS_MASK;
- break;
+ /* Normalize the value that was read */
- case BM_STS:
- Mask = BM_STS_MASK;
- break;
+ RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition);
- case GBL_STS:
- Mask = GBL_STS_MASK;
- break;
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI RegisterRead: got %X\n", RegisterValue));
+ return_VALUE (RegisterValue);
+}
- case PWRBTN_STS:
- Mask = PWRBTN_STS_MASK;
- break;
- case SLPBTN_STS:
- Mask = SLPBTN_STS_MASK;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwBitRegisterWrite
+ *
+ * PARAMETERS: RegisterId - ID of ACPI BitRegister to access
+ * Value - (only used on write) value to write to the
+ * Register, NOT pre-normalized to the bit pos.
+ * Flags - Lock the hardware or not
+ *
+ * RETURN: Value written to from specified Register. This value
+ * is shifted all the way right.
+ *
+ * DESCRIPTION: ACPI Bit Register write function.
+ *
+ ******************************************************************************/
- case RTC_STS:
- Mask = RTC_STS_MASK;
- break;
+UINT32
+AcpiHwBitRegisterWrite (
+ UINT32 RegisterId,
+ UINT32 Value,
+ UINT32 Flags)
+{
+ UINT32 RegisterValue = 0;
+ ACPI_BIT_REGISTER_INFO *BitRegInfo;
- case WAK_STS:
- Mask = WAK_STS_MASK;
- break;
- default:
- Mask = 0;
- break;
- }
+ ACPI_FUNCTION_TRACE_U32 ("HwBitRegisterWrite", RegisterId);
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_STS);
- if (ReadWrite == ACPI_WRITE)
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE)))
{
- /*
- * Status Registers are different from the rest. Clear by
- * writing 1, writing 0 has no effect. So, the only relevent
- * information is the single bit we're interested in, all
- * others should be written as 0 so they will be left
- * unchanged
- */
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
-
- if (Value)
- {
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS,
- (UINT16) Value);
- RegisterValue = 0;
- }
+ return_VALUE (0);
}
+ }
- break;
-
-
- case PM1_EN:
-
- switch (RegisterId)
- {
- case TMR_EN:
- Mask = TMR_EN_MASK;
- break;
+ /* Get the info structure corresponding to the requested ACPI Register */
- case GBL_EN:
- Mask = GBL_EN_MASK;
- break;
+ BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
+ if (!BitRegInfo)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- case PWRBTN_EN:
- Mask = PWRBTN_EN_MASK;
- break;
+ /* Always do a register read first so we can insert the new bits */
- case SLPBTN_EN:
- Mask = SLPBTN_EN_MASK;
- break;
+ RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, BitRegInfo->ParentRegister);
- case RTC_EN:
- Mask = RTC_EN_MASK;
- break;
+ /*
+ * Decode the Register ID
+ * Register id = Register block id | bit id
+ *
+ * Check bit id to fine locate Register offset.
+ * Check Mask to determine Register offset, and then read-write.
+ */
+ switch (BitRegInfo->ParentRegister)
+ {
+ case ACPI_REGISTER_PM1_STATUS:
- default:
- Mask = 0;
- break;
+ /*
+ * Status Registers are different from the rest. Clear by
+ * writing 1, writing 0 has no effect. So, the only relevent
+ * information is the single bit we're interested in, all others should
+ * be written as 0 so they will be left unchanged
+ */
+ Value = ACPI_REGISTER_PREPARE_BITS (Value, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask);
+ if (Value)
+ {
+ AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ (UINT16) Value);
+ RegisterValue = 0;
}
+ break;
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_EN);
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
+ case ACPI_REGISTER_PM1_ENABLE:
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_EN, (UINT16) RegisterValue);
- }
+ ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value);
+ AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
break;
- case PM1_CONTROL:
-
- switch (RegisterId)
- {
- case SCI_EN:
- Mask = SCI_EN_MASK;
- break;
-
- case BM_RLD:
- Mask = BM_RLD_MASK;
- break;
-
- case GBL_RLS:
- Mask = GBL_RLS_MASK;
- break;
-
- case SLP_TYPE_A:
- case SLP_TYPE_B:
- Mask = SLP_TYPE_X_MASK;
- break;
-
- case SLP_EN:
- Mask = SLP_EN_MASK;
- break;
-
- default:
- Mask = 0;
- break;
- }
-
+ case ACPI_REGISTER_PM1_CONTROL:
/*
* Read the PM1 Control register.
* Note that at this level, the fact that there are actually TWO
- * registers (A and B) and that B may not exist, are abstracted.
+ * registers (A and B - and that B may not exist) is abstracted.
*/
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM1_CONTROL);
-
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", RegisterValue));
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- /*
- * SLP_TYPE_x Registers are written differently
- * than any other control Registers with
- * respect to A and B Registers. The value
- * for A may be different than the value for B
- *
- * Therefore, pass the RegisterId, not just generic PM1_CONTROL,
- * because we need to do different things. Yuck.
- */
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId,
- (UINT16) RegisterValue);
- }
- break;
-
+ ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value);
- case PM2_CONTROL:
+ AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId,
+ (UINT16) RegisterValue);
+ break;
- switch (RegisterId)
- {
- case ARB_DIS:
- Mask = ARB_DIS_MASK;
- break;
- default:
- Mask = 0;
- break;
- }
+ case ACPI_REGISTER_PM2_CONTROL:
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL);
+ RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
- RegisterValue, HIDWORD(AcpiGbl_FADT->XPm2CntBlk.Address),
- LODWORD(AcpiGbl_FADT->XPm2CntBlk.Address)));
-
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
- RegisterValue,
- HIDWORD(AcpiGbl_FADT->XPm2CntBlk.Address),
- LODWORD(AcpiGbl_FADT->XPm2CntBlk.Address)));
-
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- PM2_CONTROL, (UINT8) (RegisterValue));
- }
- break;
+ RegisterValue, ACPI_HIDWORD (AcpiGbl_FADT->XPm2CntBlk.Address),
+ ACPI_LODWORD (AcpiGbl_FADT->XPm2CntBlk.Address)));
+ ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value);
- case PM_TIMER:
-
- Mask = TMR_VAL_MASK;
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
- PM_TIMER);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM_TIMER: Read %X from %8.8X%8.8X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
RegisterValue,
- HIDWORD(AcpiGbl_FADT->XPmTmrBlk.Address),
- LODWORD(AcpiGbl_FADT->XPmTmrBlk.Address)));
-
- break;
-
-
- case GPE1_EN_BLOCK:
- case GPE1_STS_BLOCK:
- case GPE0_EN_BLOCK:
- case GPE0_STS_BLOCK:
-
- /* Determine the bit to be accessed
- *
- * (UINT32) RegisterId:
- * 31 24 16 8 0
- * +--------+--------+--------+--------+
- * | gpe_block_id | gpe_bit_number |
- * +--------+--------+--------+--------+
- *
- * gpe_block_id is one of GPE[01]_EN_BLOCK and GPE[01]_STS_BLOCK
- * gpe_bit_number is relative from the gpe_block (0x00~0xFF)
- */
- Mask = REGISTER_BIT_ID(RegisterId); /* gpe_bit_number */
- RegisterId = REGISTER_BLOCK_ID(RegisterId) | (Mask >> 3);
- Mask = AcpiGbl_DecodeTo8bit [Mask % 8];
-
- /*
- * The base address of the GPE 0 Register Block
- * Plus 1/2 the length of the GPE 0 Register Block
- * The enable Register is the Register following the Status Register
- * and each Register is defined as 1/2 of the total Register Block
- */
-
- /*
- * This sets the bit within EnableBit that needs to be written to
- * the Register indicated in Mask to a 1, all others are 0
- */
-
- /* Now get the current Enable Bits in the selected Reg */
-
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, RegisterId);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "GPE Enable bits: Read %X from %X\n",
- RegisterValue, RegisterId));
+ ACPI_HIDWORD (AcpiGbl_FADT->XPm2CntBlk.Address),
+ ACPI_LODWORD (AcpiGbl_FADT->XPm2CntBlk.Address)));
- if (ReadWrite == ACPI_WRITE)
- {
- RegisterValue &= ~Mask;
- Value <<= AcpiHwGetBitShift (Mask);
- Value &= Mask;
- RegisterValue |= Value;
-
- /*
- * This write will put the Action state into the General Purpose
- * Enable Register indexed by the value in Mask
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
- RegisterValue, RegisterId));
- AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId,
- (UINT8) RegisterValue);
- RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
- RegisterId);
- }
+ AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
break;
- case SMI_CMD_BLOCK:
- case PROCESSOR_BLOCK:
-
- /* Not used by any callers at this time - therefore, not implemented */
-
default:
-
- Mask = 0;
break;
}
- if (ACPI_MTX_LOCK == UseLock) {
- AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
}
+ /* Normalize the value that was read */
- RegisterValue &= Mask;
- RegisterValue >>= AcpiHwGetBitShift (Mask);
+ RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition);
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Register I/O: returning %X\n", RegisterValue));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI RegisterWrite actual %X\n", RegisterValue));
return_VALUE (RegisterValue);
}
@@ -710,81 +536,53 @@ AcpiHwRegisterRead (
UINT32 BankOffset;
- FUNCTION_TRACE ("HwRegisterRead");
+ ACPI_FUNCTION_TRACE ("HwRegisterRead");
if (ACPI_MTX_LOCK == UseLock)
{
- AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE)))
+ {
+ return_VALUE (0);
+ }
}
-
- switch (REGISTER_BLOCK_ID(RegisterId))
+ switch (RegisterId)
{
- case PM1_STS: /* 16-bit access */
+ case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aEvtBlk, 0);
Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bEvtBlk, 0);
break;
- case PM1_EN: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
- BankOffset = DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
+ BankOffset = ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset);
Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset);
break;
- case PM1_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aCntBlk, 0);
Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bCntBlk, 0);
break;
- case PM2_CONTROL: /* 8-bit access */
+ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XPm2CntBlk, 0);
break;
- case PM_TIMER: /* 32-bit access */
+ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
Value = AcpiHwLowLevelRead (32, &AcpiGbl_FADT->XPmTmrBlk, 0);
break;
-
- /*
- * For the GPE? Blocks, the lower word of RegisterId contains the
- * byte offset for which to read, as each part of each block may be
- * several bytes long.
- */
- case GPE0_STS_BLOCK: /* 8-bit access */
-
- BankOffset = REGISTER_BIT_ID(RegisterId);
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe0Blk, BankOffset);
- break;
-
- case GPE0_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe0BlkLen) + REGISTER_BIT_ID(RegisterId);
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe0Blk, BankOffset);
- break;
-
- case GPE1_STS_BLOCK: /* 8-bit access */
-
- BankOffset = REGISTER_BIT_ID(RegisterId);
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe1Blk, BankOffset);
- break;
-
- case GPE1_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe1BlkLen) + REGISTER_BIT_ID(RegisterId);
- Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XGpe1Blk, BankOffset);
- break;
-
- case SMI_CMD_BLOCK: /* 8bit */
+ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value, 8);
break;
@@ -794,10 +592,9 @@ AcpiHwRegisterRead (
break;
}
-
if (ACPI_MTX_LOCK == UseLock)
{
- AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
}
return_VALUE (Value);
@@ -827,95 +624,68 @@ AcpiHwRegisterWrite (
UINT32 BankOffset;
- FUNCTION_TRACE ("HwRegisterWrite");
+ ACPI_FUNCTION_TRACE ("HwRegisterWrite");
if (ACPI_MTX_LOCK == UseLock)
{
- AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE)))
+ {
+ return_VOID;
+ }
}
-
- switch (REGISTER_BLOCK_ID (RegisterId))
+ switch (RegisterId)
{
- case PM1_STS: /* 16-bit access */
+ case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, 0);
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, 0);
break;
- case PM1_EN: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
- BankOffset = DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
+ BankOffset = ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset);
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset);
break;
- case PM1_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
break;
- case PM1A_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
break;
- case PM1B_CONTROL: /* 16-bit access */
+ case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
break;
- case PM2_CONTROL: /* 8-bit access */
+ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk, 0);
break;
- case PM_TIMER: /* 32-bit access */
+ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk, 0);
break;
- case GPE0_STS_BLOCK: /* 8-bit access */
-
- BankOffset = REGISTER_BIT_ID(RegisterId);
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe0Blk, BankOffset);
- break;
-
-
- case GPE0_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe0BlkLen) + REGISTER_BIT_ID(RegisterId);
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe0Blk, BankOffset);
- break;
-
+ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
- case GPE1_STS_BLOCK: /* 8-bit access */
-
- BankOffset = REGISTER_BIT_ID(RegisterId);
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe1Blk, BankOffset);
- break;
-
-
- case GPE1_EN_BLOCK: /* 8-bit access */
-
- BankOffset = DIV_2 (AcpiGbl_FADT->Gpe1BlkLen) + REGISTER_BIT_ID(RegisterId);
- AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XGpe1Blk, BankOffset);
- break;
-
-
- case SMI_CMD_BLOCK: /* 8bit */
-
- /* For 2.0, SMI_CMD is always in IO space */
- /* TBD: what about 1.0? 0.71? */
+ /* SMI_CMD is currently always in IO space */
AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8);
break;
@@ -926,10 +696,9 @@ AcpiHwRegisterWrite (
break;
}
-
if (ACPI_MTX_LOCK == UseLock)
{
- AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
}
return_VOID;
@@ -963,7 +732,7 @@ AcpiHwLowLevelRead (
UINT16 PciRegister;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -976,7 +745,6 @@ AcpiHwLowLevelRead (
return 0;
}
-
/*
* Three address spaces supported:
* Memory, Io, or PCI config.
@@ -1044,7 +812,7 @@ AcpiHwLowLevelWrite (
UINT16 PciRegister;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -1057,7 +825,6 @@ AcpiHwLowLevelWrite (
return;
}
-
/*
* Three address spaces supported:
* Memory, Io, or PCI config.
diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c
index 8a18138..0db2df6 100644
--- a/sys/contrib/dev/acpica/hwsleep.c
+++ b/sys/contrib/dev/acpica/hwsleep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 25 $
+ * $Revision: 35 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,10 +120,7 @@
#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwsleep")
-
-static UINT8 SleepTypeA;
-static UINT8 SleepTypeB;
+ ACPI_MODULE_NAME ("hwsleep")
/******************************************************************************
@@ -133,7 +130,7 @@ static UINT8 SleepTypeB;
* PARAMETERS: PhysicalAddress - Physical address of ACPI real mode
* entry point.
*
- * RETURN: AE_OK or AE_ERROR
+ * RETURN: Status
*
* DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
*
@@ -144,25 +141,18 @@ AcpiSetFirmwareWakingVector (
ACPI_PHYSICAL_ADDRESS PhysicalAddress)
{
- FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
-
+ ACPI_FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
- /* Make sure that we have an FACS */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
/* Set the vector */
- if (AcpiGbl_FACS->VectorWidth == 32)
+ if (AcpiGbl_CommonFACS.VectorWidth == 32)
{
- * (UINT32 *) AcpiGbl_FACS->FirmwareWakingVector = (UINT32) PhysicalAddress;
+ *(UINT32 *) AcpiGbl_CommonFACS.FirmwareWakingVector = (UINT32) PhysicalAddress;
}
else
{
- *AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
+ *AcpiGbl_CommonFACS.FirmwareWakingVector = PhysicalAddress;
}
return_ACPI_STATUS (AE_OK);
@@ -179,7 +169,7 @@ AcpiSetFirmwareWakingVector (
*
* RETURN: Status
*
- * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
+ * DESCRIPTION: Access function for FirmwareWakingVector field in FACS
*
******************************************************************************/
@@ -188,7 +178,7 @@ AcpiGetFirmwareWakingVector (
ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
{
- FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
+ ACPI_FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
if (!PhysicalAddress)
@@ -196,22 +186,15 @@ AcpiGetFirmwareWakingVector (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Make sure that we have an FACS */
-
- if (!AcpiGbl_FACS)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
/* Get the vector */
- if (AcpiGbl_FACS->VectorWidth == 32)
+ if (AcpiGbl_CommonFACS.VectorWidth == 32)
{
- *PhysicalAddress = * (UINT32 *) AcpiGbl_FACS->FirmwareWakingVector;
+ *PhysicalAddress = *(UINT32 *) AcpiGbl_CommonFACS.FirmwareWakingVector;
}
else
{
- *PhysicalAddress = *AcpiGbl_FACS->FirmwareWakingVector;
+ *PhysicalAddress = *AcpiGbl_CommonFACS.FirmwareWakingVector;
}
return_ACPI_STATUS (AE_OK);
@@ -241,35 +224,46 @@ AcpiEnterSleepStatePrep (
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg;
- FUNCTION_TRACE ("AcpiEnterSleepStatePrep");
+
+ ACPI_FUNCTION_TRACE ("AcpiEnterSleepStatePrep");
+
/*
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
*/
- Status = AcpiHwObtainSleepTypeRegisterData (SleepState, &SleepTypeA, &SleepTypeB);
- if (!ACPI_SUCCESS (Status))
+ Status = AcpiHwGetSleepTypeData (SleepState,
+ &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
+ if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /* run the _PTS and _GTS methods */
+ /* Setup parameter object */
- MEMSET(&ArgList, 0, sizeof(ArgList));
ArgList.Count = 1;
ArgList.Pointer = &Arg;
- MEMSET(&Arg, 0, sizeof(Arg));
Arg.Type = ACPI_TYPE_INTEGER;
Arg.Integer.Value = SleepState;
- AcpiEvaluateObject (NULL, "\\_PTS", &ArgList, NULL);
- AcpiEvaluateObject (NULL, "\\_GTS", &ArgList, NULL);
+ /* Run the _PTS and _GTS methods */
+
+ Status = AcpiEvaluateObject (NULL, "\\_PTS", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiEvaluateObject (NULL, "\\_GTS", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
return_ACPI_STATUS (AE_OK);
}
-
/******************************************************************************
*
* FUNCTION: AcpiEnterSleepState
@@ -285,77 +279,84 @@ AcpiEnterSleepStatePrep (
ACPI_STATUS
AcpiEnterSleepState (
- UINT8 SleepState)
+ UINT8 SleepState)
{
- UINT16 PM1AControl;
- UINT16 PM1BControl;
+ UINT16 PM1AControl;
+ UINT16 PM1BControl;
+ ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
+ ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
- FUNCTION_TRACE ("AcpiEnterSleepState");
+ ACPI_FUNCTION_TRACE ("AcpiEnterSleepState");
- if ((SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
- (SleepTypeB > ACPI_SLEEP_TYPE_MAX))
+
+ if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
+ (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
{
- REPORT_ERROR (("Sleep values out of range: A=%x B=%x\n",
- SleepTypeA, SleepTypeB));
- return_ACPI_STATUS (AE_ERROR);
+ ACPI_REPORT_ERROR (("Sleep values out of range: A=%x B=%x\n",
+ AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
- /* clear wake status */
- AcpiHwRegisterBitAccess (ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1);
+ SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A);
+ SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
+
+ /* Clear wake status */
+ AcpiHwBitRegisterWrite (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
AcpiHwClearAcpiStatus();
- /* disable arbitration here? */
+ /* TBD: Disable arbitration here? */
AcpiHwDisableNonWakeupGpes();
- PM1AControl = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_CONTROL);
+ /* Get current value of PM1A control */
+ PM1AControl = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL);
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", SleepState));
- /* mask off SLP_EN and SLP_TYP fields */
+ /* Clear SLP_EN and SLP_TYP fields */
- PM1AControl &= ~(SLP_TYPE_X_MASK | SLP_EN_MASK);
+ PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask);
PM1BControl = PM1AControl;
- /* mask in SLP_TYP */
+ /* Insert SLP_TYP bits */
- PM1AControl |= (SleepTypeA << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
- PM1BControl |= (SleepTypeB << AcpiHwGetBitShift (SLP_TYPE_X_MASK));
+ PM1AControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition);
+ PM1BControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition);
- /* write #1: fill in SLP_TYP data */
+ /* Write #1: fill in SLP_TYP data */
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl);
+ AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
+ AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
- /* mask in SLP_EN */
+ /* Insert SLP_ENABLE bit */
- PM1AControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK));
- PM1BControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK));
+ PM1AControl |= SleepEnableRegInfo->AccessBitMask;
+ PM1BControl |= SleepEnableRegInfo->AccessBitMask;
- /* write #2: SLP_TYP + SLP_EN */
+ /* Write #2: SLP_TYP + SLP_EN */
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl);
+ AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
+ AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
/*
* Wait a second, then try again. This is to get S4/5 to work on all machines.
*/
if (SleepState > ACPI_STATE_S3)
{
- AcpiOsStall(1000000);
+ AcpiOsStall (1000000);
- AcpiHwRegisterWrite (ACPI_MTX_LOCK, PM1_CONTROL,
- (1 << AcpiHwGetBitShift (SLP_EN_MASK)));
+ AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL,
+ SleepEnableRegInfo->AccessBitMask);
}
- /* wait until we enter sleep state */
+ /* Wait until we enter sleep state */
- while (!AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, WAK_STS))
+ while (!AcpiHwBitRegisterRead (ACPI_BITREG_WAKE_STATUS, ACPI_MTX_LOCK))
{
- /* spin until we wake */
+ /* Spin until we wake */
}
return_ACPI_STATUS (AE_OK);
@@ -379,23 +380,37 @@ AcpiLeaveSleepState (
{
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg;
+ ACPI_STATUS Status;
+
+ ACPI_FUNCTION_TRACE ("AcpiLeaveSleepState");
- FUNCTION_TRACE ("AcpiLeaveSleepState");
/* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
- SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
- MEMSET (&ArgList, 0, sizeof(ArgList));
+ AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
+
+ /* Setup parameter object */
+
ArgList.Count = 1;
ArgList.Pointer = &Arg;
- MEMSET (&Arg, 0, sizeof(Arg));
Arg.Type = ACPI_TYPE_INTEGER;
Arg.Integer.Value = SleepState;
- AcpiEvaluateObject (NULL, "\\_BFS", &ArgList, NULL);
- AcpiEvaluateObject (NULL, "\\_WAK", &ArgList, NULL);
+ /* Ignore any errors from these methods */
+
+ Status = AcpiEvaluateObject (NULL, "\\_BFS", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", AcpiFormatException (Status)));
+ }
+
+ Status = AcpiEvaluateObject (NULL, "\\_WAK", &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status)));
+ }
/* _WAK returns stuff - do we want to look at it? */
diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c
index 4a03117..8339b27 100644
--- a/sys/contrib/dev/acpica/hwtimer.c
+++ b/sys/contrib/dev/acpica/hwtimer.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 14 $
+ * $Revision: 19 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,7 +119,7 @@
#include "achware.h"
#define _COMPONENT ACPI_HARDWARE
- MODULE_NAME ("hwtimer")
+ ACPI_MODULE_NAME ("hwtimer")
/******************************************************************************
@@ -138,7 +138,7 @@ ACPI_STATUS
AcpiGetTimerResolution (
UINT32 *Resolution)
{
- FUNCTION_TRACE ("AcpiGetTimerResolution");
+ ACPI_FUNCTION_TRACE ("AcpiGetTimerResolution");
if (!Resolution)
@@ -150,7 +150,6 @@ AcpiGetTimerResolution (
{
*Resolution = 24;
}
-
else
{
*Resolution = 32;
@@ -176,7 +175,7 @@ ACPI_STATUS
AcpiGetTimer (
UINT32 *Ticks)
{
- FUNCTION_TRACE ("AcpiGetTimer");
+ ACPI_FUNCTION_TRACE ("AcpiGetTimer");
if (!Ticks)
@@ -224,13 +223,12 @@ AcpiGetTimerDuration (
UINT32 *TimeElapsed)
{
UINT32 DeltaTicks = 0;
- UINT32 Seconds = 0;
- UINT32 Milliseconds = 0;
- UINT32 Microseconds = 0;
- UINT32 Remainder = 0;
+ UINT64_OVERLAY NormalizedTicks;
+ ACPI_STATUS Status;
+ ACPI_INTEGER OutQuotient;
- FUNCTION_TRACE ("AcpiGetTimerDuration");
+ ACPI_FUNCTION_TRACE ("AcpiGetTimerDuration");
if (!TimeElapsed)
@@ -247,24 +245,21 @@ AcpiGetTimerDuration (
{
DeltaTicks = EndTicks - StartTicks;
}
-
else if (StartTicks > EndTicks)
{
- /* 24-bit Timer */
-
if (0 == AcpiGbl_FADT->TmrValExt)
{
+ /* 24-bit Timer */
+
DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF);
}
-
- /* 32-bit Timer */
-
else
{
+ /* 32-bit Timer */
+
DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
}
}
-
else
{
*TimeElapsed = 0;
@@ -274,49 +269,18 @@ AcpiGetTimerDuration (
/*
* Compute Duration:
* -----------------
- * Since certain compilers (gcc/Linux, argh!) don't support 64-bit
- * divides in kernel-space we have to do some trickery to preserve
- * accuracy while using 32-bit math.
- *
- * TBD: Change to use 64-bit math when supported.
*
- * The process is as follows:
- * 1. Compute the number of seconds by dividing Delta Ticks by
- * the timer frequency.
- * 2. Compute the number of milliseconds in the remainder from step #1
- * by multiplying by 1000 and then dividing by the timer frequency.
- * 3. Compute the number of microseconds in the remainder from step #2
- * by multiplying by 1000 and then dividing by the timer frequency.
- * 4. Add the results from steps 1, 2, and 3 to get the total duration.
+ * Requires a 64-bit divide:
*
- * Example: The time elapsed for DeltaTicks = 0xFFFFFFFF should be
- * 1199864031 microseconds. This is computed as follows:
- * Step #1: Seconds = 1199; Remainder = 3092840
- * Step #2: Milliseconds = 864; Remainder = 113120
- * Step #3: Microseconds = 31; Remainder = <don't care!>
+ * TimeElapsed = (DeltaTicks * 1000000) / PM_TIMER_FREQUENCY;
*/
+ NormalizedTicks.Full = ((UINT64) DeltaTicks) * 1000000;
- /* Step #1 */
+ Status = AcpiUtShortDivide (&NormalizedTicks.Full, PM_TIMER_FREQUENCY,
+ &OutQuotient, NULL);
- Seconds = DeltaTicks / PM_TIMER_FREQUENCY;
- Remainder = DeltaTicks % PM_TIMER_FREQUENCY;
-
- /* Step #2 */
-
- Milliseconds = (Remainder * 1000) / PM_TIMER_FREQUENCY;
- Remainder = (Remainder * 1000) % PM_TIMER_FREQUENCY;
-
- /* Step #3 */
-
- Microseconds = (Remainder * 1000) / PM_TIMER_FREQUENCY;
-
- /* Step #4 */
-
- *TimeElapsed = Seconds * 1000000;
- *TimeElapsed += Milliseconds * 1000;
- *TimeElapsed += Microseconds;
-
- return_ACPI_STATUS (AE_OK);
+ *TimeElapsed = (UINT32) OutQuotient;
+ return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c
index c52a62a..fb65f46 100644
--- a/sys/contrib/dev/acpica/nsaccess.c
+++ b/sys/contrib/dev/acpica/nsaccess.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 141 $
+ * $Revision: 152 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsaccess")
+ ACPI_MODULE_NAME ("nsaccess")
/*******************************************************************************
@@ -144,16 +144,20 @@
ACPI_STATUS
AcpiNsRootInitialize (void)
{
- ACPI_STATUS Status = AE_OK;
- const PREDEFINED_NAMES *InitVal = NULL;
- ACPI_NAMESPACE_NODE *NewNode;
- ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ const ACPI_PREDEFINED_NAMES *InitVal = NULL;
+ ACPI_NAMESPACE_NODE *NewNode;
+ ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE ("NsRootInitialize");
+ ACPI_FUNCTION_TRACE ("NsRootInitialize");
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/*
* The global root ptr is initially NULL, so a non-NULL value indicates
@@ -173,13 +177,13 @@ AcpiNsRootInitialize (void)
/* Enter the pre-defined names in the name table */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Entering predefined entries into namespace\n"));
for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
{
Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type,
- IMODE_LOAD_PASS2, NS_NO_UPSEARCH,
- NULL, &NewNode);
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &NewNode);
if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */
{
@@ -216,7 +220,7 @@ AcpiNsRootInitialize (void)
case ACPI_TYPE_INTEGER:
ObjDesc->Integer.Value =
- (ACPI_INTEGER) STRTOUL (InitVal->Val, NULL, 10);
+ (ACPI_INTEGER) ACPI_STRTOUL (InitVal->Val, NULL, 10);
break;
@@ -225,7 +229,7 @@ AcpiNsRootInitialize (void)
/*
* Build an object around the static string
*/
- ObjDesc->String.Length = STRLEN (InitVal->Val);
+ ObjDesc->String.Length = ACPI_STRLEN (InitVal->Val);
ObjDesc->String.Pointer = InitVal->Val;
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
break;
@@ -234,9 +238,9 @@ AcpiNsRootInitialize (void)
case ACPI_TYPE_MUTEX:
ObjDesc->Mutex.SyncLevel =
- (UINT16) STRTOUL (InitVal->Val, NULL, 10);
+ (UINT16) ACPI_STRTOUL (InitVal->Val, NULL, 10);
- if (STRCMP (InitVal->Name, "_GL_") == 0)
+ if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
{
/*
* Create a counting semaphore for the
@@ -270,7 +274,7 @@ AcpiNsRootInitialize (void)
default:
- REPORT_ERROR (("Unsupported initial type value %X\n",
+ ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
InitVal->Type));
AcpiUtRemoveReference (ObjDesc);
ObjDesc = NULL;
@@ -289,7 +293,7 @@ AcpiNsRootInitialize (void)
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@@ -321,8 +325,8 @@ ACPI_STATUS
AcpiNsLookup (
ACPI_GENERIC_STATE *ScopeInfo,
NATIVE_CHAR *Pathname,
- ACPI_OBJECT_TYPE8 Type,
- OPERATING_MODE InterpreterMode,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_INTERPRETER_MODE InterpreterMode,
UINT32 Flags,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **ReturnNode)
@@ -333,13 +337,12 @@ AcpiNsLookup (
ACPI_NAMESPACE_NODE *ThisNode = NULL;
UINT32 NumSegments;
ACPI_NAME SimpleName;
- BOOLEAN NullNamePath = FALSE;
- ACPI_OBJECT_TYPE8 TypeToCheckFor;
- ACPI_OBJECT_TYPE8 ThisSearchType;
- UINT32 LocalFlags = Flags & ~NS_ERROR_IF_FOUND;
+ ACPI_OBJECT_TYPE TypeToCheckFor;
+ ACPI_OBJECT_TYPE ThisSearchType;
+ UINT32 LocalFlags = Flags & ~ACPI_NS_ERROR_IF_FOUND;
- FUNCTION_TRACE ("NsLookup");
+ ACPI_FUNCTION_TRACE ("NsLookup");
if (!ReturnNode)
@@ -348,7 +351,7 @@ AcpiNsLookup (
}
AcpiGbl_NsLookupCount++;
- *ReturnNode = ENTRY_NOT_FOUND;
+ *ReturnNode = ACPI_ENTRY_NOT_FOUND;
if (!AcpiGbl_RootNode)
{
@@ -362,7 +365,7 @@ AcpiNsLookup (
if ((!ScopeInfo) ||
(!ScopeInfo->Scope.Node))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Null scope prefix, using root node (%p)\n",
AcpiGbl_RootNode));
@@ -397,190 +400,202 @@ AcpiNsLookup (
TypeToCheckFor = Type;
}
-
- /* Examine the pathname */
-
+ /*
+ * Begin examination of the actual pathname
+ */
if (!Pathname)
{
- /* Null NamePath -- is allowed */
+ /* A Null NamePath is allowed and refers to the root */
- NullNamePath = TRUE;
NumSegments = 0;
ThisNode = AcpiGbl_RootNode;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Null Pathname (Zero segments), Flags=%x\n", Flags));
}
-
else
{
/*
- * Valid name pointer (Internal name format)
+ * Name pointer is valid (and must be in internal name format)
*
- * Check for prefixes. As represented in the AML stream, a
- * Pathname consists of an optional scope prefix followed by
- * a segment part.
+ * Check for scope prefixes:
*
- * If present, the scope prefix is either a RootPrefix (in
- * which case the name is fully qualified), or zero or more
- * ParentPrefixes (in which case the name's scope is relative
- * to the current scope).
+ * As represented in the AML stream, a namepath consists of an
+ * optional scope prefix followed by a name segment part.
*
- * The segment part consists of either:
- * - A single 4-byte name segment, or
- * - A DualNamePrefix followed by two 4-byte name segments, or
- * - A MultiNamePrefixOp, followed by a byte indicating the
- * number of segments and the segments themselves.
+ * If present, the scope prefix is either a Root Prefix (in
+ * which case the name is fully qualified), or one or more
+ * Parent Prefixes (in which case the name's scope is relative
+ * to the current scope).
*/
if (*Pathname == AML_ROOT_PREFIX)
{
/* Pathname is fully qualified, start from the root */
- CurrentNode = AcpiGbl_RootNode;
+ ThisNode = AcpiGbl_RootNode;
- /* Point to segment part */
+ /* Point to name segment part */
Pathname++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching from root [%p]\n",
- CurrentNode));
-
- if (!(*Pathname))
- {
- /* Direct reference to root, "\" */
-
- ThisNode = AcpiGbl_RootNode;
- goto CheckForNewScopeAndExit;
- }
+ ThisNode));
}
else
{
/* Pathname is relative to current scope, start there */
- CurrentNode = PrefixNode;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching relative to pfx scope [%p]\n",
PrefixNode));
/*
- * Handle up-prefix (carat). More than one prefix is supported
+ * Handle multiple Parent Prefixes (carat) by just getting
+ * the parent node for each prefix instance.
*/
+ ThisNode = PrefixNode;
while (*Pathname == AML_PARENT_PREFIX)
{
- /* Point to segment part or next ParentPrefix */
-
+ /*
+ * Point past this prefix to the name segment
+ * part or the next Parent Prefix
+ */
Pathname++;
- /* Backup to the parent's scope */
+ /* Backup to the parent node */
- ThisNode = AcpiNsGetParentObject (CurrentNode);
+ ThisNode = AcpiNsGetParentNode (ThisNode);
if (!ThisNode)
{
/* Current scope has no parent scope */
- REPORT_ERROR (
- ("Too many parent prefixes (^) - reached root\n"));
+ ACPI_REPORT_ERROR (
+ ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
return_ACPI_STATUS (AE_NOT_FOUND);
}
-
- CurrentNode = ThisNode;
}
}
/*
- * Examine the name prefix opcode, if any, to determine the number of
- * segments
+ * Determine the number of ACPI name segments in this pathname.
+ *
+ * The segment part consists of either:
+ * - A Null name segment (0)
+ * - A DualNamePrefix followed by two 4-byte name segments
+ * - A MultiNamePrefix followed by a byte indicating the
+ * number of segments and the segments themselves.
+ * - A single 4-byte name segment
+ *
+ * Examine the name prefix opcode, if any, to determine the number of
+ * segments.
*/
- if (*Pathname == AML_DUAL_NAME_PREFIX)
+ switch (*Pathname)
{
- /* Two segments, point to first segment */
+ case 0:
+ /*
+ * Null name after a root or parent prefixes. We already
+ * have the correct target node and there are no name segments.
+ */
+ NumSegments = 0;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Prefix-only Pathname (Zero name segments), Flags=%x\n", Flags));
+ break;
+
+ case AML_DUAL_NAME_PREFIX:
+
+ /* Two segments, point to first name segment */
NumSegments = 2;
Pathname++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Dual Pathname (2 segments, Flags=%X)\n", Flags));
- }
- else if (*Pathname == AML_MULTI_NAME_PREFIX_OP)
- {
- /* Extract segment count, point to first segment */
+ break;
- NumSegments = (UINT32)* (UINT8 *) ++Pathname;
+ case AML_MULTI_NAME_PREFIX_OP:
+
+ /* Extract segment count, point to first name segment */
+
+ Pathname++;
+ NumSegments = (UINT32) (UINT8) *Pathname;
Pathname++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Multi Pathname (%d Segments, Flags=%X) \n",
NumSegments, Flags));
- }
- else
- {
+ break;
+
+ default:
/*
- * No Dual or Multi prefix, hence there is only one segment and
- * Pathname is already pointing to it.
+ * Not a Null name, no Dual or Multi prefix, hence there is
+ * only one name segment and Pathname is already pointing to it.
*/
NumSegments = 1;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Simple Pathname (1 segment, Flags=%X)\n", Flags));
+ break;
}
- DEBUG_EXEC (AcpiNsPrintPathname (NumSegments, Pathname));
+ ACPI_DEBUG_EXEC (AcpiNsPrintPathname (NumSegments, Pathname));
}
/*
- * Search namespace for each segment of the name. Loop through and
+ * Search namespace for each segment of the name. Loop through and
* verify/add each name segment.
*/
- while (NumSegments-- && CurrentNode)
+ CurrentNode = ThisNode;
+ while (NumSegments && CurrentNode)
{
/*
* Search for the current name segment under the current
- * named object. The Type is significant only at the last (topmost)
- * level. (We don't care about the types along the path, only
+ * named object. The Type is significant only at the last name
+ * segment. (We don't care about the types along the path, only
* the type of the final target object.)
*/
ThisSearchType = ACPI_TYPE_ANY;
+ NumSegments--;
if (!NumSegments)
{
ThisSearchType = Type;
LocalFlags = Flags;
}
- /* Pluck one ACPI name from the front of the pathname */
+ /* Extract one ACPI name from the front of the pathname */
- MOVE_UNALIGNED32_TO_32 (&SimpleName, Pathname);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&SimpleName, Pathname);
/* Try to find the ACPI name */
- Status = AcpiNsSearchAndEnter (SimpleName, WalkState,
- CurrentNode, InterpreterMode,
- ThisSearchType, LocalFlags,
- &ThisNode);
+ Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode,
+ InterpreterMode, ThisSearchType, LocalFlags, &ThisNode);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
- /* Name not found in ACPI namespace */
+ /* Name not found in ACPI namespace */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name [%4.4s] not found in scope %p\n",
- (char*)&SimpleName, CurrentNode));
+ "Name [%4.4s] not found in scope [%4.4s] %p\n",
+ (char *) &SimpleName, (char *) &CurrentNode->Name, CurrentNode));
}
return_ACPI_STATUS (Status);
}
/*
+ * Sanity typecheck of the target object:
+ *
* If 1) This is the last segment (NumSegments == 0)
- * 2) and looking for a specific type
+ * 2) And we are looking for a specific type
* (Not checking for TYPE_ANY)
* 3) Which is not an alias
- * 4) which is not a local type (TYPE_DEF_ANY)
- * 5) which is not a local type (TYPE_SCOPE)
- * 6) which is not a local type (TYPE_INDEX_FIELD_DEFN)
- * 7) and type of object is known (not TYPE_ANY)
- * 8) and object does not match request
+ * 4) Which is not a local type (TYPE_DEF_ANY)
+ * 5) Which is not a local type (TYPE_SCOPE)
+ * 6) Which is not a local type (TYPE_INDEX_FIELD_DEFN)
+ * 7) And the type of target object is known (not TYPE_ANY)
+ * 8) And target object does not match what we are looking for
*
* Then we have a type mismatch. Just warn and ignore it.
*/
@@ -595,7 +610,7 @@ AcpiNsLookup (
{
/* Complain about a type mismatch */
- REPORT_WARNING (
+ ACPI_REPORT_WARNING (
("NsLookup: %4.4s, type %X, checking for type %X\n",
(char *) &SimpleName, ThisNode->Type, TypeToCheckFor));
}
@@ -605,39 +620,24 @@ AcpiNsLookup (
* specific type, but the type of found object is known, use that type
* to see if it opens a scope.
*/
- if ((0 == NumSegments) && (ACPI_TYPE_ANY == Type))
+ if ((NumSegments == 0) && (Type == ACPI_TYPE_ANY))
{
Type = ThisNode->Type;
}
- if ((NumSegments || AcpiNsOpensScope (Type)) &&
- (ThisNode->Child == NULL))
- {
- /*
- * More segments or the type implies enclosed scope,
- * and the next scope has not been allocated.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Load mode=%X ThisNode=%p\n",
- InterpreterMode, ThisNode));
- }
-
- CurrentNode = ThisNode;
-
- /* point to next name segment */
+ /* Point to next name segment and make this node current */
Pathname += ACPI_NAME_SIZE;
+ CurrentNode = ThisNode;
}
-
/*
* Always check if we need to open a new scope
*/
-CheckForNewScopeAndExit:
-
- if (!(Flags & NS_DONT_OPEN_SCOPE) && (WalkState))
+ if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState))
{
/*
- * If entry is a type which opens a scope, push the new scope on the
+ * If entry is a type which opens a scope, push the new scope on the
* scope stack.
*/
if (AcpiNsOpensScope (TypeToCheckFor))
@@ -648,8 +648,8 @@ CheckForNewScopeAndExit:
return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Set global scope to %p\n", ThisNode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Setting global scope to %p\n", ThisNode));
}
}
diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c
index 52afd73..b12b26d 100644
--- a/sys/contrib/dev/acpica/nsalloc.c
+++ b/sys/contrib/dev/acpica/nsalloc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 62 $
+ * $Revision: 70 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsalloc")
+ ACPI_MODULE_NAME ("nsalloc")
/*******************************************************************************
@@ -145,7 +145,7 @@ AcpiNsCreateNode (
ACPI_NAMESPACE_NODE *Node;
- FUNCTION_TRACE ("NsCreateNode");
+ ACPI_FUNCTION_TRACE ("NsCreateNode");
Node = ACPI_MEM_CALLOCATE (sizeof (ACPI_NAMESPACE_NODE));
@@ -156,9 +156,9 @@ AcpiNsCreateNode (
ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalAllocated++);
- Node->DataType = ACPI_DESC_TYPE_NAMED;
Node->Name = Name;
Node->ReferenceCount = 1;
+ ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
return_PTR (Node);
}
@@ -185,10 +185,10 @@ AcpiNsDeleteNode (
ACPI_NAMESPACE_NODE *NextNode;
- FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
+ ACPI_FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
- ParentNode = AcpiNsGetParentObject (Node);
+ ParentNode = AcpiNsGetParentNode (Node);
PrevNode = NULL;
NextNode = ParentNode->Child;
@@ -239,7 +239,7 @@ AcpiNsDeleteNode (
* its peers.
*
* Note: Current namespace lookup is linear search, so the nodes
- * are not linked in any particular order.
+ * are not linked in any particular order.
*
******************************************************************************/
@@ -248,13 +248,13 @@ AcpiNsInstallNode (
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE *ParentNode, /* Parent */
ACPI_NAMESPACE_NODE *Node, /* New Child*/
- ACPI_OBJECT_TYPE8 Type)
+ ACPI_OBJECT_TYPE Type)
{
UINT16 OwnerId = TABLE_ID_DSDT;
ACPI_NAMESPACE_NODE *ChildNode;
- FUNCTION_TRACE ("NsInstallNode");
+ ACPI_FUNCTION_TRACE ("NsInstallNode");
/*
@@ -310,7 +310,7 @@ AcpiNsInstallNode (
* real definition is found later.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[%4.4s] is a forward reference\n",
- (char*)&Node->Name));
+ (char *) &Node->Name));
}
/*
@@ -337,13 +337,13 @@ AcpiNsInstallNode (
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n",
- (char*)&Node->Name, ParentNode, Node));
+ (char *) &Node->Name, ParentNode, Node));
/*
* Increment the reference count(s) of all parents up to
* the root!
*/
- while ((Node = AcpiNsGetParentObject (Node)) != NULL)
+ while ((Node = AcpiNsGetParentNode (Node)) != NULL)
{
Node->ReferenceCount++;
}
@@ -360,8 +360,8 @@ AcpiNsInstallNode (
*
* RETURN: None.
*
- * DESCRIPTION: Delete all children of the parent object. Deletes a
- * "scope".
+ * DESCRIPTION: Delete all children of the parent object. In other words,
+ * deletes a "scope".
*
******************************************************************************/
@@ -374,7 +374,7 @@ AcpiNsDeleteChildren (
UINT8 Flags;
- FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
+ ACPI_FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
if (!ParentNode)
@@ -445,7 +445,7 @@ AcpiNsDeleteChildren (
* RETURN: None.
*
* DESCRIPTION: Delete a subtree of the namespace. This includes all objects
- * stored within the subtree. Scope tables are deleted also
+ * stored within the subtree.
*
******************************************************************************/
@@ -457,7 +457,7 @@ AcpiNsDeleteNamespaceSubtree (
UINT32 Level = 1;
- FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
+ ACPI_FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
if (!ParentNode)
@@ -514,7 +514,7 @@ AcpiNsDeleteNamespaceSubtree (
/* Move up the tree to the grandparent */
- ParentNode = AcpiNsGetParentObject (ParentNode);
+ ParentNode = AcpiNsGetParentNode (ParentNode);
}
}
@@ -541,36 +541,39 @@ static void
AcpiNsRemoveReference (
ACPI_NAMESPACE_NODE *Node)
{
- ACPI_NAMESPACE_NODE *NextNode;
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *ThisNode;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* Decrement the reference count(s) of this node and all
* nodes up to the root, Delete anything with zero remaining references.
*/
- NextNode = Node;
- while (NextNode)
+ ThisNode = Node;
+ while (ThisNode)
{
- /* Decrement the reference count on this node*/
+ /* Prepare to move up to parent */
+
+ ParentNode = AcpiNsGetParentNode (ThisNode);
+
+ /* Decrement the reference count on this node */
- NextNode->ReferenceCount--;
+ ThisNode->ReferenceCount--;
/* Delete the node if no more references */
- if (!NextNode->ReferenceCount)
+ if (!ThisNode->ReferenceCount)
{
/* Delete all children and delete the node */
- AcpiNsDeleteChildren (NextNode);
- AcpiNsDeleteNode (NextNode);
+ AcpiNsDeleteChildren (ThisNode);
+ AcpiNsDeleteNode (ThisNode);
}
- /* Move up to parent */
-
- NextNode = AcpiNsGetParentObject (NextNode);
+ ThisNode = ParentNode;
}
}
@@ -594,16 +597,18 @@ AcpiNsDeleteNamespaceByOwner (
UINT16 OwnerId)
{
ACPI_NAMESPACE_NODE *ChildNode;
+ ACPI_NAMESPACE_NODE *DeletionNode;
UINT32 Level;
ACPI_NAMESPACE_NODE *ParentNode;
- FUNCTION_TRACE ("NsDeleteNamespaceByOwner");
+ ACPI_FUNCTION_TRACE_U32 ("NsDeleteNamespaceByOwner", OwnerId);
- ParentNode = AcpiGbl_RootNode;
- ChildNode = 0;
- Level = 1;
+ ParentNode = AcpiGbl_RootNode;
+ ChildNode = NULL;
+ DeletionNode = NULL;
+ Level = 1;
/*
* Traverse the tree of nodes until we bubble back up
@@ -611,22 +616,30 @@ AcpiNsDeleteNamespaceByOwner (
*/
while (Level > 0)
{
- /* Get the next node in this scope (NULL if none) */
+ /*
+ * Get the next child of this parent node. When ChildNode is NULL,
+ * the first child of the parent is returned
+ */
+ ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
+
+ if (DeletionNode)
+ {
+ AcpiNsRemoveReference (DeletionNode);
+ DeletionNode = NULL;
+ }
- ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode,
- ChildNode);
if (ChildNode)
{
if (ChildNode->OwnerId == OwnerId)
{
- /* Found a child node - detach any attached object */
+ /* Found a matching child node - detach any attached object */
AcpiNsDetachObject (ChildNode);
}
/* Check if this node has any children */
- if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, 0))
+ if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
{
/*
* There is at least one child of this node,
@@ -634,11 +647,11 @@ AcpiNsDeleteNamespaceByOwner (
*/
Level++;
ParentNode = ChildNode;
- ChildNode = 0;
+ ChildNode = NULL;
}
else if (ChildNode->OwnerId == OwnerId)
{
- AcpiNsRemoveReference (ChildNode);
+ DeletionNode = ChildNode;
}
}
else
@@ -648,12 +661,11 @@ AcpiNsDeleteNamespaceByOwner (
* Move up to the grandparent.
*/
Level--;
-
if (Level != 0)
{
if (ParentNode->OwnerId == OwnerId)
{
- AcpiNsRemoveReference (ParentNode);
+ DeletionNode = ParentNode;
}
}
@@ -663,7 +675,7 @@ AcpiNsDeleteNamespaceByOwner (
/* Move up the tree to the grandparent */
- ParentNode = AcpiNsGetParentObject (ParentNode);
+ ParentNode = AcpiNsGetParentNode (ParentNode);
}
}
diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c
index f2b0b35..ee74fee 100644
--- a/sys/contrib/dev/acpica/nsdump.c
+++ b/sys/contrib/dev/acpica/nsdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 116 $
+ * $Revision: 127 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsdump")
+ ACPI_MODULE_NAME ("nsdump")
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
@@ -146,9 +146,7 @@ AcpiNsPrintPathname (
UINT32 NumSegments,
char *Pathname)
{
- UINT32 i;
-
- PROC_NAME ("AcpiNsPrintPathname");
+ ACPI_FUNCTION_NAME ("AcpiNsPrintPathname");
if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
@@ -160,9 +158,16 @@ AcpiNsPrintPathname (
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
- for (i = 0; i < NumSegments; i++)
+ while (NumSegments)
{
- AcpiOsPrintf ("%4.4s.", (char *) &Pathname[i * 4]);
+ AcpiOsPrintf ("%4.4s", Pathname);
+ Pathname += ACPI_NAME_SIZE;
+
+ NumSegments--;
+ if (NumSegments)
+ {
+ AcpiOsPrintf (".");
+ }
}
AcpiOsPrintf ("]\n");
@@ -190,11 +195,11 @@ AcpiNsDumpPathname (
UINT32 Level,
UINT32 Component)
{
- NATIVE_CHAR *Buffer;
- UINT32 Length;
+ ACPI_BUFFER Buffer;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("NsDumpPathname");
+ ACPI_FUNCTION_TRACE ("NsDumpPathname");
/* Do this only if the requested debug level and component are enabled */
@@ -204,23 +209,18 @@ AcpiNsDumpPathname (
return_ACPI_STATUS (AE_OK);
}
- Buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX);
- if (!Buffer)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
/* Convert handle to a full pathname and print it (with supplied message) */
- Length = PATHNAME_MAX;
- if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer)))
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ Status = AcpiNsHandleToPathname (Handle, &Buffer);
+ if (ACPI_SUCCESS (Status))
{
- AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer, Handle);
+ AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer.Pointer, Handle);
+ ACPI_MEM_FREE (Buffer.Pointer);
}
- ACPI_MEM_FREE (Buffer);
-
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
@@ -247,16 +247,17 @@ AcpiNsDumpOneObject (
ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
ACPI_NAMESPACE_NODE *ThisNode;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- ACPI_OBJECT_TYPE8 ObjType;
- ACPI_OBJECT_TYPE8 Type;
+ ACPI_OBJECT_TYPE ObjType;
+ ACPI_OBJECT_TYPE Type;
UINT32 BytesToDump;
UINT32 DownstreamSiblingMask = 0;
UINT32 LevelTmp;
UINT32 WhichBit;
UINT32 i;
+ UINT32 DbgLevel;
- PROC_NAME ("NsDumpOneObject");
+ ACPI_FUNCTION_NAME ("NsDumpOneObject");
ThisNode = AcpiNsMapHandleToNode (ObjHandle);
@@ -271,11 +272,6 @@ AcpiNsDumpOneObject (
return (AE_OK);
}
- if (!((ACPI_LV_TABLES & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
- {
- return (AE_OK);
- }
-
if (!ObjHandle)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
@@ -346,7 +342,7 @@ AcpiNsDumpOneObject (
if (!AcpiUtValidAcpiName (ThisNode->Name))
{
- REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name));
+ ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name));
}
/*
@@ -355,7 +351,10 @@ AcpiNsDumpOneObject (
AcpiOsPrintf (" %4.4s %-12s %p",
(char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode);
+ DbgLevel = AcpiDbgLevel;
+ AcpiDbgLevel = 0;
ObjDesc = AcpiNsGetAttachedObject (ThisNode);
+ AcpiDbgLevel = DbgLevel;
switch (Info->DisplayType)
{
@@ -391,8 +390,8 @@ AcpiNsDumpOneObject (
case ACPI_TYPE_INTEGER:
AcpiOsPrintf (" = %8.8X%8.8X\n",
- HIDWORD (ObjDesc->Integer.Value),
- LODWORD (ObjDesc->Integer.Value));
+ ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_PACKAGE:
@@ -432,8 +431,8 @@ AcpiNsDumpOneObject (
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
{
AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
- HIDWORD(ObjDesc->Region.Address),
- LODWORD(ObjDesc->Region.Address),
+ ACPI_HIDWORD (ObjDesc->Region.Address),
+ ACPI_LODWORD (ObjDesc->Region.Address),
ObjDesc->Region.Length);
}
else
@@ -490,7 +489,7 @@ AcpiNsDumpOneObject (
(ObjDesc->CommonField.BaseByteOffset * 8)
+ ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.BitLength,
- ObjDesc->CommonField.AccessBitWidth);
+ ObjDesc->CommonField.AccessByteWidth);
break;
}
@@ -525,8 +524,8 @@ AcpiNsDumpOneObject (
case ACPI_TYPE_INTEGER:
- AcpiOsPrintf (" N:%X%X\n", HIDWORD(ObjDesc->Integer.Value),
- LODWORD(ObjDesc->Integer.Value));
+ AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value),
+ ACPI_LODWORD(ObjDesc->Integer.Value));
break;
case ACPI_TYPE_STRING:
@@ -564,26 +563,31 @@ AcpiNsDumpOneObject (
/* If there is an attached object, display it */
+ DbgLevel = AcpiDbgLevel;
+ AcpiDbgLevel = 0;
ObjDesc = AcpiNsGetAttachedObject (ThisNode);
+ AcpiDbgLevel = DbgLevel;
/* Dump attached objects */
while (ObjDesc)
{
ObjType = INTERNAL_TYPE_INVALID;
+ AcpiOsPrintf (" Attached Object %p: ", ObjDesc);
/* Decode the type of attached object and dump the contents */
- AcpiOsPrintf (" Attached Object %p: ", ObjDesc);
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
+ case ACPI_DESC_TYPE_NAMED:
+
AcpiOsPrintf ("(Ptr to Node)\n");
BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
- }
+ break;
+
+
+ case ACPI_DESC_TYPE_INTERNAL:
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
- {
ObjType = ObjDesc->Common.Type;
if (ObjType > INTERNAL_TYPE_MAX)
@@ -597,18 +601,21 @@ AcpiNsDumpOneObject (
ObjType, AcpiUtGetTypeName (ObjType));
BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
}
- }
- else
- {
- AcpiOsPrintf ("(String or Buffer - not descriptor)\n");
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n");
BytesToDump = 16;
+ break;
}
- DUMP_BUFFER (ObjDesc, BytesToDump);
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
/* If value is NOT an internal object, we are done */
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
{
goto Cleanup;
}
@@ -681,7 +688,7 @@ Cleanup:
void
AcpiNsDumpObjects (
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
UINT32 OwnerId,
@@ -690,7 +697,7 @@ AcpiNsDumpObjects (
ACPI_WALK_INFO Info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
Info.DebugLevel = ACPI_LV_TABLES;
@@ -698,7 +705,7 @@ AcpiNsDumpObjects (
Info.DisplayType = DisplayType;
- AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
+ AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
(void *) &Info, NULL);
}
@@ -729,7 +736,7 @@ AcpiNsDumpOneDevice (
UINT32 i;
- PROC_NAME ("NsDumpOneDevice");
+ ACPI_FUNCTION_NAME ("NsDumpOneDevice");
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
@@ -743,7 +750,9 @@ AcpiNsDumpOneDevice (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
- Info.HardwareId, HIDWORD(Info.Address), LODWORD(Info.Address), Info.CurrentStatus));
+ Info.HardwareId,
+ ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address),
+ Info.CurrentStatus));
}
return (Status);
@@ -766,7 +775,7 @@ AcpiNsDumpRootDevices (void)
ACPI_HANDLE SysBusHandle;
- PROC_NAME ("NsDumpRootDevices");
+ ACPI_FUNCTION_NAME ("NsDumpRootDevices");
/* Only dump the table if tracing is enabled */
@@ -776,10 +785,10 @@ AcpiNsDumpRootDevices (void)
return;
}
- AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle);
+ AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
- AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK,
+ AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
AcpiNsDumpOneDevice, NULL, NULL);
}
@@ -806,7 +815,7 @@ AcpiNsDumpTables (
ACPI_HANDLE SearchHandle = SearchBase;
- FUNCTION_TRACE ("NsDumpTables");
+ ACPI_FUNCTION_TRACE ("NsDumpTables");
if (!AcpiGbl_RootNode)
@@ -819,7 +828,7 @@ AcpiNsDumpTables (
return_VOID;
}
- if (NS_ALL == SearchBase)
+ if (ACPI_NS_ALL == SearchBase)
{
/* entire namespace */
@@ -853,7 +862,7 @@ AcpiNsDumpEntry (
ACPI_WALK_INFO Info;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
Info.DebugLevel = DebugLevel;
diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c
index d863fac..725b4f3 100644
--- a/sys/contrib/dev/acpica/nseval.c
+++ b/sys/contrib/dev/acpica/nseval.c
@@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
- * $Revision: 104 $
+ * $Revision: 109 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,7 +126,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nseval")
+ ACPI_MODULE_NAME ("nseval")
/*******************************************************************************
@@ -165,7 +165,7 @@ AcpiNsEvaluateRelative (
ACPI_GENERIC_STATE ScopeInfo;
- FUNCTION_TRACE ("NsEvaluateRelative");
+ ACPI_FUNCTION_TRACE ("NsEvaluateRelative");
/*
@@ -186,12 +186,16 @@ AcpiNsEvaluateRelative (
/* Get the prefix handle and Node */
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
PrefixNode = AcpiNsMapHandleToNode (Handle);
if (!PrefixNode)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Status = AE_BAD_PARAMETER;
goto Cleanup;
}
@@ -200,10 +204,10 @@ AcpiNsEvaluateRelative (
ScopeInfo.Scope.Node = PrefixNode;
Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY,
- IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
&Node);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@@ -262,7 +266,7 @@ AcpiNsEvaluateByName (
NATIVE_CHAR *InternalPath = NULL;
- FUNCTION_TRACE ("NsEvaluateByName");
+ ACPI_FUNCTION_TRACE ("NsEvaluateByName");
/* Build an internal name string for the method */
@@ -273,15 +277,19 @@ AcpiNsEvaluateByName (
return_ACPI_STATUS (Status);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Lookup the name in the namespace */
Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
- IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
&Node);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@@ -346,7 +354,7 @@ AcpiNsEvaluateByHandle (
ACPI_OPERAND_OBJECT *LocalReturnObject;
- FUNCTION_TRACE ("NsEvaluateByHandle");
+ ACPI_FUNCTION_TRACE ("NsEvaluateByHandle");
/* Check if namespace has been initialized */
@@ -372,12 +380,16 @@ AcpiNsEvaluateByHandle (
/* Get the prefix handle and Node */
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
Node = AcpiNsMapHandleToNode (Handle);
if (!Node)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -477,7 +489,7 @@ AcpiNsExecuteControlMethod (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE ("NsExecuteControlMethod");
+ ACPI_FUNCTION_TRACE ("NsExecuteControlMethod");
/* Verify that there is a method associated with this object */
@@ -487,7 +499,7 @@ AcpiNsExecuteControlMethod (
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_NULL_OBJECT);
}
@@ -495,7 +507,7 @@ AcpiNsExecuteControlMethod (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %p Length %x]\n",
ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1));
- DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing",
+ ACPI_DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing",
ACPI_LV_NAMES, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n",
@@ -509,7 +521,11 @@ AcpiNsExecuteControlMethod (
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/*
* Execute the method via the interpreter. The interpreter is locked
@@ -538,7 +554,7 @@ AcpiNsExecuteControlMethod (
*
* DESCRIPTION: Return the current value of the object
*
- * MUTEX: Assumes namespace is locked
+ * MUTEX: Assumes namespace is locked, leaves namespace unlocked
*
******************************************************************************/
@@ -549,117 +565,62 @@ AcpiNsGetObjectValue (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *SourceDesc;
- FUNCTION_TRACE ("NsGetObjectValue");
+ ACPI_FUNCTION_TRACE ("NsGetObjectValue");
/*
- * We take the value from certain objects directly
+ * Objects require additional resolution steps (e.g., the
+ * Node may be a field that must be read, etc.) -- we can't just grab
+ * the object out of the node.
*/
- if ((Node->Type == ACPI_TYPE_PROCESSOR) ||
- (Node->Type == ACPI_TYPE_POWER))
- {
- /*
- * Create a Reference object to contain the object
- */
- ObjDesc = AcpiUtCreateInternalObject (Node->Type);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
-
- /*
- * Get the attached object
- */
- SourceDesc = AcpiNsGetAttachedObject (Node);
- if (!SourceDesc)
- {
- Status = AE_NULL_OBJECT;
- goto UnlockAndExit;
- }
-
- /*
- * Just copy from the original to the return object
- *
- * TBD: [Future] - need a low-level object copy that handles
- * the reference count automatically. (Don't want to copy it)
- */
- MEMCPY (ObjDesc, SourceDesc, sizeof (ACPI_OPERAND_OBJECT));
- ObjDesc->Common.ReferenceCount = 1;
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- }
-
+ ObjDesc = (ACPI_OPERAND_OBJECT *) Node;
/*
- * Other objects require a reference object wrapper which we
- * then attempt to resolve.
+ * Use ResolveNodeToValue() to get the associated value. This call
+ * always deletes ObjDesc (allocated above).
+ *
+ * NOTE: we can get away with passing in NULL for a walk state
+ * because ObjDesc is guaranteed to not be a reference to either
+ * a method local or a method argument (because this interface can only be
+ * called from the AcpiEvaluate external interface, never called from
+ * a running control method.)
+ *
+ * Even though we do not directly invoke the interpreter
+ * for this, we must enter it because we could access an opregion.
+ * The opregion access code assumes that the interpreter
+ * is locked.
+ *
+ * We must release the namespace lock before entering the
+ * intepreter.
*/
- else
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
{
- /* Create an Reference object to contain the object */
-
- ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
-
- /* Construct a descriptor pointing to the name */
-
- ObjDesc->Reference.Opcode = (UINT8) AML_NAME_OP;
- ObjDesc->Reference.Object = (void *) Node;
+ return_ACPI_STATUS (Status);
+ }
+ Status = AcpiExEnterInterpreter ();
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) &ObjDesc, NULL);
/*
- * Use ResolveToValue() to get the associated value. This call
- * always deletes ObjDesc (allocated above).
- *
- * NOTE: we can get away with passing in NULL for a walk state
- * because ObjDesc is guaranteed to not be a reference to either
- * a method local or a method argument
- *
- * Even though we do not directly invoke the interpreter
- * for this, we must enter it because we could access an opregion.
- * The opregion access code assumes that the interpreter
- * is locked.
- *
- * We must release the namespace lock before entering the
- * intepreter.
+ * If AcpiExResolveNodeToValue() succeeded, the return value was
+ * placed in ObjDesc.
*/
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- Status = AcpiExEnterInterpreter ();
+ AcpiExExitInterpreter ();
+
if (ACPI_SUCCESS (Status))
{
- Status = AcpiExResolveToValue (&ObjDesc, NULL);
-
- AcpiExExitInterpreter ();
+ Status = AE_CTRL_RETURN_VALUE;
+ *ReturnObjDesc = ObjDesc;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *ReturnObjDesc));
}
}
- /*
- * If AcpiExResolveToValue() succeeded, the return value was
- * placed in ObjDesc.
- */
- if (ACPI_SUCCESS (Status))
- {
- Status = AE_CTRL_RETURN_VALUE;
-
- *ReturnObjDesc = ObjDesc;
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *ReturnObjDesc));
- }
-
/* Namespace is unlocked */
return_ACPI_STATUS (Status);
-
-
-UnlockAndExit:
-
- /* Unlock the namespace */
-
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (Status);
}
+
diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c
index 9e6765b..eeedf6e 100644
--- a/sys/contrib/dev/acpica/nsinit.c
+++ b/sys/contrib/dev/acpica/nsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 35 $
+ * $Revision: 41 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsinit")
+ ACPI_MODULE_NAME ("nsinit")
/*******************************************************************************
@@ -147,7 +147,7 @@ AcpiNsInitializeObjects (
ACPI_INIT_WALK_INFO Info;
- FUNCTION_TRACE ("NsInitializeObjects");
+ ACPI_FUNCTION_TRACE ("NsInitializeObjects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@@ -209,7 +209,7 @@ AcpiNsInitializeDevices (
ACPI_DEVICE_WALK_INFO Info;
- FUNCTION_TRACE ("NsInitializeDevices");
+ ACPI_FUNCTION_TRACE ("NsInitializeDevices");
Info.DeviceCount = 0;
@@ -263,14 +263,14 @@ AcpiNsInitOneObject (
void *Context,
void **ReturnValue)
{
- ACPI_OBJECT_TYPE8 Type;
+ ACPI_OBJECT_TYPE Type;
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_OPERAND_OBJECT *ObjDesc;
- PROC_NAME ("NsInitOneObject");
+ ACPI_FUNCTION_NAME ("NsInitOneObject");
Info->ObjectCount++;
@@ -319,7 +319,7 @@ AcpiNsInitOneObject (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting region arguments [%4.4s]\n",
- AcpiFormatException (Status), (char*)&Node->Name));
+ AcpiFormatException (Status), (char *) &Node->Name));
}
if (!(AcpiDbgLevel & ACPI_LV_INIT))
@@ -345,7 +345,7 @@ AcpiNsInitOneObject (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting buffer field arguments [%4.4s]\n",
- AcpiFormatException (Status), (char*)&Node->Name));
+ AcpiFormatException (Status), (char *) &Node->Name));
}
if (!(AcpiDbgLevel & ACPI_LV_INIT))
{
@@ -396,7 +396,7 @@ AcpiNsInitOneDevice (
ACPI_DEVICE_WALK_INFO *Info = (ACPI_DEVICE_WALK_INFO *) Context;
- FUNCTION_TRACE ("NsInitOneDevice");
+ ACPI_FUNCTION_TRACE ("NsInitOneDevice");
if (!(AcpiDbgLevel & ACPI_LV_INIT))
@@ -406,21 +406,29 @@ AcpiNsInitOneDevice (
Info->DeviceCount++;
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
Node = AcpiNsMapHandleToNode (ObjHandle);
if (!Node)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/*
* Run _STA to determine if we can run _INI on the device.
*/
- DEBUG_EXEC (AcpiUtDisplayInitPathname (Node, "_STA [Method]"));
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (Node, "_STA [Method]"));
Status = AcpiUtExecute_STA (Node, &Flags);
if (ACPI_FAILURE (Status))
{
@@ -442,7 +450,7 @@ AcpiNsInitOneDevice (
/*
* The device is present. Run _INI.
*/
- DEBUG_EXEC (AcpiUtDisplayInitPathname (ObjHandle, "_INI [Method]"));
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ObjHandle, "_INI [Method]"));
Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL);
if (AE_NOT_FOUND == Status)
{
@@ -456,7 +464,7 @@ AcpiNsInitOneDevice (
/* Ignore error and move on to next device */
#ifdef ACPI_DEBUG
- NATIVE_CHAR *ScopeName = AcpiNsGetTablePathname (ObjHandle);
+ NATIVE_CHAR *ScopeName = AcpiNsGetExternalPathname (ObjHandle);
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
ScopeName, AcpiFormatException (Status)));
diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c
index f3de362..00aceb0 100644
--- a/sys/contrib/dev/acpica/nsload.c
+++ b/sys/contrib/dev/acpica/nsload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 48 $
+ * $Revision: 53 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,14 +126,14 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsload")
+ ACPI_MODULE_NAME ("nsload")
/*******************************************************************************
*
* FUNCTION: AcpiLoadNamespace
*
- * PARAMETERS: DisplayAmlDuringLoad
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -149,7 +149,7 @@ AcpiNsLoadNamespace (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiLoadNameSpace");
+ ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
/* There must be at least a DSDT installed */
@@ -160,7 +160,6 @@ AcpiNsLoadNamespace (
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
-
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
@@ -176,12 +175,10 @@ AcpiNsLoadNamespace (
AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
-
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"ACPI Namespace successfully loaded at root %p\n",
AcpiGbl_RootNode));
-
return_ACPI_STATUS (Status);
}
@@ -190,11 +187,12 @@ AcpiNsLoadNamespace (
*
* FUNCTION: AcpiNsOneParsePass
*
- * PARAMETERS:
+ * PARAMETERS: PassNumber - 1 or 2
+ * TableDesc - The table to be parsed.
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
@@ -208,7 +206,7 @@ AcpiNsOneCompleteParse (
ACPI_WALK_STATE *WalkState;
- FUNCTION_TRACE ("NsOneCompleteParse");
+ ACPI_FUNCTION_TRACE ("NsOneCompleteParse");
/* Create and init a Root Node */
@@ -221,7 +219,6 @@ AcpiNsOneCompleteParse (
((ACPI_PARSE2_OBJECT *) ParseRoot)->Name = ACPI_ROOT_NAME;
-
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
@@ -271,7 +268,7 @@ AcpiNsParseTable (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsParseTable");
+ ACPI_FUNCTION_TRACE ("NsParseTable");
/*
@@ -290,7 +287,6 @@ AcpiNsParseTable (
return_ACPI_STATUS (Status);
}
-
/*
* AML Parse, pass 2
*
@@ -331,8 +327,19 @@ AcpiNsLoadTable (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsLoadTable");
+ ACPI_FUNCTION_TRACE ("NsLoadTable");
+
+
+ /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
+
+ if (!(AcpiGbl_AcpiTableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
+ {
+ /* Just ignore this table */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ /* Check validity of the AML start and length */
if (!TableDesc->AmlStart)
{
@@ -342,14 +349,12 @@ AcpiNsLoadTable (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart));
-
if (!TableDesc->AmlLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Parse the table and load the namespace with all named
* objects found within. Control methods are NOT parsed
@@ -361,9 +366,14 @@ AcpiNsLoadTable (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
Status = AcpiNsParseTable (TableDesc, Node->Child);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@@ -407,15 +417,18 @@ AcpiNsLoadTableByType (
ACPI_TABLE_TYPE TableType)
{
UINT32 i;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
ACPI_TABLE_DESC *TableDesc;
- FUNCTION_TRACE ("NsLoadTableByType");
-
+ ACPI_FUNCTION_TRACE ("NsLoadTableByType");
- AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/*
* Table types supported are:
@@ -423,7 +436,6 @@ AcpiNsLoadTableByType (
*/
switch (TableType)
{
-
case ACPI_TABLE_DSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
@@ -519,11 +531,8 @@ AcpiNsLoadTableByType (
UnlockAndExit:
-
- AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
-
}
@@ -538,8 +547,8 @@ UnlockAndExit:
* DESCRIPTION: Walks the namespace starting at the given handle and deletes
* all objects, entries, and scopes in the entire subtree.
*
- * TBD: [Investigate] What if any part of this subtree is in use?
- * (i.e. on one of the object stacks?)
+ * Namespace/Interpreter should be locked or the subsystem should
+ * be in shutdown before this routine is called.
*
******************************************************************************/
@@ -555,7 +564,7 @@ AcpiNsDeleteSubtree (
UINT32 Level;
- FUNCTION_TRACE ("NsDeleteSubtree");
+ ACPI_FUNCTION_TRACE ("NsDeleteSubtree");
ParentHandle = StartHandle;
@@ -575,7 +584,6 @@ AcpiNsDeleteSubtree (
ChildHandle = NextChildHandle;
-
/* Did we get a new object? */
if (ACPI_SUCCESS (Status))
@@ -594,7 +602,6 @@ AcpiNsDeleteSubtree (
ChildHandle = 0;
}
}
-
else
{
/*
@@ -641,7 +648,7 @@ AcpiNsUnloadNamespace (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsUnloadNameSpace");
+ ACPI_FUNCTION_TRACE ("NsUnloadNameSpace");
/* Parameter validation */
@@ -656,7 +663,6 @@ AcpiNsUnloadNamespace (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* This function does the real work */
Status = AcpiNsDeleteSubtree (Handle);
diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c
index 644141c..19059c7 100644
--- a/sys/contrib/dev/acpica/nsnames.c
+++ b/sys/contrib/dev/acpica/nsnames.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 65 $
+ * $Revision: 74 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,97 +123,127 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsnames")
+ ACPI_MODULE_NAME ("nsnames")
/*******************************************************************************
*
- * FUNCTION: AcpiNsGetTablePathname
+ * FUNCTION: AcpiNsBuildExternalPath
*
- * PARAMETERS: Node - Scope whose name is needed
+ * PARAMETERS: Node - NS node whose pathname is needed
+ * Size - Size of the pathname
+ * *NameBuffer - Where to return the pathname
*
- * RETURN: Pointer to storage containing the fully qualified name of
- * the scope, in Label format (all segments strung together
- * with no separators)
+ * RETURN: Places the pathname into the NameBuffer, in external format
+ * (name segments separated by path separators)
*
- * DESCRIPTION: Used for debug printing in AcpiNsSearchTable().
+ * DESCRIPTION: Generate a full pathaname
*
******************************************************************************/
-NATIVE_CHAR *
-AcpiNsGetTablePathname (
- ACPI_NAMESPACE_NODE *Node)
+void
+AcpiNsBuildExternalPath (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_SIZE Size,
+ NATIVE_CHAR *NameBuffer)
{
- NATIVE_CHAR *NameBuffer;
- UINT32 Size;
- ACPI_NAME Name;
- ACPI_NAMESPACE_NODE *ChildNode;
+ UINT32 Index;
ACPI_NAMESPACE_NODE *ParentNode;
- FUNCTION_TRACE_PTR ("NsGetTablePathname", Node);
+ ACPI_FUNCTION_NAME ("NsBuildExternalPath");
- if (!AcpiGbl_RootNode || !Node)
+ /* Special case for root */
+
+ Index = Size - 1;
+ if (Index < ACPI_NAME_SIZE)
{
- /*
- * If the name space has not been initialized,
- * this function should not have been called.
- */
- return_PTR (NULL);
+ NameBuffer[0] = AML_ROOT_PREFIX;
+ NameBuffer[1] = 0;
+ return;
}
- ChildNode = Node->Child;
+ /* Store terminator byte, then build name backwards */
+ ParentNode = Node;
+ NameBuffer[Index] = 0;
- /* Calculate required buffer size based on depth below root */
-
- Size = 1;
- ParentNode = ChildNode;
- while (ParentNode)
+ while ((Index > ACPI_NAME_SIZE) && (ParentNode != AcpiGbl_RootNode))
{
- ParentNode = AcpiNsGetParentObject (ParentNode);
- if (ParentNode)
- {
- Size += ACPI_NAME_SIZE;
- }
+ Index -= ACPI_NAME_SIZE;
+
+ /* Put the name into the buffer */
+
+ ACPI_MOVE_UNALIGNED32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+
+ /* Prefix name with the path separator */
+
+ Index--;
+ NameBuffer[Index] = PATH_SEPARATOR;
}
+ /* Overwrite final separator with the root prefix character */
- /* Allocate a buffer to be returned to caller */
+ NameBuffer[Index] = AML_ROOT_PREFIX;
- NameBuffer = ACPI_MEM_CALLOCATE (Size + 1);
- if (!NameBuffer)
+ if (Index != 0)
{
- REPORT_ERROR (("NsGetTablePathname: allocation failure\n"));
- return_PTR (NULL);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+ Index, Size, &NameBuffer[Size]));
}
+ return;
+}
- /* Store terminator byte, then build name backwards */
- NameBuffer[Size] = '\0';
- while ((Size > ACPI_NAME_SIZE) &&
- AcpiNsGetParentObject (ChildNode))
- {
- Size -= ACPI_NAME_SIZE;
- Name = AcpiNsFindParentName (ChildNode);
+#ifdef ACPI_DEBUG
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetExternalPathname
+ *
+ * PARAMETERS: Node - NS node whose pathname is needed
+ *
+ * RETURN: Pointer to storage containing the fully qualified name of
+ * the node, In external format (name segments separated by path
+ * separators.)
+ *
+ * DESCRIPTION: Used for debug printing in AcpiNsSearchTable().
+ *
+ ******************************************************************************/
- /* Put the name into the buffer */
+NATIVE_CHAR *
+AcpiNsGetExternalPathname (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ NATIVE_CHAR *NameBuffer;
+ ACPI_SIZE Size;
- MOVE_UNALIGNED32_TO_32 ((NameBuffer + Size), &Name);
- ChildNode = AcpiNsGetParentObject (ChildNode);
- }
- NameBuffer[--Size] = AML_ROOT_PREFIX;
+ ACPI_FUNCTION_TRACE_PTR ("NsGetExternalPathname", Node);
+
+
+ /* Calculate required buffer size based on depth below root */
- if (Size != 0)
+ Size = AcpiNsGetPathnameLength (Node);
+
+ /* Allocate a buffer to be returned to caller */
+
+ NameBuffer = ACPI_MEM_CALLOCATE (Size);
+ if (!NameBuffer)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad pointer returned; size=%X\n", Size));
+ ACPI_REPORT_ERROR (("NsGetTablePathname: allocation failure\n"));
+ return_PTR (NULL);
}
+ /* Build the path in the allocated buffer */
+
+ AcpiNsBuildExternalPath (Node, Size, NameBuffer);
return_PTR (NameBuffer);
}
+#endif
/*******************************************************************************
@@ -228,26 +258,28 @@ AcpiNsGetTablePathname (
*
******************************************************************************/
-UINT32
+ACPI_SIZE
AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node)
{
- UINT32 Size;
+ ACPI_SIZE Size;
ACPI_NAMESPACE_NODE *NextNode;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
- for (Size = 0, NextNode = Node;
- AcpiNsGetParentObject (NextNode);
- NextNode = AcpiNsGetParentObject (NextNode))
+ Size = 0;
+ NextNode = Node;
+
+ while (NextNode != AcpiGbl_RootNode)
{
Size += PATH_SEGMENT_LENGTH;
+ NextNode = AcpiNsGetParentNode (NextNode);
}
return (Size + 1);
@@ -260,107 +292,51 @@ AcpiNsGetPathnameLength (
*
* PARAMETERS: TargetHandle - Handle of named object whose name is
* to be found
- * BufSize - Size of the buffer provided
- * UserBuffer - Where the pathname is returned
+ * Buffer - Where the pathname is returned
*
* RETURN: Status, Buffer is filled with pathname if status is AE_OK
*
* DESCRIPTION: Build and return a full namespace pathname
*
- * MUTEX: Locks Namespace
- *
******************************************************************************/
ACPI_STATUS
AcpiNsHandleToPathname (
ACPI_HANDLE TargetHandle,
- UINT32 *BufSize,
- NATIVE_CHAR *UserBuffer)
+ ACPI_BUFFER *Buffer)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
- UINT32 PathLength;
- UINT32 UserBufSize;
- ACPI_NAME Name;
- UINT32 Size;
+ ACPI_SIZE RequiredSize;
- FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
+ ACPI_FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
- if (!AcpiGbl_RootNode)
- {
- /*
- * If the name space has not been initialized,
- * this function should not have been called.
- */
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
-
Node = AcpiNsMapHandleToNode (TargetHandle);
if (!Node)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Determine size required for the caller buffer */
- /* Set return length to the required path length */
-
- PathLength = AcpiNsGetPathnameLength (Node);
- Size = PathLength - 1;
+ RequiredSize = AcpiNsGetPathnameLength (Node);
- UserBufSize = *BufSize;
- *BufSize = PathLength;
+ /* Validate/Allocate/Clear caller buffer */
- /* Check if the user buffer is sufficiently large */
-
- if (PathLength > UserBufSize)
- {
- Status = AE_BUFFER_OVERFLOW;
- goto Exit;
- }
-
- if (Size < ACPI_NAME_SIZE)
- {
- UserBuffer[0] = '\\';
- UserBuffer[1] = 0;
- goto Exit;
- }
-
- /* Store null terminator */
-
- UserBuffer[Size] = 0;
- Size -= ACPI_NAME_SIZE;
-
- /* Put the original ACPI name at the end of the path */
-
- MOVE_UNALIGNED32_TO_32 ((UserBuffer + Size),
- &Node->Name);
-
- UserBuffer[--Size] = PATH_SEPARATOR;
-
- /* Build name backwards, putting "." between segments */
-
- while ((Size > ACPI_NAME_SIZE) && Node)
+ Status = AcpiUtInitializeBuffer (Buffer, RequiredSize);
+ if (ACPI_FAILURE (Status))
{
- Size -= ACPI_NAME_SIZE;
- Name = AcpiNsFindParentName (Node);
- MOVE_UNALIGNED32_TO_32 ((UserBuffer + Size), &Name);
-
- UserBuffer[--Size] = PATH_SEPARATOR;
- Node = AcpiNsGetParentObject (Node);
+ return_ACPI_STATUS (Status);
}
- /*
- * Overlay the "." preceding the first segment with
- * the root name "\"
- */
- UserBuffer[Size] = '\\';
+ /* Build the path in the caller buffer */
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Len=%X, %s \n", PathLength, UserBuffer));
+ AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
-Exit:
- return_ACPI_STATUS (Status);
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, RequiredSize));
+ return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c
index a6166c5..6ba1338 100644
--- a/sys/contrib/dev/acpica/nsobject.c
+++ b/sys/contrib/dev/acpica/nsobject.c
@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
- * $Revision: 73 $
+ * $Revision: 78 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,7 +126,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsobject")
+ ACPI_MODULE_NAME ("nsobject")
/*******************************************************************************
@@ -152,14 +152,14 @@ ACPI_STATUS
AcpiNsAttachObject (
ACPI_NAMESPACE_NODE *Node,
ACPI_OPERAND_OBJECT *Object,
- ACPI_OBJECT_TYPE8 Type)
+ ACPI_OBJECT_TYPE Type)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *LastObjDesc;
- ACPI_OBJECT_TYPE8 ObjectType = ACPI_TYPE_ANY;
+ ACPI_OBJECT_TYPE ObjectType = ACPI_TYPE_ANY;
- FUNCTION_TRACE ("NsAttachObject");
+ ACPI_FUNCTION_TRACE ("NsAttachObject");
/*
@@ -169,7 +169,7 @@ AcpiNsAttachObject (
{
/* Invalid handle */
- REPORT_ERROR (("NsAttachObject: Null NamedObj handle\n"));
+ ACPI_REPORT_ERROR (("NsAttachObject: Null NamedObj handle\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -177,15 +177,15 @@ AcpiNsAttachObject (
{
/* Null object */
- REPORT_ERROR (("NsAttachObject: Null object, but type not ACPI_TYPE_ANY\n"));
+ ACPI_REPORT_ERROR (("NsAttachObject: Null object, but type not ACPI_TYPE_ANY\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (!VALID_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
/* Not a name handle */
- REPORT_ERROR (("NsAttachObject: Invalid handle\n"));
+ ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -211,7 +211,7 @@ AcpiNsAttachObject (
* If the source object is a namespace Node with an attached object,
* we will use that (attached) object
*/
- else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED) &&
+ else if ((ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) &&
((ACPI_NAMESPACE_NODE *) Object)->Object)
{
/*
@@ -259,7 +259,7 @@ AcpiNsAttachObject (
}
- /*
+ /*
* Handle objects with multiple descriptors - walk
* to the end of the descriptor list
*/
@@ -301,7 +301,7 @@ AcpiNsDetachObject (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE ("NsDetachObject");
+ ACPI_FUNCTION_TRACE ("NsDetachObject");
ObjDesc = Node->Object;
@@ -314,7 +314,7 @@ AcpiNsDetachObject (
/* Clear the entry in all cases */
Node->Object = NULL;
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_INTERNAL)
{
Node->Object = ObjDesc->Common.NextObject;
if (Node->Object &&
@@ -328,8 +328,8 @@ AcpiNsDetachObject (
Node->Type = ACPI_TYPE_ANY;
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object=%p Value=%p Name %4.4s\n",
- Node, ObjDesc, (char *) &Node->Name));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Node %p [%4.4s] Object %p\n",
+ Node, (char *) &Node->Name, ObjDesc));
/* Remove one reference on the object (and all subobjects) */
@@ -353,7 +353,7 @@ ACPI_OPERAND_OBJECT *
AcpiNsGetAttachedObject (
ACPI_NAMESPACE_NODE *Node)
{
- FUNCTION_TRACE_PTR ("NsGetAttachedObject", Node);
+ ACPI_FUNCTION_TRACE_PTR ("NsGetAttachedObject", Node);
if (!Node)
@@ -363,8 +363,8 @@ AcpiNsGetAttachedObject (
}
if (!Node->Object ||
- ((!(VALID_DESCRIPTOR_TYPE (Node->Object, ACPI_DESC_TYPE_INTERNAL))) &&
- (!(VALID_DESCRIPTOR_TYPE (Node->Object, ACPI_DESC_TYPE_NAMED)))) ||
+ ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_INTERNAL) &&
+ (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) ||
(Node->Object->Common.Type == INTERNAL_TYPE_DATA))
{
return_PTR (NULL);
@@ -389,7 +389,7 @@ ACPI_OPERAND_OBJECT *
AcpiNsGetSecondaryObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
- FUNCTION_TRACE_PTR ("AcpiNsGetSecondaryObject", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR ("AcpiNsGetSecondaryObject", ObjDesc);
if ((!ObjDesc) ||
@@ -408,11 +408,11 @@ AcpiNsGetSecondaryObject (
*
* FUNCTION: AcpiNsAttachData
*
- * PARAMETERS:
+ * PARAMETERS:
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION:
*
******************************************************************************/
@@ -427,7 +427,6 @@ AcpiNsAttachData (
ACPI_OPERAND_OBJECT *DataDesc;
-
/* */
PrevObjDesc = NULL;
ObjDesc = Node->Object;
@@ -475,11 +474,11 @@ AcpiNsAttachData (
*
* FUNCTION: AcpiNsDetachData
*
- * PARAMETERS:
+ * PARAMETERS:
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION:
*
******************************************************************************/
@@ -520,16 +519,15 @@ AcpiNsDetachData (
}
-
/*******************************************************************************
*
* FUNCTION: AcpiNsGetAttachedData
*
- * PARAMETERS:
+ * PARAMETERS:
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION:
*
******************************************************************************/
@@ -559,4 +557,3 @@ AcpiNsGetAttachedData (
}
-
diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c
index 0ca44cc..3944ee5 100644
--- a/sys/contrib/dev/acpica/nssearch.c
+++ b/sys/contrib/dev/acpica/nssearch.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 77 $
+ * $Revision: 82 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nssearch")
+ ACPI_MODULE_NAME ("nssearch")
/*******************************************************************************
@@ -156,13 +156,13 @@ ACPI_STATUS
AcpiNsSearchNode (
UINT32 TargetName,
ACPI_NAMESPACE_NODE *Node,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_NAMESPACE_NODE *NextNode;
- FUNCTION_TRACE ("NsSearchNode");
+ ACPI_FUNCTION_TRACE ("NsSearchNode");
#ifdef ACPI_DEBUG
@@ -170,11 +170,11 @@ AcpiNsSearchNode (
{
NATIVE_CHAR *ScopeName;
- ScopeName = AcpiNsGetTablePathname (Node);
+ ScopeName = AcpiNsGetExternalPathname (Node);
if (ScopeName)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %X)\n",
- ScopeName, Node, (char *) &TargetName, Type));
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %s)\n",
+ ScopeName, Node, (char *) &TargetName, AcpiUtGetTypeName (Type)));
ACPI_MEM_FREE (ScopeName);
}
@@ -281,17 +281,17 @@ static ACPI_STATUS
AcpiNsSearchParentTree (
UINT32 TargetName,
ACPI_NAMESPACE_NODE *Node,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *ParentNode;
- FUNCTION_TRACE ("NsSearchParentTree");
+ ACPI_FUNCTION_TRACE ("NsSearchParentTree");
- ParentNode = AcpiNsGetParentObject (Node);
+ ParentNode = AcpiNsGetParentNode (Node);
/*
* If there is no parent (at the root) or type is "local", we won't be
@@ -325,9 +325,9 @@ AcpiNsSearchParentTree (
*/
while (ParentNode)
{
- /*
+ /*
* Search parent scope. Use TYPE_ANY because we don't care about the
- * object type at this point, we only care about the existence of
+ * object type at this point, we only care about the existence of
* the actual name we are searching for. Typechecking comes later.
*/
Status = AcpiNsSearchNode (TargetName, ParentNode,
@@ -341,7 +341,7 @@ AcpiNsSearchParentTree (
* Not found here, go up another level
* (until we reach the root)
*/
- ParentNode = AcpiNsGetParentObject (ParentNode);
+ ParentNode = AcpiNsGetParentNode (ParentNode);
}
/* Not found in parent tree */
@@ -380,8 +380,8 @@ AcpiNsSearchAndEnter (
UINT32 TargetName,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE *Node,
- OPERATING_MODE InterpreterMode,
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_INTERPRETER_MODE InterpreterMode,
+ ACPI_OBJECT_TYPE Type,
UINT32 Flags,
ACPI_NAMESPACE_NODE **ReturnNode)
{
@@ -389,7 +389,7 @@ AcpiNsSearchAndEnter (
ACPI_NAMESPACE_NODE *NewNode;
- FUNCTION_TRACE ("NsSearchAndEnter");
+ ACPI_FUNCTION_TRACE ("NsSearchAndEnter");
/* Parameter validation */
@@ -399,7 +399,7 @@ AcpiNsSearchAndEnter (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param- Table %p Name %X Return %p\n",
Node, TargetName, ReturnNode));
- REPORT_ERROR (("NsSearchAndEnter: bad (null) parameter\n"));
+ ACPI_REPORT_ERROR (("NsSearchAndEnter: bad (null) parameter\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -410,13 +410,13 @@ AcpiNsSearchAndEnter (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08x *** \n",
TargetName));
- REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name\n"));
+ ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name\n"));
return_ACPI_STATUS (AE_BAD_CHARACTER);
}
/* Try to find the name in the table specified by the caller */
- *ReturnNode = ENTRY_NOT_FOUND;
+ *ReturnNode = ACPI_ENTRY_NOT_FOUND;
Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode);
if (Status != AE_NOT_FOUND)
{
@@ -425,7 +425,7 @@ AcpiNsSearchAndEnter (
* return the error
*/
if ((Status == AE_OK) &&
- (Flags & NS_ERROR_IF_FOUND))
+ (Flags & ACPI_NS_ERROR_IF_FOUND))
{
Status = AE_ALREADY_EXISTS;
}
@@ -446,8 +446,8 @@ AcpiNsSearchAndEnter (
* the search when namespace references are being resolved
* (load pass 2) and during the execution phase.
*/
- if ((InterpreterMode != IMODE_LOAD_PASS1) &&
- (Flags & NS_SEARCH_PARENT))
+ if ((InterpreterMode != ACPI_IMODE_LOAD_PASS1) &&
+ (Flags & ACPI_NS_SEARCH_PARENT))
{
/*
* Not found in table - search parent tree according
@@ -464,7 +464,7 @@ AcpiNsSearchAndEnter (
/*
* In execute mode, just search, never add names. Exit now.
*/
- if (InterpreterMode == IMODE_EXECUTE)
+ if (InterpreterMode == ACPI_IMODE_EXECUTE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n",
(char *) &TargetName, Node));
diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c
index c3d7cc1..f2966f9 100644
--- a/sys/contrib/dev/acpica/nsutils.c
+++ b/sys/contrib/dev/acpica/nsutils.c
@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 93 $
+ * $Revision: 104 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include "actables.h"
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsutils")
+ ACPI_MODULE_NAME ("nsutils")
/*******************************************************************************
@@ -179,20 +179,20 @@ AcpiNsValidPathSeparator (
*
******************************************************************************/
-ACPI_OBJECT_TYPE8
+ACPI_OBJECT_TYPE
AcpiNsGetType (
ACPI_NAMESPACE_NODE *Node)
{
- FUNCTION_TRACE ("NsGetType");
+ ACPI_FUNCTION_TRACE ("NsGetType");
if (!Node)
{
- REPORT_WARNING (("NsGetType: Null Node ptr"));
+ ACPI_REPORT_WARNING (("NsGetType: Null Node ptr"));
return_VALUE (ACPI_TYPE_ANY);
}
- return_VALUE (Node->Type);
+ return_VALUE ((ACPI_OBJECT_TYPE) Node->Type);
}
@@ -209,20 +209,20 @@ AcpiNsGetType (
UINT32
AcpiNsLocal (
- ACPI_OBJECT_TYPE8 Type)
+ ACPI_OBJECT_TYPE Type)
{
- FUNCTION_TRACE ("NsLocal");
+ ACPI_FUNCTION_TRACE ("NsLocal");
if (!AcpiUtValidObjectType (Type))
{
/* Type code out of range */
- REPORT_WARNING (("NsLocal: Invalid Object Type\n"));
- return_VALUE (NSP_NORMAL);
+ ACPI_REPORT_WARNING (("NsLocal: Invalid Object Type\n"));
+ return_VALUE (ACPI_NS_NORMAL);
}
- return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & NSP_LOCAL);
+ return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
}
@@ -248,7 +248,7 @@ AcpiNsGetInternalNameLength (
UINT32 i;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
NextExternalChar = Info->ExternalName;
@@ -270,7 +270,6 @@ AcpiNsGetInternalNameLength (
Info->FullyQualified = TRUE;
NextExternalChar++;
}
-
else
{
/*
@@ -334,7 +333,7 @@ AcpiNsBuildInternalName (
UINT32 i;
- FUNCTION_TRACE ("NsBuildInternalName");
+ ACPI_FUNCTION_TRACE ("NsBuildInternalName");
/* Setup the correct prefixes, counts, and pointers */
@@ -375,17 +374,15 @@ AcpiNsBuildInternalName (
}
}
- if (NumSegments == 1)
+ if (NumSegments <= 1)
{
Result = &InternalName[i];
}
-
else if (NumSegments == 2)
{
InternalName[i] = AML_DUAL_NAME_PREFIX;
Result = &InternalName[i+1];
}
-
else
{
InternalName[i] = AML_MULTI_NAME_PREFIX_OP;
@@ -408,12 +405,11 @@ AcpiNsBuildInternalName (
Result[i] = '_';
}
-
else
{
/* Convert the character to uppercase and save it */
- Result[i] = (char) TOUPPER (*ExternalName);
+ Result[i] = (char) ACPI_TOUPPER (*ExternalName);
ExternalName++;
}
}
@@ -432,7 +428,6 @@ AcpiNsBuildInternalName (
Result += ACPI_NAME_SIZE;
}
-
/* Terminate the string */
*Result = 0;
@@ -477,7 +472,7 @@ AcpiNsInternalizeName (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsInternalizeName");
+ ACPI_FUNCTION_TRACE ("NsInternalizeName");
if ((!ExternalName) ||
@@ -487,7 +482,6 @@ AcpiNsInternalizeName (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Get the length of the new internal name */
Info.ExternalName = ExternalName;
@@ -540,23 +534,22 @@ AcpiNsExternalizeName (
{
UINT32 PrefixLength = 0;
UINT32 NamesIndex = 0;
- UINT32 NamesCount = 0;
+ UINT32 NumSegments = 0;
UINT32 i = 0;
UINT32 j = 0;
+ UINT32 RequiredLength;
- FUNCTION_TRACE ("NsExternalizeName");
+ ACPI_FUNCTION_TRACE ("NsExternalizeName");
if (!InternalNameLength ||
!InternalName ||
- !ConvertedNameLength ||
!ConvertedName)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Check for a prefix (one '\' | one or more '^').
*/
@@ -591,36 +584,36 @@ AcpiNsExternalizeName (
{
switch (InternalName[PrefixLength])
{
+ case AML_MULTI_NAME_PREFIX_OP:
- /* <count> 4-byte names */
+ /* <count> 4-byte names */
- case AML_MULTI_NAME_PREFIX_OP:
NamesIndex = PrefixLength + 2;
- NamesCount = (UINT32) InternalName[PrefixLength + 1];
+ NumSegments = (UINT32) (UINT8) InternalName[PrefixLength + 1];
break;
+ case AML_DUAL_NAME_PREFIX:
- /* two 4-byte names */
+ /* Two 4-byte names */
- case AML_DUAL_NAME_PREFIX:
NamesIndex = PrefixLength + 1;
- NamesCount = 2;
+ NumSegments = 2;
break;
+ case 0:
- /* NullName */
+ /* NullName */
- case 0:
NamesIndex = 0;
- NamesCount = 0;
+ NumSegments = 0;
break;
+ default:
- /* one 4-byte name */
+ /* one 4-byte name */
- default:
NamesIndex = PrefixLength;
- NamesCount = 1;
+ NumSegments = 1;
break;
}
}
@@ -630,24 +623,23 @@ AcpiNsExternalizeName (
* of the prefix, length of all object names, length of any required
* punctuation ('.') between object names, plus the NULL terminator.
*/
- *ConvertedNameLength = PrefixLength + (4 * NamesCount) +
- ((NamesCount > 0) ? (NamesCount - 1) : 0) + 1;
+ RequiredLength = PrefixLength + (4 * NumSegments) +
+ ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1;
/*
* Check to see if we're still in bounds. If not, there's a problem
* with InternalName (invalid format).
*/
- if (*ConvertedNameLength > InternalNameLength)
+ if (RequiredLength > InternalNameLength)
{
- REPORT_ERROR (("NsExternalizeName: Invalid internal name\n"));
+ ACPI_REPORT_ERROR (("NsExternalizeName: Invalid internal name\n"));
return_ACPI_STATUS (AE_BAD_PATHNAME);
}
/*
* Build ConvertedName...
*/
-
- (*ConvertedName) = ACPI_MEM_CALLOCATE (*ConvertedNameLength);
+ *ConvertedName = ACPI_MEM_CALLOCATE (RequiredLength);
if (!(*ConvertedName))
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -660,9 +652,9 @@ AcpiNsExternalizeName (
(*ConvertedName)[j++] = InternalName[i];
}
- if (NamesCount > 0)
+ if (NumSegments > 0)
{
- for (i = 0; i < NamesCount; i++)
+ for (i = 0; i < NumSegments; i++)
{
if (i > 0)
{
@@ -676,6 +668,11 @@ AcpiNsExternalizeName (
}
}
+ if (ConvertedNameLength)
+ {
+ *ConvertedNameLength = RequiredLength;
+ }
+
return_ACPI_STATUS (AE_OK);
}
@@ -700,7 +697,7 @@ AcpiNsMapHandleToNode (
ACPI_HANDLE Handle)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -718,7 +715,7 @@ AcpiNsMapHandleToNode (
/* We can at least attempt to verify the handle */
- if (!VALID_DESCRIPTOR_TYPE (Handle, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Handle) != ACPI_DESC_TYPE_NAMED)
{
return (NULL);
}
@@ -788,7 +785,7 @@ AcpiNsTerminate (void)
ACPI_NAMESPACE_NODE *ThisNode;
- FUNCTION_TRACE ("NsTerminate");
+ ACPI_FUNCTION_TRACE ("NsTerminate");
ThisNode = AcpiGbl_RootNode;
@@ -837,26 +834,26 @@ AcpiNsTerminate (void)
UINT32
AcpiNsOpensScope (
- ACPI_OBJECT_TYPE8 Type)
+ ACPI_OBJECT_TYPE Type)
{
- FUNCTION_TRACE_U32 ("NsOpensScope", Type);
+ ACPI_FUNCTION_TRACE_U32 ("NsOpensScope", Type);
if (!AcpiUtValidObjectType (Type))
{
/* type code out of range */
- REPORT_WARNING (("NsOpensScope: Invalid Object Type\n"));
- return_VALUE (NSP_NORMAL);
+ ACPI_REPORT_WARNING (("NsOpensScope: Invalid Object Type %X\n", Type));
+ return_VALUE (ACPI_NS_NORMAL);
}
- return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & NSP_NEWSCOPE);
+ return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
}
/*******************************************************************************
*
- * FUNCTION: AcpiNsGetNode
+ * FUNCTION: AcpiNsGetNodeByPath
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
@@ -865,6 +862,8 @@ AcpiNsOpensScope (
* root of the name space. If Name is fully
* qualified (first INT8 is '\'), the passed value
* of Scope will not be accessed.
+ * Flags - Used to indicate whether to perform upsearch or
+ * not.
* ReturnNode - Where the Node is returned
*
* DESCRIPTION: Look up a name relative to a given scope and return the
@@ -875,9 +874,10 @@ AcpiNsOpensScope (
******************************************************************************/
ACPI_STATUS
-AcpiNsGetNode (
+AcpiNsGetNodeByPath (
NATIVE_CHAR *Pathname,
ACPI_NAMESPACE_NODE *StartNode,
+ UINT32 Flags,
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_GENERIC_STATE ScopeInfo;
@@ -885,22 +885,14 @@ AcpiNsGetNode (
NATIVE_CHAR *InternalPath = NULL;
- FUNCTION_TRACE_PTR ("NsGetNode", Pathname);
+ ACPI_FUNCTION_TRACE_PTR ("NsGetNodeByPath", Pathname);
- /* Ensure that the namespace has been initialized */
-
- if (!AcpiGbl_RootNode)
- {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
-
if (!Pathname)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* Convert path to internal representation */
Status = AcpiNsInternalizeName (Pathname, &InternalPath);
@@ -909,8 +901,13 @@ AcpiNsGetNode (
return_ACPI_STATUS (Status);
}
+ /* Must lock namespace during lookup */
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Setup lookup scope (search starting point) */
@@ -919,21 +916,18 @@ AcpiNsGetNode (
/* Lookup the name in the namespace */
Status = AcpiNsLookup (&ScopeInfo, InternalPath,
- ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ (Flags | ACPI_NS_DONT_OPEN_SCOPE),
NULL, ReturnNode);
-
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
InternalPath, AcpiFormatException (Status)));
}
-
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
/* Cleanup */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
ACPI_MEM_FREE (InternalPath);
return_ACPI_STATUS (Status);
}
@@ -960,18 +954,19 @@ AcpiNsFindParentName (
ACPI_NAMESPACE_NODE *ParentNode;
- FUNCTION_TRACE ("NsFindParentName");
+ ACPI_FUNCTION_TRACE ("NsFindParentName");
if (ChildNode)
{
/* Valid entry. Get the parent Node */
- ParentNode = AcpiNsGetParentObject (ChildNode);
+ ParentNode = AcpiNsGetParentNode (ChildNode);
if (ParentNode)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n",
- ChildNode, (char*)&ChildNode->Name, ParentNode, (char*)&ParentNode->Name));
+ ChildNode, (char *) &ChildNode->Name,
+ ParentNode, (char *) &ParentNode->Name));
if (ParentNode->Name)
{
@@ -980,7 +975,7 @@ AcpiNsFindParentName (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n",
- ChildNode, (char*)&ChildNode->Name));
+ ChildNode, (char *) &ChildNode->Name));
}
return_VALUE (ACPI_UNKNOWN_NAME);
@@ -1028,7 +1023,7 @@ AcpiNsExistDownstreamSibling (
/*******************************************************************************
*
- * FUNCTION: AcpiNsGetParentObject
+ * FUNCTION: AcpiNsGetParentNode
*
* PARAMETERS: Node - Current table entry
*
@@ -1040,12 +1035,10 @@ AcpiNsExistDownstreamSibling (
ACPI_NAMESPACE_NODE *
-AcpiNsGetParentObject (
+AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node)
{
-
-
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!Node)
diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/nswalk.c
index c39e7a3..06741d0 100644
--- a/sys/contrib/dev/acpica/nswalk.c
+++ b/sys/contrib/dev/acpica/nswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 26 $
+ * $Revision: 32 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nswalk")
+ ACPI_MODULE_NAME ("nswalk")
/*******************************************************************************
@@ -147,14 +147,14 @@
ACPI_NAMESPACE_NODE *
AcpiNsGetNextNode (
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_NAMESPACE_NODE *ChildNode)
{
ACPI_NAMESPACE_NODE *NextNode = NULL;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!ChildNode)
@@ -237,7 +237,7 @@ AcpiNsGetNextNode (
ACPI_STATUS
AcpiNsWalkNamespace (
- ACPI_OBJECT_TYPE8 Type,
+ ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartNode,
UINT32 MaxDepth,
BOOLEAN UnlockBeforeCallback,
@@ -248,11 +248,11 @@ AcpiNsWalkNamespace (
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_OBJECT_TYPE8 ChildType;
+ ACPI_OBJECT_TYPE ChildType;
UINT32 Level;
- FUNCTION_TRACE ("NsWalkNamespace");
+ ACPI_FUNCTION_TRACE ("NsWalkNamespace");
/* Special case for the namespace Root Node */
@@ -299,7 +299,11 @@ AcpiNsWalkNamespace (
*/
if (UnlockBeforeCallback)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
Status = UserFunction (ChildNode, Level,
@@ -307,7 +311,11 @@ AcpiNsWalkNamespace (
if (UnlockBeforeCallback)
{
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
switch (Status)
@@ -323,14 +331,12 @@ AcpiNsWalkNamespace (
/* Exit now, with OK status */
return_ACPI_STATUS (AE_OK);
- break;
default:
/* All others are valid exceptions */
return_ACPI_STATUS (Status);
- break;
}
}
@@ -356,7 +362,6 @@ AcpiNsWalkNamespace (
}
}
}
-
else
{
/*
@@ -366,7 +371,7 @@ AcpiNsWalkNamespace (
*/
Level--;
ChildNode = ParentNode;
- ParentNode = AcpiNsGetParentObject (ParentNode);
+ ParentNode = AcpiNsGetParentNode (ParentNode);
}
}
diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c
index 3b2f194..c6555a1 100644
--- a/sys/contrib/dev/acpica/nsxfname.c
+++ b/sys/contrib/dev/acpica/nsxfname.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 82 $
+ * $Revision: 89 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsxfname")
+ ACPI_MODULE_NAME ("nsxfname")
/****************************************************************************
@@ -159,7 +159,7 @@ AcpiGetHandle (
ACPI_NAMESPACE_NODE *PrefixNode = NULL;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Parameter Validation */
@@ -173,21 +173,29 @@ AcpiGetHandle (
if (Parent)
{
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
PrefixNode = AcpiNsMapHandleToNode (Parent);
if (!PrefixNode)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
/* Special case for root, since we can't search for it */
- if (STRCMP (Pathname, NS_ROOT_PATH) == 0)
+ if (ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH) == 0)
{
*RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode);
return (AE_OK);
@@ -196,7 +204,7 @@ AcpiGetHandle (
/*
* Find the Node and convert to a handle
*/
- Status = AcpiNsGetNode (Pathname, PrefixNode, &Node);
+ Status = AcpiNsGetNodeByPath (Pathname, PrefixNode, ACPI_NS_NO_UPSEARCH, &Node);
*RetHandle = NULL;
if (ACPI_SUCCESS (Status))
@@ -214,7 +222,7 @@ AcpiGetHandle (
*
* PARAMETERS: Handle - Handle to be converted to a pathname
* NameType - Full pathname or single segment
- * RetPathPtr - Buffer for returned path
+ * Buffer - Buffer for returned path
*
* RETURN: Pointer to a string containing the fully qualified Name.
*
@@ -228,41 +236,43 @@ ACPI_STATUS
AcpiGetName (
ACPI_HANDLE Handle,
UINT32 NameType,
- ACPI_BUFFER *RetPathPtr)
+ ACPI_BUFFER *Buffer)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
- /* Buffer pointer must be valid always */
+ /* Parameter validation */
- if (!RetPathPtr || (NameType > ACPI_NAME_TYPE_MAX))
+ if (NameType > ACPI_NAME_TYPE_MAX)
{
return (AE_BAD_PARAMETER);
}
- /* Allow length to be zero and ignore the pointer */
-
- if ((RetPathPtr->Length) &&
- (!RetPathPtr->Pointer))
+ Status = AcpiUtValidateBuffer (Buffer);
+ if (ACPI_FAILURE (Status))
{
- return (AE_BAD_PARAMETER);
+ return (Status);
}
if (NameType == ACPI_FULL_PATHNAME)
{
/* Get the full pathname (From the namespace root) */
- Status = AcpiNsHandleToPathname (Handle, &RetPathPtr->Length,
- RetPathPtr->Pointer);
+ Status = AcpiNsHandleToPathname (Handle, Buffer);
return (Status);
}
/*
* Wants the single segment ACPI name.
- * Validate handle and convert to an Node
+ * Validate handle and convert to a namespace Node
*/
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
Node = AcpiNsMapHandleToNode (Handle);
if (!Node)
{
@@ -270,26 +280,25 @@ AcpiGetName (
goto UnlockAndExit;
}
- /* Check if name will fit in buffer */
+ /* Validate/Allocate/Clear caller buffer */
- if (RetPathPtr->Length < PATH_SEGMENT_LENGTH)
+ Status = AcpiUtInitializeBuffer (Buffer, PATH_SEGMENT_LENGTH);
+ if (ACPI_FAILURE (Status))
{
- RetPathPtr->Length = PATH_SEGMENT_LENGTH;
- Status = AE_BUFFER_OVERFLOW;
goto UnlockAndExit;
}
/* Just copy the ACPI name from the Node and zero terminate it */
- STRNCPY (RetPathPtr->Pointer, (NATIVE_CHAR *) &Node->Name,
+ ACPI_STRNCPY (Buffer->Pointer, (NATIVE_CHAR *) &Node->Name,
ACPI_NAME_SIZE);
- ((NATIVE_CHAR *) RetPathPtr->Pointer) [ACPI_NAME_SIZE] = 0;
+ ((NATIVE_CHAR *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
Status = AE_OK;
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
@@ -329,19 +338,27 @@ AcpiGetObjectInfo (
return (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
Node = AcpiNsMapHandleToNode (Handle);
if (!Node)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
Info->Type = Node->Type;
Info->Name = Node->Name;
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/*
* If not a device, we are all done.
@@ -366,8 +383,7 @@ AcpiGetObjectInfo (
Status = AcpiUtExecute_HID (Node, &Hid);
if (ACPI_SUCCESS (Status))
{
- STRNCPY (Info->HardwareId, Hid.Buffer, sizeof(Info->HardwareId));
-
+ ACPI_STRNCPY (Info->HardwareId, Hid.Buffer, sizeof(Info->HardwareId));
Info->Valid |= ACPI_VALID_HID;
}
@@ -376,8 +392,7 @@ AcpiGetObjectInfo (
Status = AcpiUtExecute_UID (Node, &Uid);
if (ACPI_SUCCESS (Status))
{
- STRCPY (Info->UniqueId, Uid.Buffer);
-
+ ACPI_STRCPY (Info->UniqueId, Uid.Buffer);
Info->Valid |= ACPI_VALID_UID;
}
diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c
index fc0ee50..ea1941e 100644
--- a/sys/contrib/dev/acpica/nsxfobj.c
+++ b/sys/contrib/dev/acpica/nsxfobj.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 98 $
+ * $Revision: 108 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsxfobj")
+ ACPI_MODULE_NAME ("nsxfobj")
/*******************************************************************************
@@ -158,12 +158,11 @@ AcpiEvaluateObject (
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **InternalParams = NULL;
ACPI_OPERAND_OBJECT *InternalReturnObj = NULL;
- UINT32 BufferSpaceNeeded;
- UINT32 UserBufferLength;
+ ACPI_SIZE BufferSpaceNeeded;
UINT32 i;
- FUNCTION_TRACE ("AcpiEvaluateObject");
+ ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
/*
@@ -177,13 +176,13 @@ AcpiEvaluateObject (
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
- InternalParams = ACPI_MEM_CALLOCATE ((ExternalParams->Count + 1) * sizeof (void *));
+ InternalParams = ACPI_MEM_CALLOCATE ((ExternalParams->Count + 1) *
+ sizeof (void *));
if (!InternalParams)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/*
* Convert each external object in the list to an
* internal object
@@ -192,7 +191,6 @@ AcpiEvaluateObject (
{
Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
&InternalParams[i]);
-
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteInternalObjectList (InternalParams);
@@ -202,7 +200,6 @@ AcpiEvaluateObject (
InternalParams[ExternalParams->Count] = NULL;
}
-
/*
* Three major cases:
* 1) Fully qualified pathname
@@ -215,9 +212,9 @@ AcpiEvaluateObject (
/*
* The path is fully qualified, just evaluate by name
*/
- Status = AcpiNsEvaluateByName (Pathname, InternalParams, &InternalReturnObj);
+ Status = AcpiNsEvaluateByName (Pathname, InternalParams,
+ &InternalReturnObj);
}
-
else if (!Handle)
{
/*
@@ -227,17 +224,17 @@ AcpiEvaluateObject (
*/
if (!Pathname)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Both Handle and Pathname are NULL\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Both Handle and Pathname are NULL\n"));
}
-
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Handle is NULL and Pathname is relative\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Handle is NULL and Pathname is relative\n"));
}
Status = AE_BAD_PARAMETER;
}
-
else
{
/*
@@ -251,16 +248,16 @@ AcpiEvaluateObject (
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
- Status = AcpiNsEvaluateByHandle (Handle, InternalParams, &InternalReturnObj);
+ Status = AcpiNsEvaluateByHandle (Handle, InternalParams,
+ &InternalReturnObj);
}
-
else
{
/*
* Both a Handle and a relative Pathname
*/
Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams,
- &InternalReturnObj);
+ &InternalReturnObj);
}
}
@@ -269,29 +266,27 @@ AcpiEvaluateObject (
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
-
if (ReturnBuffer)
{
- UserBufferLength = ReturnBuffer->Length;
- ReturnBuffer->Length = 0;
-
- if (InternalReturnObj)
+ if (!InternalReturnObj)
{
- if (VALID_DESCRIPTOR_TYPE (InternalReturnObj, ACPI_DESC_TYPE_NAMED))
+ ReturnBuffer->Length = 0;
+ }
+ else
+ {
+ if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED)
{
/*
- * If we got an Node as a return object,
- * this means the object we are evaluating
- * has nothing interesting to return (such
- * as a mutex, etc.) We return an error
- * because these types are essentially
- * unsupported by this interface. We
- * don't check up front because this makes
- * it easier to add support for various
- * types at a later date if necessary.
+ * If we received a NS Node as a return object, this means that
+ * the object we are evaluating has nothing interesting to
+ * return (such as a mutex, etc.) We return an error because
+ * these types are essentially unsupported by this interface.
+ * We don't check up front because this makes it easier to add
+ * support for various types at a later date if necessary.
*/
Status = AE_TYPE;
- InternalReturnObj = NULL; /* No need to delete an Node */
+ InternalReturnObj = NULL; /* No need to delete a NS Node */
+ ReturnBuffer->Length = 0;
}
if (ACPI_SUCCESS (Status))
@@ -304,25 +299,18 @@ AcpiEvaluateObject (
&BufferSpaceNeeded);
if (ACPI_SUCCESS (Status))
{
- /*
- * Check if there is enough room in the
- * caller's buffer
- */
- if (UserBufferLength < BufferSpaceNeeded)
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded);
+ if (ACPI_FAILURE (Status))
{
/*
- * Caller's buffer is too small, can't
- * give him partial results fail the call
- * but return the buffer size needed
+ * Caller's buffer is too small or a new one can't be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed buffer size %X, received %X\n",
- BufferSpaceNeeded, UserBufferLength));
-
- ReturnBuffer->Length = BufferSpaceNeeded;
- Status = AE_BUFFER_OVERFLOW;
+ "Needed buffer size %X, %s\n",
+ BufferSpaceNeeded, AcpiFormatException (Status)));
}
-
else
{
/*
@@ -330,14 +318,12 @@ AcpiEvaluateObject (
*/
Status = AcpiUtCopyIobjectToEobject (InternalReturnObj,
ReturnBuffer);
- ReturnBuffer->Length = BufferSpaceNeeded;
}
}
}
}
}
-
/* Delete the return and parameter objects */
if (InternalReturnObj)
@@ -388,7 +374,7 @@ AcpiGetNextObject (
ACPI_HANDLE Child,
ACPI_HANDLE *RetHandle)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_NAMESPACE_NODE *ParentNode = NULL;
ACPI_NAMESPACE_NODE *ChildNode = NULL;
@@ -401,7 +387,11 @@ AcpiGetNextObject (
return (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* If null handle, use the parent */
@@ -416,11 +406,9 @@ AcpiGetNextObject (
goto UnlockAndExit;
}
}
-
- /* Non-null handle, ignore the parent */
-
else
{
+ /* Non-null handle, ignore the parent */
/* Convert and validate the handle */
ChildNode = AcpiNsMapHandleToNode (Child);
@@ -431,11 +419,9 @@ AcpiGetNextObject (
}
}
-
/* Internal function does the real work */
- Node = AcpiNsGetNextNode ((ACPI_OBJECT_TYPE8) Type,
- ParentNode, ChildNode);
+ Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode);
if (!Node)
{
Status = AE_NOT_FOUND;
@@ -450,7 +436,7 @@ AcpiGetNextObject (
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
@@ -474,6 +460,7 @@ AcpiGetType (
ACPI_OBJECT_TYPE *RetType)
{
ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
/* Parameter Validation */
@@ -493,22 +480,26 @@ AcpiGetType (
return (AE_OK);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* Convert and validate the handle */
Node = AcpiNsMapHandleToNode (Handle);
if (!Node)
{
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
*RetType = Node->Type;
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return (AE_OK);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Status);
}
@@ -532,7 +523,7 @@ AcpiGetParent (
ACPI_HANDLE *RetHandle)
{
ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
if (!RetHandle)
@@ -547,8 +538,11 @@ AcpiGetParent (
return (AE_NULL_ENTRY);
}
-
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* Convert and validate the handle */
@@ -559,15 +553,14 @@ AcpiGetParent (
goto UnlockAndExit;
}
-
/* Get the parent entry */
*RetHandle =
- AcpiNsConvertEntryToHandle (AcpiNsGetParentObject (Node));
+ AcpiNsConvertEntryToHandle (AcpiNsGetParentNode (Node));
/* Return exeption if parent is null */
- if (!AcpiNsGetParentObject (Node))
+ if (!AcpiNsGetParentNode (Node))
{
Status = AE_NULL_ENTRY;
}
@@ -575,7 +568,7 @@ AcpiGetParent (
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
@@ -622,7 +615,7 @@ AcpiWalkNamespace (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiWalkNamespace");
+ ACPI_FUNCTION_TRACE ("AcpiWalkNamespace");
/* Parameter validation */
@@ -640,13 +633,16 @@ AcpiWalkNamespace (
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- Status = AcpiNsWalkNamespace ((ACPI_OBJECT_TYPE8) Type, StartObject,
- MaxDepth, NS_WALK_UNLOCK, UserFunction, Context,
- ReturnValue);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK,
+ UserFunction, Context, ReturnValue);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@@ -682,9 +678,18 @@ AcpiNsGetDeviceCallback (
Info = Context;
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
Node = AcpiNsMapHandleToNode (ObjHandle);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
if (!Node)
{
@@ -716,20 +721,18 @@ AcpiNsGetDeviceCallback (
{
return (AE_OK);
}
-
else if (ACPI_FAILURE (Status))
{
return (AE_CTRL_DEPTH);
}
- if (STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0)
+ if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0)
{
Status = AcpiUtExecute_CID (Node, &Cid);
if (Status == AE_NOT_FOUND)
{
return (AE_OK);
}
-
else if (ACPI_FAILURE (Status))
{
return (AE_CTRL_DEPTH);
@@ -737,7 +740,7 @@ AcpiNsGetDeviceCallback (
/* TBD: Handle CID packages */
- if (STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0)
+ if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0)
{
return (AE_OK);
}
@@ -785,7 +788,7 @@ AcpiGetDevices (
ACPI_GET_DEVICES_INFO Info;
- FUNCTION_TRACE ("AcpiGetDevices");
+ ACPI_FUNCTION_TRACE ("AcpiGetDevices");
/* Parameter validation */
@@ -809,15 +812,19 @@ AcpiGetDevices (
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- NS_WALK_UNLOCK,
+ ACPI_NS_WALK_UNLOCK,
AcpiNsGetDeviceCallback, &Info,
ReturnValue);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@@ -826,11 +833,11 @@ AcpiGetDevices (
*
* FUNCTION: AcpiAttachData
*
- * PARAMETERS:
+ * PARAMETERS:
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION:
*
******************************************************************************/
@@ -853,8 +860,11 @@ AcpiAttachData (
return (AE_BAD_PARAMETER);
}
-
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* Convert and validate the handle */
@@ -868,8 +878,7 @@ AcpiAttachData (
Status = AcpiNsAttachData (Node, Handler, Data);
UnlockAndExit:
-
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
@@ -878,11 +887,11 @@ UnlockAndExit:
*
* FUNCTION: AcpiDetachData
*
- * PARAMETERS:
+ * PARAMETERS:
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION:
*
******************************************************************************/
@@ -903,7 +912,11 @@ AcpiDetachData (
return (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* Convert and validate the handle */
@@ -917,8 +930,7 @@ AcpiDetachData (
Status = AcpiNsDetachData (Node, Handler);
UnlockAndExit:
-
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
@@ -927,11 +939,11 @@ UnlockAndExit:
*
* FUNCTION: AcpiGetData
*
- * PARAMETERS:
+ * PARAMETERS:
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION:
*
******************************************************************************/
@@ -954,7 +966,11 @@ AcpiGetData (
return (AE_BAD_PARAMETER);
}
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
/* Convert and validate the handle */
@@ -968,10 +984,8 @@ AcpiGetData (
Status = AcpiNsGetAttachedData (Node, Handler, Data);
UnlockAndExit:
-
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
-
diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c
index 3597c6b..72b77b4 100644
--- a/sys/contrib/dev/acpica/psargs.c
+++ b/sys/contrib/dev/acpica/psargs.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 54 $
+ * $Revision: 58 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psargs")
+ ACPI_MODULE_NAME ("psargs")
/*******************************************************************************
@@ -146,10 +146,10 @@ AcpiPsGetNextPackageLength (
UINT32 Length = 0;
- FUNCTION_TRACE ("PsGetNextPackageLength");
+ ACPI_FUNCTION_TRACE ("PsGetNextPackageLength");
- EncodedLength = (UINT32) GET8 (ParserState->Aml);
+ EncodedLength = (UINT32) ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
@@ -163,7 +163,7 @@ AcpiPsGetNextPackageLength (
case 1: /* 2-byte encoding (next byte + bits 0-3) */
- Length = ((GET8 (ParserState->Aml) << 04) |
+ Length = ((ACPI_GET8 (ParserState->Aml) << 04) |
(EncodedLength & 0x0F));
ParserState->Aml++;
break;
@@ -171,8 +171,8 @@ AcpiPsGetNextPackageLength (
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
- Length = ((GET8 (ParserState->Aml + 1) << 12) |
- (GET8 (ParserState->Aml) << 04) |
+ Length = ((ACPI_GET8 (ParserState->Aml + 1) << 12) |
+ (ACPI_GET8 (ParserState->Aml) << 04) |
(EncodedLength & 0x0F));
ParserState->Aml += 2;
break;
@@ -180,9 +180,9 @@ AcpiPsGetNextPackageLength (
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
- Length = ((GET8 (ParserState->Aml + 2) << 20) |
- (GET8 (ParserState->Aml + 1) << 12) |
- (GET8 (ParserState->Aml) << 04) |
+ Length = ((ACPI_GET8 (ParserState->Aml + 2) << 20) |
+ (ACPI_GET8 (ParserState->Aml + 1) << 12) |
+ (ACPI_GET8 (ParserState->Aml) << 04) |
(EncodedLength & 0x0F));
ParserState->Aml += 3;
break;
@@ -213,7 +213,7 @@ AcpiPsGetNextPackageEnd (
NATIVE_UINT Length;
- FUNCTION_TRACE ("PsGetNextPackageEnd");
+ ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd");
Length = (NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState);
@@ -246,12 +246,12 @@ AcpiPsGetNextNamestring (
UINT32 Length;
- FUNCTION_TRACE ("PsGetNextNamestring");
+ ACPI_FUNCTION_TRACE ("PsGetNextNamestring");
/* Handle multiple prefix characters */
- while (AcpiPsIsPrefixChar (GET8 (End)))
+ while (AcpiPsIsPrefixChar (ACPI_GET8 (End)))
{
/* include prefix '\\' or '^' */
@@ -260,7 +260,7 @@ AcpiPsGetNextNamestring (
/* Decode the path */
- switch (GET8 (End))
+ switch (ACPI_GET8 (End))
{
case 0:
@@ -286,7 +286,7 @@ AcpiPsGetNextNamestring (
/* multiple name segments */
- Length = (UINT32) GET8 (End + 1) * 4;
+ Length = (UINT32) ACPI_GET8 (End + 1) * 4;
End += 2 + Length;
break;
@@ -343,7 +343,7 @@ AcpiPsGetNextNamepath (
ACPI_PARSE_OBJECT *Count;
- FUNCTION_TRACE ("PsGetNextNamepath");
+ ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
Path = AcpiPsGetNextNamestring (ParserState);
@@ -443,7 +443,7 @@ AcpiPsGetNextNamepath (
ACPI_GENERIC_STATE ScopeInfo;
- FUNCTION_TRACE ("PsGetNextNamepath");
+ ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
Path = AcpiPsGetNextNamestring (ParserState);
@@ -475,8 +475,8 @@ AcpiPsGetNextNamepath (
* parent tree, but don't open a new scope -- we just want to lookup the
* object (MUST BE mode EXECUTE to perform upsearch)
*/
- Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, IMODE_EXECUTE,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL,
+ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
&Node);
if (ACPI_SUCCESS (Status))
{
@@ -554,7 +554,7 @@ AcpiPsGetNextSimpleArg (
ACPI_PARSE_OBJECT *Arg)
{
- FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
+ ACPI_FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
switch (ArgType)
@@ -563,7 +563,7 @@ AcpiPsGetNextSimpleArg (
case ARGP_BYTEDATA:
AcpiPsInitOp (Arg, AML_BYTE_OP);
- Arg->Value.Integer = (UINT32) GET8 (ParserState->Aml);
+ Arg->Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
break;
@@ -574,7 +574,7 @@ AcpiPsGetNextSimpleArg (
/* Get 2 bytes from the AML stream */
- MOVE_UNALIGNED16_TO_32 (&Arg->Value.Integer, ParserState->Aml);
+ ACPI_MOVE_UNALIGNED16_TO_32 (&Arg->Value.Integer, ParserState->Aml);
ParserState->Aml += 2;
break;
@@ -585,7 +585,7 @@ AcpiPsGetNextSimpleArg (
/* Get 4 bytes from the AML stream */
- MOVE_UNALIGNED32_TO_32 (&Arg->Value.Integer, ParserState->Aml);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Arg->Value.Integer, ParserState->Aml);
ParserState->Aml += 4;
break;
@@ -596,7 +596,7 @@ AcpiPsGetNextSimpleArg (
/* Get 8 bytes from the AML stream */
- MOVE_UNALIGNED64_TO_64 (&Arg->Value.Integer, ParserState->Aml);
+ ACPI_MOVE_UNALIGNED64_TO_64 (&Arg->Value.Integer, ParserState->Aml);
ParserState->Aml += 8;
break;
@@ -604,9 +604,9 @@ AcpiPsGetNextSimpleArg (
case ARGP_CHARLIST:
AcpiPsInitOp (Arg, AML_STRING_OP);
- Arg->Value.String = (char*) ParserState->Aml;
+ Arg->Value.String = (char *) ParserState->Aml;
- while (GET8 (ParserState->Aml) != '\0')
+ while (ACPI_GET8 (ParserState->Aml) != '\0')
{
ParserState->Aml++;
}
@@ -649,12 +649,12 @@ AcpiPsGetNextField (
UINT32 Name;
- FUNCTION_TRACE ("PsGetNextField");
+ ACPI_FUNCTION_TRACE ("PsGetNextField");
/* determine field type */
- switch (GET8 (ParserState->Aml))
+ switch (ACPI_GET8 (ParserState->Aml))
{
default:
@@ -693,7 +693,7 @@ AcpiPsGetNextField (
/* Get the 4-character name */
- MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml);
AcpiPsSetName (Field, Name);
ParserState->Aml += 4;
@@ -713,13 +713,13 @@ AcpiPsGetNextField (
case AML_INT_ACCESSFIELD_OP:
- /*
+ /*
* Get AccessType and AccessAttrib and merge into the field Op
* AccessType is first operand, AccessAttribute is second
*/
- Field->Value.Integer32 = (GET8 (ParserState->Aml) << 8);
+ Field->Value.Integer32 = (ACPI_GET8 (ParserState->Aml) << 8);
ParserState->Aml++;
- Field->Value.Integer32 |= GET8 (ParserState->Aml);
+ Field->Value.Integer32 |= ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
break;
}
@@ -757,7 +757,7 @@ AcpiPsGetNextArg (
UINT32 Subop;
- FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
+ ACPI_FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
switch (ArgType)
@@ -845,6 +845,7 @@ AcpiPsGetNextArg (
case ARGP_TARGET:
case ARGP_SUPERNAME:
+ case ARGP_SIMPLENAME:
{
Subop = AcpiPsPeekOpcode (ParserState);
if (Subop == 0 ||
diff --git a/sys/contrib/dev/acpica/psfind.c b/sys/contrib/dev/acpica/psfind.c
index a65f9aa..eb91d53 100644
--- a/sys/contrib/dev/acpica/psfind.c
+++ b/sys/contrib/dev/acpica/psfind.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: psfind - Parse tree search routine
- * $Revision: 32 $
+ * $Revision: 37 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psfind")
+ ACPI_MODULE_NAME ("psfind")
/*******************************************************************************
@@ -201,26 +201,10 @@ AcpiPsFindName (
while (Op)
{
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
- if (OpInfo->Flags & AML_FIELD)
- {
- /* Field, search named fields */
- Field = AcpiPsGetChild (Op);
- while (Field)
- {
- OpInfo = AcpiPsGetOpcodeInfo (Field->Opcode);
-
- if ((OpInfo->Flags & AML_NAMED) &&
- AcpiPsGetName (Field) == Name &&
- (!Opcode || Field->Opcode == Opcode))
- {
- return (Field);
- }
+ /* Check AML_CREATE first (since some opcodes have AML_FIELD set also )*/
- Field = Field->Next;
- }
- }
- else if (OpInfo->Flags & AML_CREATE)
+ if (OpInfo->Flags & AML_CREATE)
{
if (Op->Opcode == AML_CREATE_FIELD_OP)
{
@@ -235,11 +219,30 @@ AcpiPsFindName (
if ((Field) &&
(Field->Value.String) &&
- (!STRNCMP (Field->Value.String, (char *) &Name, ACPI_NAME_SIZE)))
+ (!ACPI_STRNCMP (Field->Value.String, (char *) &Name, ACPI_NAME_SIZE)))
{
return (Op);
}
}
+ else if (OpInfo->Flags & AML_FIELD)
+ {
+ /* Field, search named fields */
+
+ Field = AcpiPsGetChild (Op);
+ while (Field)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (Field->Opcode);
+
+ if ((OpInfo->Flags & AML_NAMED) &&
+ AcpiPsGetName (Field) == Name &&
+ (!Opcode || Field->Opcode == Opcode))
+ {
+ return (Field);
+ }
+
+ Field = Field->Next;
+ }
+ }
else if ((OpInfo->Flags & AML_NAMED) &&
(AcpiPsGetName (Op) == Name) &&
(!Opcode || Op->Opcode == Opcode || Opcode == AML_SCOPE_OP))
@@ -283,7 +286,7 @@ AcpiPsFind (
BOOLEAN Unprefixed = TRUE;
- FUNCTION_TRACE_PTR ("PsFind", Scope);
+ ACPI_FUNCTION_TRACE_PTR ("PsFind", Scope);
if (!Scope || !Path)
@@ -297,9 +300,9 @@ AcpiPsFind (
/* Handle all prefixes in the name path */
- while (AcpiPsIsPrefixChar (GET8 (Path)))
+ while (AcpiPsIsPrefixChar (ACPI_GET8 (Path)))
{
- switch (GET8 (Path))
+ switch (ACPI_GET8 (Path))
{
case '\\':
@@ -320,7 +323,6 @@ AcpiPsFind (
{
Scope = AcpiPsGetParent (Scope);
}
-
break;
}
@@ -330,9 +332,9 @@ AcpiPsFind (
/* get name segment count */
- switch (GET8 (Path))
+ switch (ACPI_GET8 (Path))
{
- case '\0':
+ case 0:
SegCount = 0;
/* Null name case */
@@ -347,9 +349,9 @@ AcpiPsFind (
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Null path, returning current root scope Op=%p\n", Op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Null path, returning current root scope Op=%p\n", Op));
return_PTR (Op);
- break;
case AML_DUAL_NAME_PREFIX:
SegCount = 2;
@@ -357,7 +359,7 @@ AcpiPsFind (
break;
case AML_MULTI_NAME_PREFIX_OP:
- SegCount = GET8 (Path + 1);
+ SegCount = ACPI_GET8 (Path + 1);
Path += 2;
break;
@@ -366,14 +368,15 @@ AcpiPsFind (
break;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Search scope %p Segs=%d Opcode=%4.4X Create=%d\n",
- Scope, SegCount, Opcode, Create));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Search scope %p Segs=%d Opcode=%4.4X Create=%d\n",
+ Scope, SegCount, Opcode, Create));
/* match each name segment */
while (Scope && SegCount)
{
- MOVE_UNALIGNED32_TO_32 (&Name, Path);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Name, Path);
Path += 4;
SegCount --;
@@ -389,7 +392,9 @@ AcpiPsFind (
Op = AcpiPsFindName (Scope, Name, NameOp);
if (Op)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "[%4.4s] Found! Op=%p Opcode=%4.4X\n", (char*)&Name, Op, Op->Opcode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Found! Op=%p Opcode=%4.4X\n",
+ (char *) &Name, Op, Op->Opcode));
}
if (!Op)
@@ -412,7 +417,9 @@ AcpiPsFind (
AcpiPsSetName (Op, Name);
AcpiPsAppendArg (Scope, Op);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "[%4.4s] Not found, created Op=%p Opcode=%4.4X\n", (char*)&Name, Op, Opcode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Not found, created Op=%p Opcode=%4.4X\n",
+ (char *) &Name, Op, Opcode));
}
}
@@ -426,17 +433,23 @@ AcpiPsFind (
Op = AcpiPsFindName (Scope, Name, Opcode);
if (Op)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4X\n", (char*)&Name, Op, Op->Opcode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4X\n",
+ (char *) &Name, Op, Op->Opcode));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "[%4.4s] Not found in parent=%p\n", (char*)&Name, Scope));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "[%4.4s] Not found in parent=%p\n",
+ (char *) &Name, Scope));
}
}
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Segment [%4.4s] Not Found in scope %p!\n", (char*)&Name, Scope));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Segment [%4.4s] Not Found in scope %p!\n",
+ (char *) &Name, Scope));
}
}
diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c
index f439f9b..459c661 100644
--- a/sys/contrib/dev/acpica/psopcode.c
+++ b/sys/contrib/dev/acpica/psopcode.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 54 $
+ * $Revision: 64 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,7 @@
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psopcode")
+ ACPI_MODULE_NAME ("psopcode")
#define _UNK 0x6B
@@ -327,7 +327,7 @@
#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
#define ARGI_DEBUG_OP ARG_NONE
#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
-#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REFERENCE)
+#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
@@ -351,7 +351,7 @@
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION, ARGI_TARGETREF)
-#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_TARGETREF)
+#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
#define ARGI_LOCAL0 ARG_NONE
#define ARGI_LOCAL1 ARG_NONE
#define ARGI_LOCAL2 ARG_NONE
@@ -540,7 +540,8 @@
static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] =
{
-/* Index Name Parser Args Interpreter Args Class Type Flags */
+/*! [Begin] no source code translation */
+/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
@@ -639,8 +640,8 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] =
/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, INTERNAL_TYPE_INDEX_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, INTERNAL_TYPE_BANK_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, INTERNAL_TYPE_INDEX_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, INTERNAL_TYPE_BANK_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* Internal opcodes that map to invalid AML opcodes */
@@ -676,8 +677,9 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] =
/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R),
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
-/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/*! [End] no source code translation !*/
};
/*
@@ -767,7 +769,7 @@ const ACPI_OPCODE_INFO *
AcpiPsGetOpcodeInfo (
UINT16 Opcode)
{
- PROC_NAME ("PsGetOpcodeInfo");
+ ACPI_FUNCTION_NAME ("PsGetOpcodeInfo");
/*
@@ -780,8 +782,6 @@ AcpiPsGetOpcodeInfo (
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]);
- break;
-
case AML_EXTOP:
@@ -790,9 +790,10 @@ AcpiPsGetOpcodeInfo (
if (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE)
{
return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
- break;
}
+ /* Else fall through to error case below */
+
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", Opcode));
@@ -823,6 +824,8 @@ NATIVE_CHAR *
AcpiPsGetOpcodeName (
UINT16 Opcode)
{
+#ifdef ACPI_DEBUG
+
const ACPI_OPCODE_INFO *Op;
@@ -830,10 +833,11 @@ AcpiPsGetOpcodeName (
/* Always guaranteed to return a valid pointer */
-#ifdef ACPI_DEBUG
return (Op->Name);
+
#else
return ("AE_NOT_CONFIGURED");
+
#endif
}
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c
index 9e8cfb7..c2507b5 100644
--- a/sys/contrib/dev/acpica/psparse.c
+++ b/sys/contrib/dev/acpica/psparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 109 $
+ * $Revision: 119 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -133,7 +133,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psparse")
+ ACPI_MODULE_NAME ("psparse")
UINT32 AcpiGbl_Depth = 0;
@@ -191,7 +191,7 @@ AcpiPsPeekOpcode (
Aml = ParserState->Aml;
- Opcode = (UINT16) GET8 (Aml);
+ Opcode = (UINT16) ACPI_GET8 (Aml);
if (Opcode == AML_EXTOP)
@@ -199,7 +199,7 @@ AcpiPsPeekOpcode (
/* Extended opcode */
Aml++;
- Opcode = (UINT16) ((Opcode << 8) | GET8 (Aml));
+ Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml));
}
return (Opcode);
@@ -285,9 +285,16 @@ AcpiPsCompleteThisOp (
ACPI_PARSE_OBJECT *ReplacementOp = NULL;
- FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
+ ACPI_FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
+ /* Check for null Op, can happen if AML code is corrupt */
+
+ if (!Op)
+ {
+ return_VALUE (TRUE);
+ }
+
/* Delete this op and the subtree below it if asked to */
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
@@ -429,11 +436,9 @@ AcpiPsNextParseState (
{
ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
ACPI_STATUS Status = AE_CTRL_PENDING;
- UINT8 *Start;
- UINT32 PackageLength;
- FUNCTION_TRACE_PTR ("PsNextParseState", Op);
+ ACPI_FUNCTION_TRACE_PTR ("PsNextParseState", Op);
switch (CallbackStatus)
@@ -449,16 +454,21 @@ AcpiPsNextParseState (
break;
- case AE_CTRL_PENDING:
+ case AE_CTRL_BREAK:
- /*
- * Predicate of a WHILE was true and the loop just completed an
- * execution. Go back to the start of the loop and reevaluate the
- * predicate.
- */
+ ParserState->Aml = WalkState->AmlLastWhile;
+ WalkState->ControlState->Common.Value = FALSE;
+ Status = AE_CTRL_BREAK;
+ break;
+
+ case AE_CTRL_CONTINUE:
- /* TBD: How to handle a break within a while. */
- /* This code attempts it */
+
+ ParserState->Aml = WalkState->AmlLastWhile;
+ Status = AE_CTRL_CONTINUE;
+ break;
+
+ case AE_CTRL_PENDING:
ParserState->Aml = WalkState->AmlLastWhile;
break;
@@ -469,13 +479,8 @@ AcpiPsNextParseState (
/*
* Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package
- *
- * Note: ParserState->Aml is modified by the package length procedure
- * TBD: [Investigate] perhaps it shouldn't, too much trouble
*/
- Start = ParserState->Aml;
- PackageLength = AcpiPsGetNextPackageLength (ParserState);
- ParserState->Aml = Start + PackageLength;
+ ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
break;
@@ -551,14 +556,14 @@ AcpiPsParseLoop (
UINT8 *AmlOpStart;
- FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
ParserState = &WalkState->ParserState;
WalkState->ArgTypes = 0;
#ifndef PARSER_ONLY
- if (WalkState->WalkType & WALK_METHOD_RESTART)
+ if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
{
/* We are restarting a preempted control method */
@@ -573,7 +578,7 @@ AcpiPsParseLoop (
(ParserState->Scope->ParseScope.Op->Opcode == AML_WHILE_OP)) &&
(WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
- CONTROL_PREDICATE_EXECUTING))
+ ACPI_CONTROL_PREDICATE_EXECUTING))
{
/*
@@ -581,7 +586,7 @@ AcpiPsParseLoop (
* predicate and branch based on that value
*/
WalkState->Op = NULL;
- Status = AcpiDsGetPredicateValue (WalkState, TRUE);
+ Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
if (ACPI_FAILURE (Status) &&
((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
{
@@ -654,7 +659,7 @@ AcpiPsParseLoop (
"Found unknown opcode %X at AML offset %X, ignoring\n",
WalkState->Opcode, WalkState->AmlOffset));
- DUMP_BUFFER (ParserState->Aml, 128);
+ ACPI_DUMP_BUFFER (ParserState->Aml, 128);
/* Assume one-byte bad opcode */
@@ -800,8 +805,8 @@ AcpiPsParseLoop (
if (WalkState->OpInfo)
{
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Op=%p Opcode=%4.4X Aml %p Oft=%5.5X\n",
- Op, Op->Opcode, ParserState->Aml, Op->AmlOffset));
+ "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
+ Op->Opcode, WalkState->OpInfo->Name, Op, ParserState->Aml, Op->AmlOffset));
}
}
@@ -863,9 +868,9 @@ AcpiPsParseLoop (
* because we don't have enough info in the first pass
* to parse them correctly.
*/
- ((ACPI_PARSE2_OBJECT * ) Op)->Data = ParserState->Aml;
- ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd -
- ParserState->Aml);
+ ((ACPI_PARSE2_OBJECT * ) Op)->Data = ParserState->Aml;
+ ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd -
+ ParserState->Aml);
/*
* Skip body of method. For OpRegions, we must continue
@@ -873,173 +878,212 @@ AcpiPsParseLoop (
* package (We don't know where the end is).
*/
ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
+ WalkState->ArgCount = 0;
+ }
+ else if (Op->Opcode == AML_WHILE_OP)
+ {
+ if (WalkState->ControlState)
+ {
+ WalkState->ControlState->Control.PackageEnd = ParserState->PkgEnd;
+ }
}
-
break;
}
}
- /*
- * Zero ArgCount means that all arguments for this op have been processed
- */
- if (!WalkState->ArgCount)
+ /* Check for arguments that need to be processed */
+
+ if (WalkState->ArgCount)
{
- /* completed Op, prepare for next */
+ /* There are arguments (complex ones), push Op and prepare for argument */
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
- if (WalkState->OpInfo->Flags & AML_NAMED)
- {
- if (AcpiGbl_Depth)
- {
- AcpiGbl_Depth--;
- }
+ AcpiPsPushScope (ParserState, Op, WalkState->ArgTypes, WalkState->ArgCount);
+ Op = NULL;
+ continue;
+ }
- if (Op->Opcode == AML_REGION_OP)
- {
- /*
- * Skip parsing of control method or opregion body,
- * because we don't have enough info in the first pass
- * to parse them correctly.
- *
- * Completed parsing an OpRegion declaration, we now
- * know the length.
- */
- ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml -
- ((ACPI_PARSE2_OBJECT * ) Op)->Data);
- }
+
+ /* All arguments have been processed -- Op is complete, prepare for next */
+
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ if (AcpiGbl_Depth)
+ {
+ AcpiGbl_Depth--;
}
- if (WalkState->OpInfo->Flags & AML_CREATE)
+ if (Op->Opcode == AML_REGION_OP)
{
/*
- * Backup to beginning of CreateXXXfield declaration (1 for
- * Opcode)
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
*
- * BodyLength is unknown until we parse the body
+ * Completed parsing an OpRegion declaration, we now
+ * know the length.
*/
((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml -
((ACPI_PARSE2_OBJECT * ) Op)->Data);
}
+ }
- /* This op complete, notify the dispatcher */
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration (1 for
+ * Opcode)
+ *
+ * BodyLength is unknown until we parse the body
+ */
+ ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml -
+ ((ACPI_PARSE2_OBJECT * ) Op)->Data);
+ }
- if (WalkState->AscendingCallback != NULL)
- {
- WalkState->Op = Op;
- WalkState->Opcode = Op->Opcode;
+ /* This op complete, notify the dispatcher */
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
+ if (WalkState->AscendingCallback != NULL)
+ {
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Opcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
}
+ }
CloseThisOp:
+ /*
+ * Finished one argument of the containing scope
+ */
+ ParserState->Scope->ParseScope.ArgCount--;
+
+ /* Close this Op (may result in parse subtree deletion) */
+
+ if (AcpiPsCompleteThisOp (WalkState, Op))
+ {
+ Op = NULL;
+ }
+
+ switch (Status)
+ {
+ case AE_OK:
+ break;
+
+
+ case AE_CTRL_TRANSFER:
+
/*
- * Finished one argument of the containing scope
+ * We are about to transfer to a called method.
*/
- ParserState->Scope->ParseScope.ArgCount--;
+ WalkState->PrevOp = Op;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
- /* Close this Op (may result in parse subtree deletion) */
- if (AcpiPsCompleteThisOp (WalkState, Op))
- {
- Op = NULL;
- }
+ case AE_CTRL_END:
- switch (Status)
- {
- case AE_OK:
- break;
+ AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
+ WalkState->Opcode = Op->Opcode;
- case AE_CTRL_TRANSFER:
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+
+ AcpiPsCompleteThisOp (WalkState, Op);
+ Op = NULL;
+ Status = AE_OK;
+ break;
- /*
- * We are about to transfer to a called method.
- */
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
- break;
+ case AE_CTRL_BREAK:
+ case AE_CTRL_CONTINUE:
- case AE_CTRL_END:
+ /* Pop off scopes until we find the While */
+ while (!Op || (Op->Opcode != AML_WHILE_OP))
+ {
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
+ }
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
- WalkState->Opcode = Op->Opcode;
+ /* Close this iteration of the While loop */
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
+ WalkState->Opcode = Op->Opcode;
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
- Status = AE_OK;
- break;
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ AcpiPsCompleteThisOp (WalkState, Op);
+ Op = NULL;
- case AE_CTRL_TERMINATE:
+ Status = AE_OK;
+ break;
- Status = AE_OK;
- /* Clean up */
- do
+ case AE_CTRL_TERMINATE:
+
+ Status = AE_OK;
+
+ /* Clean up */
+ do
+ {
+ if (Op)
{
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
- AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
+ AcpiPsCompleteThisOp (WalkState, Op);
+ }
+ AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
- } while (Op);
+ } while (Op);
- return_ACPI_STATUS (Status);
- break;
+ return_ACPI_STATUS (Status);
- default: /* All other non-AE_OK status */
+ default: /* All other non-AE_OK status */
- if (Op == NULL)
+ do
+ {
+ if (Op)
{
- AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
+ AcpiPsCompleteThisOp (WalkState, Op);
}
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
+ AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
- /*
- * TBD: TEMP:
- */
- return_ACPI_STATUS (Status);
- break;
- }
+ } while (Op);
- /* This scope complete? */
- if (AcpiPsHasCompletedScope (ParserState))
+ /*
+ * TBD: Cleanup parse ops on error
+ */
+#if 0
+ if (Op == NULL)
{
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
- }
- else
- {
- Op = NULL;
}
+#endif
+ WalkState->PrevOp = Op;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
+ }
+
+ /* This scope complete? */
+
+ if (AcpiPsHasCompletedScope (ParserState))
+ {
+ AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
}
else
{
- /* ArgCount is non-zero */
- /* complex argument, push Op and prepare for argument */
-
- AcpiPsPushScope (ParserState, Op, WalkState->ArgTypes, WalkState->ArgCount);
Op = NULL;
}
@@ -1134,7 +1178,7 @@ AcpiPsParseAml (
ACPI_WALK_STATE *PreviousWalkState;
- FUNCTION_TRACE ("PsParseAml");
+ ACPI_FUNCTION_TRACE ("PsParseAml");
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with WalkState=%p Aml=%p size=%X\n",
WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize));
@@ -1151,8 +1195,9 @@ AcpiPsParseAml (
WalkState->Thread = Thread;
AcpiDsPushWalkState (WalkState, Thread);
-
- /* TBD: [Restructure] TEMP until we pass WalkState to the interpreter
+ /*
+ * This global allows the AML debugger to get a handle to the currently
+ * executing control method.
*/
AcpiGbl_CurrentWalkList = Thread;
@@ -1231,14 +1276,23 @@ AcpiPsParseAml (
{
if (ACPI_SUCCESS (Status))
{
- /* There is another walk state, restart it */
-
/*
- * If the method returned value is not used by the parent,
+ * There is another walk state, restart it.
+ * If the method return value is not used by the parent,
* The object is deleted
*/
AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ReturnDesc);
- WalkState->WalkType |= WALK_METHOD_RESTART;
+ WalkState->WalkType |= ACPI_WALK_METHOD_RESTART;
+ }
+ else
+ {
+ /* On error, delete any return object */
+
+ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
+
+ ACPI_REPORT_ERROR (("Method execution failed, %s\n", AcpiFormatException (Status)));
+ ACPI_DUMP_PATHNAME (WalkState->MethodNode, "Method pathname: ",
+ ACPI_LV_ERROR, _COMPONENT);
}
}
diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/psscope.c
index f3f868d..3c20f7e 100644
--- a/sys/contrib/dev/acpica/psscope.c
+++ b/sys/contrib/dev/acpica/psscope.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psscope - Parser scope stack management routines
- * $Revision: 31 $
+ * $Revision: 35 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,7 +119,7 @@
#include "acparser.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psscope")
+ ACPI_MODULE_NAME ("psscope")
/*******************************************************************************
@@ -186,7 +186,7 @@ AcpiPsInitScope (
ACPI_GENERIC_STATE *Scope;
- FUNCTION_TRACE_PTR ("PsInitScope", RootOp);
+ ACPI_FUNCTION_TRACE_PTR ("PsInitScope", RootOp);
Scope = AcpiUtCreateGenericState ();
@@ -233,7 +233,7 @@ AcpiPsPushScope (
ACPI_GENERIC_STATE *Scope;
- FUNCTION_TRACE_PTR ("PsPushScope", Op);
+ ACPI_FUNCTION_TRACE_PTR ("PsPushScope", Op);
Scope = AcpiUtCreateGenericState ();
@@ -265,7 +265,7 @@ AcpiPsPushScope (
{
/* single argument */
- Scope->ParseScope.ArgEnd = ACPI_MAX_AML;
+ Scope->ParseScope.ArgEnd = ACPI_TO_POINTER (ACPI_MAX_PTR);
}
return_ACPI_STATUS (AE_OK);
@@ -298,7 +298,7 @@ AcpiPsPopScope (
ACPI_GENERIC_STATE *Scope = ParserState->Scope;
- FUNCTION_TRACE ("PsPopScope");
+ ACPI_FUNCTION_TRACE ("PsPopScope");
/*
@@ -354,7 +354,7 @@ AcpiPsCleanupScope (
{
ACPI_GENERIC_STATE *Scope;
- FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
+ ACPI_FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
if (!ParserState)
diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/pstree.c
index c7580c9..6ab0142 100644
--- a/sys/contrib/dev/acpica/pstree.c
+++ b/sys/contrib/dev/acpica/pstree.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
- * $Revision: 35 $
+ * $Revision: 37 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("pstree")
+ ACPI_MODULE_NAME ("pstree")
/*******************************************************************************
@@ -147,7 +147,7 @@ AcpiPsGetArg (
const ACPI_OPCODE_INFO *OpInfo;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Get the info structure for this opcode */
@@ -204,7 +204,7 @@ AcpiPsAppendArg (
const ACPI_OPCODE_INFO *OpInfo;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!Op)
@@ -219,7 +219,7 @@ AcpiPsAppendArg (
{
/* Invalid opcode */
- REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n", Op->Opcode));
+ ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n", Op->Opcode));
return;
}
@@ -284,7 +284,7 @@ AcpiPsGetChild (
ACPI_PARSE_OBJECT *Child = NULL;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
switch (Op->Opcode)
@@ -353,7 +353,7 @@ AcpiPsGetDepthNext (
ACPI_PARSE_OBJECT *Arg;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (!Op)
diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c
index 15d5ac1..51ae639 100644
--- a/sys/contrib/dev/acpica/psutils.c
+++ b/sys/contrib/dev/acpica/psutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 44 $
+ * $Revision: 49 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,14 +120,7 @@
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psutils")
-
-
-#define PARSEOP_GENERIC 0x01
-#define PARSEOP_NAMED 0x02
-#define PARSEOP_DEFERRED 0x04
-#define PARSEOP_BYTELIST 0x08
-#define PARSEOP_IN_CACHE 0x80
+ ACPI_MODULE_NAME ("psutils")
/*******************************************************************************
@@ -149,19 +142,14 @@ AcpiPsInitOp (
ACPI_PARSE_OBJECT *Op,
UINT16 Opcode)
{
- const ACPI_OPCODE_INFO *AmlOp;
-
-
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
Op->DataType = ACPI_DESC_TYPE_PARSER;
Op->Opcode = Opcode;
- AmlOp = AcpiPsGetOpcodeInfo (Opcode);
-
- DEBUG_ONLY_MEMBERS (STRNCPY (Op->OpName, AmlOp->Name,
- sizeof (Op->OpName)));
+ ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (Op->OpName,
+ (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->OpName)));
}
@@ -189,7 +177,7 @@ AcpiPsAllocOp (
const ACPI_OPCODE_INFO *OpInfo;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
@@ -199,25 +187,25 @@ AcpiPsAllocOp (
if (OpInfo->Flags & AML_DEFER)
{
Size = sizeof (ACPI_PARSE2_OBJECT);
- Flags = PARSEOP_DEFERRED;
+ Flags = ACPI_PARSEOP_DEFERRED;
}
else if (OpInfo->Flags & AML_NAMED)
{
Size = sizeof (ACPI_PARSE2_OBJECT);
- Flags = PARSEOP_NAMED;
+ Flags = ACPI_PARSEOP_NAMED;
}
else if (Opcode == AML_INT_BYTELIST_OP)
{
Size = sizeof (ACPI_PARSE2_OBJECT);
- Flags = PARSEOP_BYTELIST;
+ Flags = ACPI_PARSEOP_BYTELIST;
}
else
{
Size = sizeof (ACPI_PARSE_OBJECT);
- Flags = PARSEOP_GENERIC;
+ Flags = ACPI_PARSEOP_GENERIC;
}
@@ -263,7 +251,7 @@ void
AcpiPsFreeOp (
ACPI_PARSE_OBJECT *Op)
{
- PROC_NAME ("PsFreeOp");
+ ACPI_FUNCTION_NAME ("PsFreeOp");
if (Op->Opcode == AML_INT_RETURN_VALUE_OP)
@@ -271,7 +259,7 @@ AcpiPsFreeOp (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Free retval op: %p\n", Op));
}
- if (Op->Flags == PARSEOP_GENERIC)
+ if (Op->Flags == ACPI_PARSEOP_GENERIC)
{
AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE, Op);
}
@@ -299,7 +287,7 @@ void
AcpiPsDeleteParseCache (
void)
{
- FUNCTION_TRACE ("PsDeleteParseCache");
+ ACPI_FUNCTION_TRACE ("PsDeleteParseCache");
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE);
@@ -350,7 +338,7 @@ AcpiPsGetName (
/* The "generic" object has no name associated with it */
- if (Op->Flags & PARSEOP_GENERIC)
+ if (Op->Flags & ACPI_PARSEOP_GENERIC)
{
return (0);
}
@@ -372,7 +360,7 @@ AcpiPsSetName (
/* The "generic" object has no name associated with it */
- if (Op->Flags & PARSEOP_GENERIC)
+ if (Op->Flags & ACPI_PARSEOP_GENERIC)
{
return;
}
diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c
index 8975561..47d957d 100644
--- a/sys/contrib/dev/acpica/pswalk.c
+++ b/sys/contrib/dev/acpica/pswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 61 $
+ * $Revision: 63 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("pswalk")
+ ACPI_MODULE_NAME ("pswalk")
/*******************************************************************************
@@ -152,12 +152,12 @@ AcpiPsGetNextWalkOp (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
+ ACPI_FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
/* Check for a argument only if we are descending in the tree */
- if (WalkState->NextOpInfo != NEXT_OP_UPWARD)
+ if (WalkState->NextOpInfo != ACPI_NEXT_OP_UPWARD)
{
/* Look for an argument or child of the current op */
@@ -168,7 +168,7 @@ AcpiPsGetNextWalkOp (
WalkState->PrevOp = Op;
WalkState->NextOp = Next;
- WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (AE_OK);
}
@@ -209,7 +209,7 @@ AcpiPsGetNextWalkOp (
WalkState->PrevOp = Op;
WalkState->NextOp = Next;
- WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
/* Continue downward */
@@ -271,7 +271,7 @@ AcpiPsGetNextWalkOp (
WalkState->PrevOp = Parent;
WalkState->NextOp = Next;
- WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (Status);
}
@@ -339,7 +339,7 @@ AcpiPsDeleteParseTree (
ACPI_THREAD_STATE *Thread;
- FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
+ ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
if (!SubtreeRoot)
@@ -371,7 +371,7 @@ AcpiPsDeleteParseTree (
/* Head downward in the tree */
- WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
+ WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
/* Visit all nodes in the subtree */
diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c
index 7ee0a8e..06d46d6 100644
--- a/sys/contrib/dev/acpica/psxface.c
+++ b/sys/contrib/dev/acpica/psxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 56 $
+ * $Revision: 59 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_PARSER
- MODULE_NAME ("psxface")
+ ACPI_MODULE_NAME ("psxface")
/*******************************************************************************
@@ -159,7 +159,7 @@ AcpiPsxExecute (
ACPI_WALK_STATE *WalkState;
- FUNCTION_TRACE ("PsxExecute");
+ ACPI_FUNCTION_TRACE ("PsxExecute");
/* Validate the Node and get the attached object */
@@ -211,9 +211,16 @@ AcpiPsxExecute (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /*
+ * Get a new OwnerId for objects created by this method. Namespace
+ * objects (such as Operation Regions) can be created during the
+ * first pass parse.
+ */
+ ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
+ WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
NULL, NULL, NULL);
if (!WalkState)
{
@@ -287,15 +294,6 @@ AcpiPsxExecute (
}
}
- /* Now check status from the method execution */
-
- if (ACPI_FAILURE (Status))
- {
- REPORT_ERROR (("Method execution failed, %s\n", AcpiFormatException (Status)));
- DUMP_PATHNAME (MethodNode, "Method pathname: ",
- ACPI_LV_ERROR, _COMPONENT);
- }
-
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
@@ -304,7 +302,7 @@ AcpiPsxExecute (
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned ObjDesc=%p\n",
*ReturnObjDesc));
- DUMP_STACK_ENTRY (*ReturnObjDesc);
+ ACPI_DUMP_STACK_ENTRY (*ReturnObjDesc);
Status = AE_CTRL_RETURN_VALUE;
}
diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c
index 7231098..5a6fbd3 100644
--- a/sys/contrib/dev/acpica/rsaddr.c
+++ b/sys/contrib/dev/acpica/rsaddr.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 20 $
+ * $Revision: 24 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,7 +120,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsaddr")
+ ACPI_MODULE_NAME ("rsaddr")
/*******************************************************************************
@@ -129,13 +129,12 @@
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -148,26 +147,26 @@
ACPI_STATUS
AcpiRsAddress16Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
NATIVE_CHAR *TempPtr;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16);
UINT32 Index;
UINT16 Temp16;
UINT8 Temp8;
- FUNCTION_TRACE ("RsAddress16Resource");
+ ACPI_FUNCTION_TRACE ("RsAddress16Resource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_ADDRESS16;
@@ -215,7 +214,7 @@ AcpiRsAddress16Resource (
Buffer += 1;
Temp8 = *Buffer;
- if (MEMORY_RANGE == OutputStruct->Data.Address16.ResourceType)
+ if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address16.ResourceType)
{
OutputStruct->Data.Address16.Attribute.Memory.ReadWriteAttribute =
(UINT16) (Temp8 & 0x01);
@@ -224,7 +223,7 @@ AcpiRsAddress16Resource (
}
else
{
- if (IO_RANGE == OutputStruct->Data.Address16.ResourceType)
+ if (ACPI_IO_RANGE == OutputStruct->Data.Address16.ResourceType)
{
OutputStruct->Data.Address16.Attribute.Io.RangeAttribute =
(UINT16) (Temp8 & 0x03);
@@ -240,35 +239,35 @@ AcpiRsAddress16Resource (
* Get Granularity (Bytes 6-7)
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.Granularity,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.Granularity,
Buffer);
/*
* Get MinAddressRange (Bytes 8-9)
*/
Buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MinAddressRange,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MinAddressRange,
Buffer);
/*
* Get MaxAddressRange (Bytes 10-11)
*/
Buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MaxAddressRange,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MaxAddressRange,
Buffer);
/*
* Get AddressTranslationOffset (Bytes 12-13)
*/
Buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressTranslationOffset,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressTranslationOffset,
Buffer);
/*
* Get AddressLength (Bytes 14-15)
*/
Buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressLength,
+ ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressLength,
Buffer);
/*
@@ -327,7 +326,7 @@ AcpiRsAddress16Resource (
* StructSize to the next 32-bit boundary.
*/
Temp8 = (UINT8) (Index + 1);
- StructSize += ROUND_UP_TO_32BITS (Temp8);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
}
else
{
@@ -355,9 +354,8 @@ AcpiRsAddress16Resource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -370,16 +368,16 @@ ACPI_STATUS
AcpiRsAddress16Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT8 *LengthField;
UINT8 Temp8;
NATIVE_CHAR *TempPointer = NULL;
- UINT32 ActualBytes;
+ ACPI_SIZE ActualBytes;
- FUNCTION_TRACE ("RsAddress16Stream");
+ ACPI_FUNCTION_TRACE ("RsAddress16Stream");
/*
@@ -418,7 +416,7 @@ AcpiRsAddress16Stream (
*/
Temp8 = 0;
- if (MEMORY_RANGE == LinkedList->Data.Address16.ResourceType)
+ if (ACPI_MEMORY_RANGE == LinkedList->Data.Address16.ResourceType)
{
Temp8 = (UINT8)
(LinkedList->Data.Address16.Attribute.Memory.ReadWriteAttribute &
@@ -428,7 +426,7 @@ AcpiRsAddress16Stream (
(LinkedList->Data.Address16.Attribute.Memory.CacheAttribute &
0x0F) << 1;
}
- else if (IO_RANGE == LinkedList->Data.Address16.ResourceType)
+ else if (ACPI_IO_RANGE == LinkedList->Data.Address16.ResourceType)
{
Temp8 = (UINT8)
(LinkedList->Data.Address16.Attribute.Io.RangeAttribute &
@@ -441,35 +439,35 @@ AcpiRsAddress16Stream (
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED16_TO_16 (Buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
&LinkedList->Data.Address16.Granularity);
Buffer += 2;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED16_TO_16 (Buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
&LinkedList->Data.Address16.MinAddressRange);
Buffer += 2;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED16_TO_16 (Buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
&LinkedList->Data.Address16.MaxAddressRange);
Buffer += 2;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED16_TO_16 (Buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
&LinkedList->Data.Address16.AddressTranslationOffset);
Buffer += 2;
/*
* Set the address length
*/
- MOVE_UNALIGNED16_TO_16 (Buffer,
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
&LinkedList->Data.Address16.AddressLength);
Buffer += 2;
@@ -488,21 +486,21 @@ AcpiRsAddress16Stream (
/*
* Copy the string
*/
- STRCPY (TempPointer,
+ ACPI_STRCPY (TempPointer,
LinkedList->Data.Address16.ResourceSource.StringPtr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr)
+ Buffer += (ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr)
+ 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- ActualBytes = POINTER_DIFF (Buffer, *OutputBuffer);
+ ActualBytes = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
*BytesConsumed = ActualBytes;
/*
@@ -510,7 +508,7 @@ AcpiRsAddress16Stream (
* minus the header size (3 bytes)
*/
ActualBytes -= 3;
- MOVE_UNALIGNED16_TO_16 (LengthField, &ActualBytes);
+ ACPI_MOVE_UNALIGNED16_TO_16 (LengthField, &ActualBytes);
return_ACPI_STATUS (AE_OK);
}
@@ -521,13 +519,12 @@ AcpiRsAddress16Stream (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -540,33 +537,32 @@ AcpiRsAddress16Stream (
ACPI_STATUS
AcpiRsAddress32Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer;
ACPI_RESOURCE *OutputStruct;
UINT16 Temp16;
UINT8 Temp8;
NATIVE_CHAR *TempPtr;
- UINT32 StructSize;
+ ACPI_SIZE StructSize;
UINT32 Index;
- FUNCTION_TRACE ("RsAddress32Resource");
+ ACPI_FUNCTION_TRACE ("RsAddress32Resource");
Buffer = ByteStreamBuffer;
OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
- StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32);
+ StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32);
/*
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
-
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_ADDRESS32;
@@ -617,7 +613,7 @@ AcpiRsAddress32Resource (
Buffer += 1;
Temp8 = *Buffer;
- if (MEMORY_RANGE == OutputStruct->Data.Address32.ResourceType)
+ if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address32.ResourceType)
{
OutputStruct->Data.Address32.Attribute.Memory.ReadWriteAttribute =
(UINT16) (Temp8 & 0x01);
@@ -627,7 +623,7 @@ AcpiRsAddress32Resource (
}
else
{
- if (IO_RANGE == OutputStruct->Data.Address32.ResourceType)
+ if (ACPI_IO_RANGE == OutputStruct->Data.Address32.ResourceType)
{
OutputStruct->Data.Address32.Attribute.Io.RangeAttribute =
(UINT16) (Temp8 & 0x03);
@@ -643,35 +639,35 @@ AcpiRsAddress32Resource (
* Get Granularity (Bytes 6-9)
*/
Buffer += 1;
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.Granularity,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.Granularity,
Buffer);
/*
* Get MinAddressRange (Bytes 10-13)
*/
Buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange,
Buffer);
/*
* Get MaxAddressRange (Bytes 14-17)
*/
Buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange,
Buffer);
/*
* Get AddressTranslationOffset (Bytes 18-21)
*/
Buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset,
Buffer);
/*
* Get AddressLength (Bytes 22-25)
*/
Buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressLength,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressLength,
Buffer);
/*
@@ -727,7 +723,7 @@ AcpiRsAddress32Resource (
* StructSize to the next 32-bit boundary.
*/
Temp8 = (UINT8) (Index + 1);
- StructSize += ROUND_UP_TO_32BITS (Temp8);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
}
else
{
@@ -755,9 +751,8 @@ AcpiRsAddress32Resource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -770,7 +765,7 @@ ACPI_STATUS
AcpiRsAddress32Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer;
UINT16 *LengthField;
@@ -778,7 +773,7 @@ AcpiRsAddress32Stream (
NATIVE_CHAR *TempPointer;
- FUNCTION_TRACE ("RsAddress32Stream");
+ ACPI_FUNCTION_TRACE ("RsAddress32Stream");
Buffer = *OutputBuffer;
@@ -819,7 +814,7 @@ AcpiRsAddress32Stream (
*/
Temp8 = 0;
- if(MEMORY_RANGE == LinkedList->Data.Address32.ResourceType)
+ if (ACPI_MEMORY_RANGE == LinkedList->Data.Address32.ResourceType)
{
Temp8 = (UINT8)
(LinkedList->Data.Address32.Attribute.Memory.ReadWriteAttribute &
@@ -829,7 +824,7 @@ AcpiRsAddress32Stream (
(LinkedList->Data.Address32.Attribute.Memory.CacheAttribute &
0x0F) << 1;
}
- else if (IO_RANGE == LinkedList->Data.Address32.ResourceType)
+ else if (ACPI_IO_RANGE == LinkedList->Data.Address32.ResourceType)
{
Temp8 = (UINT8)
(LinkedList->Data.Address32.Attribute.Io.RangeAttribute &
@@ -842,35 +837,35 @@ AcpiRsAddress32Stream (
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.Address32.Granularity);
Buffer += 4;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.Address32.MinAddressRange);
Buffer += 4;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.Address32.MaxAddressRange);
Buffer += 4;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.Address32.AddressTranslationOffset);
Buffer += 4;
/*
* Set the address length
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.Address32.AddressLength);
Buffer += 4;
@@ -889,20 +884,20 @@ AcpiRsAddress32Stream (
/*
* Copy the string
*/
- STRCPY (TempPointer,
+ ACPI_STRCPY (TempPointer,
LinkedList->Data.Address32.ResourceSource.StringPtr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
/*
* Set the length field to the number of bytes consumed
@@ -919,13 +914,12 @@ AcpiRsAddress32Stream (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -938,32 +932,32 @@ AcpiRsAddress32Stream (
ACPI_STATUS
AcpiRsAddress64Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer;
ACPI_RESOURCE *OutputStruct;
UINT16 Temp16;
UINT8 Temp8;
NATIVE_CHAR *TempPtr;
- UINT32 StructSize;
+ ACPI_SIZE StructSize;
UINT32 Index;
- FUNCTION_TRACE ("RsAddress64Resource");
+ ACPI_FUNCTION_TRACE ("RsAddress64Resource");
Buffer = ByteStreamBuffer;
OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
- StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64);
+ StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64);
/*
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_ADDRESS64;
@@ -1015,7 +1009,7 @@ AcpiRsAddress64Resource (
Buffer += 1;
Temp8 = *Buffer;
- if (MEMORY_RANGE == OutputStruct->Data.Address64.ResourceType)
+ if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address64.ResourceType)
{
OutputStruct->Data.Address64.Attribute.Memory.ReadWriteAttribute =
(UINT16) (Temp8 & 0x01);
@@ -1025,7 +1019,7 @@ AcpiRsAddress64Resource (
}
else
{
- if (IO_RANGE == OutputStruct->Data.Address64.ResourceType)
+ if (ACPI_IO_RANGE == OutputStruct->Data.Address64.ResourceType)
{
OutputStruct->Data.Address64.Attribute.Io.RangeAttribute =
(UINT16) (Temp8 & 0x03);
@@ -1041,35 +1035,35 @@ AcpiRsAddress64Resource (
* Get Granularity (Bytes 6-13)
*/
Buffer += 1;
- MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.Granularity,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.Granularity,
Buffer);
/*
* Get MinAddressRange (Bytes 14-21)
*/
Buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange,
Buffer);
/*
* Get MaxAddressRange (Bytes 22-29)
*/
Buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange,
Buffer);
/*
* Get AddressTranslationOffset (Bytes 30-37)
*/
Buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset,
Buffer);
/*
* Get AddressLength (Bytes 38-45)
*/
Buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressLength,
+ ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressLength,
Buffer);
/*
@@ -1128,7 +1122,7 @@ AcpiRsAddress64Resource (
* StructSize to the next 32-bit boundary.
*/
Temp8 = (UINT8) (Index + 1);
- StructSize += ROUND_UP_TO_32BITS (Temp8);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
}
else
{
@@ -1156,9 +1150,8 @@ AcpiRsAddress64Resource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -1171,7 +1164,7 @@ ACPI_STATUS
AcpiRsAddress64Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer;
UINT16 *LengthField;
@@ -1179,7 +1172,7 @@ AcpiRsAddress64Stream (
NATIVE_CHAR *TempPointer;
- FUNCTION_TRACE ("RsAddress64Stream");
+ ACPI_FUNCTION_TRACE ("RsAddress64Stream");
Buffer = *OutputBuffer;
@@ -1221,7 +1214,7 @@ AcpiRsAddress64Stream (
*/
Temp8 = 0;
- if(MEMORY_RANGE == LinkedList->Data.Address64.ResourceType)
+ if (ACPI_MEMORY_RANGE == LinkedList->Data.Address64.ResourceType)
{
Temp8 = (UINT8)
(LinkedList->Data.Address64.Attribute.Memory.ReadWriteAttribute &
@@ -1231,7 +1224,7 @@ AcpiRsAddress64Stream (
(LinkedList->Data.Address64.Attribute.Memory.CacheAttribute &
0x0F) << 1;
}
- else if (IO_RANGE == LinkedList->Data.Address64.ResourceType)
+ else if (ACPI_IO_RANGE == LinkedList->Data.Address64.ResourceType)
{
Temp8 = (UINT8)
(LinkedList->Data.Address64.Attribute.Io.RangeAttribute &
@@ -1244,35 +1237,35 @@ AcpiRsAddress64Stream (
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED64_TO_64 (Buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
&LinkedList->Data.Address64.Granularity);
Buffer += 8;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED64_TO_64 (Buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
&LinkedList->Data.Address64.MinAddressRange);
Buffer += 8;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED64_TO_64 (Buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
&LinkedList->Data.Address64.MaxAddressRange);
Buffer += 8;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED64_TO_64 (Buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
&LinkedList->Data.Address64.AddressTranslationOffset);
Buffer += 8;
/*
* Set the address length
*/
- MOVE_UNALIGNED64_TO_64 (Buffer,
+ ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
&LinkedList->Data.Address64.AddressLength);
Buffer += 8;
@@ -1291,19 +1284,19 @@ AcpiRsAddress64Stream (
/*
* Copy the string
*/
- STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr);
+ ACPI_STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
/*
* Set the length field to the number of bytes consumed
diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c
index de3b7aa..806d041 100644
--- a/sys/contrib/dev/acpica/rscalc.c
+++ b/sys/contrib/dev/acpica/rscalc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
- * $Revision: 33 $
+ * $Revision: 39 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rscalc")
+ ACPI_MODULE_NAME ("rscalc")
/*******************************************************************************
@@ -144,15 +144,15 @@
ACPI_STATUS
AcpiRsCalculateByteStreamLength (
ACPI_RESOURCE *LinkedList,
- UINT32 *SizeNeeded)
+ ACPI_SIZE *SizeNeeded)
{
- UINT32 ByteStreamSizeNeeded = 0;
- UINT32 SegmentSize;
+ ACPI_SIZE ByteStreamSizeNeeded = 0;
+ ACPI_SIZE SegmentSize;
ACPI_RESOURCE_EXT_IRQ *ExIrq = NULL;
BOOLEAN Done = FALSE;
- FUNCTION_TRACE ("RsCalculateByteStreamLength");
+ ACPI_FUNCTION_TRACE ("RsCalculateByteStreamLength");
while (!Done)
@@ -343,7 +343,6 @@ AcpiRsCalculateByteStreamLength (
* so exit with an error
*/
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- break;
} /* switch (LinkedList->Id) */
@@ -355,7 +354,7 @@ AcpiRsCalculateByteStreamLength (
/*
* Point to the next object
*/
- LinkedList = POINTER_ADD (ACPI_RESOURCE,
+ LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE,
LinkedList, LinkedList->Length);
}
@@ -389,7 +388,7 @@ ACPI_STATUS
AcpiRsCalculateListLength (
UINT8 *ByteStreamBuffer,
UINT32 ByteStreamBufferLength,
- UINT32 *SizeNeeded)
+ ACPI_SIZE *SizeNeeded)
{
UINT32 BufferSize = 0;
UINT32 BytesParsed = 0;
@@ -405,7 +404,7 @@ AcpiRsCalculateListLength (
UINT8 AdditionalBytes;
- FUNCTION_TRACE ("RsCalculateListLength");
+ ACPI_FUNCTION_TRACE ("RsCalculateListLength");
while (BytesParsed < ByteStreamBufferLength)
@@ -417,65 +416,65 @@ AcpiRsCalculateListLength (
switch (ResourceType)
{
- case RESOURCE_DESC_MEMORY_24:
+ case ACPI_RDESC_TYPE_MEMORY_24:
/*
* 24-Bit Memory Resource
*/
BytesConsumed = 12;
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
break;
- case RESOURCE_DESC_LARGE_VENDOR:
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
/*
* Vendor Defined Resource
*/
Buffer = ByteStreamBuffer;
++Buffer;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
/*
* Ensure a 32-bit boundary for the structure
*/
- Temp16 = (UINT16) ROUND_UP_TO_32BITS (Temp16);
+ Temp16 = (UINT16) ACPI_ROUND_UP_TO_32BITS (Temp16);
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
(Temp16 * sizeof (UINT8));
break;
- case RESOURCE_DESC_MEMORY_32:
+ case ACPI_RDESC_TYPE_MEMORY_32:
/*
* 32-Bit Memory Range Resource
*/
BytesConsumed = 20;
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
break;
- case RESOURCE_DESC_FIXED_MEMORY_32:
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
/*
* 32-Bit Fixed Memory Resource
*/
BytesConsumed = 12;
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
break;
- case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
/*
* 64-Bit Address Resource
*/
Buffer = ByteStreamBuffer;
++Buffer;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -501,21 +500,21 @@ AcpiRsCalculateListLength (
/*
* Ensure a 64-bit boundary for the structure
*/
- Temp8 = (UINT8) ROUND_UP_TO_64BITS (Temp8);
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_64BITS (Temp8);
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) +
(Temp8 * sizeof (UINT8));
break;
- case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
/*
* 32-Bit Address Resource
*/
Buffer = ByteStreamBuffer;
++Buffer;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -541,21 +540,21 @@ AcpiRsCalculateListLength (
/*
* Ensure a 32-bit boundary for the structure
*/
- Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8);
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) +
(Temp8 * sizeof (UINT8));
break;
- case RESOURCE_DESC_WORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
/*
* 16-Bit Address Resource
*/
Buffer = ByteStreamBuffer;
++Buffer;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -581,21 +580,21 @@ AcpiRsCalculateListLength (
/*
* Ensure a 32-bit boundary for the structure
*/
- Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8);
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) +
(Temp8 * sizeof (UINT8));
break;
- case RESOURCE_DESC_EXTENDED_XRUPT:
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
/*
* Extended IRQ
*/
Buffer = ByteStreamBuffer;
++Buffer;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -635,15 +634,15 @@ AcpiRsCalculateListLength (
/*
* Ensure a 32-bit boundary for the structure
*/
- Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8);
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) +
(AdditionalBytes * sizeof (UINT8)) +
(Temp8 * sizeof (UINT8));
break;
- case RESOURCE_DESC_IRQ_FORMAT:
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
/*
* IRQ Resource.
* Determine if it there are two or three trailing bytes
@@ -668,7 +667,7 @@ AcpiRsCalculateListLength (
/*
* Look at the number of bits set
*/
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
for (Index = 0; Index < 16; Index++)
{
@@ -680,12 +679,12 @@ AcpiRsCalculateListLength (
Temp16 >>= 1;
}
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO) +
(NumberOfInterrupts * sizeof (UINT32));
break;
- case RESOURCE_DESC_DMA_FORMAT:
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
/*
* DMA Resource
*/
@@ -712,12 +711,12 @@ AcpiRsCalculateListLength (
Temp8 >>= 1;
}
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) +
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) +
(NumberOfChannels * sizeof (UINT32));
break;
- case RESOURCE_DESC_START_DEPENDENT:
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
/*
* Start Dependent Functions Resource
* Determine if it there are two or three trailing bytes
@@ -734,11 +733,11 @@ AcpiRsCalculateListLength (
BytesConsumed = 1;
}
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
break;
- case RESOURCE_DESC_END_DEPENDENT:
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
/*
* End Dependent Functions Resource
*/
@@ -747,25 +746,25 @@ AcpiRsCalculateListLength (
break;
- case RESOURCE_DESC_IO_PORT:
+ case ACPI_RDESC_TYPE_IO_PORT:
/*
* IO Port Resource
*/
BytesConsumed = 8;
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
break;
- case RESOURCE_DESC_FIXED_IO_PORT:
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
/*
* Fixed IO Port Resource
*/
BytesConsumed = 4;
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
break;
- case RESOURCE_DESC_SMALL_VENDOR:
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
/*
* Vendor Specific Resource
*/
@@ -778,13 +777,13 @@ AcpiRsCalculateListLength (
/*
* Ensure a 32-bit boundary for the structure
*/
- Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8);
- StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
+ Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
+ StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
(Temp8 * sizeof (UINT8));
break;
- case RESOURCE_DESC_END_TAG:
+ case ACPI_RDESC_TYPE_END_TAG:
/*
* End Tag
*/
@@ -800,13 +799,12 @@ AcpiRsCalculateListLength (
* so exit with an error
*/
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- break;
}
/*
* Update the return value and counter
*/
- BufferSize += StructureSize;
+ BufferSize += ACPI_ALIGN_RESOURCE_SIZE(StructureSize);
BytesParsed += BytesConsumed;
/*
@@ -843,7 +841,7 @@ AcpiRsCalculateListLength (
ACPI_STATUS
AcpiRsCalculatePciRoutingTableLength (
ACPI_OPERAND_OBJECT *PackageObject,
- UINT32 *BufferSizeNeeded)
+ ACPI_SIZE *BufferSizeNeeded)
{
UINT32 NumberOfElements;
UINT32 TempSizeNeeded = 0;
@@ -855,7 +853,7 @@ AcpiRsCalculatePciRoutingTableLength (
UINT32 TableIndex;
- FUNCTION_TRACE ("RsCalculatePciRoutingTableLength");
+ ACPI_FUNCTION_TRACE ("RsCalculatePciRoutingTableLength");
NumberOfElements = PackageObject->Package.Count;
@@ -907,7 +905,7 @@ AcpiRsCalculatePciRoutingTableLength (
}
}
- TempSizeNeeded += (sizeof (PCI_ROUTING_TABLE) - 4);
+ TempSizeNeeded += (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
/*
* Was a String type found?
@@ -939,7 +937,7 @@ AcpiRsCalculatePciRoutingTableLength (
/* Round up the size since each element must be aligned */
- TempSizeNeeded = ROUND_UP_TO_64BITS (TempSizeNeeded);
+ TempSizeNeeded = ACPI_ROUND_UP_TO_64BITS (TempSizeNeeded);
/*
* Point to the next ACPI_OPERAND_OBJECT
@@ -950,6 +948,6 @@ AcpiRsCalculatePciRoutingTableLength (
/*
* Adding an extra element to the end of the list, essentially a NULL terminator
*/
- *BufferSizeNeeded = TempSizeNeeded + sizeof (PCI_ROUTING_TABLE);
+ *BufferSizeNeeded = TempSizeNeeded + sizeof (ACPI_PCI_ROUTING_TABLE);
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c
index 14aaf5d..51e9934 100644
--- a/sys/contrib/dev/acpica/rscreate.c
+++ b/sys/contrib/dev/acpica/rscreate.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
- * $Revision: 38 $
+ * $Revision: 53 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rscreate")
+ ACPI_MODULE_NAME ("rscreate")
/*******************************************************************************
@@ -148,17 +148,16 @@
ACPI_STATUS
AcpiRsCreateResourceList (
ACPI_OPERAND_OBJECT *ByteStreamBuffer,
- UINT8 *OutputBuffer,
- UINT32 *OutputBufferLength)
+ ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
UINT8 *ByteStreamStart;
- UINT32 ListSizeNeeded = 0;
+ ACPI_SIZE ListSizeNeeded = 0;
UINT32 ByteStreamBufferLength;
- FUNCTION_TRACE ("RsCreateResourceList");
+ ACPI_FUNCTION_TRACE ("RsCreateResourceList");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", ByteStreamBuffer));
@@ -183,29 +182,25 @@ AcpiRsCreateResourceList (
return_ACPI_STATUS (Status);
}
- /*
- * Is caller buffer large enough?
- */
- if (ListSizeNeeded > *OutputBufferLength)
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (OutputBuffer, ListSizeNeeded);
+ if (ACPI_FAILURE (Status))
{
- *OutputBufferLength = ListSizeNeeded;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ return_ACPI_STATUS (Status);
}
- /*
- * Zero out the return buffer before proceeding
- */
- MEMSET (OutputBuffer, 0x00, *OutputBufferLength);
+ /* Do the conversion */
Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength,
- &OutputBuffer);
+ OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer));
- *OutputBufferLength = ListSizeNeeded;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
+ OutputBuffer->Pointer, OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
@@ -221,71 +216,68 @@ AcpiRsCreateResourceList (
*
* RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
* If the OutputBuffer is too small, the error will be
- * AE_BUFFER_OVERFLOW and OutputBufferLength will point
+ * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a
* linked list of PCI interrupt descriptions
*
+ * NOTE: It is the caller's responsibility to ensure that the start of the
+ * output buffer is aligned properly (if necessary).
+ *
******************************************************************************/
ACPI_STATUS
AcpiRsCreatePciRoutingTable (
ACPI_OPERAND_OBJECT *PackageObject,
- UINT8 *OutputBuffer,
- UINT32 *OutputBufferLength)
+ ACPI_BUFFER *OutputBuffer)
{
- UINT8 *Buffer = OutputBuffer;
+ UINT8 *Buffer;
ACPI_OPERAND_OBJECT **TopObjectList = NULL;
ACPI_OPERAND_OBJECT **SubObjectList = NULL;
ACPI_OPERAND_OBJECT *PackageElement = NULL;
- UINT32 BufferSizeNeeded = 0;
+ ACPI_SIZE BufferSizeNeeded = 0;
UINT32 NumberOfElements = 0;
UINT32 Index = 0;
- PCI_ROUTING_TABLE *UserPrt = NULL;
+ ACPI_PCI_ROUTING_TABLE *UserPrt = NULL;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
+ ACPI_BUFFER PathBuffer;
+
+ ACPI_FUNCTION_TRACE ("RsCreatePciRoutingTable");
- FUNCTION_TRACE ("RsCreatePciRoutingTable");
+ /* Params already validated, so we don't re-validate here */
/*
- * Params already validated, so we don't re-validate here
+ * Get the required buffer length
*/
Status = AcpiRsCalculatePciRoutingTableLength (PackageObject,
&BufferSizeNeeded);
- if (!ACPI_SUCCESS(Status))
+ if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", BufferSizeNeeded));
- /* Is caller buffer large enough? */
+ /* Validate/Allocate/Clear caller buffer */
- if (BufferSizeNeeded > *OutputBufferLength)
+ Status = AcpiUtInitializeBuffer (OutputBuffer, BufferSizeNeeded);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ return_ACPI_STATUS (Status);
}
- *OutputBufferLength = BufferSizeNeeded;
/*
- * Zero out the return buffer before proceeding
- */
- MEMSET (OutputBuffer, 0x00, *OutputBufferLength);
-
- /*
- * Loop through the ACPI_INTERNAL_OBJECTS - Each object should
- * contain a UINT32 Address, a UINT8 Pin, a Name and a UINT8
- * SourceIndex.
+ * Loop through the ACPI_INTERNAL_OBJECTS - Each object should contain an
+ * ACPI_INTEGER Address, a UINT8 Pin, a Name and a UINT8 SourceIndex.
*/
TopObjectList = PackageObject->Package.Elements;
NumberOfElements = PackageObject->Package.Count;
- UserPrt = (PCI_ROUTING_TABLE *) Buffer;
-
-
- Buffer = ROUND_PTR_UP_TO_8 (Buffer, UINT8);
+ Buffer = OutputBuffer->Pointer;
+ UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer;
for (Index = 0; Index < NumberOfElements; Index++)
{
@@ -296,15 +288,14 @@ AcpiRsCreatePciRoutingTable (
* be zero because we cleared the return buffer earlier
*/
Buffer += UserPrt->Length;
- UserPrt = (PCI_ROUTING_TABLE *) Buffer;
+ UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer;
/*
- * Fill in the Length field with the information we
- * have at this point.
- * The minus four is to subtract the size of the
- * UINT8 Source[4] member because it is added below.
+ * Fill in the Length field with the information we have at this point.
+ * The minus four is to subtract the size of the UINT8 Source[4] member
+ * because it is added below.
*/
- UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) -4);
+ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) -4);
/*
* Dereference the sub-package
@@ -312,9 +303,8 @@ AcpiRsCreatePciRoutingTable (
PackageElement = *TopObjectList;
/*
- * The SubObjectList will now point to an array of
- * the four IRQ elements: Address, Pin, Source and
- * SourceIndex
+ * The SubObjectList will now point to an array of the four IRQ
+ * elements: Address, Pin, Source and SourceIndex
*/
SubObjectList = PackageElement->Package.Elements;
@@ -368,37 +358,33 @@ AcpiRsCreatePciRoutingTable (
/* Use *remaining* length of the buffer as max for pathname */
- BufferSizeNeeded = *OutputBufferLength -
- (UINT32) ((UINT8 *) UserPrt->Source - OutputBuffer);
+ PathBuffer.Length = OutputBuffer->Length -
+ (UINT32) ((UINT8 *) UserPrt->Source - (UINT8 *) OutputBuffer->Pointer);
+ PathBuffer.Pointer = UserPrt->Source;
- Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node,
- &BufferSizeNeeded, UserPrt->Source);
+ Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node, &PathBuffer);
- UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */
+ UserPrt->Length += ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */
break;
case ACPI_TYPE_STRING:
- STRCPY (UserPrt->Source,
+ ACPI_STRCPY (UserPrt->Source,
(*SubObjectList)->String.Pointer);
- /*
- * Add to the Length field the length of the string
- */
+ /* Add to the Length field the length of the string */
+
UserPrt->Length += (*SubObjectList)->String.Length;
break;
case ACPI_TYPE_INTEGER:
/*
- * If this is a number, then the Source Name
- * is NULL, since the entire buffer was zeroed
- * out, we can leave this alone.
- */
- /*
- * Add to the Length field the length of
- * the UINT32 NULL
+ * If this is a number, then the Source Name is NULL, since the
+ * entire buffer was zeroed out, we can leave this alone.
+ *
+ * Add to the Length field the length of the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
break;
@@ -409,12 +395,11 @@ AcpiRsCreatePciRoutingTable (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
AcpiUtGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
- break;
}
/* Now align the current length */
- UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length);
+ UserPrt->Length = ACPI_ROUND_UP_TO_64BITS (UserPrt->Length);
/*
* 4) Fourth subobject: Dereference the Source Index
@@ -432,16 +417,13 @@ AcpiRsCreatePciRoutingTable (
return_ACPI_STATUS (AE_BAD_DATA);
}
- /*
- * Point to the next ACPI_OPERAND_OBJECT
- */
+ /* Point to the next ACPI_OPERAND_OBJECT */
+
TopObjectList++;
}
- /*
- * Report the amount of buffer used
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
+ OutputBuffer->Pointer, OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
@@ -452,11 +434,10 @@ AcpiRsCreatePciRoutingTable (
*
* PARAMETERS: LinkedListBuffer - Pointer to the resource linked list
* 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
- * AE_BUFFER_OVERFLOW and OutputBufferLength will point
+ * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the linked list of device resources and
@@ -468,14 +449,13 @@ AcpiRsCreatePciRoutingTable (
ACPI_STATUS
AcpiRsCreateByteStream (
ACPI_RESOURCE *LinkedListBuffer,
- UINT8 *OutputBuffer,
- UINT32 *OutputBufferLength)
+ ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
- UINT32 ByteStreamSizeNeeded = 0;
+ ACPI_SIZE ByteStreamSizeNeeded = 0;
- FUNCTION_TRACE ("RsCreateByteStream");
+ ACPI_FUNCTION_TRACE ("RsCreateByteStream");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", LinkedListBuffer));
@@ -496,28 +476,25 @@ AcpiRsCreateByteStream (
return_ACPI_STATUS (Status);
}
- /*
- * Is caller buffer large enough?
- */
- if (ByteStreamSizeNeeded > *OutputBufferLength)
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (OutputBuffer, ByteStreamSizeNeeded);
+ if (ACPI_FAILURE (Status))
{
- *OutputBufferLength = ByteStreamSizeNeeded;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ return_ACPI_STATUS (Status);
}
- /*
- * Zero out the return buffer before proceeding
- */
- MEMSET (OutputBuffer, 0x00, *OutputBufferLength);
+ /* Do the conversion */
Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded,
- &OutputBuffer);
+ OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
+ OutputBuffer->Pointer, OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c
index 9a0a290..5c4be20 100644
--- a/sys/contrib/dev/acpica/rsdump.c
+++ b/sys/contrib/dev/acpica/rsdump.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
- * $Revision: 23 $
+ * $Revision: 29 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsdump")
+ ACPI_MODULE_NAME ("rsdump")
#ifdef ACPI_DEBUG
@@ -146,19 +146,19 @@ AcpiRsDumpIrq (
UINT8 Index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("IRQ Resource\n");
AcpiOsPrintf (" %s Triggered\n",
- LEVEL_SENSITIVE == IrqData->EdgeLevel ? "Level" : "Edge");
+ ACPI_LEVEL_SENSITIVE == IrqData->EdgeLevel ? "Level" : "Edge");
AcpiOsPrintf (" Active %s\n",
- ACTIVE_LOW == IrqData->ActiveHighLow ? "Low" : "High");
+ ACPI_ACTIVE_LOW == IrqData->ActiveHighLow ? "Low" : "High");
AcpiOsPrintf (" %s\n",
- SHARED == IrqData->SharedExclusive ? "Shared" : "Exclusive");
+ ACPI_SHARED == IrqData->SharedExclusive ? "Shared" : "Exclusive");
AcpiOsPrintf (" %X Interrupts ( ", IrqData->NumberOfInterrupts);
@@ -192,26 +192,26 @@ AcpiRsDumpDma (
UINT8 Index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("DMA Resource\n");
switch (DmaData->Type)
{
- case COMPATIBILITY:
+ case ACPI_COMPATIBILITY:
AcpiOsPrintf (" Compatibility mode\n");
break;
- case TYPE_A:
+ case ACPI_TYPE_A:
AcpiOsPrintf (" Type A\n");
break;
- case TYPE_B:
+ case ACPI_TYPE_B:
AcpiOsPrintf (" Type B\n");
break;
- case TYPE_F:
+ case ACPI_TYPE_F:
AcpiOsPrintf (" Type F\n");
break;
@@ -221,20 +221,20 @@ AcpiRsDumpDma (
}
AcpiOsPrintf (" %sBus Master\n",
- BUS_MASTER == DmaData->BusMaster ? "" : "Not a ");
+ ACPI_BUS_MASTER == DmaData->BusMaster ? "" : "Not a ");
switch (DmaData->Transfer)
{
- case TRANSFER_8:
+ case ACPI_TRANSFER_8:
AcpiOsPrintf (" 8-bit only transfer\n");
break;
- case TRANSFER_8_16:
+ case ACPI_TRANSFER_8_16:
AcpiOsPrintf (" 8 and 16-bit transfer\n");
break;
- case TRANSFER_16:
+ case ACPI_TRANSFER_16:
AcpiOsPrintf (" 16 bit only transfer\n");
break;
@@ -257,7 +257,7 @@ AcpiRsDumpDma (
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpStartDependentFunctions
+ * FUNCTION: AcpiRsDumpStartDependFns
*
* PARAMETERS: Data - pointer to the resource structure to dump.
*
@@ -268,28 +268,28 @@ AcpiRsDumpDma (
******************************************************************************/
void
-AcpiRsDumpStartDependentFunctions (
+AcpiRsDumpStartDependFns (
ACPI_RESOURCE_DATA *Data)
{
ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("Start Dependent Functions Resource\n");
switch (SdfData->CompatibilityPriority)
{
- case GOOD_CONFIGURATION:
+ case ACPI_GOOD_CONFIGURATION:
AcpiOsPrintf (" Good configuration\n");
break;
- case ACCEPTABLE_CONFIGURATION:
+ case ACPI_ACCEPTABLE_CONFIGURATION:
AcpiOsPrintf (" Acceptable configuration\n");
break;
- case SUB_OPTIMAL_CONFIGURATION:
+ case ACPI_SUB_OPTIMAL_CONFIGURATION:
AcpiOsPrintf (" Sub-optimal configuration\n");
break;
@@ -300,15 +300,15 @@ AcpiRsDumpStartDependentFunctions (
switch(SdfData->PerformanceRobustness)
{
- case GOOD_CONFIGURATION:
+ case ACPI_GOOD_CONFIGURATION:
AcpiOsPrintf (" Good configuration\n");
break;
- case ACCEPTABLE_CONFIGURATION:
+ case ACPI_ACCEPTABLE_CONFIGURATION:
AcpiOsPrintf (" Acceptable configuration\n");
break;
- case SUB_OPTIMAL_CONFIGURATION:
+ case ACPI_SUB_OPTIMAL_CONFIGURATION:
AcpiOsPrintf (" Sub-optimal configuration\n");
break;
@@ -341,13 +341,13 @@ AcpiRsDumpIo (
ACPI_RESOURCE_IO *IoData = (ACPI_RESOURCE_IO *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("Io Resource\n");
AcpiOsPrintf (" %d bit decode\n",
- DECODE_16 == IoData->IoDecode ? 16 : 10);
+ ACPI_DECODE_16 == IoData->IoDecode ? 16 : 10);
AcpiOsPrintf (" Range minimum base: %08X\n",
IoData->MinBaseAddress);
@@ -384,7 +384,7 @@ AcpiRsDumpFixedIo (
ACPI_RESOURCE_FIXED_IO *FixedIoData = (ACPI_RESOURCE_FIXED_IO *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("Fixed Io Resource\n");
@@ -418,7 +418,7 @@ AcpiRsDumpVendorSpecific (
UINT16 Index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("Vendor Specific Resource\n");
@@ -454,13 +454,13 @@ AcpiRsDumpMemory24 (
ACPI_RESOURCE_MEM24 *Memory24Data = (ACPI_RESOURCE_MEM24 *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("24-Bit Memory Range Resource\n");
AcpiOsPrintf (" Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
Memory24Data->ReadWriteAttribute ?
"/Write" : " only");
@@ -499,13 +499,13 @@ AcpiRsDumpMemory32 (
ACPI_RESOURCE_MEM32 *Memory32Data = (ACPI_RESOURCE_MEM32 *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("32-Bit Memory Range Resource\n");
AcpiOsPrintf (" Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
Memory32Data->ReadWriteAttribute ?
"/Write" : " only");
@@ -544,13 +544,13 @@ AcpiRsDumpFixedMemory32 (
ACPI_RESOURCE_FIXED_MEM32 *FixedMemory32Data = (ACPI_RESOURCE_FIXED_MEM32 *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("32-Bit Fixed Location Memory Range Resource\n");
AcpiOsPrintf (" Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
FixedMemory32Data->ReadWriteAttribute ?
"/Write" : " Only");
@@ -583,7 +583,7 @@ AcpiRsDumpAddress16 (
ACPI_RESOURCE_ADDRESS16 *Address16Data = (ACPI_RESOURCE_ADDRESS16 *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("16-Bit Address Space Resource\n");
@@ -591,28 +591,28 @@ AcpiRsDumpAddress16 (
switch (Address16Data->ResourceType)
{
- case MEMORY_RANGE:
+ case ACPI_MEMORY_RANGE:
AcpiOsPrintf ("Memory Range\n");
switch (Address16Data->Attribute.Memory.CacheAttribute)
{
- case NON_CACHEABLE_MEMORY:
+ case ACPI_NON_CACHEABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Noncacheable memory\n");
break;
- case CACHABLE_MEMORY:
+ case ACPI_CACHABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Cacheable memory\n");
break;
- case WRITE_COMBINING_MEMORY:
+ case ACPI_WRITE_COMBINING_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Write-combining memory\n");
break;
- case PREFETCHABLE_MEMORY:
+ case ACPI_PREFETCHABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Prefetchable memory\n");
break;
@@ -624,28 +624,28 @@ AcpiRsDumpAddress16 (
}
AcpiOsPrintf (" Type Specific: Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
Address16Data->Attribute.Memory.ReadWriteAttribute ?
"/Write" : " Only");
break;
- case IO_RANGE:
+ case ACPI_IO_RANGE:
AcpiOsPrintf ("I/O Range\n");
switch (Address16Data->Attribute.Io.RangeAttribute)
{
- case NON_ISA_ONLY_RANGES:
+ case ACPI_NON_ISA_ONLY_RANGES:
AcpiOsPrintf (" Type Specific: "
"Non-ISA Io Addresses\n");
break;
- case ISA_ONLY_RANGES:
+ case ACPI_ISA_ONLY_RANGES:
AcpiOsPrintf (" Type Specific: "
"ISA Io Addresses\n");
break;
- case ENTIRE_RANGE:
+ case ACPI_ENTIRE_RANGE:
AcpiOsPrintf (" Type Specific: "
"ISA and non-ISA Io Addresses\n");
break;
@@ -657,7 +657,7 @@ AcpiRsDumpAddress16 (
}
break;
- case BUS_NUMBER_RANGE:
+ case ACPI_BUS_NUMBER_RANGE:
AcpiOsPrintf ("Bus Number Range\n");
break;
@@ -669,19 +669,19 @@ AcpiRsDumpAddress16 (
}
AcpiOsPrintf (" Resource %s\n",
- CONSUMER == Address16Data->ProducerConsumer ?
+ ACPI_CONSUMER == Address16Data->ProducerConsumer ?
"Consumer" : "Producer");
AcpiOsPrintf (" %s decode\n",
- SUB_DECODE == Address16Data->Decode ?
+ ACPI_SUB_DECODE == Address16Data->Decode ?
"Subtractive" : "Positive");
AcpiOsPrintf (" Min address is %s fixed\n",
- ADDRESS_FIXED == Address16Data->MinAddressFixed ?
+ ACPI_ADDRESS_FIXED == Address16Data->MinAddressFixed ?
"" : "not");
AcpiOsPrintf (" Max address is %s fixed\n",
- ADDRESS_FIXED == Address16Data->MaxAddressFixed ?
+ ACPI_ADDRESS_FIXED == Address16Data->MaxAddressFixed ?
"" : "not");
AcpiOsPrintf (" Granularity: %08X\n",
@@ -730,35 +730,35 @@ AcpiRsDumpAddress32 (
ACPI_RESOURCE_ADDRESS32 *Address32Data = (ACPI_RESOURCE_ADDRESS32 *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("32-Bit Address Space Resource\n");
switch (Address32Data->ResourceType)
{
- case MEMORY_RANGE:
+ case ACPI_MEMORY_RANGE:
AcpiOsPrintf (" Resource Type: Memory Range\n");
switch (Address32Data->Attribute.Memory.CacheAttribute)
{
- case NON_CACHEABLE_MEMORY:
+ case ACPI_NON_CACHEABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Noncacheable memory\n");
break;
- case CACHABLE_MEMORY:
+ case ACPI_CACHABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Cacheable memory\n");
break;
- case WRITE_COMBINING_MEMORY:
+ case ACPI_WRITE_COMBINING_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Write-combining memory\n");
break;
- case PREFETCHABLE_MEMORY:
+ case ACPI_PREFETCHABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Prefetchable memory\n");
break;
@@ -770,28 +770,28 @@ AcpiRsDumpAddress32 (
}
AcpiOsPrintf (" Type Specific: Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
Address32Data->Attribute.Memory.ReadWriteAttribute ?
"/Write" : " Only");
break;
- case IO_RANGE:
+ case ACPI_IO_RANGE:
AcpiOsPrintf (" Resource Type: Io Range\n");
switch (Address32Data->Attribute.Io.RangeAttribute)
{
- case NON_ISA_ONLY_RANGES:
+ case ACPI_NON_ISA_ONLY_RANGES:
AcpiOsPrintf (" Type Specific: "
"Non-ISA Io Addresses\n");
break;
- case ISA_ONLY_RANGES:
+ case ACPI_ISA_ONLY_RANGES:
AcpiOsPrintf (" Type Specific: "
"ISA Io Addresses\n");
break;
- case ENTIRE_RANGE:
+ case ACPI_ENTIRE_RANGE:
AcpiOsPrintf (" Type Specific: "
"ISA and non-ISA Io Addresses\n");
break;
@@ -803,7 +803,7 @@ AcpiRsDumpAddress32 (
}
break;
- case BUS_NUMBER_RANGE:
+ case ACPI_BUS_NUMBER_RANGE:
AcpiOsPrintf (" Resource Type: Bus Number Range\n");
break;
@@ -815,19 +815,19 @@ AcpiRsDumpAddress32 (
}
AcpiOsPrintf (" Resource %s\n",
- CONSUMER == Address32Data->ProducerConsumer ?
+ ACPI_CONSUMER == Address32Data->ProducerConsumer ?
"Consumer" : "Producer");
AcpiOsPrintf (" %s decode\n",
- SUB_DECODE == Address32Data->Decode ?
+ ACPI_SUB_DECODE == Address32Data->Decode ?
"Subtractive" : "Positive");
AcpiOsPrintf (" Min address is %s fixed\n",
- ADDRESS_FIXED == Address32Data->MinAddressFixed ?
+ ACPI_ADDRESS_FIXED == Address32Data->MinAddressFixed ?
"" : "not ");
AcpiOsPrintf (" Max address is %s fixed\n",
- ADDRESS_FIXED == Address32Data->MaxAddressFixed ?
+ ACPI_ADDRESS_FIXED == Address32Data->MaxAddressFixed ?
"" : "not ");
AcpiOsPrintf (" Granularity: %08X\n",
@@ -876,35 +876,35 @@ AcpiRsDumpAddress64 (
ACPI_RESOURCE_ADDRESS64 *Address64Data = (ACPI_RESOURCE_ADDRESS64 *) Data;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("64-Bit Address Space Resource\n");
switch (Address64Data->ResourceType)
{
- case MEMORY_RANGE:
+ case ACPI_MEMORY_RANGE:
AcpiOsPrintf (" Resource Type: Memory Range\n");
switch (Address64Data->Attribute.Memory.CacheAttribute)
{
- case NON_CACHEABLE_MEMORY:
+ case ACPI_NON_CACHEABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Noncacheable memory\n");
break;
- case CACHABLE_MEMORY:
+ case ACPI_CACHABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Cacheable memory\n");
break;
- case WRITE_COMBINING_MEMORY:
+ case ACPI_WRITE_COMBINING_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Write-combining memory\n");
break;
- case PREFETCHABLE_MEMORY:
+ case ACPI_PREFETCHABLE_MEMORY:
AcpiOsPrintf (" Type Specific: "
"Prefetchable memory\n");
break;
@@ -916,28 +916,28 @@ AcpiRsDumpAddress64 (
}
AcpiOsPrintf (" Type Specific: Read%s\n",
- READ_WRITE_MEMORY ==
+ ACPI_READ_WRITE_MEMORY ==
Address64Data->Attribute.Memory.ReadWriteAttribute ?
"/Write" : " Only");
break;
- case IO_RANGE:
+ case ACPI_IO_RANGE:
AcpiOsPrintf (" Resource Type: Io Range\n");
switch (Address64Data->Attribute.Io.RangeAttribute)
{
- case NON_ISA_ONLY_RANGES:
+ case ACPI_NON_ISA_ONLY_RANGES:
AcpiOsPrintf (" Type Specific: "
"Non-ISA Io Addresses\n");
break;
- case ISA_ONLY_RANGES:
+ case ACPI_ISA_ONLY_RANGES:
AcpiOsPrintf (" Type Specific: "
"ISA Io Addresses\n");
break;
- case ENTIRE_RANGE:
+ case ACPI_ENTIRE_RANGE:
AcpiOsPrintf (" Type Specific: "
"ISA and non-ISA Io Addresses\n");
break;
@@ -949,7 +949,7 @@ AcpiRsDumpAddress64 (
}
break;
- case BUS_NUMBER_RANGE:
+ case ACPI_BUS_NUMBER_RANGE:
AcpiOsPrintf (" Resource Type: Bus Number Range\n");
break;
@@ -961,19 +961,19 @@ AcpiRsDumpAddress64 (
}
AcpiOsPrintf (" Resource %s\n",
- CONSUMER == Address64Data->ProducerConsumer ?
+ ACPI_CONSUMER == Address64Data->ProducerConsumer ?
"Consumer" : "Producer");
AcpiOsPrintf (" %s decode\n",
- SUB_DECODE == Address64Data->Decode ?
+ ACPI_SUB_DECODE == Address64Data->Decode ?
"Subtractive" : "Positive");
AcpiOsPrintf (" Min address is %s fixed\n",
- ADDRESS_FIXED == Address64Data->MinAddressFixed ?
+ ACPI_ADDRESS_FIXED == Address64Data->MinAddressFixed ?
"" : "not ");
AcpiOsPrintf (" Max address is %s fixed\n",
- ADDRESS_FIXED == Address64Data->MaxAddressFixed ?
+ ACPI_ADDRESS_FIXED == Address64Data->MaxAddressFixed ?
"" : "not ");
AcpiOsPrintf (" Granularity: %16X\n",
@@ -1023,25 +1023,25 @@ AcpiRsDumpExtendedIrq (
UINT8 Index = 0;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
AcpiOsPrintf ("Extended IRQ Resource\n");
AcpiOsPrintf (" Resource %s\n",
- CONSUMER == ExtIrqData->ProducerConsumer ?
+ ACPI_CONSUMER == ExtIrqData->ProducerConsumer ?
"Consumer" : "Producer");
AcpiOsPrintf (" %s\n",
- LEVEL_SENSITIVE == ExtIrqData->EdgeLevel ?
+ ACPI_LEVEL_SENSITIVE == ExtIrqData->EdgeLevel ?
"Level" : "Edge");
AcpiOsPrintf (" Active %s\n",
- ACTIVE_LOW == ExtIrqData->ActiveHighLow ?
+ ACPI_ACTIVE_LOW == ExtIrqData->ActiveHighLow ?
"low" : "high");
AcpiOsPrintf (" %s\n",
- SHARED == ExtIrqData->SharedExclusive ?
+ ACPI_SHARED == ExtIrqData->SharedExclusive ?
"Shared" : "Exclusive");
AcpiOsPrintf (" Interrupts : %X ( ",
@@ -1086,7 +1086,7 @@ AcpiRsDumpResourceList (
BOOLEAN Done = FALSE;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer)
@@ -1106,7 +1106,7 @@ AcpiRsDumpResourceList (
break;
case ACPI_RSTYPE_START_DPF:
- AcpiRsDumpStartDependentFunctions (&Resource->Data);
+ AcpiRsDumpStartDependFns (&Resource->Data);
break;
case ACPI_RSTYPE_END_DPF:
@@ -1166,7 +1166,7 @@ AcpiRsDumpResourceList (
}
- Resource = POINTER_ADD (ACPI_RESOURCE, Resource, Resource->Length);
+ Resource = ACPI_PTR_ADD (ACPI_RESOURCE, Resource, Resource->Length);
}
}
@@ -1187,27 +1187,28 @@ AcpiRsDumpResourceList (
void
AcpiRsDumpIrqList (
- UINT8 *RouteTable)
+ UINT8 *RouteTable)
{
- UINT8 *Buffer = RouteTable;
- UINT8 Count = 0;
- BOOLEAN Done = FALSE;
- PCI_ROUTING_TABLE *PrtElement;
+ UINT8 *Buffer = RouteTable;
+ UINT8 Count = 0;
+ BOOLEAN Done = FALSE;
+ ACPI_PCI_ROUTING_TABLE *PrtElement;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer)
{
- PrtElement = (PCI_ROUTING_TABLE *) Buffer;
+ PrtElement = (ACPI_PCI_ROUTING_TABLE *) Buffer;
while (!Done)
{
AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++);
- AcpiOsPrintf (" Address: %X\n",
- PrtElement->Address);
+ AcpiOsPrintf (" Address: %8.8X%8.8X\n",
+ ACPI_HIDWORD (PrtElement->Address),
+ ACPI_LODWORD (PrtElement->Address));
AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin);
@@ -1218,7 +1219,7 @@ AcpiRsDumpIrqList (
Buffer += PrtElement->Length;
- PrtElement = (PCI_ROUTING_TABLE *) Buffer;
+ PrtElement = (ACPI_PCI_ROUTING_TABLE *) Buffer;
if(0 == PrtElement->Length)
{
diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c
index c979585..0efa40e9 100644
--- a/sys/contrib/dev/acpica/rsio.c
+++ b/sys/contrib/dev/acpica/rsio.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 14 $
+ * $Revision: 17 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,7 +120,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsio")
+ ACPI_MODULE_NAME ("rsio")
/*******************************************************************************
@@ -129,13 +129,12 @@
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -148,18 +147,18 @@
ACPI_STATUS
AcpiRsIoResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
- FUNCTION_TRACE ("RsIoResource");
+ ACPI_FUNCTION_TRACE ("RsIoResource");
/*
@@ -181,7 +180,7 @@ AcpiRsIoResource (
* Check MinBase Address
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Io.MinBaseAddress = Temp16;
@@ -189,7 +188,7 @@ AcpiRsIoResource (
* Check MaxBase Address
*/
Buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Io.MaxBaseAddress = Temp16;
@@ -228,13 +227,12 @@ AcpiRsIoResource (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -247,18 +245,18 @@ AcpiRsIoResource (
ACPI_STATUS
AcpiRsFixedIoResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
- FUNCTION_TRACE ("RsFixedIoResource");
+ ACPI_FUNCTION_TRACE ("RsFixedIoResource");
/*
@@ -272,7 +270,7 @@ AcpiRsFixedIoResource (
* Check Range Base Address
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.FixedIo.BaseAddress = Temp16;
@@ -303,9 +301,8 @@ AcpiRsFixedIoResource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -318,14 +315,14 @@ ACPI_STATUS
AcpiRsIoStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsIoStream");
+ ACPI_FUNCTION_TRACE ("RsIoStream");
/*
@@ -347,7 +344,7 @@ AcpiRsIoStream (
*/
Temp16 = (UINT16) LinkedList->Data.Io.MinBaseAddress;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -355,7 +352,7 @@ AcpiRsIoStream (
*/
Temp16 = (UINT16) LinkedList->Data.Io.MaxBaseAddress;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -377,7 +374,7 @@ AcpiRsIoStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -388,9 +385,8 @@ AcpiRsIoStream (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -403,14 +399,14 @@ ACPI_STATUS
AcpiRsFixedIoStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsFixedIoStream");
+ ACPI_FUNCTION_TRACE ("RsFixedIoStream");
/*
@@ -425,7 +421,7 @@ AcpiRsFixedIoStream (
*/
Temp16 = (UINT16) LinkedList->Data.FixedIo.BaseAddress;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -439,7 +435,7 @@ AcpiRsFixedIoStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -450,13 +446,12 @@ AcpiRsFixedIoStream (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -469,19 +464,19 @@ AcpiRsFixedIoStream (
ACPI_STATUS
AcpiRsDmaResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT8 Temp8 = 0;
UINT8 Index;
UINT8 i;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
- FUNCTION_TRACE ("RsDmaResource");
+ ACPI_FUNCTION_TRACE ("RsDmaResource");
/*
@@ -559,9 +554,8 @@ AcpiRsDmaResource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -574,7 +568,7 @@ ACPI_STATUS
AcpiRsDmaStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
@@ -582,7 +576,7 @@ AcpiRsDmaStream (
UINT8 Index;
- FUNCTION_TRACE ("RsDmaStream");
+ ACPI_FUNCTION_TRACE ("RsDmaStream");
/*
@@ -619,7 +613,7 @@ AcpiRsDmaStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c
index 7944046..46087ac 100644
--- a/sys/contrib/dev/acpica/rsirq.c
+++ b/sys/contrib/dev/acpica/rsirq.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 19 $
+ * $Revision: 24 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,7 +120,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsirq")
+ ACPI_MODULE_NAME ("rsirq")
/*******************************************************************************
@@ -129,13 +129,12 @@
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -148,9 +147,9 @@
ACPI_STATUS
AcpiRsIrqResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
@@ -158,10 +157,10 @@ AcpiRsIrqResource (
UINT8 Temp8 = 0;
UINT8 Index;
UINT8 i;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ);
- FUNCTION_TRACE ("RsIrqResource");
+ ACPI_FUNCTION_TRACE ("RsIrqResource");
/*
@@ -176,7 +175,7 @@ AcpiRsIrqResource (
* Point to the 16-bits of Bytes 1 and 2
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Irq.NumberOfInterrupts = 0;
@@ -210,15 +209,15 @@ AcpiRsIrqResource (
*/
if (Temp8 & 0x01)
{
- OutputStruct->Data.Irq.EdgeLevel = EDGE_SENSITIVE;
- OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_HIGH;
+ OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE;
+ OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH;
}
else
{
if (Temp8 & 0x8)
{
- OutputStruct->Data.Irq.EdgeLevel = LEVEL_SENSITIVE;
- OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_LOW;
+ OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE;
+ OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW;
}
else
{
@@ -242,9 +241,9 @@ AcpiRsIrqResource (
* Assume Edge Sensitive, Active High, Non-Sharable
* per ACPI Specification
*/
- OutputStruct->Data.Irq.EdgeLevel = EDGE_SENSITIVE;
- OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_HIGH;
- OutputStruct->Data.Irq.SharedExclusive = EXCLUSIVE;
+ OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE;
+ OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH;
+ OutputStruct->Data.Irq.SharedExclusive = ACPI_EXCLUSIVE;
}
/*
@@ -266,9 +265,8 @@ AcpiRsIrqResource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -281,7 +279,7 @@ ACPI_STATUS
AcpiRsIrqStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
@@ -290,16 +288,16 @@ AcpiRsIrqStream (
BOOLEAN IRQInfoByteNeeded;
- FUNCTION_TRACE ("RsIrqStream");
+ ACPI_FUNCTION_TRACE ("RsIrqStream");
/*
* The descriptor field is set based upon whether a third byte is
* needed to contain the IRQ Information.
*/
- if (EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
- ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow &&
- EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive)
+ if (ACPI_EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
+ ACPI_ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow &&
+ ACPI_EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive)
{
*Buffer = 0x22;
IRQInfoByteNeeded = FALSE;
@@ -324,7 +322,7 @@ AcpiRsIrqStream (
Temp16 |= 0x1 << Temp8;
}
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -336,8 +334,8 @@ AcpiRsIrqStream (
Temp8 = (UINT8) ((LinkedList->Data.Irq.SharedExclusive &
0x01) << 4);
- if (LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
- ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow)
+ if (ACPI_LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
+ ACPI_ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow)
{
Temp8 |= 0x08;
}
@@ -353,7 +351,7 @@ AcpiRsIrqStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -364,13 +362,12 @@ AcpiRsIrqStream (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -383,9 +380,9 @@ AcpiRsIrqStream (
ACPI_STATUS
AcpiRsExtendedIrqResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
@@ -393,17 +390,17 @@ AcpiRsExtendedIrqResource (
UINT8 Temp8 = 0;
NATIVE_CHAR *TempPtr;
UINT8 Index;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ);
- FUNCTION_TRACE ("RsExtendedIrqResource");
+ ACPI_FUNCTION_TRACE ("RsExtendedIrqResource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ;
@@ -417,30 +414,20 @@ AcpiRsExtendedIrqResource (
OutputStruct->Data.ExtendedIrq.ProducerConsumer = Temp8 & 0x01;
/*
- * Check for HE, LL or HL
+ * Check for Interrupt Mode
+ *
+ * The definition of an Extended IRQ changed between ACPI spec v1.0b
+ * and ACPI spec 2.0 (section 6.4.3.6 in both).
+ *
+ * - Edge/Level are defined opposite in the table vs the headers
*/
- if(Temp8 & 0x02)
- {
- OutputStruct->Data.ExtendedIrq.EdgeLevel = EDGE_SENSITIVE;
- OutputStruct->Data.ExtendedIrq.ActiveHighLow = ACTIVE_HIGH;
- }
- else
- {
- if(Temp8 & 0x4)
- {
- OutputStruct->Data.ExtendedIrq.EdgeLevel = LEVEL_SENSITIVE;
- OutputStruct->Data.ExtendedIrq.ActiveHighLow = ACTIVE_LOW;
- }
- else
- {
- /*
- * Only _LL and _HE polarity/trigger interrupts
- * are allowed (ACPI spec v1.0b ection 6.4.2.1),
- * so an error will occur if we reach this point
- */
- return_ACPI_STATUS (AE_BAD_DATA);
- }
- }
+ OutputStruct->Data.ExtendedIrq.EdgeLevel =
+ (Temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
+
+ /*
+ * Check Interrupt Polarity
+ */
+ OutputStruct->Data.ExtendedIrq.ActiveHighLow = (Temp8 >> 2) & 0x1;
/*
* Check for sharable
@@ -530,7 +517,7 @@ AcpiRsExtendedIrqResource (
* StructSize to the next 32-bit boundary.
*/
Temp8 = (UINT8) (Index + 1);
- StructSize += ROUND_UP_TO_32BITS (Temp8);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
}
else
{
@@ -558,9 +545,8 @@ AcpiRsExtendedIrqResource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -573,7 +559,7 @@ ACPI_STATUS
AcpiRsExtendedIrqStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 *LengthField;
@@ -582,7 +568,7 @@ AcpiRsExtendedIrqStream (
NATIVE_CHAR *TempPointer = NULL;
- FUNCTION_TRACE ("RsExtendedIrqStream");
+ ACPI_FUNCTION_TRACE ("RsExtendedIrqStream");
/*
@@ -603,16 +589,25 @@ AcpiRsExtendedIrqStream (
Temp8 = (UINT8)(LinkedList->Data.ExtendedIrq.ProducerConsumer & 0x01);
Temp8 |= ((LinkedList->Data.ExtendedIrq.SharedExclusive & 0x01) << 3);
- if (LEVEL_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel &&
- ACTIVE_LOW == LinkedList->Data.ExtendedIrq.ActiveHighLow)
- {
- Temp8 |= 0x04;
- }
- else
+ /*
+ * Set the Interrupt Mode
+ *
+ * The definition of an Extended IRQ changed between ACPI spec v1.0b
+ * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not
+ * implement the more restrictive definition of 1.0b
+ *
+ * - Edge/Level are defined opposite in the table vs the headers
+ */
+ if (ACPI_EDGE_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel)
{
- Temp8 |= 0x02;
+ Temp8 |= 0x2;
}
+ /*
+ * Set the Interrupt Polarity
+ */
+ Temp8 |= ((LinkedList->Data.ExtendedIrq.ActiveHighLow & 0x1) << 2);
+
*Buffer = Temp8;
Buffer += 1;
@@ -627,7 +622,7 @@ AcpiRsExtendedIrqStream (
for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts;
Index++)
{
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.ExtendedIrq.Interrupts[Index]);
Buffer += 4;
}
@@ -645,20 +640,20 @@ AcpiRsExtendedIrqStream (
/*
* Copy the string
*/
- STRCPY (TempPointer,
+ ACPI_STRCPY (TempPointer,
LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
/*
* Set the length field to the number of bytes consumed
diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/rslist.c
index 1171f2b..809544b 100644
--- a/sys/contrib/dev/acpica/rslist.c
+++ b/sys/contrib/dev/acpica/rslist.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
- * $Revision: 19 $
+ * $Revision: 26 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,7 +120,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rslist")
+ ACPI_MODULE_NAME ("rslist")
/*******************************************************************************
@@ -141,30 +141,28 @@ AcpiRsGetResourceType (
UINT8 ResourceStartByte)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
* Determine if this is a small or large resource
*/
- switch (ResourceStartByte & RESOURCE_DESC_TYPE_MASK)
+ switch (ResourceStartByte & ACPI_RDESC_TYPE_MASK)
{
- case RESOURCE_DESC_TYPE_SMALL:
+ case ACPI_RDESC_TYPE_SMALL:
/*
* Small Resource Type -- Only bits 6:3 are valid
*/
- return ((UINT8) (ResourceStartByte & RESOURCE_DESC_SMALL_MASK));
- break;
+ return ((UINT8) (ResourceStartByte & ACPI_RDESC_SMALL_MASK));
- case RESOURCE_DESC_TYPE_LARGE:
+ case ACPI_RDESC_TYPE_LARGE:
/*
* Large Resource Type -- All bits are valid
*/
return (ResourceStartByte);
- break;
}
return (0xFF);
@@ -191,18 +189,18 @@ ACPI_STATUS
AcpiRsByteStreamToList (
UINT8 *ByteStreamBuffer,
UINT32 ByteStreamBufferLength,
- UINT8 **OutputBuffer)
+ UINT8 *OutputBuffer)
{
ACPI_STATUS Status;
UINT32 BytesParsed = 0;
UINT8 ResourceType = 0;
- UINT32 BytesConsumed = 0;
- UINT8 **Buffer = OutputBuffer;
- UINT32 StructureSize = 0;
+ ACPI_SIZE BytesConsumed = 0;
+ UINT8 *Buffer = OutputBuffer;
+ ACPI_SIZE StructureSize = 0;
BOOLEAN EndTagProcessed = FALSE;
+ ACPI_RESOURCE *Resource;
-
- FUNCTION_TRACE ("RsByteStreamToList");
+ ACPI_FUNCTION_TRACE ("RsByteStreamToList");
while (BytesParsed < ByteStreamBufferLength &&
@@ -215,148 +213,148 @@ AcpiRsByteStreamToList (
switch (ResourceType)
{
- case RESOURCE_DESC_MEMORY_24:
+ case ACPI_RDESC_TYPE_MEMORY_24:
/*
* 24-Bit Memory Resource
*/
Status = AcpiRsMemory24Resource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_LARGE_VENDOR:
+ case ACPI_RDESC_TYPE_LARGE_VENDOR:
/*
* Vendor Defined Resource
*/
Status = AcpiRsVendorResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_MEMORY_32:
+ case ACPI_RDESC_TYPE_MEMORY_32:
/*
* 32-Bit Memory Range Resource
*/
Status = AcpiRsMemory32RangeResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_FIXED_MEMORY_32:
+ case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
/*
* 32-Bit Fixed Memory Resource
*/
Status = AcpiRsFixedMemory32Resource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
/*
* 64-Bit Address Resource
*/
Status = AcpiRsAddress64Resource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
/*
* 32-Bit Address Resource
*/
Status = AcpiRsAddress32Resource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_WORD_ADDRESS_SPACE:
+ case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
/*
* 16-Bit Address Resource
*/
Status = AcpiRsAddress16Resource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_EXTENDED_XRUPT:
+ case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
/*
* Extended IRQ
*/
Status = AcpiRsExtendedIrqResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_IRQ_FORMAT:
+ case ACPI_RDESC_TYPE_IRQ_FORMAT:
/*
* IRQ Resource
*/
Status = AcpiRsIrqResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_DMA_FORMAT:
+ case ACPI_RDESC_TYPE_DMA_FORMAT:
/*
* DMA Resource
*/
Status = AcpiRsDmaResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_START_DEPENDENT:
+ case ACPI_RDESC_TYPE_START_DEPENDENT:
/*
* Start Dependent Functions Resource
*/
- Status = AcpiRsStartDependentFunctionsResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ Status = AcpiRsStartDependFnsResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_END_DEPENDENT:
+ case ACPI_RDESC_TYPE_END_DEPENDENT:
/*
* End Dependent Functions Resource
*/
- Status = AcpiRsEndDependentFunctionsResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ Status = AcpiRsEndDependFnsResource (ByteStreamBuffer,
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_IO_PORT:
+ case ACPI_RDESC_TYPE_IO_PORT:
/*
* IO Port Resource
*/
Status = AcpiRsIoResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_FIXED_IO_PORT:
+ case ACPI_RDESC_TYPE_FIXED_IO_PORT:
/*
* Fixed IO Port Resource
*/
Status = AcpiRsFixedIoResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_SMALL_VENDOR:
+ case ACPI_RDESC_TYPE_SMALL_VENDOR:
/*
* Vendor Specific Resource
*/
Status = AcpiRsVendorResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
- case RESOURCE_DESC_END_TAG:
+ case ACPI_RDESC_TYPE_END_TAG:
/*
* End Tag
*/
EndTagProcessed = TRUE;
Status = AcpiRsEndTagResource (ByteStreamBuffer,
- &BytesConsumed, Buffer, &StructureSize);
+ &BytesConsumed, &Buffer, &StructureSize);
break;
@@ -368,8 +366,7 @@ AcpiRsByteStreamToList (
break;
}
-
- if (!ACPI_SUCCESS(Status))
+ if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
@@ -387,7 +384,9 @@ AcpiRsByteStreamToList (
/*
* Set the Buffer to the next structure
*/
- *Buffer += StructureSize;
+ Resource = (ACPI_RESOURCE *)Buffer;
+ Resource->Length = ACPI_ALIGN_RESOURCE_SIZE(Resource->Length);
+ Buffer += ACPI_ALIGN_RESOURCE_SIZE(StructureSize);
} /* end while */
@@ -428,15 +427,15 @@ ACPI_STATUS
AcpiRsListToByteStream (
ACPI_RESOURCE *LinkedList,
UINT32 ByteStreamSizeNeeded,
- UINT8 **OutputBuffer)
+ UINT8 *OutputBuffer)
{
ACPI_STATUS Status;
- UINT8 *Buffer = *OutputBuffer;
- UINT32 BytesConsumed = 0;
+ UINT8 *Buffer = OutputBuffer;
+ ACPI_SIZE BytesConsumed = 0;
BOOLEAN Done = FALSE;
- FUNCTION_TRACE ("RsListToByteStream");
+ ACPI_FUNCTION_TRACE ("RsListToByteStream");
while (!Done)
@@ -461,7 +460,7 @@ AcpiRsListToByteStream (
/*
* Start Dependent Functions Resource
*/
- Status = AcpiRsStartDependentFunctionsStream (LinkedList,
+ Status = AcpiRsStartDependFnsStream (LinkedList,
&Buffer, &BytesConsumed);
break;
@@ -469,7 +468,7 @@ AcpiRsListToByteStream (
/*
* End Dependent Functions Resource
*/
- Status = AcpiRsEndDependentFunctionsStream (LinkedList,
+ Status = AcpiRsEndDependFnsStream (LinkedList,
&Buffer, &BytesConsumed);
break;
@@ -571,8 +570,7 @@ AcpiRsListToByteStream (
} /* switch (LinkedList->Id) */
-
- if (!ACPI_SUCCESS(Status))
+ if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
@@ -585,7 +583,7 @@ AcpiRsListToByteStream (
/*
* Point to the next object
*/
- LinkedList = POINTER_ADD (ACPI_RESOURCE,
+ LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE,
LinkedList, LinkedList->Length);
}
diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/rsmemory.c
index 368f765..2da4523 100644
--- a/sys/contrib/dev/acpica/rsmemory.c
+++ b/sys/contrib/dev/acpica/rsmemory.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmem24 - Memory resource descriptors
- * $Revision: 14 $
+ * $Revision: 17 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,7 +120,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsmemory")
+ ACPI_MODULE_NAME ("rsmemory")
/*******************************************************************************
@@ -129,13 +129,12 @@
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -148,18 +147,18 @@
ACPI_STATUS
AcpiRsMemory24Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
- FUNCTION_TRACE ("RsMemory24Resource");
+ ACPI_FUNCTION_TRACE ("RsMemory24Resource");
/*
@@ -167,7 +166,7 @@ AcpiRsMemory24Resource (
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
Buffer += 2;
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_MEM24;
@@ -182,28 +181,28 @@ AcpiRsMemory24Resource (
/*
* Get MinBaseAddress (Bytes 4-5)
*/
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
Buffer += 2;
OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
/*
* Get MaxBaseAddress (Bytes 6-7)
*/
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
Buffer += 2;
OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
/*
* Get Alignment (Bytes 8-9)
*/
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
Buffer += 2;
OutputStruct->Data.Memory24.Alignment = Temp16;
/*
* Get RangeLength (Bytes 10-11)
*/
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Memory24.RangeLength = Temp16;
/*
@@ -225,9 +224,8 @@ AcpiRsMemory24Resource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -240,14 +238,14 @@ ACPI_STATUS
AcpiRsMemory24Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsMemory24Stream");
+ ACPI_FUNCTION_TRACE ("RsMemory24Stream");
/*
@@ -260,7 +258,7 @@ AcpiRsMemory24Stream (
* The length field is static
*/
Temp16 = 0x09;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -273,31 +271,31 @@ AcpiRsMemory24Stream (
/*
* Set the Range minimum base address
*/
- MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
Buffer += 2;
/*
* Set the Range maximum base address
*/
- MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
Buffer += 2;
/*
* Set the base alignment
*/
- MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
Buffer += 2;
/*
* Set the range length
*/
- MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
Buffer += 2;
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -308,13 +306,12 @@ AcpiRsMemory24Stream (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -327,18 +324,18 @@ AcpiRsMemory24Stream (
ACPI_STATUS
AcpiRsMemory32RangeResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
- FUNCTION_TRACE ("RsMemory32RangeResource");
+ ACPI_FUNCTION_TRACE ("RsMemory32RangeResource");
/*
@@ -346,7 +343,7 @@ AcpiRsMemory32RangeResource (
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
Buffer += 2;
*BytesConsumed = Temp16 + 3;
@@ -373,27 +370,27 @@ AcpiRsMemory32RangeResource (
/*
* Get MinBaseAddress (Bytes 4-7)
*/
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress,
Buffer);
Buffer += 4;
/*
* Get MaxBaseAddress (Bytes 8-11)
*/
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress,
Buffer);
Buffer += 4;
/*
* Get Alignment (Bytes 12-15)
*/
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
Buffer += 4;
/*
* Get RangeLength (Bytes 16-19)
*/
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
/*
* Set the Length parameter
@@ -414,13 +411,12 @@ AcpiRsMemory32RangeResource (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -433,25 +429,25 @@ AcpiRsMemory32RangeResource (
ACPI_STATUS
AcpiRsFixedMemory32Resource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
- FUNCTION_TRACE ("RsFixedMemory32Resource");
+ ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
Buffer += 2;
*BytesConsumed = Temp16 + 3;
@@ -468,14 +464,14 @@ AcpiRsFixedMemory32Resource (
/*
* Get RangeBaseAddress (Bytes 4-7)
*/
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress,
Buffer);
Buffer += 4;
/*
* Get RangeLength (Bytes 8-11)
*/
- MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength,
+ ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength,
Buffer);
/*
@@ -497,9 +493,8 @@ AcpiRsFixedMemory32Resource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -512,14 +507,14 @@ ACPI_STATUS
AcpiRsMemory32RangeStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsMemory32RangeStream");
+ ACPI_FUNCTION_TRACE ("RsMemory32RangeStream");
/*
@@ -533,7 +528,7 @@ AcpiRsMemory32RangeStream (
*/
Temp16 = 0x11;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -546,31 +541,31 @@ AcpiRsMemory32RangeStream (
/*
* Set the Range minimum base address
*/
- MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
Buffer += 4;
/*
* Set the Range maximum base address
*/
- MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
Buffer += 4;
/*
* Set the base alignment
*/
- MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
Buffer += 4;
/*
* Set the range length
*/
- MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
Buffer += 4;
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -581,9 +576,8 @@ AcpiRsMemory32RangeStream (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -596,14 +590,14 @@ ACPI_STATUS
AcpiRsFixedMemory32Stream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsFixedMemory32Stream");
+ ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream");
/*
@@ -617,7 +611,7 @@ AcpiRsFixedMemory32Stream (
*/
Temp16 = 0x09;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -630,21 +624,21 @@ AcpiRsFixedMemory32Stream (
/*
* Set the Range base address
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.FixedMemory32.RangeBaseAddress);
Buffer += 4;
/*
* Set the range length
*/
- MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
&LinkedList->Data.FixedMemory32.RangeLength);
Buffer += 4;
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c
index ee1732f..adc3b4e 100644
--- a/sys/contrib/dev/acpica/rsmisc.c
+++ b/sys/contrib/dev/acpica/rsmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
- * $Revision: 17 $
+ * $Revision: 20 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,7 +120,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsmisc")
+ ACPI_MODULE_NAME ("rsmisc")
/*******************************************************************************
@@ -129,13 +129,12 @@
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -148,15 +147,15 @@
ACPI_STATUS
AcpiRsEndTagResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
- UINT32 StructSize = ACPI_RESOURCE_LENGTH;
+ ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH;
- FUNCTION_TRACE ("RsEndTagResource");
+ ACPI_FUNCTION_TRACE ("RsEndTagResource");
/*
@@ -188,9 +187,8 @@ AcpiRsEndTagResource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -203,13 +201,13 @@ ACPI_STATUS
AcpiRsEndTagStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsEndTagStream");
+ ACPI_FUNCTION_TRACE ("RsEndTagStream");
/*
@@ -230,7 +228,7 @@ AcpiRsEndTagStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -241,13 +239,12 @@ AcpiRsEndTagStream (
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -260,19 +257,19 @@ AcpiRsEndTagStream (
ACPI_STATUS
AcpiRsVendorResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
UINT8 Index;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR);
- FUNCTION_TRACE ("RsVendorResource");
+ ACPI_FUNCTION_TRACE ("RsVendorResource");
/*
@@ -289,7 +286,7 @@ AcpiRsVendorResource (
/* Dereference */
- MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
/* Calculate bytes consumed */
@@ -329,7 +326,7 @@ AcpiRsVendorResource (
* calculate the length of the vendor string and expand the
* StructSize to the next 32-bit boundary.
*/
- StructSize += ROUND_UP_TO_32BITS (Temp16);
+ StructSize += ACPI_ROUND_UP_TO_32BITS (Temp16);
/*
* Set the Length parameter
@@ -350,9 +347,8 @@ AcpiRsVendorResource (
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -365,7 +361,7 @@ ACPI_STATUS
AcpiRsVendorStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT16 Temp16 = 0;
@@ -373,7 +369,7 @@ AcpiRsVendorStream (
UINT8 Index;
- FUNCTION_TRACE ("RsVendorStream");
+ ACPI_FUNCTION_TRACE ("RsVendorStream");
/*
@@ -389,7 +385,7 @@ AcpiRsVendorStream (
Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length;
- MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
Buffer += 2;
}
else
@@ -418,24 +414,23 @@ AcpiRsVendorStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsStartDependentFunctionsResource
+ * FUNCTION: AcpiRsStartDependFnsResource
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -446,19 +441,19 @@ AcpiRsVendorStream (
******************************************************************************/
ACPI_STATUS
-AcpiRsStartDependentFunctionsResource (
+AcpiRsStartDependFnsResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
+ ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT8 Temp8 = 0;
- UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+ ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
- FUNCTION_TRACE ("RsStartDependentFunctionsResource");
+ ACPI_FUNCTION_TRACE ("RsStartDependFnsResource");
/*
@@ -501,10 +496,10 @@ AcpiRsStartDependentFunctionsResource (
else
{
OutputStruct->Data.StartDpf.CompatibilityPriority =
- ACCEPTABLE_CONFIGURATION;
+ ACPI_ACCEPTABLE_CONFIGURATION;
OutputStruct->Data.StartDpf.PerformanceRobustness =
- ACCEPTABLE_CONFIGURATION;
+ ACPI_ACCEPTABLE_CONFIGURATION;
}
/*
@@ -522,17 +517,16 @@ AcpiRsStartDependentFunctionsResource (
/*******************************************************************************
*
- * FUNCTION: AcpiRsEndDependentFunctionsResource
+ * FUNCTION: AcpiRsEndDependFnsResource
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
* stream
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
- * OutputBuffer - Pointer to the user's return buffer
- * StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * BytesConsumed - Pointer to where the number of bytes
+ * consumed the ByteStreamBuffer is
+ * returned
+ * OutputBuffer - Pointer to the return data buffer
+ * StructureSize - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
@@ -543,17 +537,17 @@ AcpiRsStartDependentFunctionsResource (
******************************************************************************/
ACPI_STATUS
-AcpiRsEndDependentFunctionsResource (
+AcpiRsEndDependFnsResource (
UINT8 *ByteStreamBuffer,
- UINT32 *BytesConsumed,
+ ACPI_SIZE *BytesConsumed,
UINT8 **OutputBuffer,
- UINT32 *StructureSize)
+ ACPI_SIZE *StructureSize)
{
ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
- UINT32 StructSize = ACPI_RESOURCE_LENGTH;
+ ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH;
- FUNCTION_TRACE ("RsEndDependentFunctionsResource");
+ ACPI_FUNCTION_TRACE ("RsEndDependFnsResource");
/*
@@ -581,7 +575,7 @@ AcpiRsEndDependentFunctionsResource (
/*******************************************************************************
*
- * FUNCTION: AcpiRsStartDependentFunctionsStream
+ * FUNCTION: AcpiRsStartDependFnsStream
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
@@ -597,25 +591,25 @@ AcpiRsEndDependentFunctionsResource (
******************************************************************************/
ACPI_STATUS
-AcpiRsStartDependentFunctionsStream (
+AcpiRsStartDependFnsStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed)
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
UINT8 Temp8 = 0;
- FUNCTION_TRACE ("RsStartDependentFunctionsStream");
+ ACPI_FUNCTION_TRACE ("RsStartDependFnsStream");
/*
* The descriptor field is set based upon whether a byte is needed
* to contain Priority data.
*/
- if (ACCEPTABLE_CONFIGURATION ==
+ if (ACPI_ACCEPTABLE_CONFIGURATION ==
LinkedList->Data.StartDpf.CompatibilityPriority &&
- ACCEPTABLE_CONFIGURATION ==
+ ACPI_ACCEPTABLE_CONFIGURATION ==
LinkedList->Data.StartDpf.PerformanceRobustness)
{
*Buffer = 0x30;
@@ -641,20 +635,19 @@ AcpiRsStartDependentFunctionsStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsEndDependentFunctionsStream
+ * FUNCTION: AcpiRsEndDependFnsStream
*
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * BytesConsumed - Pointer to where the number of bytes
+ * used in the OutputBuffer is returned
*
* RETURN: Status
*
@@ -664,16 +657,15 @@ AcpiRsStartDependentFunctionsStream (
******************************************************************************/
ACPI_STATUS
-AcpiRsEndDependentFunctionsStream (
+AcpiRsEndDependFnsStream (
ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
- UINT32 *BytesConsumed
- )
+ ACPI_SIZE *BytesConsumed)
{
UINT8 *Buffer = *OutputBuffer;
- FUNCTION_TRACE ("RsEndDependentFunctionsStream");
+ ACPI_FUNCTION_TRACE ("RsEndDependFnsStream");
/*
@@ -685,7 +677,7 @@ AcpiRsEndDependentFunctionsStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
+ *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c
index cbe498d..1b92806 100644
--- a/sys/contrib/dev/acpica/rsutils.c
+++ b/sys/contrib/dev/acpica/rsutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
- * $Revision: 23 $
+ * $Revision: 29 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsutils")
+ ACPI_MODULE_NAME ("rsutils")
/*******************************************************************************
@@ -151,15 +151,12 @@ AcpiRsGetPrtMethodData (
{
ACPI_OPERAND_OBJECT *RetObj;
ACPI_STATUS Status;
- UINT32 BufferSpaceNeeded;
- FUNCTION_TRACE ("RsGetPrtMethodData");
+ ACPI_FUNCTION_TRACE ("RsGetPrtMethodData");
- /* already validated params, so we won't repeat here */
-
- BufferSpaceNeeded = RetBuffer->Length;
+ /* Parameters guaranteed valid by caller */
/*
* Execute the method, no parameters
@@ -178,35 +175,26 @@ AcpiRsGetPrtMethodData (
return_ACPI_STATUS (AE_TYPE);
}
-
/*
- * The return object will be a package, so check the
- * parameters. If the return object is not a package,
- * then the underlying AML code is corrupt or improperly
- * written.
+ * The return object will be a package, so check the parameters. If the
+ * return object is not a package, then the underlying AML code is corrupt
+ * or improperly written.
*/
if (ACPI_TYPE_PACKAGE != RetObj->Common.Type)
{
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n",
+ AcpiUtGetTypeName (RetObj->Common.Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/*
- * Make the call to create a resource linked list from the
- * byte stream buffer that comes back from the _CRS method
- * execution.
- */
- Status = AcpiRsCreatePciRoutingTable (RetObj, RetBuffer->Pointer,
- &BufferSpaceNeeded);
-
- /*
- * Tell the user how much of the buffer we have used or is needed
- * and return the final status.
+ * Create a resource linked list from the byte stream buffer that comes
+ * back from the _CRS method execution.
*/
- RetBuffer->Length = BufferSpaceNeeded;
+ Status = AcpiRsCreatePciRoutingTable (RetObj, RetBuffer);
-
- /* On exit, we must delete the object returned by evaluateObject */
+ /* On exit, we must delete the object returned by EvaluateObject */
Cleanup:
@@ -240,16 +228,15 @@ AcpiRsGetCrsMethodData (
{
ACPI_OPERAND_OBJECT *RetObj;
ACPI_STATUS Status;
- UINT32 BufferSpaceNeeded = RetBuffer->Length;
- FUNCTION_TRACE ("RsGetCrsMethodData");
+ ACPI_FUNCTION_TRACE ("RsGetCrsMethodData");
- /* already validated params, so we won't repeat here */
+ /* Parameters guaranteed valid by caller */
/*
- * Execute the method, no parameters
+ * Execute the method, no parameters
*/
Status = AcpiNsEvaluateRelative (Handle, "_CRS", NULL, &RetObj);
if (ACPI_FAILURE (Status))
@@ -267,31 +254,24 @@ AcpiRsGetCrsMethodData (
/*
* The return object will be a buffer, but check the
- * parameters. If the return object is not a buffer,
- * then the underlying AML code is corrupt or improperly
- * written.
+ * parameters. If the return object is not a buffer,
+ * then the underlying AML code is corrupt or improperly
+ * written.
*/
if (ACPI_TYPE_BUFFER != RetObj->Common.Type)
{
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n",
+ AcpiUtGetTypeName (RetObj->Common.Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/*
* Make the call to create a resource linked list from the
- * byte stream buffer that comes back from the _CRS method
- * execution.
- */
- Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer,
- &BufferSpaceNeeded);
-
-
- /*
- * Tell the user how much of the buffer we have used or is needed
- * and return the final status.
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
*/
- RetBuffer->Length = BufferSpaceNeeded;
-
+ Status = AcpiRsCreateResourceList (RetObj, RetBuffer);
/* On exit, we must delete the object returned by evaluateObject */
@@ -327,16 +307,15 @@ AcpiRsGetPrsMethodData (
{
ACPI_OPERAND_OBJECT *RetObj;
ACPI_STATUS Status;
- UINT32 BufferSpaceNeeded = RetBuffer->Length;
- FUNCTION_TRACE ("RsGetPrsMethodData");
+ ACPI_FUNCTION_TRACE ("RsGetPrsMethodData");
- /* already validated params, so we won't repeat here */
+ /* Parameters guaranteed valid by caller */
/*
- * Execute the method, no parameters
+ * Execute the method, no parameters
*/
Status = AcpiNsEvaluateRelative (Handle, "_PRS", NULL, &RetObj);
if (ACPI_FAILURE (Status))
@@ -354,30 +333,24 @@ AcpiRsGetPrsMethodData (
/*
* The return object will be a buffer, but check the
- * parameters. If the return object is not a buffer,
- * then the underlying AML code is corrupt or improperly
- * written..
+ * parameters. If the return object is not a buffer,
+ * then the underlying AML code is corrupt or improperly
+ * written..
*/
if (ACPI_TYPE_BUFFER != RetObj->Common.Type)
{
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n",
+ AcpiUtGetTypeName (RetObj->Common.Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/*
* Make the call to create a resource linked list from the
- * byte stream buffer that comes back from the _CRS method
- * execution.
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
*/
- Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer,
- &BufferSpaceNeeded);
-
- /*
- * Tell the user how much of the buffer we have used or is needed
- * and return the final status.
- */
- RetBuffer->Length = BufferSpaceNeeded;
-
+ Status = AcpiRsCreateResourceList (RetObj, RetBuffer);
/* On exit, we must delete the object returned by evaluateObject */
@@ -413,53 +386,26 @@ AcpiRsSetSrsMethodData (
{
ACPI_OPERAND_OBJECT *Params[2];
ACPI_STATUS Status;
- UINT8 *ByteStream = NULL;
- UINT32 BufferSizeNeeded = 0;
+ ACPI_BUFFER Buffer;
- FUNCTION_TRACE ("RsSetSrsMethodData");
+ ACPI_FUNCTION_TRACE ("RsSetSrsMethodData");
- /* already validated params, so we won't repeat here */
+ /* Parameters guaranteed valid by caller */
/*
* The InBuffer parameter will point to a linked list of
* resource parameters. It needs to be formatted into a
- * byte stream to be sent in as an input parameter.
- */
- BufferSizeNeeded = 0;
-
- /*
- * First call is to get the buffer size needed
+ * byte stream to be sent in as an input parameter to _SRS
+ *
+ * Convert the linked list into a byte stream
*/
- Status = AcpiRsCreateByteStream (InBuffer->Pointer, ByteStream,
- &BufferSizeNeeded);
- /*
- * We expect a return of AE_BUFFER_OVERFLOW
- * if not, exit with the error
- */
- if (AE_BUFFER_OVERFLOW != Status)
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Allocate the buffer needed
- */
- ByteStream = ACPI_MEM_CALLOCATE (BufferSizeNeeded);
- if (NULL == ByteStream)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * Now call to convert the linked list into a byte stream
- */
- Status = AcpiRsCreateByteStream (InBuffer->Pointer, ByteStream,
- &BufferSizeNeeded);
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiRsCreateByteStream (InBuffer->Pointer, &Buffer);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ return_ACPI_STATUS (Status);
}
/*
@@ -468,28 +414,26 @@ AcpiRsSetSrsMethodData (
Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
if (!Params[0])
{
- Status = AE_NO_MEMORY;
- goto Cleanup;
+ AcpiOsFree (Buffer.Pointer);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- Params [1] = NULL;
/*
- * Set up the parameter object
+ * Set up the parameter object
*/
- Params[0]->Buffer.Length = BufferSizeNeeded;
- Params[0]->Buffer.Pointer = ByteStream;
+ Params[0]->Buffer.Length = Buffer.Length;
+ Params[0]->Buffer.Pointer = Buffer.Pointer;
+ Params[1] = NULL;
/*
* Execute the method, no return value
*/
Status = AcpiNsEvaluateRelative (Handle, "_SRS", Params, NULL);
- AcpiUtRemoveReference (Params[0]);
/*
* Clean up and return the status from AcpiNsEvaluateRelative
*/
-Cleanup:
-
+ AcpiUtRemoveReference (Params[0]);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c
index 81c0968..5105e9a 100644
--- a/sys/contrib/dev/acpica/rsxface.c
+++ b/sys/contrib/dev/acpica/rsxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 15 $
+ * $Revision: 18 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsxface")
+ ACPI_MODULE_NAME ("rsxface")
/*******************************************************************************
@@ -157,7 +157,7 @@ AcpiGetIrqRoutingTable (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiGetIrqRoutingTable ");
+ ACPI_FUNCTION_TRACE ("AcpiGetIrqRoutingTable ");
/*
@@ -166,13 +166,17 @@ AcpiGetIrqRoutingTable (
* we also need a valid pointer in the buffer. If it's a zero buffer length,
* we'll be returning the needed buffer size, so keep going.
*/
- if ((!DeviceHandle) ||
- (!RetBuffer) ||
- ((!RetBuffer->Pointer) && (RetBuffer->Length)))
+ if (!DeviceHandle)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
Status = AcpiRsGetPrtMethodData (DeviceHandle, RetBuffer);
return_ACPI_STATUS (Status);
}
@@ -210,7 +214,7 @@ AcpiGetCurrentResources (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiGetCurrentResources");
+ ACPI_FUNCTION_TRACE ("AcpiGetCurrentResources");
/*
@@ -219,13 +223,17 @@ AcpiGetCurrentResources (
* we also need a valid pointer in the buffer. If it's a zero buffer length,
* we'll be returning the needed buffer size, so keep going.
*/
- if ((!DeviceHandle) ||
- (!RetBuffer) ||
- ((RetBuffer->Length) && (!RetBuffer->Pointer)))
+ if (!DeviceHandle)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
Status = AcpiRsGetCrsMethodData (DeviceHandle, RetBuffer);
return_ACPI_STATUS (Status);
}
@@ -260,7 +268,7 @@ AcpiGetPossibleResources (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiGetPossibleResources");
+ ACPI_FUNCTION_TRACE ("AcpiGetPossibleResources");
/*
@@ -269,13 +277,17 @@ AcpiGetPossibleResources (
* we also need a valid pointer in the buffer. If it's a zero buffer length,
* we'll be returning the needed buffer size, so keep going.
*/
- if ((!DeviceHandle) ||
- (!RetBuffer) ||
- ((RetBuffer->Length) && (!RetBuffer->Pointer)))
+ if (!DeviceHandle)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
Status = AcpiRsGetPrsMethodData (DeviceHandle, RetBuffer);
return_ACPI_STATUS (Status);
}
@@ -307,7 +319,7 @@ AcpiSetCurrentResources (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiSetCurrentResources");
+ ACPI_FUNCTION_TRACE ("AcpiSetCurrentResources");
/*
diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c
index 3f6a1ea..e6eb3f0 100644
--- a/sys/contrib/dev/acpica/tbconvrt.c
+++ b/sys/contrib/dev/acpica/tbconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
- * $Revision: 28 $
+ * $Revision: 36 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,13 +117,11 @@
#define __TBCONVRT_C__
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
-#include "actbl.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbconvrt")
+ ACPI_MODULE_NAME ("tbconvrt")
/*******************************************************************************
@@ -146,7 +144,7 @@ AcpiTbGetTableCount (
UINT32 PointerSize;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
#ifndef _IA64
@@ -155,7 +153,6 @@ AcpiTbGetTableCount (
{
PointerSize = sizeof (UINT32);
}
-
else
#endif
{
@@ -194,17 +191,17 @@ AcpiTbConvertToXsdt (
XSDT_DESCRIPTOR *NewTable;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- *NumberOfTables = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo->Pointer);
+ /* Get the number of tables defined in the RSDT or XSDT */
+ *NumberOfTables = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo->Pointer);
/* Compute size of the converted XSDT */
TableSize = (*NumberOfTables * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER);
-
/* Allocate an XSDT */
NewTable = ACPI_MEM_CALLOCATE (TableSize);
@@ -215,7 +212,7 @@ AcpiTbConvertToXsdt (
/* Copy the header and set the length */
- MEMCPY (NewTable, TableInfo->Pointer, sizeof (ACPI_TABLE_HEADER));
+ ACPI_MEMCPY (NewTable, TableInfo->Pointer, sizeof (ACPI_TABLE_HEADER));
NewTable->Header.Length = TableSize;
/* Copy the table pointers */
@@ -224,13 +221,8 @@ AcpiTbConvertToXsdt (
{
if (AcpiGbl_RSDP->Revision < 2)
{
-#ifdef _IA64
- NewTable->TableOffsetEntry[i] =
- ((RSDT_DESCRIPTOR_REV071 *) TableInfo->Pointer)->TableOffsetEntry[i];
-#else
ACPI_STORE_ADDRESS (NewTable->TableOffsetEntry[i],
((RSDT_DESCRIPTOR_REV1 *) TableInfo->Pointer)->TableOffsetEntry[i]);
-#endif
}
else
{
@@ -239,12 +231,10 @@ AcpiTbConvertToXsdt (
}
}
-
/* Delete the original table (either mapped or in a buffer) */
AcpiTbDeleteSingleTable (TableInfo);
-
/* Point the table descriptor to the new table */
TableInfo->Pointer = (ACPI_TABLE_HEADER *) NewTable;
@@ -260,12 +250,12 @@ AcpiTbConvertToXsdt (
*
* FUNCTION: AcpiTbConvertTableFadt
*
- * PARAMETERS:
+ * PARAMETERS: None
*
- * RETURN:
+ * RETURN: Status
*
* DESCRIPTION:
- * Converts BIOS supplied 1.0 and 0.71 ACPI FADT to an intermediate
+ * Converts a BIOS supplied ACPI 1.0 FADT to an intermediate
* ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
* copied to the intermediate FADT. The ACPI CA software uses this
* intermediate FADT. Thus a significant amount of special #ifdef
@@ -277,257 +267,87 @@ AcpiTbConvertToXsdt (
ACPI_STATUS
AcpiTbConvertTableFadt (void)
{
-
-#ifdef _IA64
- FADT_DESCRIPTOR_REV071 *FADT71;
- UINT8 Pm1AddressSpace;
- UINT8 Pm2AddressSpace;
- UINT8 PmTimerAddressSpace;
- UINT8 Gpe0AddressSpace;
- UINT8 Gpe1AddressSpace;
-#else
FADT_DESCRIPTOR_REV1 *FADT1;
-#endif
-
FADT_DESCRIPTOR_REV2 *FADT2;
ACPI_TABLE_DESC *TableDesc;
- FUNCTION_TRACE ("TbConvertTableFadt");
-
+ ACPI_FUNCTION_TRACE ("TbConvertTableFadt");
- /* AcpiGbl_FADT is valid */
- /* Allocate and zero the 2.0 buffer */
+ /*
+ * AcpiGbl_FADT is valid
+ * Allocate and zero the 2.0 FADT buffer
+ */
FADT2 = ACPI_MEM_CALLOCATE (sizeof (FADT_DESCRIPTOR_REV2));
if (FADT2 == NULL)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
- /* The ACPI FADT revision number is FADT2_REVISION_ID=3 */
- /* So, if the current table revision is less than 3 it is type 1.0 or 0.71 */
-
- if (AcpiGbl_FADT->header.Revision >= FADT2_REVISION_ID)
+ /*
+ * The ACPI FADT revision number is FADT2_REVISION_ID=3
+ * So, if the current table revision is less than 3 it is type 1.0
+ */
+ if (AcpiGbl_FADT->Header.Revision >= FADT2_REVISION_ID)
{
/* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
*FADT2 = *((FADT_DESCRIPTOR_REV2*) AcpiGbl_FADT);
-
}
-
else
{
-
-#ifdef _IA64
- /*
- * For the 64-bit case only, a revision ID less than V2.0 means the
- * tables are the 0.71 extensions
- */
-
- /* The BIOS stored FADT should agree with Revision 0.71 */
-
- FADT71 = (FADT_DESCRIPTOR_REV071 *) AcpiGbl_FADT;
-
- /* Copy the table header*/
-
- FADT2->header = FADT71->header;
-
- /* Copy the common fields */
-
- FADT2->SciInt = FADT71->SciInt;
- FADT2->AcpiEnable = FADT71->AcpiEnable;
- FADT2->AcpiDisable = FADT71->AcpiDisable;
- FADT2->S4BiosReq = FADT71->S4BiosReq;
- FADT2->Plvl2Lat = FADT71->Plvl2Lat;
- FADT2->Plvl3Lat = FADT71->Plvl3Lat;
- FADT2->DayAlrm = FADT71->DayAlrm;
- FADT2->MonAlrm = FADT71->MonAlrm;
- FADT2->Century = FADT71->Century;
- FADT2->Gpe1Base = FADT71->Gpe1Base;
-
- /*
- * We still use the block length registers even though
- * the GAS structure should obsolete them. This is because
- * these registers are byte lengths versus the GAS which
- * contains a bit width
- */
- FADT2->Pm1EvtLen = FADT71->Pm1EvtLen;
- FADT2->Pm1CntLen = FADT71->Pm1CntLen;
- FADT2->Pm2CntLen = FADT71->Pm2CntLen;
- FADT2->PmTmLen = FADT71->PmTmLen;
- FADT2->Gpe0BlkLen = FADT71->Gpe0BlkLen;
- FADT2->Gpe1BlkLen = FADT71->Gpe1BlkLen;
- FADT2->Gpe1Base = FADT71->Gpe1Base;
-
- /* Copy the existing 0.71 flags to 2.0. The other bits are zero.*/
-
- FADT2->WbInvd = FADT71->FlushCash;
- FADT2->ProcC1 = FADT71->ProcC1;
- FADT2->Plvl2Up = FADT71->Plvl2Up;
- FADT2->PwrButton = FADT71->PwrButton;
- FADT2->SleepButton = FADT71->SleepButton;
- FADT2->FixedRTC = FADT71->FixedRTC;
- FADT2->Rtcs4 = FADT71->Rtcs4;
- FADT2->TmrValExt = FADT71->TmrValExt;
- FADT2->DockCap = FADT71->DockCap;
-
-
- /* We should not use these next two addresses */
- /* Since our buffer is pre-zeroed nothing to do for */
- /* the next three data items in the structure */
- /* FADT2->FirmwareCtrl = 0; */
- /* FADT2->Dsdt = 0; */
-
- /* System Interrupt Model isn't used in ACPI 2.0*/
- /* FADT2->Reserved1 = 0; */
-
- /* This field is set by the OEM to convey the preferred */
- /* power management profile to OSPM. It doesn't have any*/
- /* 0.71 equivalence. Since we don't know what kind of */
- /* 64-bit system this is, we will pick unspecified. */
-
- FADT2->Prefer_PM_Profile = PM_UNSPECIFIED;
-
-
- /* Port address of SMI command port */
- /* We shouldn't use this port because IA64 doesn't */
- /* have or use SMI. It has PMI. */
-
- FADT2->SmiCmd = (UINT32)(FADT71->SmiCmd & 0xFFFFFFFF);
-
-
- /* processor performance state control*/
- /* The value OSPM writes to the SMI_CMD register to assume */
- /* processor performance state control responsibility. */
- /* There isn't any equivalence in 0.71 */
- /* Again this should be meaningless for IA64 */
- /* FADT2->PstateCnt = 0; */
-
- /* The 32-bit Power management and GPE registers are */
- /* not valid in IA-64 and we are not going to use them */
- /* so leaving them pre-zeroed. */
-
- /* Support for the _CST object and C States change notification.*/
- /* This data item hasn't any 0.71 equivalence so leaving it zero.*/
- /* FADT2->CstCnt = 0; */
-
- /* number of flush strides that need to be read */
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->FlushSize = 0; */
-
- /* Processor's memory cache line width, in bytes */
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->FlushStride = 0; */
-
- /* Processor's duty cycle index in processor's P_CNT reg*/
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->DutyOffset = 0; */
-
- /* Processor's duty cycle value bit width in P_CNT register.*/
- /* No 0.71 equivalence. Leave pre-zeroed. */
- /* FADT2->DutyWidth = 0; */
-
-
- /* Since there isn't any equivalence in 0.71 */
- /* and since BigSur had to support legacy */
-
- FADT2->IapcBootArch = BAF_LEGACY_DEVICES;
-
- /* Copy to ACPI 2.0 64-BIT Extended Addresses */
-
- FADT2->XFirmwareCtrl = FADT71->FirmwareCtrl;
- FADT2->XDsdt = FADT71->Dsdt;
-
-
- /* Extract the address space IDs */
-
- Pm1AddressSpace = (UINT8)((FADT71->AddressSpace & PM1_BLK_ADDRESS_SPACE) >> 1);
- Pm2AddressSpace = (UINT8)((FADT71->AddressSpace & PM2_CNT_BLK_ADDRESS_SPACE) >> 2);
- PmTimerAddressSpace = (UINT8)((FADT71->AddressSpace & PM_TMR_BLK_ADDRESS_SPACE) >> 3);
- Gpe0AddressSpace = (UINT8)((FADT71->AddressSpace & GPE0_BLK_ADDRESS_SPACE) >> 4);
- Gpe1AddressSpace = (UINT8)((FADT71->AddressSpace & GPE1_BLK_ADDRESS_SPACE) >> 5);
-
- /*
- * Convert the 0.71 (non-GAS style) Block addresses to V2.0 GAS structures,
- * in this order:
- *
- * PM 1A Events
- * PM 1B Events
- * PM 1A Control
- * PM 1B Control
- * PM 2 Control
- * PM Timer Control
- * GPE Block 0
- * GPE Block 1
- */
-
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XPm1aEvtBlk, FADT71->Pm1EvtLen, FADT71->Pm1aEvtBlk, Pm1AddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XPm1bEvtBlk, FADT71->Pm1EvtLen, FADT71->Pm1bEvtBlk, Pm1AddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XPm1aCntBlk, FADT71->Pm1CntLen, FADT71->Pm1aCntBlk, Pm1AddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XPm1bCntBlk, FADT71->Pm1CntLen, FADT71->Pm1bCntBlk, Pm1AddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XPm2CntBlk, FADT71->Pm2CntLen, FADT71->Pm2CntBlk, Pm2AddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XPmTmrBlk, FADT71->PmTmLen, FADT71->PmTmrBlk, PmTimerAddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XGpe0Blk, FADT71->Gpe0BlkLen, FADT71->Gpe0Blk, Gpe0AddressSpace);
- ASL_BUILD_GAS_FROM_ENTRY (FADT2->XGpe1Blk, FADT71->Gpe1BlkLen, FADT71->Gpe1Blk, Gpe1AddressSpace);
-
-#else
-
/* ACPI 1.0 FACS */
-
/* The BIOS stored FADT should agree with Revision 1.0 */
FADT1 = (FADT_DESCRIPTOR_REV1*) AcpiGbl_FADT;
/*
- * Copy the table header and the common part of the tables
- * The 2.0 table is an extension of the 1.0 table, so the
- * entire 1.0 table can be copied first, then expand some
- * fields to 64 bits.
+ * Copy the table header and the common part of the tables.
+ *
+ * The 2.0 table is an extension of the 1.0 table, so the entire 1.0
+ * table can be copied first, then expand some fields to 64 bits.
*/
- MEMCPY (FADT2, FADT1, sizeof (FADT_DESCRIPTOR_REV1));
-
+ ACPI_MEMCPY (FADT2, FADT1, sizeof (FADT_DESCRIPTOR_REV1));
/* Convert table pointers to 64-bit fields */
ACPI_STORE_ADDRESS (FADT2->XFirmwareCtrl, FADT1->FirmwareCtrl);
ACPI_STORE_ADDRESS (FADT2->XDsdt, FADT1->Dsdt);
- /* System Interrupt Model isn't used in ACPI 2.0*/
- /* FADT2->Reserved1 = 0; */
-
- /* This field is set by the OEM to convey the preferred */
- /* power management profile to OSPM. It doesn't have any*/
- /* 1.0 equivalence. Since we don't know what kind of */
- /* 32-bit system this is, we will pick unspecified. */
+ /*
+ * System Interrupt Model isn't used in ACPI 2.0 (FADT2->Reserved1 = 0;)
+ */
+ /*
+ * This field is set by the OEM to convey the preferred power management
+ * profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't
+ * know what kind of 32-bit system this is, we will use "unspecified".
+ */
FADT2->Prefer_PM_Profile = PM_UNSPECIFIED;
-
- /* Processor Performance State Control. This is the value */
- /* OSPM writes to the SMI_CMD register to assume processor */
- /* performance state control responsibility. There isn't */
- /* any equivalence in 1.0. So leave it zeroed. */
-
+ /*
+ * Processor Performance State Control. This is the value OSPM writes to
+ * the SMI_CMD register to assume processor performance state control
+ * responsibility. There isn't any equivalence in 1.0, leave it zeroed.
+ */
FADT2->PstateCnt = 0;
-
- /* Support for the _CST object and C States change notification.*/
- /* This data item hasn't any 1.0 equivalence so leaving it zero.*/
-
+ /*
+ * Support for the _CST object and C States change notification.
+ * This data item hasn't any 1.0 equivalence so leave it zero.
+ */
FADT2->CstCnt = 0;
-
- /* Since there isn't any equivalence in 1.0 and since it */
- /* is highly likely that a 1.0 system has legacy support. */
-
+ /*
+ * Since there isn't any equivalence in 1.0 and since it highly likely
+ * that a 1.0 system has legacy support.
+ */
FADT2->IapcBootArch = BAF_LEGACY_DEVICES;
-
/*
- * Convert the V1.0 Block addresses to V2.0 GAS structures
+ * Convert the V1.0 block addresses to V2.0 GAS structures
* in this order:
*
* PM 1A Events
@@ -539,7 +359,6 @@ AcpiTbConvertTableFadt (void)
* GPE Block 0
* GPE Block 1
*/
-
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1aEvtBlk, FADT1->Pm1EvtLen, FADT1->Pm1aEvtBlk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1bEvtBlk, FADT1->Pm1EvtLen, FADT1->Pm1bEvtBlk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1aCntBlk, FADT1->Pm1CntLen, FADT1->Pm1aCntBlk);
@@ -548,23 +367,19 @@ AcpiTbConvertTableFadt (void)
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPmTmrBlk, FADT1->PmTmLen, FADT1->PmTmrBlk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XGpe0Blk, FADT1->Gpe0BlkLen, FADT1->Gpe0Blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XGpe1Blk, FADT1->Gpe1BlkLen, FADT1->Gpe1Blk);
-#endif
}
-
/*
* Global FADT pointer will point to the common V2.0 FADT
*/
AcpiGbl_FADT = FADT2;
- AcpiGbl_FADT->header.Length = sizeof (FADT_DESCRIPTOR);
-
+ AcpiGbl_FADT->Header.Length = sizeof (FADT_DESCRIPTOR);
/* Free the original table */
TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_FADT];
AcpiTbDeleteSingleTable (TableDesc);
-
/* Install the new table */
TableDesc->Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_FADT;
@@ -572,14 +387,12 @@ AcpiTbConvertTableFadt (void)
TableDesc->Allocation = ACPI_MEM_ALLOCATED;
TableDesc->Length = sizeof (FADT_DESCRIPTOR_REV2);
-
/* Dump the entire FADT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of common internal FADT, size %d (%X)\n",
- AcpiGbl_FADT->header.Length, AcpiGbl_FADT->header.Length));
- DUMP_BUFFER ((UINT8 *) (AcpiGbl_FADT), AcpiGbl_FADT->header.Length);
-
+ AcpiGbl_FADT->Header.Length, AcpiGbl_FADT->Header.Length));
+ ACPI_DUMP_BUFFER ((UINT8 *) (AcpiGbl_FADT), AcpiGbl_FADT->Header.Length);
return_ACPI_STATUS (AE_OK);
}
@@ -589,11 +402,12 @@ AcpiTbConvertTableFadt (void)
*
* FUNCTION: AcpiTbConvertTableFacs
*
- * PARAMETERS:
+ * PARAMETERS: TableInfo - Info for currently installad FACS
*
- * RETURN:
+ * RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Convert ACPI 1.0 and ACPI 2.0 FACS to a common internal
+ * table format.
*
******************************************************************************/
@@ -601,70 +415,36 @@ ACPI_STATUS
AcpiTbBuildCommonFacs (
ACPI_TABLE_DESC *TableInfo)
{
- ACPI_COMMON_FACS *CommonFacs;
-
-#ifdef _IA64
- FACS_DESCRIPTOR_REV071 *FACS71;
-#else
FACS_DESCRIPTOR_REV1 *FACS1;
-#endif
-
FACS_DESCRIPTOR_REV2 *FACS2;
- FUNCTION_TRACE ("TbBuildCommonFacs");
-
-
- /* Allocate a common FACS */
-
- CommonFacs = ACPI_MEM_CALLOCATE (sizeof (ACPI_COMMON_FACS));
- if (!CommonFacs)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ ACPI_FUNCTION_TRACE ("TbBuildCommonFacs");
/* Copy fields to the new FACS */
if (AcpiGbl_RSDP->Revision < 2)
{
-#ifdef _IA64
- /* 0.71 FACS */
-
- FACS71 = (FACS_DESCRIPTOR_REV071 *) AcpiGbl_FACS;
-
- CommonFacs->GlobalLock = (UINT32 *) &(FACS71->GlobalLock);
- CommonFacs->FirmwareWakingVector = &FACS71->FirmwareWakingVector;
- CommonFacs->VectorWidth = 64;
-#else
/* ACPI 1.0 FACS */
FACS1 = (FACS_DESCRIPTOR_REV1 *) AcpiGbl_FACS;
- CommonFacs->GlobalLock = &(FACS1->GlobalLock);
- CommonFacs->FirmwareWakingVector = (UINT64 *) &FACS1->FirmwareWakingVector;
- CommonFacs->VectorWidth = 32;
-
-#endif
+ AcpiGbl_CommonFACS.GlobalLock = &(FACS1->GlobalLock);
+ AcpiGbl_CommonFACS.FirmwareWakingVector = (UINT64 *) &FACS1->FirmwareWakingVector;
+ AcpiGbl_CommonFACS.VectorWidth = 32;
}
-
else
{
/* ACPI 2.0 FACS */
FACS2 = (FACS_DESCRIPTOR_REV2 *) AcpiGbl_FACS;
- CommonFacs->GlobalLock = &(FACS2->GlobalLock);
- CommonFacs->FirmwareWakingVector = &FACS2->XFirmwareWakingVector;
- CommonFacs->VectorWidth = 64;
+ AcpiGbl_CommonFACS.GlobalLock = &(FACS2->GlobalLock);
+ AcpiGbl_CommonFACS.FirmwareWakingVector = &FACS2->XFirmwareWakingVector;
+ AcpiGbl_CommonFACS.VectorWidth = 64;
}
-
- /* Set the global FACS pointer to point to the common FACS */
-
-
- AcpiGbl_FACS = CommonFacs;
-
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c
index 4e0d7d9..af12874 100644
--- a/sys/contrib/dev/acpica/tbget.c
+++ b/sys/contrib/dev/acpica/tbget.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
- * $Revision: 57 $
+ * $Revision: 63 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,14 +117,11 @@
#define __TBGET_C__
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbget")
-
-#define RSDP_CHECKSUM_LENGTH 20
+ ACPI_MODULE_NAME ("tbget")
/*******************************************************************************
@@ -152,7 +149,7 @@ AcpiTbGetTablePtr (
UINT32 i;
- FUNCTION_TRACE ("TbGetTablePtr");
+ ACPI_FUNCTION_TRACE ("TbGetTablePtr");
if (!AcpiGbl_DSDT)
@@ -165,7 +162,6 @@ AcpiTbGetTablePtr (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* For all table types (Single/Multiple), the first
* instance is always in the list head.
@@ -180,7 +176,6 @@ AcpiTbGetTablePtr (
return_ACPI_STATUS (AE_OK);
}
-
/*
* Check for instance out of range
*/
@@ -238,7 +233,7 @@ AcpiTbGetTable (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("TbGetTable");
+ ACPI_FUNCTION_TRACE ("TbGetTable");
if (!TableInfo)
@@ -246,7 +241,6 @@ AcpiTbGetTable (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
if (BufferPtr)
{
/*
@@ -272,14 +266,13 @@ AcpiTbGetTable (
/* Copy the entire table (including header) to the local buffer */
Size = TableHeader->Length;
- MEMCPY (FullTable, BufferPtr, Size);
+ ACPI_MEMCPY (FullTable, BufferPtr, Size);
/* Save allocation type */
Allocation = ACPI_MEM_ALLOCATED;
}
-
/*
* Not reading from a buffer, just map the table's physical memory
* into our address space.
@@ -299,7 +292,6 @@ AcpiTbGetTable (
Allocation = ACPI_MEM_MAPPED;
}
-
/* Return values */
TableInfo->Pointer = FullTable;
@@ -335,7 +327,7 @@ AcpiTbGetAllTables (
ACPI_TABLE_DESC TableInfo;
- FUNCTION_TRACE ("TbGetAllTables");
+ ACPI_FUNCTION_TRACE ("TbGetAllTables");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Number of tables: %d\n", NumberOfTables));
@@ -349,7 +341,7 @@ AcpiTbGetAllTables (
{
/* Clear the TableInfo each time */
- MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC));
+ ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC));
/* Get the table via the XSDT */
@@ -385,7 +377,6 @@ AcpiTbGetAllTables (
}
}
-
/*
* Convert the FADT to a common format. This allows earlier revisions of the
* table to coexist with newer versions, using common access code.
@@ -396,7 +387,6 @@ AcpiTbGetAllTables (
return_ACPI_STATUS (Status);
}
-
/*
* Get the minimum set of ACPI tables, namely:
*
@@ -434,7 +424,6 @@ AcpiTbGetAllTables (
return_ACPI_STATUS (Status);
}
-
/*
* Get the DSDT (We know that the FADT is valid now)
*/
@@ -456,19 +445,18 @@ AcpiTbGetAllTables (
/* Dump the DSDT Header */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Hex dump of DSDT Header:\n"));
- DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER));
+ ACPI_DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER));
/* Dump the entire DSDT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of DSDT (After header), size %d (%x)\n",
AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length));
- DUMP_BUFFER ((UINT8 *) (AcpiGbl_DSDT + 1), AcpiGbl_DSDT->Length);
+ ACPI_DUMP_BUFFER ((UINT8 *) (AcpiGbl_DSDT + 1), AcpiGbl_DSDT->Length);
/* Always delete the RSDP mapping, we are done with it */
AcpiTbDeleteAcpiTable (ACPI_TABLE_RSDP);
-
return_ACPI_STATUS (Status);
}
@@ -491,17 +479,17 @@ AcpiTbVerifyRsdp (
{
ACPI_TABLE_DESC TableInfo;
ACPI_STATUS Status;
- UINT8 *TablePtr;
+ RSDP_DESCRIPTOR *Rsdp;
- FUNCTION_TRACE ("TbVerifyRsdp");
+ ACPI_FUNCTION_TRACE ("TbVerifyRsdp");
/*
* Obtain access to the RSDP structure
*/
Status = AcpiOsMapMemory (RsdpPhysicalAddress, sizeof (RSDP_DESCRIPTOR),
- (void **) &TablePtr);
+ (void **) &Rsdp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -510,7 +498,7 @@ AcpiTbVerifyRsdp (
/*
* The signature and checksum must both be correct
*/
- if (STRNCMP ((NATIVE_CHAR *) TablePtr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ if (ACPI_STRNCMP ((NATIVE_CHAR *) Rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
{
/* Nope, BAD Signature */
@@ -518,22 +506,32 @@ AcpiTbVerifyRsdp (
goto Cleanup;
}
- if (AcpiTbChecksum (TablePtr, RSDP_CHECKSUM_LENGTH) != 0)
- {
- /* Nope, BAD Checksum */
+ /* Check the standard checksum */
+ if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ {
Status = AE_BAD_CHECKSUM;
goto Cleanup;
}
- /* TBD: Check extended checksum if table version >= 2 */
+ /* Check extended checksum if table version >= 2 */
+
+ if (Rsdp->Revision >= 2)
+ {
+ if (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)
+ {
+ Status = AE_BAD_CHECKSUM;
+ goto Cleanup;
+ }
+ }
+
/* The RSDP supplied is OK */
- TableInfo.Pointer = (ACPI_TABLE_HEADER *) TablePtr;
+ TableInfo.Pointer = (ACPI_TABLE_HEADER *) Rsdp;
TableInfo.Length = sizeof (RSDP_DESCRIPTOR);
TableInfo.Allocation = ACPI_MEM_MAPPED;
- TableInfo.BasePointer = TablePtr;
+ TableInfo.BasePointer = Rsdp;
/* Save the table pointers and allocation info */
@@ -543,7 +541,6 @@ AcpiTbVerifyRsdp (
goto Cleanup;
}
-
/* Save the RSDP in a global for easy access */
AcpiGbl_RSDP = (RSDP_DESCRIPTOR *) TableInfo.Pointer;
@@ -553,7 +550,7 @@ AcpiTbVerifyRsdp (
/* Error exit */
Cleanup:
- AcpiOsUnmapMemory (TablePtr, sizeof (RSDP_DESCRIPTOR));
+ AcpiOsUnmapMemory (Rsdp, sizeof (RSDP_DESCRIPTOR));
return_ACPI_STATUS (Status);
}
@@ -577,7 +574,7 @@ AcpiTbGetRsdtAddress (void)
ACPI_PHYSICAL_ADDRESS PhysicalAddress;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/*
@@ -586,14 +583,8 @@ AcpiTbGetRsdtAddress (void)
*/
if (AcpiGbl_RSDP->Revision < 2)
{
-#ifdef _IA64
- /* 0.71 RSDP has 64bit Rsdt address field */
- PhysicalAddress = ((RSDP_DESCRIPTOR_REV071 *)AcpiGbl_RSDP)->RsdtPhysicalAddress;
-#else
PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) AcpiGbl_RSDP->RsdtPhysicalAddress;
-#endif
}
-
else
{
PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
@@ -623,32 +614,31 @@ AcpiTbValidateRsdt (
UINT32 NoMatch;
- PROC_NAME ("TbValidateRsdt");
+ ACPI_FUNCTION_NAME ("TbValidateRsdt");
/*
* For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 (and above), we use the XSDT
+ * For RSDP revision 2 and above, we use the XSDT
*/
if (AcpiGbl_RSDP->Revision < 2)
{
- NoMatch = STRNCMP ((char *) TablePtr, RSDT_SIG,
+ NoMatch = ACPI_STRNCMP ((char *) TablePtr, RSDT_SIG,
sizeof (RSDT_SIG) -1);
}
else
{
- NoMatch = STRNCMP ((char *) TablePtr, XSDT_SIG,
+ NoMatch = ACPI_STRNCMP ((char *) TablePtr, XSDT_SIG,
sizeof (XSDT_SIG) -1);
}
-
if (NoMatch)
{
/* Invalid RSDT or XSDT signature */
- REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
+ ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
- DUMP_BUFFER (AcpiGbl_RSDP, 20);
+ ACPI_DUMP_BUFFER (AcpiGbl_RSDP, 20);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
"RSDT/XSDT signature at %X is invalid\n",
@@ -685,7 +675,7 @@ AcpiTbGetTablePointer (
ACPI_STATUS Status;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
@@ -693,12 +683,10 @@ AcpiTbGetTablePointer (
*Size = SIZE_IN_HEADER;
Status = AcpiTbMapAcpiTable (PhysicalAddress, Size, TablePtr);
}
-
else
{
*Size = 0;
- *TablePtr = (ACPI_TABLE_HEADER *) (ACPI_TBLPTR) PhysicalAddress;
-
+ *TablePtr = ACPI_PHYSADDR_TO_PTR (PhysicalAddress);
Status = AE_OK;
}
@@ -727,7 +715,7 @@ AcpiTbGetTableRsdt (
ACPI_PHYSICAL_ADDRESS PhysicalAddress;
- FUNCTION_TRACE ("TbGetTableRsdt");
+ ACPI_FUNCTION_TRACE ("TbGetTableRsdt");
/*
@@ -735,13 +723,12 @@ AcpiTbGetTableRsdt (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- AcpiGbl_RSDP, HIDWORD(AcpiGbl_RSDP->RsdtPhysicalAddress),
- LODWORD(AcpiGbl_RSDP->RsdtPhysicalAddress)));
-
+ AcpiGbl_RSDP,
+ ACPI_HIDWORD (AcpiGbl_RSDP->RsdtPhysicalAddress),
+ ACPI_LODWORD (AcpiGbl_RSDP->RsdtPhysicalAddress)));
PhysicalAddress = AcpiTbGetRsdtAddress ();
-
/* Get the RSDT/XSDT */
Status = AcpiTbGetTable (PhysicalAddress, NULL, &TableInfo);
@@ -752,7 +739,6 @@ AcpiTbGetTableRsdt (
return_ACPI_STATUS (Status);
}
-
/* Check the RSDT or XSDT signature */
Status = AcpiTbValidateRsdt (TableInfo.Pointer);
@@ -761,14 +747,12 @@ AcpiTbGetTableRsdt (
return_ACPI_STATUS (Status);
}
-
/*
* Valid RSDT signature, verify the checksum. If it fails, just
* print a warning and ignore it.
*/
Status = AcpiTbVerifyTableChecksum (TableInfo.Pointer);
-
/* Convert and/or copy to an XSDT structure */
Status = AcpiTbConvertToXsdt (&TableInfo, NumberOfTables);
@@ -788,7 +772,6 @@ AcpiTbGetTableRsdt (
AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", AcpiGbl_XSDT));
-
return_ACPI_STATUS (Status);
}
@@ -821,7 +804,7 @@ AcpiTbGetTableFacs (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("TbGetTableFacs");
+ ACPI_FUNCTION_TRACE ("TbGetTableFacs");
/* Must have a valid FADT pointer */
@@ -844,13 +827,12 @@ AcpiTbGetTableFacs (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- MEMCPY (TablePtr, BufferPtr, Size);
+ ACPI_MEMCPY (TablePtr, BufferPtr, Size);
/* Save allocation type */
Allocation = ACPI_MEM_ALLOCATED;
}
-
else
{
/* Just map the physical memory to our address space */
@@ -867,7 +849,6 @@ AcpiTbGetTableFacs (
Allocation = ACPI_MEM_MAPPED;
}
-
/* Return values */
TableInfo->Pointer = TablePtr;
diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c
index a7c889c..7198a0c 100644
--- a/sys/contrib/dev/acpica/tbinstal.c
+++ b/sys/contrib/dev/acpica/tbinstal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 47 $
+ * $Revision: 55 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,12 +118,62 @@
#define __TBINSTAL_C__
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbinstal")
+ ACPI_MODULE_NAME ("tbinstal")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbMatchSignature
+ *
+ * PARAMETERS: Signature - Table signature to match
+ * TableInfo - Return data
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compare signature against the list of "ACPI-subsystem-owned"
+ * tables (DSDT/FADT/SSDT, etc.) Returns the TableTypeID on match.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbMatchSignature (
+ NATIVE_CHAR *Signature,
+ ACPI_TABLE_DESC *TableInfo)
+{
+ NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE ("TbMatchSignature");
+
+
+ /*
+ * Search for a signature match among the known table types
+ */
+ for (i = 0; i < NUM_ACPI_TABLES; i++)
+ {
+ if (!ACPI_STRNCMP (Signature, AcpiGbl_AcpiTableData[i].Signature,
+ AcpiGbl_AcpiTableData[i].SigLength))
+ {
+ /* Found a signature match, return index if requested */
+
+ if (TableInfo)
+ {
+ TableInfo->Type = (UINT8) i;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Signature match %4.4s\n",
+ (char *) AcpiGbl_AcpiTableData[i].Signature));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
+}
/*******************************************************************************
@@ -148,7 +198,7 @@ AcpiTbInstallTable (
{
ACPI_STATUS Status;
- FUNCTION_TRACE ("TbInstallTable");
+ ACPI_FUNCTION_TRACE ("TbInstallTable");
/*
@@ -163,7 +213,11 @@ AcpiTbInstallTable (
/* Lock tables while installing */
- AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Install the table into the global data structure */
@@ -172,7 +226,7 @@ AcpiTbInstallTable (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
AcpiGbl_AcpiTableData[TableInfo->Type].Name, TableInfo->Pointer));
- AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
@@ -205,11 +259,9 @@ AcpiTbRecognizeTable (
{
ACPI_TABLE_HEADER *TableHeader;
ACPI_STATUS Status;
- ACPI_TABLE_TYPE TableType = 0;
- UINT32 i;
- FUNCTION_TRACE ("TbRecognizeTable");
+ ACPI_FUNCTION_TRACE ("TbRecognizeTable");
/* Ensure that we have a valid table pointer */
@@ -221,56 +273,35 @@ AcpiTbRecognizeTable (
}
/*
- * Search for a signature match among the known table types
- * Start at index one -> Skip the RSDP
+ * We only "recognize" a limited number of ACPI tables -- namely, the
+ * ones that are used by the subsystem (DSDT, FADT, etc.)
+ *
+ * An AE_NOT_FOUND means that the table was not recognized.
+ * This can be any one of many valid ACPI tables, it just isn't one of
+ * the tables that is consumed by the core subsystem
*/
- Status = AE_SUPPORT;
- for (i = 1; i < NUM_ACPI_TABLES; i++)
+ Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo);
+ if (ACPI_SUCCESS (Status))
{
- if (!STRNCMP (TableHeader->Signature,
- AcpiGbl_AcpiTableData[i].Signature,
- AcpiGbl_AcpiTableData[i].SigLength))
- {
- /*
- * Found a signature match, get the pertinent info from the
- * TableData structure
- */
- TableType = i;
- Status = AcpiGbl_AcpiTableData[i].Status;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found %4.4s\n",
- (char*)AcpiGbl_AcpiTableData[i].Signature));
- break;
- }
- }
-
- /* Return the table type and length via the info struct */
-
- TableInfo->Type = (UINT8) TableType;
- TableInfo->Length = TableHeader->Length;
+ /* Return the table type and length via the info struct */
+ TableInfo->Length = TableHeader->Length;
- /*
- * Validate checksum for _most_ tables,
- * even the ones whose signature we don't recognize
- */
- if (TableType != ACPI_TABLE_FACS)
- {
- /* But don't abort if the checksum is wrong */
- /* TBD: [Future] make this a configuration option? */
-
- AcpiTbVerifyTableChecksum (TableHeader);
- }
+ /*
+ * Validate checksum for _most_ tables,
+ * even the ones whose signature we don't recognize
+ */
+ if (TableInfo->Type != ACPI_TABLE_FACS)
+ {
+ Status = AcpiTbVerifyTableChecksum (TableHeader);
+ if (ACPI_FAILURE (Status) &&
+ (!ACPI_CHECKSUM_ABORT))
+ {
+ /* Ignore the error if configuration says so */
- /*
- * An AE_SUPPORT means that the table was not recognized.
- * We basically ignore this; just print a debug message
- */
- if (Status == AE_SUPPORT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Unsupported table %s (Type %X) was found and discarded\n",
- AcpiGbl_AcpiTableData[TableType].Name, TableType));
+ Status = AE_OK;
+ }
+ }
}
return_ACPI_STATUS (Status);
@@ -299,7 +330,7 @@ AcpiTbInitTableDescriptor (
ACPI_TABLE_DESC *TableDesc;
- FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
+ ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
/*
* Install the table into the global data structure
@@ -307,13 +338,12 @@ AcpiTbInitTableDescriptor (
ListHead = &AcpiGbl_AcpiTables[TableType];
TableDesc = ListHead;
-
/*
* Two major types of tables: 1) Only one instance is allowed. This
* includes most ACPI tables such as the DSDT. 2) Multiple instances of
* the table are allowed. This includes SSDT and PSDTs.
*/
- if (IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags))
+ if (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags))
{
/*
* Only one table allowed, and a table has alread been installed
@@ -325,9 +355,9 @@ AcpiTbInitTableDescriptor (
}
TableDesc->Count = 1;
+ TableDesc->Prev = NULL;
+ TableDesc->Next = NULL;
}
-
-
else
{
/*
@@ -357,16 +387,15 @@ AcpiTbInitTableDescriptor (
ListHead->Prev = TableDesc;
}
-
else
{
TableDesc->Count = 1;
}
}
-
/* Common initialization of the table descriptor */
+ TableDesc->Type = TableInfo->Type;
TableDesc->Pointer = TableInfo->Pointer;
TableDesc->BasePointer = TableInfo->BasePointer;
TableDesc->Length = TableInfo->Length;
@@ -374,7 +403,7 @@ AcpiTbInitTableDescriptor (
TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1),
TableDesc->AmlLength = (UINT32) (TableDesc->Length -
(UINT32) sizeof (ACPI_TABLE_HEADER));
- TableDesc->TableId = AcpiUtAllocateOwnerId (OWNER_TYPE_TABLE);
+ TableDesc->TableId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_TABLE);
TableDesc->LoadedIntoNamespace = FALSE;
/*
@@ -386,7 +415,6 @@ AcpiTbInitTableDescriptor (
*(AcpiGbl_AcpiTableData[TableType].GlobalPtr) = TableInfo->Pointer;
}
-
/* Return Data */
TableInfo->TableId = TableDesc->TableId;
@@ -422,7 +450,6 @@ AcpiTbDeleteAcpiTables (void)
{
AcpiTbDeleteAcpiTable (Type);
}
-
}
@@ -443,7 +470,8 @@ void
AcpiTbDeleteAcpiTable (
ACPI_TABLE_TYPE Type)
{
- FUNCTION_TRACE_U32 ("TbDeleteAcpiTable", Type);
+
+ ACPI_FUNCTION_TRACE_U32 ("TbDeleteAcpiTable", Type);
if (Type > ACPI_TABLE_MAX)
@@ -451,14 +479,15 @@ AcpiTbDeleteAcpiTable (
return_VOID;
}
-
- AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_TABLES)))
+ {
+ return;
+ }
/* Free the table */
AcpiTbFreeAcpiTablesOfType (&AcpiGbl_AcpiTables[Type]);
-
/* Clear the appropriate "typed" global table pointer */
switch (Type)
@@ -489,8 +518,7 @@ AcpiTbDeleteAcpiTable (
break;
}
- AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_VOID;
}
@@ -517,7 +545,7 @@ AcpiTbFreeAcpiTablesOfType (
UINT32 i;
- FUNCTION_TRACE_PTR ("TbFreeAcpiTablesOfType", ListHead);
+ ACPI_FUNCTION_TRACE_PTR ("TbFreeAcpiTablesOfType", ListHead);
/* Get the head of the list */
@@ -567,17 +595,14 @@ AcpiTbDeleteSingleTable (
switch (TableDesc->Allocation)
{
-
case ACPI_MEM_NOT_ALLOCATED:
break;
-
case ACPI_MEM_ALLOCATED:
ACPI_MEM_FREE (TableDesc->BasePointer);
break;
-
case ACPI_MEM_MAPPED:
AcpiOsUnmapMemory (TableDesc->BasePointer, TableDesc->Length);
@@ -608,7 +633,7 @@ AcpiTbUninstallTable (
ACPI_TABLE_DESC *NextDesc;
- FUNCTION_TRACE_PTR ("TbDeleteSingleTable", TableDesc);
+ ACPI_FUNCTION_TRACE_PTR ("TbDeleteSingleTable", TableDesc);
if (!TableDesc)
@@ -616,7 +641,6 @@ AcpiTbUninstallTable (
return_PTR (NULL);
}
-
/* Unlink the descriptor */
if (TableDesc->Prev)
@@ -629,17 +653,14 @@ AcpiTbUninstallTable (
TableDesc->Next->Prev = TableDesc->Prev;
}
-
/* Free the memory allocated for the table itself */
AcpiTbDeleteSingleTable (TableDesc);
-
/* Free the table descriptor (Don't delete the list head, tho) */
if ((TableDesc->Prev) == (TableDesc->Next))
{
-
NextDesc = NULL;
/* Clear the list head */
@@ -647,9 +668,7 @@ AcpiTbUninstallTable (
TableDesc->Pointer = NULL;
TableDesc->Length = 0;
TableDesc->Count = 0;
-
}
-
else
{
/* Free the table descriptor */
@@ -658,7 +677,6 @@ AcpiTbUninstallTable (
ACPI_MEM_FREE (TableDesc);
}
-
return_PTR (NextDesc);
}
diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c
index 8b7dfa0..3c1f1cb 100644
--- a/sys/contrib/dev/acpica/tbutils.c
+++ b/sys/contrib/dev/acpica/tbutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
- * $Revision: 43 $
+ * $Revision: 49 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbutils")
+ ACPI_MODULE_NAME ("tbutils")
/*******************************************************************************
@@ -147,7 +147,7 @@ AcpiTbHandleToObject (
ACPI_TABLE_DESC *ListHead;
- PROC_NAME ("TbHandleToObject");
+ ACPI_FUNCTION_NAME ("TbHandleToObject");
for (i = 0; i < ACPI_TABLE_MAX; i++)
@@ -199,7 +199,7 @@ AcpiTbValidateTableHeader (
ACPI_NAME Signature;
- PROC_NAME ("TbValidateTableHeader");
+ ACPI_FUNCTION_NAME ("TbValidateTableHeader");
/* Verify that this is a valid address */
@@ -214,15 +214,15 @@ AcpiTbValidateTableHeader (
/* Ensure that the signature is 4 ASCII characters */
- MOVE_UNALIGNED32_TO_32 (&Signature, &TableHeader->Signature);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, &TableHeader->Signature);
if (!AcpiUtValidAcpiName (Signature))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table signature at %p [%p] has invalid characters\n",
TableHeader, &Signature));
- REPORT_WARNING (("Invalid table signature %4.4s found\n", (char*)&Signature));
- DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
+ ACPI_REPORT_WARNING (("Invalid table signature %4.4s found\n", (char *) &Signature));
+ ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
return (AE_BAD_SIGNATURE);
}
@@ -233,10 +233,10 @@ AcpiTbValidateTableHeader (
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Invalid length in table header %p name %4.4s\n",
- TableHeader, (char*)&Signature));
+ TableHeader, (char *) &Signature));
- REPORT_WARNING (("Invalid table header length found\n"));
- DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
+ ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", TableHeader->Length));
+ ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
return (AE_BAD_HEADER);
}
@@ -271,7 +271,7 @@ AcpiTbMapAcpiTable (
ACPI_STATUS Status = AE_OK;
- PROC_NAME ("TbMapAcpiTable");
+ ACPI_FUNCTION_NAME ("TbMapAcpiTable");
/* If size is zero, look at the table header to get the actual size */
@@ -350,7 +350,7 @@ AcpiTbVerifyTableChecksum (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("TbVerifyTableChecksum");
+ ACPI_FUNCTION_TRACE ("TbVerifyTableChecksum");
/* Compute the checksum on the table */
@@ -361,8 +361,8 @@ AcpiTbVerifyTableChecksum (
if (Checksum)
{
- REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
- Checksum, (char*)&TableHeader->Signature));
+ ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n",
+ Checksum, (char *) &TableHeader->Signature));
Status = AE_BAD_CHECKSUM;
}
@@ -390,8 +390,8 @@ AcpiTbChecksum (
void *Buffer,
UINT32 Length)
{
- UINT8 *limit;
- UINT8 *rover;
+ const UINT8 *limit;
+ const UINT8 *rover;
UINT8 sum = 0;
diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c
index 457c634..7ff0f63 100644
--- a/sys/contrib/dev/acpica/tbxface.c
+++ b/sys/contrib/dev/acpica/tbxface.c
@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 45 $
+ * $Revision: 51 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbxface")
+ ACPI_MODULE_NAME ("tbxface")
/*******************************************************************************
@@ -148,7 +148,7 @@ AcpiLoadTables (void)
UINT32 NumberOfTables = 0;
- FUNCTION_TRACE ("AcpiLoadTables");
+ ACPI_FUNCTION_TRACE ("AcpiLoadTables");
/* Get the RSDP */
@@ -157,7 +157,7 @@ AcpiLoadTables (void)
&RsdpPhysicalAddress);
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n",
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n",
AcpiFormatException (Status)));
goto ErrorExit;
}
@@ -167,7 +167,7 @@ AcpiLoadTables (void)
Status = AcpiTbVerifyRsdp (RsdpPhysicalAddress);
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n",
+ ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n",
AcpiFormatException (Status)));
goto ErrorExit;
}
@@ -177,7 +177,7 @@ AcpiLoadTables (void)
Status = AcpiTbGetTableRsdt (&NumberOfTables);
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
AcpiFormatException (Status)));
goto ErrorExit;
}
@@ -187,7 +187,7 @@ AcpiLoadTables (void)
Status = AcpiTbGetAllTables (NumberOfTables, NULL);
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n",
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n",
AcpiFormatException (Status)));
goto ErrorExit;
}
@@ -200,7 +200,7 @@ AcpiLoadTables (void)
Status = AcpiNsLoadNamespace ();
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n",
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n",
AcpiFormatException (Status)));
goto ErrorExit;
}
@@ -209,7 +209,7 @@ AcpiLoadTables (void)
ErrorExit:
- REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n",
+ ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n",
AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
@@ -240,7 +240,7 @@ AcpiLoadTable (
ACPI_TABLE_DESC TableInfo;
- FUNCTION_TRACE ("AcpiLoadTable");
+ ACPI_FUNCTION_TRACE ("AcpiLoadTable");
if (!TablePtr)
@@ -267,17 +267,34 @@ AcpiLoadTable (
return_ACPI_STATUS (Status);
}
+ /* Convert the table to common format if necessary */
+
+ switch (TableInfo.Type)
+ {
+ case ACPI_TABLE_FADT:
+
+ Status = AcpiTbConvertTableFadt ();
+ break;
+
+ case ACPI_TABLE_FACS:
+
+ Status = AcpiTbBuildCommonFacs (&TableInfo);
+ break;
+
+ default:
+ /* Load table into namespace if it contains executable AML */
+
+ Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
+ break;
+ }
- Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
/* Uninstall table and free the buffer */
AcpiTbUninstallTable (TableInfo.InstalledDesc);
- return_ACPI_STATUS (Status);
}
-
return_ACPI_STATUS (Status);
}
@@ -301,7 +318,7 @@ AcpiUnloadTable (
ACPI_TABLE_DESC *ListHead;
- FUNCTION_TRACE ("AcpiUnloadTable");
+ ACPI_FUNCTION_TRACE ("AcpiUnloadTable");
/* Parameter validation */
@@ -366,7 +383,7 @@ AcpiGetTableHeader (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiGetTableHeader");
+ ACPI_FUNCTION_TRACE ("AcpiGetTableHeader");
if ((Instance == 0) ||
@@ -379,7 +396,7 @@ AcpiGetTableHeader (
/* Check the table type and instance */
if ((TableType > ACPI_TABLE_MAX) ||
- (IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
+ (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
Instance > 1))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -405,7 +422,7 @@ AcpiGetTableHeader (
/*
* Copy the header to the caller's buffer
*/
- MEMCPY ((void *) OutTableHeader, (void *) TblPtr,
+ ACPI_MEMCPY ((void *) OutTableHeader, (void *) TblPtr,
sizeof (ACPI_TABLE_HEADER));
return_ACPI_STATUS (Status);
@@ -443,26 +460,29 @@ AcpiGetTable (
{
ACPI_TABLE_HEADER *TblPtr;
ACPI_STATUS Status;
- UINT32 RetBufLen;
+ UINT32 TableLength;
- FUNCTION_TRACE ("AcpiGetTable");
+ ACPI_FUNCTION_TRACE ("AcpiGetTable");
- /*
- * If we have a buffer, we must have a length too
- */
- if ((Instance == 0) ||
- (!RetBuffer) ||
- ((!RetBuffer->Pointer) && (RetBuffer->Length)))
+ /* Parameter validation */
+
+ if (Instance == 0)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ Status = AcpiUtValidateBuffer (RetBuffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Check the table type and instance */
if ((TableType > ACPI_TABLE_MAX) ||
- (IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
+ (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
Instance > 1))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -486,34 +506,31 @@ AcpiGetTable (
return_ACPI_STATUS (AE_NOT_EXIST);
}
- /*
- * Got a table ptr, assume it's ok and copy it to the user's buffer
- */
+ /* Get the table length */
+
if (TableType == ACPI_TABLE_RSDP)
{
/*
* RSD PTR is the only "table" without a header
*/
- RetBufLen = sizeof (RSDP_DESCRIPTOR);
+ TableLength = sizeof (RSDP_DESCRIPTOR);
}
else
{
- RetBufLen = TblPtr->Length;
+ TableLength = TblPtr->Length;
}
- /*
- * Verify we have space in the caller's buffer for the table
- */
- if (RetBuffer->Length < RetBufLen)
+ /* Validate/Allocate/Clear caller buffer */
+
+ Status = AcpiUtInitializeBuffer (RetBuffer, TableLength);
+ if (ACPI_FAILURE (Status))
{
- RetBuffer->Length = RetBufLen;
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ return_ACPI_STATUS (Status);
}
- RetBuffer->Length = RetBufLen;
-
- MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, RetBufLen);
+ /* Copy the table to the buffer */
+ ACPI_MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength);
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c
index e9a3e84..8a2e147 100644
--- a/sys/contrib/dev/acpica/tbxfroot.c
+++ b/sys/contrib/dev/acpica/tbxfroot.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 52 $
+ * $Revision: 58 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,236 +117,70 @@
#define __TBXFROOT_C__
#include "acpi.h"
-#include "achware.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
- MODULE_NAME ("tbxfroot")
-
-#define RSDP_CHECKSUM_LENGTH 20
+ ACPI_MODULE_NAME ("tbxfroot")
/*******************************************************************************
*
- * FUNCTION: AcpiFindRootPointer
+ * FUNCTION: AcpiTbFindTable
*
- * PARAMETERS: **RsdpPhysicalAddress - Where to place the RSDP address
- * Flags - Logical/Physical addressing
+ * PARAMETERS: Signature - String with ACPI table signature
+ * OemId - String with the table OEM ID
+ * OemTableId - String with the OEM Table ID.
*
- * RETURN: Status, Physical address of the RSDP
+ * RETURN: Status
*
- * DESCRIPTION: Find the RSDP
+ * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
+ * Signature, OEM ID and OEM Table ID.
*
******************************************************************************/
ACPI_STATUS
-AcpiFindRootPointer (
- UINT32 Flags,
- ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
+AcpiTbFindTable (
+ NATIVE_CHAR *Signature,
+ NATIVE_CHAR *OemId,
+ NATIVE_CHAR *OemTableId,
+ ACPI_TABLE_HEADER **TablePtr)
{
- ACPI_TABLE_DESC TableInfo;
ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *Table;
- FUNCTION_TRACE ("AcpiFindRootPointer");
-
-
- /* Get the RSDP */
-
- Status = AcpiTbFindRsdp (&TableInfo, Flags);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- *RsdpPhysicalAddress = TableInfo.PhysicalAddress;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbScanMemoryForRsdp
- *
- * PARAMETERS: StartAddress - Starting pointer for search
- * Length - Maximum length to search
- *
- * RETURN: Pointer to the RSDP if found, otherwise NULL.
- *
- * DESCRIPTION: Search a block of memory for the RSDP signature
- *
- ******************************************************************************/
-
-UINT8 *
-AcpiTbScanMemoryForRsdp (
- UINT8 *StartAddress,
- UINT32 Length)
-{
- UINT32 Offset;
- UINT8 *MemRover;
-
-
- FUNCTION_TRACE ("TbScanMemoryForRsdp");
+ ACPI_FUNCTION_TRACE ("TbFindTable");
- /* Search from given start addr for the requested length */
+ /* Validate string lengths */
- for (Offset = 0, MemRover = StartAddress;
- Offset < Length;
- Offset += RSDP_SCAN_STEP, MemRover += RSDP_SCAN_STEP)
+ if ((ACPI_STRLEN (Signature) > 4) ||
+ (ACPI_STRLEN (OemId) > 6) ||
+ (ACPI_STRLEN (OemTableId) > 8))
{
-
- /* The signature and checksum must both be correct */
-
- if (STRNCMP ((NATIVE_CHAR *) MemRover,
- RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
- AcpiTbChecksum (MemRover, RSDP_CHECKSUM_LENGTH) == 0)
- {
- /* If so, we have found the RSDP */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at physical address %p\n",MemRover));
- return_PTR (MemRover);
- }
+ return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
- /* Searched entire block, no RSDP was found */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
-
- return_PTR (NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbFindRsdp
- *
- * PARAMETERS: *TableInfo - Where the table info is returned
- * Flags - Current memory mode (logical vs.
- * physical addressing)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
- * pointer structure. If it is found, set *RSDP to point to it.
- *
- * NOTE: The RSDP must be either in the first 1K of the Extended
- * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
- * 5.2.2; assertion #421).
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbFindRsdp (
- ACPI_TABLE_DESC *TableInfo,
- UINT32 Flags)
-{
- UINT8 *TablePtr;
- UINT8 *MemRover;
- UINT64 PhysAddr;
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("TbFindRsdp");
-
+ /* Find the table */
- /*
- * Scan supports either 1) Logical addressing or 2) Physical addressing
- */
- if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
+ Status = AcpiGetFirmwareTable (Signature, 1,
+ ACPI_LOGICAL_ADDRESSING, &Table);
+ if (ACPI_FAILURE (Status))
{
- /*
- * 1) Search EBDA (low memory) paragraphs
- */
- Status = AcpiOsMapMemory (LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
- (void **) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (TablePtr, LO_RSDP_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, LO_RSDP_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- PhysAddr = LO_RSDP_WINDOW_BASE;
- PhysAddr += (MemRover - TablePtr);
-
- TableInfo->PhysicalAddress = PhysAddr;
-
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
- */
- Status = AcpiOsMapMemory (HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
- (void **) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (TablePtr, HI_RSDP_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, HI_RSDP_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- PhysAddr = HI_RSDP_WINDOW_BASE;
- PhysAddr += (MemRover - TablePtr);
-
- TableInfo->PhysicalAddress = PhysAddr;
-
- return_ACPI_STATUS (AE_OK);
- }
+ return_ACPI_STATUS (Status);
}
+ /* Check OemId and OemTableId */
- /*
- * Physical addressing
- */
- else
+ if ((OemId[0] && ACPI_STRCMP (OemId, Table->OemId)) ||
+ (OemTableId[0] && ACPI_STRCMP (OemTableId, Table->OemTableId)))
{
- /*
- * 1) Search EBDA (low memory) paragraphs
- */
- MemRover = AcpiTbScanMemoryForRsdp ((UINT8 *) LO_RSDP_WINDOW_BASE,
- LO_RSDP_WINDOW_SIZE);
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- TableInfo->PhysicalAddress = (ACPI_TBLPTR) MemRover;
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
- */
- MemRover = AcpiTbScanMemoryForRsdp ((UINT8 *) HI_RSDP_WINDOW_BASE,
- HI_RSDP_WINDOW_SIZE);
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- TableInfo->PhysicalAddress = (ACPI_TBLPTR) MemRover;
- return_ACPI_STATUS (AE_OK);
- }
+ return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
}
-
- /* RSDP signature was not found */
-
- return_ACPI_STATUS (AE_NOT_FOUND);
+ *TablePtr = Table;
+ return_ACPI_STATUS (AE_OK);
}
@@ -390,7 +224,7 @@ AcpiGetFirmwareTable (
UINT32 j;
- FUNCTION_TRACE ("AcpiGetFirmwareTable");
+ ACPI_FUNCTION_TRACE ("AcpiGetFirmwareTable");
/*
@@ -432,13 +266,13 @@ AcpiGetFirmwareTable (
}
else
{
- AcpiGbl_RSDP = (void *) (NATIVE_UINT) PhysicalAddress;
+ AcpiGbl_RSDP = ACPI_PHYSADDR_TO_PTR (PhysicalAddress);
}
/*
* The signature and checksum must both be correct
*/
- if (STRNCMP ((NATIVE_CHAR *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ if (ACPI_STRNCMP ((NATIVE_CHAR *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
{
/* Nope, BAD Signature */
@@ -446,7 +280,7 @@ AcpiGetFirmwareTable (
goto Cleanup;
}
- if (AcpiTbChecksum (AcpiGbl_RSDP, RSDP_CHECKSUM_LENGTH) != 0)
+ if (AcpiTbChecksum (AcpiGbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
{
/* Nope, BAD Checksum */
@@ -455,12 +289,11 @@ AcpiGetFirmwareTable (
}
}
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- AcpiGbl_RSDP, HIDWORD(AcpiGbl_RSDP->RsdtPhysicalAddress),
- LODWORD(AcpiGbl_RSDP->RsdtPhysicalAddress)));
-
+ AcpiGbl_RSDP,
+ ACPI_HIDWORD (AcpiGbl_RSDP->RsdtPhysicalAddress),
+ ACPI_LODWORD (AcpiGbl_RSDP->RsdtPhysicalAddress)));
/* Get the RSDT and validate it */
@@ -477,7 +310,6 @@ AcpiGetFirmwareTable (
goto Cleanup;
}
-
/* Get the number of table pointers within the RSDT */
TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtPtr);
@@ -493,7 +325,8 @@ AcpiGetFirmwareTable (
if (AcpiGbl_RSDP->Revision < 2)
{
- PhysicalAddress = ((RSDT_DESCRIPTOR *) RsdtPtr)->TableOffsetEntry[i];
+ PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
+ ((RSDT_DESCRIPTOR *) RsdtPtr)->TableOffsetEntry[i];
}
else
{
@@ -511,7 +344,7 @@ AcpiGetFirmwareTable (
/* Compare table signatures and table instance */
- if (!STRNCMP ((char *) TablePtr, Signature, STRLEN (Signature)))
+ if (!ACPI_STRNCMP ((char *) TablePtr, Signature, ACPI_STRLEN (Signature)))
{
/* An instance of the table was found */
@@ -548,3 +381,225 @@ Cleanup:
}
+/* TBD: Move to a new file */
+
+#ifndef _IA16
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiFindRootPointer
+ *
+ * PARAMETERS: **RsdpPhysicalAddress - Where to place the RSDP address
+ * Flags - Logical/Physical addressing
+ *
+ * RETURN: Status, Physical address of the RSDP
+ *
+ * DESCRIPTION: Find the RSDP
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiFindRootPointer (
+ UINT32 Flags,
+ ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
+{
+ ACPI_TABLE_DESC TableInfo;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiFindRootPointer");
+
+
+ /* Get the RSDP */
+
+ Status = AcpiTbFindRsdp (&TableInfo, Flags);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ *RsdpPhysicalAddress = TableInfo.PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbScanMemoryForRsdp
+ *
+ * PARAMETERS: StartAddress - Starting pointer for search
+ * Length - Maximum length to search
+ *
+ * RETURN: Pointer to the RSDP if found, otherwise NULL.
+ *
+ * DESCRIPTION: Search a block of memory for the RSDP signature
+ *
+ ******************************************************************************/
+
+UINT8 *
+AcpiTbScanMemoryForRsdp (
+ UINT8 *StartAddress,
+ UINT32 Length)
+{
+ UINT32 Offset;
+ UINT8 *MemRover;
+
+
+ ACPI_FUNCTION_TRACE ("TbScanMemoryForRsdp");
+
+
+ /* Search from given start addr for the requested length */
+
+ for (Offset = 0, MemRover = StartAddress;
+ Offset < Length;
+ Offset += RSDP_SCAN_STEP, MemRover += RSDP_SCAN_STEP)
+ {
+
+ /* The signature and checksum must both be correct */
+
+ if (ACPI_STRNCMP ((NATIVE_CHAR *) MemRover,
+ RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 &&
+ AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH) == 0)
+ {
+ /* If so, we have found the RSDP */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "RSDP located at physical address %p\n",MemRover));
+ return_PTR (MemRover);
+ }
+ }
+
+ /* Searched entire block, no RSDP was found */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,"Searched entire block, no RSDP was found.\n"));
+ return_PTR (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbFindRsdp
+ *
+ * PARAMETERS: *TableInfo - Where the table info is returned
+ * Flags - Current memory mode (logical vs.
+ * physical addressing)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
+ * pointer structure. If it is found, set *RSDP to point to it.
+ *
+ * NOTE: The RSDP must be either in the first 1K of the Extended
+ * BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
+ * 5.2.2; assertion #421).
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbFindRsdp (
+ ACPI_TABLE_DESC *TableInfo,
+ UINT32 Flags)
+{
+ UINT8 *TablePtr;
+ UINT8 *MemRover;
+ UINT64 PhysAddr;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("TbFindRsdp");
+
+
+ /*
+ * Scan supports either 1) Logical addressing or 2) Physical addressing
+ */
+ if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
+ {
+ /*
+ * 1) Search EBDA (low memory) paragraphs
+ */
+ Status = AcpiOsMapMemory ((UINT64) LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
+ (void **) &TablePtr);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, LO_RSDP_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, LO_RSDP_WINDOW_SIZE);
+
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ PhysAddr = LO_RSDP_WINDOW_BASE;
+ PhysAddr += (MemRover - TablePtr);
+
+ TableInfo->PhysicalAddress = PhysAddr;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+ */
+ Status = AcpiOsMapMemory ((UINT64) HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
+ (void **) &TablePtr);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, HI_RSDP_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, HI_RSDP_WINDOW_SIZE);
+
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ PhysAddr = HI_RSDP_WINDOW_BASE;
+ PhysAddr += (MemRover - TablePtr);
+
+ TableInfo->PhysicalAddress = PhysAddr;
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /*
+ * Physical addressing
+ */
+ else
+ {
+ /*
+ * 1) Search EBDA (low memory) paragraphs
+ */
+ MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (LO_RSDP_WINDOW_BASE),
+ LO_RSDP_WINDOW_SIZE);
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
+ */
+ MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (HI_RSDP_WINDOW_BASE),
+ HI_RSDP_WINDOW_SIZE);
+ if (MemRover)
+ {
+ /* Found it, return the physical address */
+
+ TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ /* RSDP signature was not found */
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+}
+
+#endif
+
diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c
index e2f3d29..dbbd024 100644
--- a/sys/contrib/dev/acpica/utalloc.c
+++ b/sys/contrib/dev/acpica/utalloc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utalloc - local cache and memory allocation routines
- * $Revision: 109 $
+ * $Revision: 121 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acglobal.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utalloc")
+ ACPI_MODULE_NAME ("utalloc")
/******************************************************************************
@@ -148,7 +148,7 @@ AcpiUtReleaseToCache (
ACPI_MEMORY_LIST *CacheInfo;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* If walk cache is full, just free this wallkstate object */
@@ -164,12 +164,15 @@ AcpiUtReleaseToCache (
else
{
- AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ {
+ return;
+ }
/* Mark the object as cached */
- MEMSET (Object, 0xCA, CacheInfo->ObjectSize);
- ((ACPI_OPERAND_OBJECT *) Object)->Common.DataType = ACPI_CACHED_OBJECT;
+ ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize);
+ ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_CACHED_OBJECT);
/* Put the object at the head of the cache list */
@@ -177,7 +180,7 @@ AcpiUtReleaseToCache (
CacheInfo->ListHead = Object;
CacheInfo->CacheDepth++;
- AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
}
}
@@ -204,11 +207,15 @@ AcpiUtAcquireFromCache (
void *Object;
- PROC_NAME ("UtAcquireFromCache");
+ ACPI_FUNCTION_NAME ("UtAcquireFromCache");
CacheInfo = &AcpiGbl_MemoryLists[ListId];
- AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ {
+ return (NULL);
+ }
+
ACPI_MEM_TRACKING (CacheInfo->CacheRequests++);
/* Check the cache first */
@@ -228,11 +235,14 @@ AcpiUtAcquireFromCache (
Object, AcpiGbl_MemoryLists[ListId].ListName));
#endif
- AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
+ {
+ return (NULL);
+ }
/* Clear (zero) the previously used Object */
- MEMSET (Object, 0, CacheInfo->ObjectSize);
+ ACPI_MEMSET (Object, 0, CacheInfo->ObjectSize);
}
else
@@ -241,7 +251,10 @@ AcpiUtAcquireFromCache (
/* Avoid deadlock with ACPI_MEM_CALLOCATE */
- AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
+ {
+ return (NULL);
+ }
Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize);
ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++);
@@ -271,7 +284,7 @@ AcpiUtDeleteGenericCache (
char *Next;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
CacheInfo = &AcpiGbl_MemoryLists[ListId];
@@ -288,9 +301,241 @@ AcpiUtDeleteGenericCache (
}
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidateBuffer
+ *
+ * PARAMETERS: Buffer - Buffer descriptor to be validated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform parameter validation checks on an ACPI_BUFFER
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtValidateBuffer (
+ ACPI_BUFFER *Buffer)
+{
+
+ /* Obviously, the structure pointer must be valid */
+
+ if (!Buffer)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Special semantics for the length */
+
+ if ((Buffer->Length == ACPI_NO_BUFFER) ||
+ (Buffer->Length == ACPI_ALLOCATE_BUFFER) ||
+ (Buffer->Length == ACPI_ALLOCATE_LOCAL_BUFFER))
+ {
+ return (AE_OK);
+ }
+
+ /* Length is valid, the buffer pointer must be also */
+
+ if (!Buffer->Pointer)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtInitializeBuffer
+ *
+ * PARAMETERS: RequiredLength - Length needed
+ * Buffer - Buffer to be validated
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate that the buffer is of the required length or
+ * allocate a new buffer.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtInitializeBuffer (
+ ACPI_BUFFER *Buffer,
+ ACPI_SIZE RequiredLength)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ switch (Buffer->Length)
+ {
+ case ACPI_NO_BUFFER:
+
+ /* Set the exception and returned the required length */
+
+ Status = AE_BUFFER_OVERFLOW;
+ break;
+ case ACPI_ALLOCATE_BUFFER:
+
+ /* Allocate a new buffer */
+
+ Buffer->Pointer = AcpiOsAllocate (RequiredLength);
+ if (!Buffer->Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+ break;
+
+
+ case ACPI_ALLOCATE_LOCAL_BUFFER:
+
+ /* Allocate a new buffer with local interface to allow tracking */
+
+ Buffer->Pointer = ACPI_MEM_ALLOCATE (RequiredLength);
+ if (!Buffer->Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+ break;
+
+
+ default:
+
+ /* Validate the size of the buffer */
+
+ if (Buffer->Length < RequiredLength)
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ }
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+ break;
+ }
+
+ Buffer->Length = RequiredLength;
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocate
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocate (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtAllocate", Size);
+
+
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtAllocate: Attempt to allocate zero bytes\n"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocate (Size);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtAllocate: Could not allocate size %X\n", Size));
+
+ return_PTR (NULL);
+ }
+
+ return_PTR (Allocation);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCallocate
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtCallocate (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtCallocate", Size);
+
+
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtCallocate: Attempt to allocate zero bytes\n"));
+ return_PTR (NULL);
+ }
+
+ Allocation = AcpiOsAllocate (Size);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtCallocate: Could not allocate size %X\n", Size));
+ return_PTR (NULL);
+ }
+
+ /* Clear the memory block */
+
+ ACPI_MEMSET (Allocation, 0, Size);
+ return_PTR (Allocation);
+}
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
/*
* These procedures are used for tracking memory leaks in the subsystem, and
* they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
@@ -305,9 +550,161 @@ AcpiUtDeleteGenericCache (
/*******************************************************************************
*
+ * FUNCTION: AcpiUtAllocateAndTrack
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *Allocation;
+ ACPI_STATUS Status;
+
+
+ Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component,
+ Module, Line);
+ if (!Allocation)
+ {
+ return (NULL);
+ }
+
+ Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
+ ACPI_MEM_MALLOC, Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsFree (Allocation);
+ return (NULL);
+ }
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
+
+ return ((void *) &Allocation->UserSpace);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCallocateAndTrack
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtCallocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *Allocation;
+ ACPI_STATUS Status;
+
+
+ Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component,
+ Module, Line);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("UtCallocate: Could not allocate size %X\n", Size));
+ return (NULL);
+ }
+
+ Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
+ ACPI_MEM_CALLOC, Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsFree (Allocation);
+ return (NULL);
+ }
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
+
+ return ((void *) &Allocation->UserSpace);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFreeAndTrack
+ *
+ * PARAMETERS: Allocation - Address of the memory to deallocate
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Frees the memory at Allocation
+ *
+ ******************************************************************************/
+
+void
+AcpiUtFreeAndTrack (
+ void *Allocation,
+ UINT32 Component,
+ NATIVE_CHAR *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *DebugBlock;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtFree", Allocation);
+
+
+ if (NULL == Allocation)
+ {
+ _ACPI_REPORT_ERROR (Module, Line, Component,
+ ("AcpiUtFree: Attempt to delete a NULL address\n"));
+
+ return_VOID;
+ }
+
+ DebugBlock = (ACPI_DEBUG_MEM_BLOCK *)
+ (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER));
+
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++;
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size;
+
+ AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock,
+ Component, Module, Line);
+ AcpiOsFree (DebugBlock);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtFindAllocation
*
- * PARAMETERS: Address - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
*
* RETURN: A list element if found; NULL otherwise.
*
@@ -318,12 +715,12 @@ AcpiUtDeleteGenericCache (
ACPI_DEBUG_MEM_BLOCK *
AcpiUtFindAllocation (
UINT32 ListId,
- void *Address)
+ void *Allocation)
{
ACPI_DEBUG_MEM_BLOCK *Element;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
if (ListId > ACPI_MEM_LIST_MAX)
@@ -337,7 +734,7 @@ AcpiUtFindAllocation (
while (Element)
{
- if (Element == Address)
+ if (Element == Allocation)
{
return (Element);
}
@@ -353,7 +750,7 @@ AcpiUtFindAllocation (
*
* FUNCTION: AcpiUtTrackAllocation
*
- * PARAMETERS: Address - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Size - Size of the allocation
* AllocType - MEM_MALLOC or MEM_CALLOC
* Component - Component type of caller
@@ -369,8 +766,8 @@ AcpiUtFindAllocation (
ACPI_STATUS
AcpiUtTrackAllocation (
UINT32 ListId,
- ACPI_DEBUG_MEM_BLOCK *Address,
- UINT32 Size,
+ ACPI_DEBUG_MEM_BLOCK *Allocation,
+ ACPI_SIZE Size,
UINT8 AllocType,
UINT32 Component,
NATIVE_CHAR *Module,
@@ -381,7 +778,7 @@ AcpiUtTrackAllocation (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_PTR ("UtTrackAllocation", Address);
+ ACPI_FUNCTION_TRACE_PTR ("UtTrackAllocation", Allocation);
if (ListId > ACPI_MEM_LIST_MAX)
@@ -390,48 +787,52 @@ AcpiUtTrackAllocation (
}
MemList = &AcpiGbl_MemoryLists[ListId];
- AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/*
* Search list for this address to make sure it is not already on the list.
* This will catch several kinds of problems.
*/
- Element = AcpiUtFindAllocation (ListId, Address);
+ Element = AcpiUtFindAllocation (ListId, Allocation);
if (Element)
{
- REPORT_ERROR (("UtTrackAllocation: Address already present in list! (%p)\n",
- Address));
+ ACPI_REPORT_ERROR (("UtTrackAllocation: Allocation already present in list! (%p)\n",
+ Allocation));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", Element, Address));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", Element, Allocation));
goto UnlockAndExit;
}
/* Fill in the instance data. */
- Address->Size = Size;
- Address->AllocType = AllocType;
- Address->Component = Component;
- Address->Line = Line;
+ Allocation->Size = (UINT32) Size;
+ Allocation->AllocType = AllocType;
+ Allocation->Component = Component;
+ Allocation->Line = Line;
- STRNCPY (Address->Module, Module, MAX_MODULE_NAME);
+ ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
/* Insert at list head */
if (MemList->ListHead)
{
- ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Address;
+ ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
}
- Address->Next = MemList->ListHead;
- Address->Previous = NULL;
+ Allocation->Next = MemList->ListHead;
+ Allocation->Previous = NULL;
- MemList->ListHead = Address;
+ MemList->ListHead = Allocation;
UnlockAndExit:
- AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
return_ACPI_STATUS (Status);
}
@@ -440,7 +841,7 @@ UnlockAndExit:
*
* FUNCTION: AcpiUtRemoveAllocation
*
- * PARAMETERS: Address - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
@@ -454,15 +855,16 @@ UnlockAndExit:
ACPI_STATUS
AcpiUtRemoveAllocation (
UINT32 ListId,
- ACPI_DEBUG_MEM_BLOCK *Address,
+ ACPI_DEBUG_MEM_BLOCK *Allocation,
UINT32 Component,
NATIVE_CHAR *Module,
UINT32 Line)
{
ACPI_MEMORY_LIST *MemList;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("UtRemoveAllocation");
+ ACPI_FUNCTION_TRACE ("UtRemoveAllocation");
if (ListId > ACPI_MEM_LIST_MAX)
@@ -475,40 +877,42 @@ AcpiUtRemoveAllocation (
{
/* No allocations! */
- _REPORT_ERROR (Module, Line, Component,
+ _ACPI_REPORT_ERROR (Module, Line, Component,
("UtRemoveAllocation: Empty allocation list, nothing to free!\n"));
return_ACPI_STATUS (AE_OK);
}
-
- AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Unlink */
- if (Address->Previous)
+ if (Allocation->Previous)
{
- (Address->Previous)->Next = Address->Next;
+ (Allocation->Previous)->Next = Allocation->Next;
}
else
{
- MemList->ListHead = Address->Next;
+ MemList->ListHead = Allocation->Next;
}
- if (Address->Next)
+ if (Allocation->Next)
{
- (Address->Next)->Previous = Address->Previous;
+ (Allocation->Next)->Previous = Allocation->Previous;
}
-
/* Mark the segment as deleted */
- MEMSET (&Address->UserSpace, 0xEA, Address->Size);
+ ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", Address->Size));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", Allocation->Size));
- AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (AE_OK);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ return_ACPI_STATUS (Status);
}
@@ -532,7 +936,7 @@ AcpiUtDumpAllocationInfo (
ACPI_MEMORY_LIST *MemList;
*/
- FUNCTION_TRACE ("UtDumpAllocationInfo");
+ ACPI_FUNCTION_TRACE ("UtDumpAllocationInfo");
/*
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
@@ -593,19 +997,22 @@ AcpiUtDumpAllocations (
UINT32 NumOutstanding = 0;
- FUNCTION_TRACE ("UtDumpAllocations");
+ ACPI_FUNCTION_TRACE ("UtDumpAllocations");
/*
* Walk the allocation list.
*/
- AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
+ {
+ return;
+ }
Element = AcpiGbl_MemoryLists[0].ListHead;
while (Element)
{
if ((Element->Component & Component) &&
- ((Module == NULL) || (0 == STRCMP (Module, Element->Module))))
+ ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
{
/* Ignore allocated objects that are in a cache */
@@ -617,8 +1024,7 @@ AcpiUtDumpAllocations (
/* Most of the elements will be internal objects. */
- switch (((ACPI_OPERAND_OBJECT *)
- (&Element->UserSpace))->Common.DataType)
+ switch (ACPI_GET_DESCRIPTOR_TYPE (&Element->UserSpace))
{
case ACPI_DESC_TYPE_INTERNAL:
AcpiOsPrintf ("ObjType %12.12s R%d",
@@ -684,7 +1090,7 @@ AcpiUtDumpAllocations (
Element = Element->Next;
}
- AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
/* Print summary */
@@ -704,187 +1110,5 @@ AcpiUtDumpAllocations (
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocate
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of malloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocate (
- UINT32 Size,
- UINT32 Component,
- NATIVE_CHAR *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *Address;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_U32 ("UtAllocate", Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- _REPORT_ERROR (Module, Line, Component,
- ("UtAllocate: Attempt to allocate zero bytes\n"));
- Size = 1;
- }
-
- Address = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK));
- if (!Address)
- {
- /* Report allocation error */
-
- _REPORT_ERROR (Module, Line, Component,
- ("UtAllocate: Could not allocate size %X\n", Size));
-
- return_PTR (NULL);
- }
-
- Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Address, Size,
- MEM_MALLOC, Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsFree (Address);
- return_PTR (NULL);
- }
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += Size;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", Address, Size));
-
- return_PTR ((void *) &Address->UserSpace);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCallocate
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtCallocate (
- UINT32 Size,
- UINT32 Component,
- NATIVE_CHAR *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *Address;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_U32 ("UtCallocate", Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- _REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Attempt to allocate zero bytes\n"));
- return_PTR (NULL);
- }
-
-
- Address = AcpiOsCallocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK));
- if (!Address)
- {
- /* Report allocation error */
-
- _REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Could not allocate size %X\n", Size));
- return_PTR (NULL);
- }
-
- Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Address, Size,
- MEM_CALLOC, Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsFree (Address);
- return_PTR (NULL);
- }
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += Size;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", Address, Size));
- return_PTR ((void *) &Address->UserSpace);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFree
- *
- * PARAMETERS: Address - Address of the memory to deallocate
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: None
- *
- * DESCRIPTION: Frees the memory at Address
- *
- ******************************************************************************/
-
-void
-AcpiUtFree (
- void *Address,
- UINT32 Component,
- NATIVE_CHAR *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *DebugBlock;
-
-
- FUNCTION_TRACE_PTR ("UtFree", Address);
-
-
- if (NULL == Address)
- {
- _REPORT_ERROR (Module, Line, Component,
- ("AcpiUtFree: Trying to delete a NULL address\n"));
-
- return_VOID;
- }
-
- DebugBlock = (ACPI_DEBUG_MEM_BLOCK *)
- (((char *) Address) - sizeof (ACPI_DEBUG_MEM_HEADER));
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size;
-
- AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock,
- Component, Module, Line);
- AcpiOsFree (DebugBlock);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Address));
-
- return_VOID;
-}
-
#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utclib.c
index 9de98de..01245ea 100644
--- a/sys/contrib/dev/acpica/utclib.c
+++ b/sys/contrib/dev/acpica/utclib.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmclib - Local implementation of C library functions
- * $Revision: 39 $
+ * $Revision: 43 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -131,7 +131,7 @@
*/
#define _COMPONENT MISCELLANEOUS
- MODULE_NAME ("cmclib")
+ ACPI_MODULE_NAME ("cmclib")
#ifndef ACPI_USE_SYSTEM_CLIBRARY
@@ -202,7 +202,6 @@ AcpiUtStrcpy (
/* Null terminate */
*String = 0;
-
return (DstString);
}
@@ -278,7 +277,6 @@ AcpiUtStrcmp (
}
}
-
return ((unsigned char) *String1 - (unsigned char) *String2);
}
@@ -313,7 +311,7 @@ AcpiUtStrncmp (
}
}
- return ((Count == -1) ? 0 : ((unsigned char) *String1 -
+ return ((Count == ACPI_INTEGER_MAX) ? 0 : ((unsigned char) *String1 -
(unsigned char) *String2));
}
@@ -716,7 +714,6 @@ AcpiUtStrstr (
String++;
}
-
return (String1);
}
@@ -769,13 +766,11 @@ AcpiUtStrtoul (
sign = NEGATIVE;
++String;
}
-
else if (*String == '+')
{
++String;
sign = POSITIVE;
}
-
else
{
sign = POSITIVE;
@@ -794,19 +789,16 @@ AcpiUtStrtoul (
Base = 16;
++String;
}
-
else
{
Base = 8;
}
}
-
else
{
Base = 10;
}
}
-
else if (Base < 2 || Base > 36)
{
/*
@@ -842,7 +834,6 @@ AcpiUtStrtoul (
{
index = *String - '0';
}
-
else
{
index = AcpiUtToUpper (*String);
@@ -850,7 +841,6 @@ AcpiUtStrtoul (
{
index = index - 'A' + 10;
}
-
else
{
goto done;
@@ -872,7 +862,6 @@ AcpiUtStrtoul (
Status = AE_ERROR;
ReturnValue = 0L; /* reset */
}
-
else
{
ReturnValue *= Base;
@@ -894,7 +883,6 @@ done:
{
*Terminator = (NATIVE_CHAR *) StringStart;
}
-
else
{
*Terminator = (NATIVE_CHAR *) String;
diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c
index 58202a7..4587b10 100644
--- a/sys/contrib/dev/acpica/utcopy.c
+++ b/sys/contrib/dev/acpica/utcopy.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 86 $
+ * $Revision: 94 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utcopy")
+ ACPI_MODULE_NAME ("utcopy")
/*******************************************************************************
@@ -148,14 +148,16 @@ AcpiUtCopyIsimpleToEsimple (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_OBJECT *ExternalObject,
UINT8 *DataSpace,
- UINT32 *BufferSpaceUsed)
+ ACPI_SIZE *BufferSpaceUsed)
{
- UINT32 Length = 0;
+ ACPI_BUFFER Buffer;
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("UtCopyIsimpleToEsimple");
+ ACPI_FUNCTION_TRACE ("UtCopyIsimpleToEsimple");
+
+ *BufferSpaceUsed = 0;
/*
* Check for NULL object case (could be an uninitialized
@@ -163,13 +165,12 @@ AcpiUtCopyIsimpleToEsimple (
*/
if (!InternalObject)
{
- *BufferSpaceUsed = 0;
return_ACPI_STATUS (AE_OK);
}
/* Always clear the external object */
- MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT));
+ ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT));
/*
* In general, the external object will be the same type as
@@ -181,28 +182,31 @@ AcpiUtCopyIsimpleToEsimple (
switch (InternalObject->Common.Type)
{
-
case ACPI_TYPE_STRING:
- Length = InternalObject->String.Length + 1;
- ExternalObject->String.Length = InternalObject->String.Length;
ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace;
- MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer, Length);
+ ExternalObject->String.Length = InternalObject->String.Length;
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length + 1);
+
+ ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer,
+ InternalObject->String.Length + 1);
break;
case ACPI_TYPE_BUFFER:
- Length = InternalObject->Buffer.Length;
- ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
ExternalObject->Buffer.Pointer = DataSpace;
- MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, Length);
+ ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length);
+
+ ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer,
+ InternalObject->Buffer.Length);
break;
case ACPI_TYPE_INTEGER:
- ExternalObject->Integer.Value= InternalObject->Integer.Value;
+ ExternalObject->Integer.Value = InternalObject->Integer.Value;
break;
@@ -238,15 +242,19 @@ AcpiUtCopyIsimpleToEsimple (
* This is a named reference, get the string. We already know that
* we have room for it, use max length
*/
- Length = MAX_STRING_LENGTH;
ExternalObject->Type = ACPI_TYPE_STRING;
ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace;
+
+ Buffer.Length = MAX_STRING_LENGTH;
+ Buffer.Pointer = DataSpace;
+
Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) InternalObject->Reference.Node,
- &Length, (char *) DataSpace);
+ &Buffer);
/* Converted (external) string length is returned from above */
- ExternalObject->String.Length = Length;
+ ExternalObject->String.Length = Buffer.Length;
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (Buffer.Length);
break;
default:
@@ -284,12 +292,8 @@ AcpiUtCopyIsimpleToEsimple (
* There is no corresponding external object type
*/
return_ACPI_STATUS (AE_SUPPORT);
- break;
}
-
- *BufferSpaceUsed = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length);
-
return_ACPI_STATUS (Status);
}
@@ -315,12 +319,12 @@ AcpiUtCopyIelementToEelement (
{
ACPI_STATUS Status = AE_OK;
ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
- UINT32 ObjectSpace;
+ ACPI_SIZE ObjectSpace;
UINT32 ThisIndex;
ACPI_OBJECT *TargetObject;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
ThisIndex = State->Pkg.Index;
@@ -361,14 +365,13 @@ AcpiUtCopyIelementToEelement (
* Save space for the array of objects (Package elements)
* update the buffer length counter
*/
- ObjectSpace = (UINT32) ROUND_UP_TO_NATIVE_WORD (
+ ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
TargetObject->Package.Count * sizeof (ACPI_OBJECT));
break;
default:
return (AE_BAD_PARAMETER);
- break;
}
Info->FreeSpace += ObjectSpace;
@@ -400,14 +403,14 @@ static ACPI_STATUS
AcpiUtCopyIpackageToEpackage (
ACPI_OPERAND_OBJECT *InternalObject,
UINT8 *Buffer,
- UINT32 *SpaceUsed)
+ ACPI_SIZE *SpaceUsed)
{
ACPI_OBJECT *ExternalObject;
ACPI_STATUS Status;
ACPI_PKG_INFO Info;
- FUNCTION_TRACE ("UtCopyIpackageToEpackage");
+ ACPI_FUNCTION_TRACE ("UtCopyIpackageToEpackage");
/*
@@ -421,7 +424,7 @@ AcpiUtCopyIpackageToEpackage (
Info.Length = 0;
Info.ObjectSpace = 0;
Info.NumPackages = 1;
- Info.FreeSpace = Buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+ Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
ExternalObject->Type = InternalObject->Common.Type;
ExternalObject->Package.Count = InternalObject->Package.Count;
@@ -432,7 +435,7 @@ AcpiUtCopyIpackageToEpackage (
* and move the free space past it
*/
Info.FreeSpace += ExternalObject->Package.Count *
- ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject,
AcpiUtCopyIelementToEelement, &Info);
@@ -464,10 +467,10 @@ AcpiUtCopyIobjectToEobject (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtCopyIobjectToEobject");
+ ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject");
- if (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE))
+ if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)
{
/*
* Package object: Copy all subobjects (including
@@ -484,7 +487,7 @@ AcpiUtCopyIobjectToEobject (
Status = AcpiUtCopyIsimpleToEsimple (InternalObject,
(ACPI_OBJECT *) RetBuffer->Pointer,
((UINT8 *) RetBuffer->Pointer +
- ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
&RetBuffer->Length);
/*
* build simple does not include the object size in the length
@@ -521,7 +524,7 @@ AcpiUtCopyEsimpleToIsimple (
ACPI_OPERAND_OBJECT *InternalObject;
- FUNCTION_TRACE ("UtCopyEsimpleToIsimple");
+ ACPI_FUNCTION_TRACE ("UtCopyEsimpleToIsimple");
/*
@@ -545,7 +548,6 @@ AcpiUtCopyEsimpleToIsimple (
* Whatever other type -- it is not supported
*/
return_ACPI_STATUS (AE_SUPPORT);
- break;
}
@@ -562,9 +564,9 @@ AcpiUtCopyEsimpleToIsimple (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- MEMCPY (InternalObject->String.Pointer,
- ExternalObject->String.Pointer,
- ExternalObject->String.Length);
+ ACPI_MEMCPY (InternalObject->String.Pointer,
+ ExternalObject->String.Pointer,
+ ExternalObject->String.Length);
InternalObject->String.Length = ExternalObject->String.Length;
break;
@@ -578,9 +580,9 @@ AcpiUtCopyEsimpleToIsimple (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- MEMCPY (InternalObject->Buffer.Pointer,
- ExternalObject->Buffer.Pointer,
- ExternalObject->Buffer.Length);
+ ACPI_MEMCPY (InternalObject->Buffer.Pointer,
+ ExternalObject->Buffer.Pointer,
+ ExternalObject->Buffer.Length);
InternalObject->Buffer.Length = ExternalObject->Buffer.Length;
break;
@@ -635,7 +637,7 @@ AcpiUtCopyEpackageToIpackage (
ACPI_OBJECT *ThisExternalObj;
- FUNCTION_TRACE ("UtCopyEpackageToIpackage");
+ ACPI_FUNCTION_TRACE ("UtCopyEpackageToIpackage");
/*
@@ -689,7 +691,7 @@ AcpiUtCopyEobjectToIobject (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtCopyEobjectToIobject");
+ ACPI_FUNCTION_TRACE ("UtCopyEobjectToIobject");
if (ExternalObject->Type == ACPI_TYPE_PACKAGE)
@@ -717,11 +719,83 @@ AcpiUtCopyEobjectToIobject (
/*******************************************************************************
*
+ * FUNCTION: AcpiUtCopySimpleObject
+ *
+ * PARAMETERS: SourceDesc - The internal object to be copied
+ * DestDesc - New target object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Simple copy of one internal object to another. Reference count
+ * of the destination object is preserved.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopySimpleObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc)
+{
+ UINT16 ReferenceCount;
+ ACPI_OPERAND_OBJECT *NextObject;
+
+
+ /* Save fields from destination that we don't want to overwrite */
+
+ ReferenceCount = DestDesc->Common.ReferenceCount;
+ NextObject = DestDesc->Common.NextObject;
+
+ /* Copy the entire source object over the destination object*/
+
+ ACPI_MEMCPY ((char *) DestDesc, (char *) SourceDesc, sizeof (ACPI_OPERAND_OBJECT));
+
+ /* Restore the saved fields */
+
+ DestDesc->Common.ReferenceCount = ReferenceCount;
+ DestDesc->Common.NextObject = NextObject;
+
+ /* Handle the objects with extra data */
+
+ switch (DestDesc->Common.Type)
+ {
+ case ACPI_TYPE_BUFFER:
+
+ DestDesc->Buffer.Node = NULL;
+
+ case ACPI_TYPE_STRING:
+
+ /*
+ * Allocate and copy the actual string if and only if:
+ * 1) There is a valid string (length > 0)
+ * 2) The string is not static (not in an ACPI table) (in this case,
+ * the actual pointer was already copied above)
+ */
+ if ((SourceDesc->String.Length) &&
+ (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ {
+ DestDesc->String.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->String.Length);
+ if (!DestDesc->String.Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
+ SourceDesc->String.Length);
+ }
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtCopyIelementToIelement
*
* PARAMETERS: ACPI_PKG_CALLBACK
*
- * RETURN: Status - the status of the call
+ * RETURN: Status
*
* DESCRIPTION: Copy one package element to another package element
*
@@ -740,7 +814,7 @@ AcpiUtCopyIelementToIelement (
ACPI_OPERAND_OBJECT *TargetObject;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
ThisIndex = State->Pkg.Index;
@@ -760,8 +834,7 @@ AcpiUtCopyIelementToIelement (
return (AE_NO_MEMORY);
}
- Status = AcpiExStoreObjectToObject (SourceObject, TargetObject,
- (ACPI_WALK_STATE *) Context);
+ Status = AcpiUtCopySimpleObject (SourceObject, TargetObject);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -799,7 +872,6 @@ AcpiUtCopyIelementToIelement (
default:
return (AE_BAD_PARAMETER);
- break;
}
return (Status);
@@ -829,7 +901,7 @@ AcpiUtCopyIpackageToIpackage (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("UtCopyIpackageToIpackage");
+ ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage");
DestObj->Common.Type = SourceObj->Common.Type;
@@ -843,7 +915,7 @@ AcpiUtCopyIpackageToIpackage (
sizeof (void *));
if (!DestObj->Package.Elements)
{
- REPORT_ERROR (
+ ACPI_REPORT_ERROR (
("AmlBuildCopyInternalPackageObject: Package allocation failure\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -868,3 +940,54 @@ AcpiUtCopyIpackageToIpackage (
return_ACPI_STATUS (Status);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCopyIobjectToIobject
+ *
+ * PARAMETERS: WalkState - Current walk state
+ * SourceDesc - The internal object to be copied
+ * DestDesc - Where the copied object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Copy an internal object to a new internal object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCopyIobjectToIobject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT **DestDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("UtCopyIobjectToIobject");
+
+
+ /* Create the top level object */
+
+ *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type);
+ if (!*DestDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Copy the object and possible subobjects */
+
+ if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE)
+ {
+ Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
+ WalkState);
+ }
+ else
+ {
+ Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c
index bc46c68..16b32a9 100644
--- a/sys/contrib/dev/acpica/utdebug.c
+++ b/sys/contrib/dev/acpica/utdebug.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 91 $
+ * $Revision: 95 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,7 +119,7 @@
#include "acpi.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utdebug")
+ ACPI_MODULE_NAME ("utdebug")
UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF;
@@ -149,7 +149,7 @@ AcpiUtInitStackPtrTrace (
UINT32 CurrentSp;
- AcpiGbl_EntryStackPointer = (UINT32) &CurrentSp;
+ AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL);
}
@@ -169,9 +169,10 @@ void
AcpiUtTrackStackPtr (
void)
{
- UINT32 CurrentSp;
+ ACPI_SIZE CurrentSp;
+
- CurrentSp = (UINT32) &CurrentSp;
+ CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL);
if (CurrentSp < AcpiGbl_LowestStackPointer)
{
@@ -532,7 +533,8 @@ AcpiUtValueExit (
{
AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, HIDWORD(Value), LODWORD(Value));
+ "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
+ ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
AcpiGbl_NestingLevel--;
}
@@ -645,8 +647,8 @@ AcpiUtDumpBuffer (
case DB_WORD_DISPLAY:
- MOVE_UNALIGNED16_TO_32 (&Temp32,
- &Buffer[i + j]);
+ ACPI_MOVE_UNALIGNED16_TO_32 (&Temp32,
+ &Buffer[i + j]);
AcpiOsPrintf ("%04X ", Temp32);
j += 2;
break;
@@ -654,8 +656,8 @@ AcpiUtDumpBuffer (
case DB_DWORD_DISPLAY:
- MOVE_UNALIGNED32_TO_32 (&Temp32,
- &Buffer[i + j]);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
+ &Buffer[i + j]);
AcpiOsPrintf ("%08X ", Temp32);
j += 4;
break;
@@ -663,12 +665,12 @@ AcpiUtDumpBuffer (
case DB_QWORD_DISPLAY:
- MOVE_UNALIGNED32_TO_32 (&Temp32,
- &Buffer[i + j]);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
+ &Buffer[i + j]);
AcpiOsPrintf ("%08X", Temp32);
- MOVE_UNALIGNED32_TO_32 (&Temp32,
- &Buffer[i + j + 4]);
+ ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
+ &Buffer[i + j + 4]);
AcpiOsPrintf ("%08X ", Temp32);
j += 8;
break;
diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c
index ccbe0da..478bc78 100644
--- a/sys/contrib/dev/acpica/utdelete.c
+++ b/sys/contrib/dev/acpica/utdelete.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 83 $
+ * $Revision: 87 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,7 +123,7 @@
#include "acparser.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utdelete")
+ ACPI_MODULE_NAME ("utdelete")
/*******************************************************************************
@@ -148,7 +148,7 @@ AcpiUtDeleteInternalObj (
ACPI_OPERAND_OBJECT *SecondDesc;
- FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
+ ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
if (!Object)
@@ -252,7 +252,7 @@ AcpiUtDeleteInternalObj (
*/
HandlerDesc = Object->Region.AddrHandler;
if ((HandlerDesc) &&
- (HandlerDesc->AddrHandler.Hflags == ADDR_HANDLER_DEFAULT_INSTALLED))
+ (HandlerDesc->AddrHandler.Hflags == ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
ObjPointer = SecondDesc->Extra.RegionContext;
}
@@ -281,31 +281,21 @@ AcpiUtDeleteInternalObj (
}
- /*
- * Delete any allocated memory found above
- */
+ /* Free any allocated memory (pointer within the object) found above */
+
if (ObjPointer)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Obj Ptr %p \n", ObjPointer));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object Subptr %p\n",
+ ObjPointer));
ACPI_MEM_FREE (ObjPointer);
}
- /* Only delete the object if it was dynamically allocated */
-
- if (Object->Common.Flags & AOPOBJ_STATIC_ALLOCATION)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p [%s] static allocation, no delete\n",
- Object, AcpiUtGetTypeName (Object->Common.Type)));
- }
+ /* Now the object can be safely deleted */
- if (!(Object->Common.Flags & AOPOBJ_STATIC_ALLOCATION))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting object %p [%s]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object %p [%s]\n",
Object, AcpiUtGetTypeName (Object->Common.Type)));
- AcpiUtDeleteObjectDesc (Object);
- }
-
+ AcpiUtDeleteObjectDesc (Object);
return_VOID;
}
@@ -330,7 +320,7 @@ AcpiUtDeleteInternalObjectList (
ACPI_OPERAND_OBJECT **InternalObj;
- FUNCTION_TRACE ("UtDeleteInternalObjectList");
+ ACPI_FUNCTION_TRACE ("UtDeleteInternalObjectList");
/* Walk the null-terminated internal list */
@@ -370,7 +360,7 @@ AcpiUtUpdateRefCount (
UINT16 NewCount;
- PROC_NAME ("UtUpdateRefCount");
+ ACPI_FUNCTION_NAME ("UtUpdateRefCount");
if (!Object)
{
@@ -499,7 +489,7 @@ AcpiUtUpdateObjectReference (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
+ ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
/* Ignore a null object ptr */
@@ -509,17 +499,15 @@ AcpiUtUpdateObjectReference (
return_ACPI_STATUS (AE_OK);
}
-
/*
- * Make sure that this isn't a namespace handle or an AML pointer
+ * Make sure that this isn't a namespace handle
*/
- if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p is NS handle\n", Object));
return_ACPI_STATUS (AE_OK);
}
-
State = AcpiUtCreateUpdateState (Object, Action);
while (State)
@@ -534,7 +522,6 @@ AcpiUtUpdateObjectReference (
*/
switch (Object->Common.Type)
{
-
case ACPI_TYPE_DEVICE:
Status = AcpiUtCreateUpdateStateAndPush (Object->Device.AddrHandler,
@@ -653,7 +640,6 @@ AcpiUtUpdateObjectReference (
break;
}
-
/*
* Now we can update the count in the main object. This can only
* happen after we update the sub-objects in case this causes the
@@ -661,13 +647,11 @@ AcpiUtUpdateObjectReference (
*/
AcpiUtUpdateRefCount (Object, Action);
-
/* Move on to the next object to be updated */
State = AcpiUtPopGenericState (&StateList);
}
-
return_ACPI_STATUS (AE_OK);
}
@@ -690,7 +674,7 @@ AcpiUtAddReference (
ACPI_OPERAND_OBJECT *Object)
{
- FUNCTION_TRACE_PTR ("UtAddReference", Object);
+ ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object);
/*
@@ -727,7 +711,7 @@ AcpiUtRemoveReference (
ACPI_OPERAND_OBJECT *Object)
{
- FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
+ ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
/*
* Allow a NULL pointer to be passed in, just ignore it. This saves
@@ -735,7 +719,7 @@ AcpiUtRemoveReference (
*
*/
if (!Object ||
- (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)))
+ (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
{
return_VOID;
diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c
index d2dd7c5..51c9284 100644
--- a/sys/contrib/dev/acpica/uteval.c
+++ b/sys/contrib/dev/acpica/uteval.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 34 $
+ * $Revision: 37 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,7 +122,7 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("uteval")
+ ACPI_MODULE_NAME ("uteval")
/*******************************************************************************
@@ -152,7 +152,7 @@ AcpiUtEvaluateNumericObject (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtEvaluateNumericObject");
+ ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject");
/* Execute the method */
@@ -163,12 +163,12 @@ AcpiUtEvaluateNumericObject (
if (Status == AE_NOT_FOUND)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s on %4.4s was not found\n",
- ObjectName, (char*)&DeviceNode->Name));
+ ObjectName, (char *) &DeviceNode->Name));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n",
- ObjectName, (char*)&DeviceNode->Name,
+ ObjectName, (char *) &DeviceNode->Name,
AcpiFormatException (Status)));
}
@@ -236,7 +236,7 @@ AcpiUtExecute_HID (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtExecute_HID");
+ ACPI_FUNCTION_TRACE ("UtExecute_HID");
/* Execute the method */
@@ -248,12 +248,12 @@ AcpiUtExecute_HID (
if (Status == AE_NOT_FOUND)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n",
- (char*)&DeviceNode->Name));
+ (char *) &DeviceNode->Name));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
- (char*)&DeviceNode->Name, AcpiFormatException (Status)));
+ (char *) &DeviceNode->Name, AcpiFormatException (Status)));
}
return_ACPI_STATUS (Status);
@@ -291,7 +291,7 @@ AcpiUtExecute_HID (
{
/* Copy the String HID from the returned object */
- STRNCPY(Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer));
+ ACPI_STRNCPY (Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer));
}
}
@@ -328,7 +328,7 @@ AcpiUtExecute_CID (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtExecute_CID");
+ ACPI_FUNCTION_TRACE ("UtExecute_CID");
/* Execute the method */
@@ -376,7 +376,7 @@ AcpiUtExecute_CID (
/* Copy the String CID from the returned object */
- STRNCPY(Cid->Buffer, ObjDesc->String.Pointer, sizeof(Cid->Buffer));
+ ACPI_STRNCPY (Cid->Buffer, ObjDesc->String.Pointer, sizeof(Cid->Buffer));
break;
case ACPI_TYPE_PACKAGE:
@@ -426,7 +426,7 @@ AcpiUtExecute_UID (
ACPI_STATUS Status;
- PROC_NAME ("UtExecute_UID");
+ ACPI_FUNCTION_NAME ("UtExecute_UID");
/* Execute the method */
@@ -438,13 +438,13 @@ AcpiUtExecute_UID (
if (Status == AE_NOT_FOUND)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n",
- (char*)&DeviceNode->Name));
+ (char *) &DeviceNode->Name));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"_UID on %4.4s failed %s\n",
- (char*)&DeviceNode->Name, AcpiFormatException (Status)));
+ (char *) &DeviceNode->Name, AcpiFormatException (Status)));
}
return (Status);
@@ -482,7 +482,7 @@ AcpiUtExecute_UID (
{
/* Copy the String UID from the returned object */
- STRNCPY(Uid->Buffer, ObjDesc->String.Pointer, sizeof(Uid->Buffer));
+ ACPI_STRNCPY (Uid->Buffer, ObjDesc->String.Pointer, sizeof(Uid->Buffer));
}
}
@@ -520,7 +520,7 @@ AcpiUtExecute_STA (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtExecute_STA");
+ ACPI_FUNCTION_TRACE ("UtExecute_STA");
/* Execute the method */
@@ -531,7 +531,7 @@ AcpiUtExecute_STA (
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"_STA on %4.4s was not found, assuming present.\n",
- (char*)&DeviceNode->Name));
+ (char *) &DeviceNode->Name));
*Flags = 0x0F;
Status = AE_OK;
@@ -540,7 +540,7 @@ AcpiUtExecute_STA (
else if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n",
- (char*)&DeviceNode->Name,
+ (char *) &DeviceNode->Name,
AcpiFormatException (Status)));
}
diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c
index 453cd02..4758da7 100644
--- a/sys/contrib/dev/acpica/utglobal.c
+++ b/sys/contrib/dev/acpica/utglobal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 136 $
+ * $Revision: 153 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,7 +125,7 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utglobal")
+ ACPI_MODULE_NAME ("utglobal")
/******************************************************************************
@@ -265,7 +265,7 @@ const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = {
* during the initialization sequence.
*/
-const PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
+const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
{
{"_GPE", INTERNAL_TYPE_DEF_ANY},
{"_PR_", INTERNAL_TYPE_DEF_ANY},
@@ -286,45 +286,45 @@ const PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
* and the table is indexed by values of ACPI_OBJECT_TYPE
*/
-const UINT8 AcpiGbl_NsProperties[] =
+const UINT8 AcpiGbl_NsProperties[] =
{
- NSP_NORMAL, /* 00 Any */
- NSP_NORMAL, /* 01 Number */
- NSP_NORMAL, /* 02 String */
- NSP_NORMAL, /* 03 Buffer */
- NSP_LOCAL, /* 04 Package */
- NSP_NORMAL, /* 05 FieldUnit */
- NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */
- NSP_LOCAL, /* 07 AcpiEvent */
- NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */
- NSP_LOCAL, /* 09 Mutex */
- NSP_LOCAL, /* 10 Region */
- NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */
- NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */
- NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */
- NSP_NORMAL, /* 14 BufferField */
- NSP_NORMAL, /* 15 DdbHandle */
- NSP_NORMAL, /* 16 Debug Object */
- NSP_NORMAL, /* 17 DefField */
- NSP_NORMAL, /* 18 BankField */
- NSP_NORMAL, /* 19 IndexField */
- NSP_NORMAL, /* 20 Reference */
- NSP_NORMAL, /* 21 Alias */
- NSP_NORMAL, /* 22 Notify */
- NSP_NORMAL, /* 23 Address Handler */
- NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource Desc */
- NSP_NEWSCOPE | NSP_LOCAL, /* 25 Resource Field */
- NSP_NORMAL, /* 26 DefFieldDefn */
- NSP_NORMAL, /* 27 BankFieldDefn */
- NSP_NORMAL, /* 28 IndexFieldDefn */
- NSP_NORMAL, /* 29 If */
- NSP_NORMAL, /* 30 Else */
- NSP_NORMAL, /* 31 While */
- NSP_NEWSCOPE, /* 32 Scope */
- NSP_LOCAL, /* 33 DefAny */
- NSP_NORMAL, /* 34 Extra */
- NSP_NORMAL, /* 35 Data */
- NSP_NORMAL /* 36 Invalid */
+ ACPI_NS_NORMAL, /* 00 Any */
+ ACPI_NS_NORMAL, /* 01 Number */
+ ACPI_NS_NORMAL, /* 02 String */
+ ACPI_NS_NORMAL, /* 03 Buffer */
+ ACPI_NS_LOCAL, /* 04 Package */
+ ACPI_NS_NORMAL, /* 05 FieldUnit */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 06 Device */
+ ACPI_NS_LOCAL, /* 07 AcpiEvent */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 08 Method */
+ ACPI_NS_LOCAL, /* 09 Mutex */
+ ACPI_NS_LOCAL, /* 10 Region */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 11 Power */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 12 Processor */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 13 Thermal */
+ ACPI_NS_NORMAL, /* 14 BufferField */
+ ACPI_NS_NORMAL, /* 15 DdbHandle */
+ ACPI_NS_NORMAL, /* 16 Debug Object */
+ ACPI_NS_NORMAL, /* 17 DefField */
+ ACPI_NS_NORMAL, /* 18 BankField */
+ ACPI_NS_NORMAL, /* 19 IndexField */
+ ACPI_NS_NORMAL, /* 20 Reference */
+ ACPI_NS_NORMAL, /* 21 Alias */
+ ACPI_NS_NORMAL, /* 22 Notify */
+ ACPI_NS_NORMAL, /* 23 Address Handler */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */
+ ACPI_NS_NORMAL, /* 26 DefFieldDefn */
+ ACPI_NS_NORMAL, /* 27 BankFieldDefn */
+ ACPI_NS_NORMAL, /* 28 IndexFieldDefn */
+ ACPI_NS_NORMAL, /* 29 If */
+ ACPI_NS_NORMAL, /* 30 Else */
+ ACPI_NS_NORMAL, /* 31 While */
+ ACPI_NS_NEWSCOPE, /* 32 Scope */
+ ACPI_NS_LOCAL, /* 33 DefAny */
+ ACPI_NS_NORMAL, /* 34 Extra */
+ ACPI_NS_NORMAL, /* 35 Data */
+ ACPI_NS_NORMAL /* 36 Invalid */
};
@@ -360,12 +360,15 @@ AcpiUtHexToAsciiChar (
/******************************************************************************
*
- * Table globals
+ * Table name globals
*
* NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
* it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
* that are not used by the subsystem are simply ignored.
*
+ * Do NOT add any table to this list that is not consumed directly by this
+ * subsystem.
+ *
******************************************************************************/
@@ -374,18 +377,147 @@ ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
{
- /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */
-
- /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL},
- /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT},
- /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FADT},
- /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS},
- /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL},
- /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL},
- /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL},
+ /*********** 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},
+};
+
+
+/******************************************************************************
+ *
+ * Event and Hardware globals
+ *
+ ******************************************************************************/
+
+ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] =
+{
+ /* Name Parent Register Register Bit Position Register Bit Mask */
+
+ /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS},
+ /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS},
+ /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS},
+ /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS},
+ /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS},
+ /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS},
+ /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS},
+
+ /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE},
+ /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+ /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE},
+ /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+ /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE},
+ /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
+
+ /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE},
+ /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD},
+ /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
+ /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
+ /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X},
+ /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE},
+
+ /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE}
+};
+
+
+ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
+{
+ /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE},
+ /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+ /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE},
+ /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+ /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, 0, 0},
+};
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetRegionName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Space ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/* Region type decoding */
+
+const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
+{
+ "SystemMemory",
+ "SystemIO",
+ "PCIConfig",
+ "EmbeddedControl",
+ "SMBus",
+ "CMOS",
+ "PCIBarTarget",
+ "DataTable",
+};
+
+
+NATIVE_CHAR *
+AcpiUtGetRegionName (
+ UINT8 SpaceId)
+{
+
+ if (SpaceId >= ACPI_USER_REGION_BEGIN)
+ {
+ return ("UserDefinedRegion");
+ }
+
+ else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
+ {
+ return ("InvalidSpaceID");
+ }
+
+ return ((NATIVE_CHAR *) AcpiGbl_RegionTypes[SpaceId]);
+}
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetEventName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Event ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
+/* Event type decoding */
+
+const NATIVE_CHAR *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
+{
+ "PM_Timer",
+ "GlobalLock",
+ "PowerButton",
+ "SleepButton",
+ "RealTimeClock",
};
+NATIVE_CHAR *
+AcpiUtGetEventName (
+ UINT32 EventId)
+{
+
+ if (EventId > ACPI_EVENT_MAX)
+ {
+ return ("InvalidEventID");
+ }
+
+ return ((NATIVE_CHAR *) AcpiGbl_EventTypes[EventId]);
+}
+
+
#ifdef ACPI_DEBUG
/*
@@ -420,6 +552,18 @@ AcpiUtGetMutexName (
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiUtGetTypeName
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate a Type ID into a name string (Debug only)
+ *
+ ****************************************************************************/
+
/*
* Elements of AcpiGbl_NsTypeNames below must match
* one-to-one with values of ACPI_OBJECT_TYPE
@@ -474,21 +618,9 @@ static const NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC
};
-/*****************************************************************************
- *
- * FUNCTION: AcpiUtGetTypeName
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Type ID into a name string (Debug only)
- *
- ****************************************************************************/
-
NATIVE_CHAR *
AcpiUtGetTypeName (
- UINT32 Type)
+ ACPI_OBJECT_TYPE Type)
{
if (Type > INTERNAL_TYPE_INVALID)
@@ -500,51 +632,6 @@ AcpiUtGetTypeName (
}
-/* Region type decoding */
-
-const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
-{
- "SystemMemory",
- "SystemIO",
- "PCIConfig",
- "EmbeddedControl",
- "SMBus",
- "CMOS",
- "PCIBarTarget",
-};
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiUtGetRegionName
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Space ID into a name string (Debug only)
- *
- ****************************************************************************/
-
-NATIVE_CHAR *
-AcpiUtGetRegionName (
- UINT8 SpaceId)
-{
-
- if (SpaceId >= ACPI_USER_REGION_BEGIN)
- {
- return ("UserDefinedRegion");
- }
-
- else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
- {
- return ("InvalidSpaceID");
- }
-
- return ((NATIVE_CHAR *) AcpiGbl_RegionTypes[SpaceId]);
-}
-
-
/* Data used in keeping track of fields */
const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] =
@@ -605,7 +692,7 @@ const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] =
BOOLEAN
AcpiUtValidObjectType (
- UINT32 Type)
+ ACPI_OBJECT_TYPE Type)
{
if (Type > ACPI_TYPE_MAX)
@@ -638,40 +725,41 @@ AcpiUtAllocateOwnerId (
ACPI_OWNER_ID OwnerId = 0xFFFF;
- FUNCTION_TRACE ("UtAllocateOwnerId");
+ ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
- AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ {
+ return (0);
+ }
switch (IdType)
{
- case OWNER_TYPE_TABLE:
+ case ACPI_OWNER_TYPE_TABLE:
OwnerId = AcpiGbl_NextTableOwnerId;
AcpiGbl_NextTableOwnerId++;
- if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID)
+ if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
{
- AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID;
+ AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
}
break;
- case OWNER_TYPE_METHOD:
+ case ACPI_OWNER_TYPE_METHOD:
OwnerId = AcpiGbl_NextMethodOwnerId;
AcpiGbl_NextMethodOwnerId++;
- if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID)
+ if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
{
- AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID;
+ AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
}
break;
}
-
- AcpiUtReleaseMutex (ACPI_MTX_CACHES);
-
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
return_VALUE (OwnerId);
}
@@ -694,17 +782,17 @@ AcpiUtInitGlobals (
UINT32 i;
- FUNCTION_TRACE ("UtInitGlobals");
+ ACPI_FUNCTION_TRACE ("UtInitGlobals");
/* Memory allocation and cache lists */
- MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
+ ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_GENERIC_STATE *) NULL)->Common.Next);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_PARSE_OBJECT *) NULL)->Next);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_PARSE2_OBJECT *) NULL)->Next);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) (NATIVE_UINT) &(((ACPI_WALK_STATE *) NULL)->Next);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE2_OBJECT *) NULL)->Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL);
+ AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL);
AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE);
AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE);
@@ -765,6 +853,7 @@ AcpiUtInitGlobals (
AcpiGbl_GlobalLockAcquired = FALSE;
AcpiGbl_GlobalLockThreadCount = 0;
+ AcpiGbl_GlobalLockHandle = 0;
/* Miscellaneous variables */
@@ -775,24 +864,22 @@ AcpiUtInitGlobals (
AcpiGbl_NsLookupCount = 0;
AcpiGbl_PsFindCount = 0;
AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID;
- AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID;
+ AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
+ AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
+ AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
/* Hardware oriented */
- AcpiGbl_Gpe0EnableRegisterSave = NULL;
- AcpiGbl_Gpe1EnableRegisterSave = NULL;
- AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */
- AcpiGbl_GpeRegisters = NULL;
- AcpiGbl_GpeInfo = NULL;
+ AcpiGbl_GpeRegisterInfo = NULL;
+ AcpiGbl_GpeNumberInfo = NULL;
/* Namespace */
AcpiGbl_RootNode = NULL;
AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME;
- AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY;
AcpiGbl_RootNodeStruct.Child = NULL;
AcpiGbl_RootNodeStruct.Peer = NULL;
diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c
index 40a4294..c1dd2ee 100644
--- a/sys/contrib/dev/acpica/utinit.c
+++ b/sys/contrib/dev/acpica/utinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 103 $
+ * $Revision: 109 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,11 +123,7 @@
#include "acevents.h"
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utinit")
-
-
-#define ACPI_OFFSET(d,o) ((UINT32) &(((d *)0)->o))
-#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o)
+ ACPI_MODULE_NAME ("utinit")
/*******************************************************************************
@@ -145,19 +141,16 @@
*
******************************************************************************/
-static ACPI_STATUS
+static void
AcpiUtFadtRegisterError (
NATIVE_CHAR *RegisterName,
UINT32 Value,
- UINT32 Offset)
+ ACPI_SIZE Offset)
{
- REPORT_ERROR (
+ ACPI_REPORT_WARNING (
("Invalid FADT value %s=%lX at offset %lX FADT=%p\n",
RegisterName, Value, Offset, AcpiGbl_FADT));
-
-
- return (AE_BAD_VALUE);
}
@@ -177,8 +170,6 @@ ACPI_STATUS
AcpiUtValidateFadt (
void)
{
- ACPI_STATUS Status = AE_OK;
-
/*
* Verify Fixed ACPI Description Table fields,
@@ -186,56 +177,56 @@ AcpiUtValidateFadt (
*/
if (AcpiGbl_FADT->Pm1EvtLen < 4)
{
- Status = AcpiUtFadtRegisterError ("PM1_EVT_LEN",
+ AcpiUtFadtRegisterError ("PM1_EVT_LEN",
(UINT32) AcpiGbl_FADT->Pm1EvtLen,
ACPI_FADT_OFFSET (Pm1EvtLen));
}
if (!AcpiGbl_FADT->Pm1CntLen)
{
- Status = AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0,
+ AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0,
ACPI_FADT_OFFSET (Pm1CntLen));
}
if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))
{
- Status = AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0,
+ AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0,
ACPI_FADT_OFFSET (XPm1aEvtBlk.Address));
}
if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address))
{
- Status = AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0,
+ AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0,
ACPI_FADT_OFFSET (XPm1aCntBlk.Address));
}
if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))
{
- Status = AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0,
+ AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0,
ACPI_FADT_OFFSET (XPmTmrBlk.Address));
}
if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) &&
!AcpiGbl_FADT->Pm2CntLen))
{
- Status = AcpiUtFadtRegisterError ("PM2_CNT_LEN",
+ AcpiUtFadtRegisterError ("PM2_CNT_LEN",
(UINT32) AcpiGbl_FADT->Pm2CntLen,
ACPI_FADT_OFFSET (Pm2CntLen));
}
if (AcpiGbl_FADT->PmTmLen < 4)
{
- Status = AcpiUtFadtRegisterError ("PM_TM_LEN",
+ AcpiUtFadtRegisterError ("PM_TM_LEN",
(UINT32) AcpiGbl_FADT->PmTmLen,
ACPI_FADT_OFFSET (PmTmLen));
}
- /* length of GPE blocks must be a multiple of 2 */
+ /* Length of GPE blocks must be a multiple of 2 */
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
(AcpiGbl_FADT->Gpe0BlkLen & 1))
{
- Status = AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN",
+ AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN",
(UINT32) AcpiGbl_FADT->Gpe0BlkLen,
ACPI_FADT_OFFSET (Gpe0BlkLen));
}
@@ -243,12 +234,12 @@ AcpiUtValidateFadt (
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
(AcpiGbl_FADT->Gpe1BlkLen & 1))
{
- Status = AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN",
+ AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN",
(UINT32) AcpiGbl_FADT->Gpe1BlkLen,
ACPI_FADT_OFFSET (Gpe1BlkLen));
}
- return (Status);
+ return (AE_OK);
}
@@ -268,21 +259,12 @@ void
AcpiUtTerminate (void)
{
- FUNCTION_TRACE ("UtTerminate");
+ ACPI_FUNCTION_TRACE ("UtTerminate");
/* Free global tables, etc. */
- if (AcpiGbl_Gpe0EnableRegisterSave)
- {
- ACPI_MEM_FREE (AcpiGbl_Gpe0EnableRegisterSave);
- }
-
- if (AcpiGbl_Gpe1EnableRegisterSave)
- {
- ACPI_MEM_FREE (AcpiGbl_Gpe1EnableRegisterSave);
- }
-
+ /* Nothing to do at this time */
return_VOID;
}
@@ -305,7 +287,7 @@ ACPI_STATUS
AcpiUtSubsystemShutdown (void)
{
- FUNCTION_TRACE ("UtSubsystemShutdown");
+ ACPI_FUNCTION_TRACE ("UtSubsystemShutdown");
/* Just exit if subsystem is already shutdown */
diff --git a/sys/contrib/dev/acpica/utmath.c b/sys/contrib/dev/acpica/utmath.c
index 1ac8cf4..91eb436 100644
--- a/sys/contrib/dev/acpica/utmath.c
+++ b/sys/contrib/dev/acpica/utmath.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmath - Integer math support routines
- * $Revision: 8 $
+ * $Revision: 10 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,7 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utmath")
+ ACPI_MODULE_NAME ("utmath")
/*
* Support for double-precision integer divide. This code is included here
@@ -159,7 +159,7 @@ AcpiUtShortDivide (
UINT32 Remainder32;
- FUNCTION_TRACE ("UtShortDivide");
+ ACPI_FUNCTION_TRACE ("UtShortDivide");
Dividend.Full = *InDividend;
@@ -167,7 +167,7 @@ AcpiUtShortDivide (
if (Divisor == 0)
{
- REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -228,14 +228,14 @@ AcpiUtDivide (
UINT64_OVERLAY Partial3;
- FUNCTION_TRACE ("UtDivide");
+ ACPI_FUNCTION_TRACE ("UtDivide");
/* Always check for a zero divisor */
if (*InDivisor == 0)
{
- REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -365,14 +365,14 @@ AcpiUtShortDivide (
UINT32 *OutRemainder)
{
- FUNCTION_TRACE ("UtShortDivide");
+ ACPI_FUNCTION_TRACE ("UtShortDivide");
/* Always check for a zero divisor */
if (Divisor == 0)
{
- REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -397,14 +397,14 @@ AcpiUtDivide (
ACPI_INTEGER *OutQuotient,
ACPI_INTEGER *OutRemainder)
{
- FUNCTION_TRACE ("UtDivide");
+ ACPI_FUNCTION_TRACE ("UtDivide");
/* Always check for a zero divisor */
if (*InDivisor == 0)
{
- REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c
index e0e1fa1..18c2901 100644
--- a/sys/contrib/dev/acpica/utmisc.c
+++ b/sys/contrib/dev/acpica/utmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 56 $
+ * $Revision: 67 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,7 +127,53 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utmisc")
+ ACPI_MODULE_NAME ("utmisc")
+
+
+#ifdef ACPI_DEBUG
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDisplayInitPathname
+ *
+ * PARAMETERS: ObjHandle - Handle whose pathname will be displayed
+ * Path - Additional path string to be appended
+ *
+ * RETURN: ACPI_STATUS
+ *
+ * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDisplayInitPathname (
+ ACPI_HANDLE ObjHandle,
+ char *Path)
+{
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+
+
+ ACPI_FUNCTION_NAME ("UtDisplayInitPathname");
+
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_SUCCESS (Status))
+ {
+ if (Path)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", (char *) Buffer.Pointer, Path));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", (char *) Buffer.Pointer));
+ }
+
+ ACPI_MEM_FREE (Buffer.Pointer);
+ }
+}
+#endif
/*******************************************************************************
@@ -153,7 +199,7 @@ AcpiUtValidAcpiName (
UINT32 i;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
for (i = 0; i < ACPI_NAME_SIZE; i++)
@@ -187,7 +233,7 @@ AcpiUtValidAcpiCharacter (
NATIVE_CHAR Character)
{
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
return ((BOOLEAN) ((Character == '_') ||
(Character >= 'A' && Character <= 'Z') ||
@@ -214,14 +260,14 @@ AcpiUtStrupr (
NATIVE_CHAR *String;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Walk entire string, uppercasing the letters */
for (String = SrcString; *String; )
{
- *String = (char) TOUPPER (*String);
+ *String = (char) ACPI_TOUPPER (*String);
String++;
}
@@ -249,7 +295,7 @@ AcpiUtMutexInitialize (
ACPI_STATUS Status;
- FUNCTION_TRACE ("UtMutexInitialize");
+ ACPI_FUNCTION_TRACE ("UtMutexInitialize");
/*
@@ -287,7 +333,7 @@ AcpiUtMutexTerminate (
UINT32 i;
- FUNCTION_TRACE ("UtMutexTerminate");
+ ACPI_FUNCTION_TRACE ("UtMutexTerminate");
/*
@@ -321,7 +367,7 @@ AcpiUtCreateMutex (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
+ ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
if (MutexId > MAX_MTX)
@@ -361,7 +407,7 @@ AcpiUtDeleteMutex (
ACPI_STATUS Status;
- FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
+ ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
if (MutexId > MAX_MTX)
@@ -400,7 +446,7 @@ AcpiUtAcquireMutex (
UINT32 ThisThreadId;
- PROC_NAME ("UtAcquireMutex");
+ ACPI_FUNCTION_NAME ("UtAcquireMutex");
if (MutexId > MAX_MTX)
@@ -446,7 +492,6 @@ AcpiUtAcquireMutex (
Status = AcpiOsWaitSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex,
1, WAIT_FOREVER);
-
if (ACPI_SUCCESS (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
@@ -488,7 +533,7 @@ AcpiUtReleaseMutex (
UINT32 ThisThreadId;
- PROC_NAME ("UtReleaseMutex");
+ ACPI_FUNCTION_NAME ("UtReleaseMutex");
ThisThreadId = AcpiOsGetThreadId ();
@@ -584,7 +629,7 @@ AcpiUtCreateUpdateStateAndPush (
ACPI_GENERIC_STATE *State;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
/* Ignore null objects; these are expected */
@@ -630,7 +675,7 @@ AcpiUtCreatePkgStateAndPush (
ACPI_GENERIC_STATE *State;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
@@ -663,7 +708,7 @@ AcpiUtPushGenericState (
ACPI_GENERIC_STATE **ListHead,
ACPI_GENERIC_STATE *State)
{
- FUNCTION_TRACE ("UtPushGenericState");
+ ACPI_FUNCTION_TRACE ("UtPushGenericState");
/* Push the state object onto the front of the list (stack) */
@@ -694,7 +739,7 @@ AcpiUtPopGenericState (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE ("UtPopGenericState");
+ ACPI_FUNCTION_TRACE ("UtPopGenericState");
/* Remove the state object at the head of the list (stack) */
@@ -730,7 +775,7 @@ AcpiUtCreateGenericState (void)
ACPI_GENERIC_STATE *State;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
State = AcpiUtAcquireFromCache (ACPI_MEM_LIST_STATE);
@@ -766,7 +811,7 @@ AcpiUtCreateThreadState (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE ("UtCreateThreadState");
+ ACPI_FUNCTION_TRACE ("UtCreateThreadState");
/* Create the generic state object */
@@ -810,7 +855,7 @@ AcpiUtCreateUpdateState (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
+ ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
/* Create the generic state object */
@@ -854,7 +899,7 @@ AcpiUtCreatePkgState (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
/* Create the generic state object */
@@ -897,7 +942,7 @@ AcpiUtCreateControlState (
ACPI_GENERIC_STATE *State;
- FUNCTION_TRACE ("UtCreateControlState");
+ ACPI_FUNCTION_TRACE ("UtCreateControlState");
/* Create the generic state object */
@@ -912,7 +957,7 @@ AcpiUtCreateControlState (
/* Init fields specific to the control struct */
State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL;
- State->Common.State = CONTROL_CONDITIONAL_EXECUTING;
+ State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
return_PTR (State);
}
@@ -935,7 +980,7 @@ void
AcpiUtDeleteGenericState (
ACPI_GENERIC_STATE *State)
{
- FUNCTION_TRACE ("UtDeleteGenericState");
+ ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
AcpiUtReleaseToCache (ACPI_MEM_LIST_STATE, State);
@@ -960,7 +1005,7 @@ void
AcpiUtDeleteGenericStateCache (
void)
{
- FUNCTION_TRACE ("UtDeleteGenericStateCache");
+ ACPI_FUNCTION_TRACE ("UtDeleteGenericStateCache");
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_STATE);
@@ -970,109 +1015,113 @@ AcpiUtDeleteGenericStateCache (
/*******************************************************************************
*
- * FUNCTION: AcpiUtResolvePackageReferences
+ * FUNCTION: AcpiUtResolveReference
*
- * PARAMETERS: ObjDesc - The Package object on which to resolve refs
+ * PARAMETERS: ACPI_PKG_CALLBACK
*
- * RETURN: Status
+ * RETURN: Status - the status of the call
*
- * DESCRIPTION: Walk through a package and turn internal references into values
+ * DESCRIPTION: Resolve a reference object to an actual value
*
******************************************************************************/
ACPI_STATUS
-AcpiUtResolvePackageReferences (
- ACPI_OPERAND_OBJECT *ObjDesc)
+AcpiUtResolveReference (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context)
{
- UINT32 Count;
- ACPI_OPERAND_OBJECT *SubObject;
-
+ ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
- FUNCTION_TRACE ("UtResolvePackageReferences");
-
- if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE)
+ switch (ObjectType)
{
- /* The object must be a package */
+ case ACPI_COPY_TYPE_SIMPLE:
- REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
- return_ACPI_STATUS(AE_ERROR);
- }
+ /*
+ * Simple object - check for a reference
+ */
+ if (SourceObject->Common.Type == INTERNAL_TYPE_REFERENCE)
+ {
+ switch (SourceObject->Reference.Opcode)
+ {
+ case AML_ZERO_OP:
- /*
- * TBD: what about nested packages? */
+ SourceObject->Common.Type = ACPI_TYPE_INTEGER;
+ SourceObject->Integer.Value = 0;
+ break;
- for (Count = 0; Count < ObjDesc->Package.Count; Count++)
- {
- SubObject = ObjDesc->Package.Elements[Count];
+ case AML_ONE_OP:
- if (SubObject->Common.Type == INTERNAL_TYPE_REFERENCE)
- {
- if (SubObject->Reference.Opcode == AML_ZERO_OP)
- {
- SubObject->Common.Type = ACPI_TYPE_INTEGER;
- SubObject->Integer.Value = 0;
- }
+ SourceObject->Common.Type = ACPI_TYPE_INTEGER;
+ SourceObject->Integer.Value = 1;
+ break;
- else if (SubObject->Reference.Opcode == AML_ONE_OP)
- {
- SubObject->Common.Type = ACPI_TYPE_INTEGER;
- SubObject->Integer.Value = 1;
- }
+ case AML_ONES_OP:
- else if (SubObject->Reference.Opcode == AML_ONES_OP)
- {
- SubObject->Common.Type = ACPI_TYPE_INTEGER;
- SubObject->Integer.Value = ACPI_INTEGER_MAX;
+ SourceObject->Common.Type = ACPI_TYPE_INTEGER;
+ SourceObject->Integer.Value = ACPI_INTEGER_MAX;
+ break;
}
}
+ break;
+
+
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /* Package object - nothing much to do here, let the walk handle it */
+
+ Info->NumPackages++;
+ State->Pkg.ThisTargetObj = NULL;
+ break;
}
- return_ACPI_STATUS(AE_OK);
+ return (AE_OK);
}
-#ifdef ACPI_DEBUG
/*******************************************************************************
*
- * FUNCTION: AcpiUtDisplayInitPathname
+ * FUNCTION: AcpiUtResolvePackageReferences
*
- * PARAMETERS: ObjHandle - Handle whose pathname will be displayed
- * Path - Additional path string to be appended
+ * PARAMETERS: ObjDesc - The Package object on which to resolve refs
*
- * RETURN: ACPI_STATUS
+ * RETURN: Status
*
- * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
+ * DESCRIPTION: Walk through a package and turn internal references into values
*
******************************************************************************/
-void
-AcpiUtDisplayInitPathname (
- ACPI_HANDLE ObjHandle,
- char *Path)
+ACPI_STATUS
+AcpiUtResolvePackageReferences (
+ ACPI_OPERAND_OBJECT *ObjDesc)
{
+ ACPI_PKG_INFO Info;
ACPI_STATUS Status;
- UINT32 Length = 128;
- char Buffer[128];
- PROC_NAME ("UtDisplayInitPathname");
+ ACPI_FUNCTION_TRACE ("UtResolvePackageReferences");
- Status = AcpiNsHandleToPathname (ObjHandle, &Length, Buffer);
- if (ACPI_SUCCESS (Status))
+ if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
- if (Path)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", Buffer, Path));
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", Buffer));
- }
+ /* The object must be a package */
+
+ ACPI_REPORT_ERROR (("Expecting a Package object\n"));
+ return_ACPI_STATUS (AE_TYPE);
}
+
+ Info.Length = 0;
+ Info.ObjectSpace = 0;
+ Info.NumPackages = 1;
+
+ Status = AcpiUtWalkPackageTree (ObjDesc, NULL,
+ AcpiUtResolveReference, &Info);
+
+ return_ACPI_STATUS (Status);
}
-#endif
+
/*******************************************************************************
*
@@ -1100,7 +1149,7 @@ AcpiUtWalkPackageTree (
ACPI_OPERAND_OBJECT *ThisSourceObj;
- FUNCTION_TRACE ("UtWalkPackageTree");
+ ACPI_FUNCTION_TRACE ("UtWalkPackageTree");
State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0);
@@ -1118,18 +1167,15 @@ AcpiUtWalkPackageTree (
/*
* Check for:
* 1) An uninitialized package element. It is completely
- * legal to declare a package and leave it uninitialized
+ * legal to declare a package and leave it uninitialized
* 2) Not an internal object - can be a namespace node instead
* 3) Any type other than a package. Packages are handled in else
- * case below.
+ * case below.
*/
if ((!ThisSourceObj) ||
- (!VALID_DESCRIPTOR_TYPE (
- ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) ||
- (!IS_THIS_OBJECT_TYPE (
- ThisSourceObj, ACPI_TYPE_PACKAGE)))
+ (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_INTERNAL) ||
+ (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE))
{
-
Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj,
State, Context);
if (ACPI_FAILURE (Status))
@@ -1202,6 +1248,93 @@ AcpiUtWalkPackageTree (
/*******************************************************************************
*
+ * FUNCTION: AcpiUtGenerateChecksum
+ *
+ * PARAMETERS: Buffer - Buffer to be scanned
+ * Length - number of bytes to examine
+ *
+ * RETURN: checksum
+ *
+ * DESCRIPTION: Generate a checksum on a raw buffer
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiUtGenerateChecksum (
+ UINT8 *Buffer,
+ UINT32 Length)
+{
+ UINT32 i;
+ signed char Sum = 0;
+
+ for (i = 0; i < Length; i++)
+ {
+ Sum = (signed char) (Sum + Buffer[i]);
+ }
+
+ return ((UINT8) (0 - Sum));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetResourceEndTag
+ *
+ * PARAMETERS: ObjDesc - The resource template buffer object
+ *
+ * RETURN: Pointer to the end tag
+ *
+ * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
+ *
+ ******************************************************************************/
+
+
+UINT8 *
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT8 BufferByte;
+ UINT8 *Buffer;
+ UINT8 *EndBuffer;
+
+
+ Buffer = ObjDesc->Buffer.Pointer;
+ EndBuffer = Buffer + ObjDesc->Buffer.Length;
+
+ while (Buffer < EndBuffer)
+ {
+ BufferByte = *Buffer;
+ if (BufferByte & ACPI_RDESC_TYPE_MASK)
+ {
+ /* Large Descriptor - Length is next 2 bytes */
+
+ Buffer += ((*(Buffer+1) | (*(Buffer+2) << 8)) + 3);
+ }
+ else
+ {
+ /* Small Descriptor. End Tag will be found here */
+
+ if ((BufferByte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG)
+ {
+ /* Found the end tag descriptor, all done. */
+
+ return (Buffer);
+ }
+
+ /* Length is in the header */
+
+ Buffer += ((BufferByte & 0x07) + 1);
+ }
+ }
+
+ /* End tag not found */
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtReportError
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c
index b8fa4ab..6cdfa54 100644
--- a/sys/contrib/dev/acpica/utobject.c
+++ b/sys/contrib/dev/acpica/utobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 61 $
+ * $Revision: 68 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utobject")
+ ACPI_MODULE_NAME ("utobject")
/*******************************************************************************
@@ -154,13 +154,13 @@ AcpiUtCreateInternalObjectDbg (
NATIVE_CHAR *ModuleName,
UINT32 LineNumber,
UINT32 ComponentId,
- ACPI_OBJECT_TYPE8 Type)
+ ACPI_OBJECT_TYPE Type)
{
ACPI_OPERAND_OBJECT *Object;
ACPI_OPERAND_OBJECT *SecondObject;
- FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg", AcpiUtGetTypeName (Type));
+ ACPI_FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg", AcpiUtGetTypeName (Type));
/* Allocate the raw object descriptor */
@@ -175,7 +175,7 @@ AcpiUtCreateInternalObjectDbg (
{
case ACPI_TYPE_REGION:
case ACPI_TYPE_BUFFER_FIELD:
-
+
/* These types require a secondary object */
SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId);
@@ -196,7 +196,7 @@ AcpiUtCreateInternalObjectDbg (
/* Save the object type in the object descriptor */
- Object->Common.Type = Type;
+ Object->Common.Type = (UINT8) Type;
/* Init the reference count */
@@ -223,7 +223,7 @@ AcpiUtValidInternalObject (
void *Object)
{
- PROC_NAME ("UtValidInternalObject");
+ ACPI_FUNCTION_NAME ("UtValidInternalObject");
/* Check for a null pointer */
@@ -237,35 +237,34 @@ AcpiUtValidInternalObject (
/* Check the descriptor type field */
- if (!VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL))
+ switch (ACPI_GET_DESCRIPTOR_TYPE (Object))
{
- /* Not an ACPI internal object, do some further checking */
+ case ACPI_DESC_TYPE_INTERNAL:
- if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Obj %p is a named obj, not ACPI obj\n", Object));
- }
+ /* The object appears to be a valid ACPI_OPERAND_OBJECT */
- else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_PARSER))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Obj %p is a parser obj, not ACPI obj\n", Object));
- }
+ return (TRUE);
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Obj %p is of unknown type\n", Object));
- }
+ case ACPI_DESC_TYPE_NAMED:
- return (FALSE);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is a named obj, not ACPI obj\n", Object));
+ break;
+ case ACPI_DESC_TYPE_PARSER:
- /* The object appears to be a valid ACPI_OPERAND_OBJECT */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is a parser obj, not ACPI obj\n", Object));
+ break;
+
+ default:
- return (TRUE);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "**** Obj %p is of unknown type\n", Object));
+ break;
+ }
+
+ return (FALSE);
}
@@ -294,13 +293,13 @@ AcpiUtAllocateObjectDescDbg (
ACPI_OPERAND_OBJECT *Object;
- FUNCTION_TRACE ("UtAllocateObjectDescDbg");
+ ACPI_FUNCTION_TRACE ("UtAllocateObjectDescDbg");
Object = AcpiUtAcquireFromCache (ACPI_MEM_LIST_OPERAND);
if (!Object)
{
- _REPORT_ERROR (ModuleName, LineNumber, ComponentId,
+ _ACPI_REPORT_ERROR (ModuleName, LineNumber, ComponentId,
("Could not allocate an object descriptor\n"));
return_PTR (NULL);
@@ -309,7 +308,7 @@ AcpiUtAllocateObjectDescDbg (
/* Mark the descriptor type */
- Object->Common.DataType = ACPI_DESC_TYPE_INTERNAL;
+ ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
Object, sizeof (ACPI_OPERAND_OBJECT)));
@@ -334,12 +333,12 @@ void
AcpiUtDeleteObjectDesc (
ACPI_OPERAND_OBJECT *Object)
{
- FUNCTION_TRACE_PTR ("UtDeleteObjectDesc", Object);
+ ACPI_FUNCTION_TRACE_PTR ("UtDeleteObjectDesc", Object);
/* Object must be an ACPI_OPERAND_OBJECT */
- if (Object->Common.DataType != ACPI_DESC_TYPE_INTERNAL)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_INTERNAL)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Obj %p is not an ACPI object\n", Object));
@@ -369,7 +368,7 @@ void
AcpiUtDeleteObjectCache (
void)
{
- FUNCTION_TRACE ("UtDeleteObjectCache");
+ ACPI_FUNCTION_TRACE ("UtDeleteObjectCache");
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_OPERAND);
@@ -397,13 +396,13 @@ AcpiUtDeleteObjectCache (
ACPI_STATUS
AcpiUtGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
- UINT32 *ObjLength)
+ ACPI_SIZE *ObjLength)
{
- UINT32 Length;
+ ACPI_SIZE Length;
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE_PTR ("UtGetSimpleObjectSize", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR ("UtGetSimpleObjectSize", InternalObject);
/* Handle a null object (Could be a uninitialized package element -- which is legal) */
@@ -419,11 +418,11 @@ AcpiUtGetSimpleObjectSize (
Length = sizeof (ACPI_OBJECT);
- if (VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_NAMED))
+ if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED)
{
/* Object is a named object (reference), just return the length */
- *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length);
+ *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
return_ACPI_STATUS (Status);
}
@@ -462,25 +461,38 @@ AcpiUtGetSimpleObjectSize (
case INTERNAL_TYPE_REFERENCE:
- /*
- * The only type that should be here is internal opcode NAMEPATH_OP -- since
- * this means an object reference
- */
- if (InternalObject->Reference.Opcode != AML_INT_NAMEPATH_OP)
+ switch (InternalObject->Reference.Opcode)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported Reference opcode=%X in object %p\n",
- InternalObject->Reference.Opcode, InternalObject));
- Status = AE_TYPE;
- }
+ case AML_ZERO_OP:
+ case AML_ONE_OP:
+ case AML_ONES_OP:
+ case AML_REVISION_OP:
+
+ /* These Constant opcodes will be resolved to Integers */
+
+ break;
+
+ case AML_INT_NAMEPATH_OP:
- else
- {
/*
* Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object
*/
- Length += ROUND_UP_TO_NATIVE_WORD (AcpiNsGetPathnameLength (InternalObject->Reference.Node));
+ Length += ACPI_ROUND_UP_TO_NATIVE_WORD (AcpiNsGetPathnameLength (InternalObject->Reference.Node));
+ break;
+
+ default:
+
+ /*
+ * No other reference opcodes are supported.
+ * Notably, Locals and Args are not supported, by this may be
+ * required eventually.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported Reference opcode=%X in object %p\n",
+ InternalObject->Reference.Opcode, InternalObject));
+ Status = AE_TYPE;
+ break;
}
break;
@@ -500,8 +512,7 @@ AcpiUtGetSimpleObjectSize (
* on a machine word boundary. (preventing alignment faults on some
* machines.)
*/
- *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length);
-
+ *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
return_ACPI_STATUS (Status);
}
@@ -527,12 +538,12 @@ AcpiUtGetElementLength (
{
ACPI_STATUS Status = AE_OK;
ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
- UINT32 ObjectSpace;
+ ACPI_SIZE ObjectSpace;
switch (ObjectType)
{
- case 0:
+ case ACPI_COPY_TYPE_SIMPLE:
/*
* Simple object - just get the size (Null object/entry is handled
@@ -548,18 +559,15 @@ AcpiUtGetElementLength (
break;
- case 1:
- /* Package - nothing much to do here, let the walk handle it */
+ case ACPI_COPY_TYPE_PACKAGE:
+
+ /* Package object - nothing much to do here, let the walk handle it */
Info->NumPackages++;
State->Pkg.ThisTargetObj = NULL;
break;
-
- default:
- return (AE_BAD_PARAMETER);
}
-
return (Status);
}
@@ -584,13 +592,13 @@ AcpiUtGetElementLength (
ACPI_STATUS
AcpiUtGetPackageObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
- UINT32 *ObjLength)
+ ACPI_SIZE *ObjLength)
{
ACPI_STATUS Status;
ACPI_PKG_INFO Info;
- FUNCTION_TRACE_PTR ("UtGetPackageObjectSize", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR ("UtGetPackageObjectSize", InternalObject);
Info.Length = 0;
@@ -609,7 +617,7 @@ AcpiUtGetPackageObjectSize (
* just add the length of the package objects themselves.
* Round up to the next machine word.
*/
- Info.Length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
+ Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
Info.NumPackages;
/* Return the total package length */
@@ -636,20 +644,19 @@ AcpiUtGetPackageObjectSize (
ACPI_STATUS
AcpiUtGetObjectSize(
ACPI_OPERAND_OBJECT *InternalObject,
- UINT32 *ObjLength)
+ ACPI_SIZE *ObjLength)
{
ACPI_STATUS Status;
- FUNCTION_ENTRY ();
+ ACPI_FUNCTION_ENTRY ();
- if ((VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_INTERNAL)) &&
- (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE)))
+ if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_INTERNAL) &&
+ (InternalObject->Common.Type == ACPI_TYPE_PACKAGE))
{
Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength);
}
-
else
{
Status = AcpiUtGetSimpleObjectSize (InternalObject, ObjLength);
diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c
index 5400026..cd38e23 100644
--- a/sys/contrib/dev/acpica/utxface.c
+++ b/sys/contrib/dev/acpica/utxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 85 $
+ * $Revision: 92 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,7 +130,7 @@
#define _COMPONENT ACPI_UTILITIES
- MODULE_NAME ("utxface")
+ ACPI_MODULE_NAME ("utxface")
/*******************************************************************************
@@ -152,10 +152,10 @@ AcpiInitializeSubsystem (
{
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiInitializeSubsystem");
+ ACPI_FUNCTION_TRACE ("AcpiInitializeSubsystem");
- DEBUG_EXEC(AcpiUtInitStackPtrTrace ());
+ ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
/* Initialize all globals used by the subsystem */
@@ -167,7 +167,7 @@ AcpiInitializeSubsystem (
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("OSD failed to initialize, %s\n",
+ ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
@@ -177,7 +177,7 @@ AcpiInitializeSubsystem (
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("Global mutex creation failure, %s\n",
+ ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n",
AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
@@ -190,7 +190,7 @@ AcpiInitializeSubsystem (
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
- REPORT_ERROR (("Namespace initialization failure, %s\n",
+ ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
@@ -198,7 +198,7 @@ AcpiInitializeSubsystem (
/* If configured, initialize the AML debugger */
- DEBUGGER_EXEC (AcpiDbInitialize ());
+ ACPI_DEBUGGER_EXEC (AcpiDbInitialize ());
return_ACPI_STATUS (Status);
}
@@ -224,21 +224,13 @@ AcpiEnableSubsystem (
ACPI_STATUS Status = AE_OK;
- FUNCTION_TRACE ("AcpiEnableSubsystem");
+ ACPI_FUNCTION_TRACE ("AcpiEnableSubsystem");
- /* Sanity check the FADT for valid values */
-
- Status = AcpiUtValidateFadt ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
/*
- * Install the default OpRegion handlers. These are
- * installed unless other handlers have already been
- * installed via the InstallAddressSpaceHandler interface
+ * Install the default OpRegion handlers. These are installed unless
+ * other handlers have already been installed via the
+ * InstallAddressSpaceHandler interface
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
@@ -253,6 +245,7 @@ AcpiEnableSubsystem (
/*
* We must initialize the hardware before we can enable ACPI.
+ * FADT values are validated here.
*/
if (!(Flags & ACPI_NO_HARDWARE_INIT))
{
@@ -297,6 +290,19 @@ AcpiEnableSubsystem (
}
}
+ /* Install SCI handler, Global Lock handler, GPE handlers */
+
+ if (!(Flags & ACPI_NO_HANDLER_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL/GPE handlers\n"));
+
+ Status = AcpiEvHandlerInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
/*
* Initialize all device objects in the namespace
* This runs the _STA and _INI methods.
@@ -355,12 +361,12 @@ AcpiEnableSubsystem (
ACPI_STATUS
AcpiTerminate (void)
{
- FUNCTION_TRACE ("AcpiTerminate");
+ ACPI_FUNCTION_TRACE ("AcpiTerminate");
/* Terminate the AML Debugger if present */
- DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE);
+ ACPI_DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE);
/* Shutdown and free all resources */
@@ -441,44 +447,41 @@ AcpiGetSystemInfo (
{
ACPI_SYSTEM_INFO *InfoPtr;
UINT32 i;
+ ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiGetSystemInfo");
+ ACPI_FUNCTION_TRACE ("AcpiGetSystemInfo");
- /*
- * Must have a valid buffer
- */
- if ((!OutBuffer) ||
- (!OutBuffer->Pointer))
+ /* Parameter validation */
+
+ Status = AcpiUtValidateBuffer (OutBuffer);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (Status);
}
- if (OutBuffer->Length < sizeof (ACPI_SYSTEM_INFO))
- {
- /*
- * Caller's buffer is too small
- */
- OutBuffer->Length = sizeof (ACPI_SYSTEM_INFO);
+ /* Validate/Allocate/Clear caller buffer */
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
}
-
/*
- * Set return length and get data
+ * Populate the return buffer
*/
- OutBuffer->Length = sizeof (ACPI_SYSTEM_INFO);
InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
/* System flags (ACPI capabilities) */
- InfoPtr->Flags = SYS_MODE_ACPI;
+ InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
/* Timer resolution - 24 or 32 bits */
+
if (!AcpiGbl_FADT)
{
InfoPtr->TimerResolution = 0;
@@ -529,7 +532,7 @@ AcpiGetSystemInfo (
ACPI_STATUS
AcpiPurgeCachedObjects (void)
{
- FUNCTION_TRACE ("AcpiPurgeCachedObjects");
+ ACPI_FUNCTION_TRACE ("AcpiPurgeCachedObjects");
AcpiUtDeleteGenericStateCache ();
OpenPOWER on IntegriCloud