summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-09-15 20:49:34 +0000
committerjkim <jkim@FreeBSD.org>2010-09-15 20:49:34 +0000
commit222f62b9508c30168451c22ba677efe564ec2bb6 (patch)
tree41eb78500422196a69e6d775b795f5ee483d4a9e
parent7246513d8afc4166ea14544296293fcb8df78649 (diff)
downloadFreeBSD-src-222f62b9508c30168451c22ba677efe564ec2bb6.zip
FreeBSD-src-222f62b9508c30168451c22ba677efe564ec2bb6.tar.gz
Import ACPICA 20100915.
-rw-r--r--changes.txt64
-rw-r--r--common/adfile.c6
-rw-r--r--common/adisasm.c12
-rw-r--r--common/adwalk.c16
-rw-r--r--common/dmrestag.c4
-rw-r--r--common/getopt.c5
-rw-r--r--compiler/Makefile4
-rw-r--r--compiler/aslanalyze.c5
-rw-r--r--compiler/aslcompile.c8
-rw-r--r--compiler/aslcompiler.h4
-rw-r--r--compiler/aslerror.c4
-rw-r--r--compiler/aslfiles.c4
-rw-r--r--compiler/asllisting.c4
-rw-r--r--compiler/asllookup.c8
-rw-r--r--compiler/aslmain.c18
-rw-r--r--compiler/aslopcodes.c6
-rw-r--r--compiler/aslpredef.c2
-rw-r--r--compiler/aslrestype1.c2
-rw-r--r--compiler/aslrestype2d.c24
-rw-r--r--compiler/aslrestype2e.c1
-rw-r--r--compiler/aslrestype2w.c24
-rw-r--r--compiler/aslstartup.c30
-rw-r--r--compiler/dtcompile.c29
-rw-r--r--compiler/dtio.c2
-rw-r--r--debugger/dbexec.c10
-rw-r--r--events/evrgnini.c13
-rw-r--r--executer/exmutex.c6
-rw-r--r--hardware/hwpci.c531
-rw-r--r--include/acglobal.h2
-rw-r--r--include/achware.h10
-rw-r--r--include/aclocal.h2
-rw-r--r--include/acmacros.h4
-rw-r--r--include/acnamesp.h16
-rw-r--r--include/acpiosxf.h10
-rw-r--r--include/acpixf.h3
-rw-r--r--include/actypes.h32
-rw-r--r--include/acutils.h57
-rw-r--r--include/platform/accygwin.h8
-rw-r--r--include/platform/acenv.h6
-rw-r--r--include/platform/acfreebsd.h3
-rw-r--r--include/platform/acgcc.h2
-rw-r--r--include/platform/acintel.h22
-rw-r--r--include/platform/aclinux.h3
-rw-r--r--include/platform/acmsvc.h6
-rw-r--r--include/platform/acos2.h6
-rw-r--r--include/platform/acwin.h2
-rw-r--r--include/platform/acwin64.h2
-rw-r--r--namespace/nsrepair2.c180
-rw-r--r--namespace/nsutils.c112
-rw-r--r--os_specific/service_layers/osunixxf.c18
-rw-r--r--os_specific/service_layers/oswintbl.c3
-rw-r--r--os_specific/service_layers/oswinxf.c13
-rw-r--r--osunixxf.c18
-rw-r--r--tables/tbfadt.c4
-rw-r--r--tools/acpiexec/Makefile8
-rw-r--r--tools/acpiexec/aecommon.h14
-rw-r--r--tools/acpiexec/aeexec.c241
-rw-r--r--tools/acpiexec/aehandlers.c84
-rw-r--r--tools/acpiexec/aemain.c54
-rw-r--r--tools/acpiexec/aetables.c66
-rw-r--r--tools/acpisrc/asfile.c5
-rw-r--r--tools/acpisrc/astable.c1
-rw-r--r--tools/acpixtract/acpixtract.c50
-rw-r--r--utilities/utdebug.c7
-rw-r--r--utilities/utmath.c28
-rw-r--r--utilities/utmisc.c194
-rw-r--r--utilities/utmutex.c24
-rw-r--r--utilities/utxferror.c550
68 files changed, 1915 insertions, 801 deletions
diff --git a/changes.txt b/changes.txt
index 6ac171f..9bb84d4 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,68 @@
----------------------------------------
+15 September 2010. Summary of changes for version 20100915:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Removed the AcpiOsDerivePciId OSL interface. The various host implementations
+of this function were not OS-dependent and are now obsolete and can be
+removed from all host OSLs. This function has been replaced by
+AcpiHwDerivePciId, which is now part of the ACPICA core code.
+AcpiHwDerivePciId has been implemented without recursion. Adds one new
+module, hwpci.c. ACPICA BZ 857.
+
+Implemented a dynamic repair for _HID and _CID strings. The following
+problems are now repaired at runtime: 1) Remove a leading asterisk in the
+string, and 2) the entire string is uppercased. Both repairs are in
+accordance with the ACPI specification and will simplify host driver code.
+ACPICA BZ 871.
+
+The ACPI_THREAD_ID type is no longer configurable, internally it is now
+always UINT64. This simplifies the ACPICA code, especially any printf output.
+UINT64 is the only common data type for all thread_id types across all
+operating systems. It is now up to the host OSL to cast the native thread_id
+type to UINT64 before returning the value to ACPICA (via AcpiOsGetThreadId).
+Lin Ming, Bob Moore.
+
+Added the ACPI_INLINE type to enhance the ACPICA configuration. The "inline"
+keyword is not standard across compilers, and this type allows inline to be
+configured on a per-compiler basis. Lin Ming.
+
+Made the system global AcpiGbl_SystemAwakeAndRunning publically available.
+Added an extern for this boolean in acpixf.h. Some hosts utilize this value
+during suspend/restore operations. ACPICA BZ 869.
+
+All code that implements error/warning messages with the "ACPI:" prefix has
+been moved to a new module, utxferror.c.
+
+The UINT64_OVERLAY was moved to utmath.c, which is the only module where it
+is used. ACPICA BZ 829. Lin Ming, Bob Moore.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
+debug version of the code includes the debug output trace mechanism and has a
+much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 89.1K Code, 19.0K Data, 108.1K Total
+ Debug Version: 165.1K Code, 51.9K Data, 217.0K Total
+ Current Release:
+ Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total
+ Debug Version: 166.3K Code, 52.1K Data, 218.4K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL/Disassembler: Write ACPI errors to stderr instead of the output file.
+This keeps the output files free of random error messages that may originate
+from within the namespace/interpreter code. Used this opportunity to merge
+all ACPI:-style messages into a single new module, utxferror.c. ACPICA BZ
+866. Lin Ming, Bob Moore.
+
+Tools: update some printfs for ansi warnings on size_t. Handle width change
+of size_t on 32-bit versus 64-bit generations. Lin Ming.
+
+----------------------------------------
06 August 2010. Summary of changes for version 20100806:
1) ACPI CA Core Subsystem:
diff --git a/common/adfile.c b/common/adfile.c
index c7f3dfb..629bd53 100644
--- a/common/adfile.c
+++ b/common/adfile.c
@@ -126,13 +126,13 @@
/* Local prototypes */
-INT32
+static INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length);
-char FilenameBuf[20];
+static char FilenameBuf[20];
/******************************************************************************
@@ -190,7 +190,7 @@ AdGenerateFilename (
*
******************************************************************************/
-INT32
+static INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
diff --git a/common/adisasm.c b/common/adisasm.c
index 79960c9..31985f7 100644
--- a/common/adisasm.c
+++ b/common/adisasm.c
@@ -147,18 +147,18 @@ LsSetupNsList (
/* Local prototypes */
-void
+static void
AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table);
-ACPI_STATUS
+static ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
UINT32 AmlLength);
-ACPI_STATUS
+static ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root);
@@ -634,7 +634,7 @@ AdDisassemblerHeader (
*
*****************************************************************************/
-void
+static void
AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table)
@@ -781,7 +781,7 @@ AdDisplayTables (
*
*****************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
@@ -904,7 +904,7 @@ AdDeferredParse (
*
*****************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root)
{
diff --git a/common/adwalk.c b/common/adwalk.c
index b070533..e8f580c 100644
--- a/common/adwalk.c
+++ b/common/adwalk.c
@@ -792,6 +792,7 @@ AcpiDmXrefDescendingOp (
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT *Object;
+ UINT32 ParamCount = 0;
WalkState = Info->WalkState;
@@ -880,18 +881,13 @@ AcpiDmXrefDescendingOp (
if (Object)
{
ObjectType2 = Object->Common.Type;
+ if (ObjectType2 == ACPI_TYPE_METHOD)
+ {
+ ParamCount = Object->Method.ParamCount;
+ }
}
- if (ObjectType2 == ACPI_TYPE_METHOD)
- {
- AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_METHOD,
- Object->Method.ParamCount);
- }
- else
- {
- AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, 0);
- }
-
+ AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount);
Op->Common.Node = Node;
}
else
diff --git a/common/dmrestag.c b/common/dmrestag.c
index e1f340d..184a856 100644
--- a/common/dmrestag.c
+++ b/common/dmrestag.c
@@ -704,8 +704,8 @@ AcpiDmUpdateResourceName (
Name[0] = '_';
Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix];
- Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4);
- Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0);
+ Name[2] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 4);
+ Name[3] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 0);
/* Update globals for next name */
diff --git a/common/getopt.c b/common/getopt.c
index db1eb16..9a8589c 100644
--- a/common/getopt.c
+++ b/common/getopt.c
@@ -126,7 +126,6 @@
int AcpiGbl_Opterr = 1;
int AcpiGbl_Optind = 1;
-int AcpiGbl_Optopt;
char *AcpiGbl_Optarg;
@@ -171,9 +170,7 @@ AcpiGetopt(
/* Get the option */
- CurrentChar =
- AcpiGbl_Optopt =
- argv[AcpiGbl_Optind][CurrentCharPtr];
+ CurrentChar = argv[AcpiGbl_Optind][CurrentCharPtr];
/* Make sure that the option is legal */
diff --git a/compiler/Makefile b/compiler/Makefile
index f1f175c..3d70282 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -151,6 +151,7 @@ OBJS = \
utobject.o \
utresrc.o \
utstate.o \
+ utxferror.o \
utxface.o
INTERMEDIATES = \
@@ -565,6 +566,9 @@ utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c
utstate.o : $(ACPICA_CORE)/utilities/utstate.c
$(COMPILE)
+utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
+ $(COMPILE)
+
utxface.o : $(ACPICA_CORE)/utilities/utxface.c
$(COMPILE)
diff --git a/compiler/aslanalyze.c b/compiler/aslanalyze.c
index 9679d90..4846c6b 100644
--- a/compiler/aslanalyze.c
+++ b/compiler/aslanalyze.c
@@ -166,7 +166,7 @@ static UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
-BOOLEAN
+static BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
@@ -1754,7 +1754,7 @@ AnOperandTypecheckWalkEnd (
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op)
{
@@ -1862,6 +1862,7 @@ AnOtherSemanticAnalysisWalkBegin (
if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
{
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
+ (PrevArgNode) &&
(PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO))
{
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
diff --git a/compiler/aslcompile.c b/compiler/aslcompile.c
index 5b664ff..f199c5b 100644
--- a/compiler/aslcompile.c
+++ b/compiler/aslcompile.c
@@ -127,12 +127,12 @@ static void
CmFlushSourceCode (
void);
-void
+static void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
-void
+static void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
@@ -345,7 +345,7 @@ CmFlushSourceCode (
*
******************************************************************************/
-void
+static void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status)
@@ -389,7 +389,7 @@ FlConsumeAnsiComment (
}
-void
+static void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status)
diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h
index c097fee..4e97677 100644
--- a/compiler/aslcompiler.h
+++ b/compiler/aslcompiler.h
@@ -686,6 +686,10 @@ ACPI_STATUS
LsDisplayNamespace (
void);
+void
+LsSetupNsList (
+ void *Handle);
+
/*
* aslutils - common compiler utilites
diff --git a/compiler/aslerror.c b/compiler/aslerror.c
index ff24e62..59d3d20 100644
--- a/compiler/aslerror.c
+++ b/compiler/aslerror.c
@@ -304,7 +304,7 @@ AePrintException (
if (Enode->LineNumber)
{
- fprintf (OutputFile, "%6u: ", Enode->LineNumber);
+ fprintf (OutputFile, " %6u: ", Enode->LineNumber);
/*
* Seek to the offset in the combined source file, read the source
@@ -358,7 +358,7 @@ AePrintException (
{
/* Decode the message ID */
- fprintf (OutputFile, "%s %4.4d -",
+ fprintf (OutputFile, "%s %4.4d - ",
AslErrorLevel[Enode->Level],
Enode->MessageId + ((Enode->Level+1) * 1000));
diff --git a/compiler/aslfiles.c b/compiler/aslfiles.c
index 6ba32ca..281b779 100644
--- a/compiler/aslfiles.c
+++ b/compiler/aslfiles.c
@@ -122,7 +122,7 @@
/* Local prototypes */
-FILE *
+static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename);
@@ -546,7 +546,7 @@ FlAddIncludeDirectory (
*
******************************************************************************/
-FILE *
+static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename)
diff --git a/compiler/asllisting.c b/compiler/asllisting.c
index 93f83ad..2ad87d4 100644
--- a/compiler/asllisting.c
+++ b/compiler/asllisting.c
@@ -202,7 +202,7 @@ static void
LsDoHexOutputAsl (
void);
-ACPI_STATUS
+static ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -222,7 +222,7 @@ LsTreeWriteWalk (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
diff --git a/compiler/asllookup.c b/compiler/asllookup.c
index 7cc7232..db909fa 100644
--- a/compiler/asllookup.c
+++ b/compiler/asllookup.c
@@ -180,11 +180,7 @@ LsDoOnePathname (
void *Context,
void **ReturnValue);
-void
-LsSetupNsList (
- void *Handle);
-
-ACPI_PARSE_OBJECT *
+static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op);
@@ -623,7 +619,7 @@ LkObjectExists (
*
******************************************************************************/
-ACPI_PARSE_OBJECT *
+static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op)
{
diff --git a/compiler/aslmain.c b/compiler/aslmain.c
index 39ea7aa..90faff7 100644
--- a/compiler/aslmain.c
+++ b/compiler/aslmain.c
@@ -214,7 +214,7 @@ Options (
printf (" -cr Disable Resource Descriptor error checking\n");
printf (" -r<Revision> Override table header Revision (1-255)\n");
- printf ("\nListings:\n");
+ printf ("\nASL Listing Files:\n");
printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n");
printf (" -ln Create namespace file (*.nsp)\n");
printf (" -ls Create combined source file (expanded includes) (*.src)\n");
@@ -462,6 +462,7 @@ AslDoOptions (
BOOLEAN IsResponseFile)
{
int j;
+ ACPI_STATUS Status;
/* Get the command line options */
@@ -554,7 +555,12 @@ AslDoOptions (
case 'e':
- AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
+ Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("Could not add %s to external list\n", AcpiGbl_Optarg);
+ return (-1);
+ }
break;
@@ -601,7 +607,6 @@ AslDoOptions (
printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
return (-1);
}
- break;
case 'I': /* Add an include file search directory */
@@ -891,6 +896,7 @@ AslCommandLine (
char **argv)
{
int BadCommandLine = 0;
+ ACPI_STATUS Status;
/* Minimum command line contains at least the command and an input file */
@@ -908,7 +914,11 @@ AslCommandLine (
if (Gbl_DoTemplates)
{
- DtCreateTemplates (Gbl_TemplateSignature);
+ Status = DtCreateTemplates (Gbl_TemplateSignature);
+ if (ACPI_FAILURE (Status))
+ {
+ exit (-1);
+ }
exit (1);
}
diff --git a/compiler/aslopcodes.c b/compiler/aslopcodes.c
index 1c6eef7..48aaa50 100644
--- a/compiler/aslopcodes.c
+++ b/compiler/aslopcodes.c
@@ -592,9 +592,9 @@ OpcDoEisaId (
/* Create ID big-endian first (bits are contiguous) */
BigEndianId =
- (UINT32) (InString[0] - 0x40) << 26 |
- (UINT32) (InString[1] - 0x40) << 21 |
- (UINT32) (InString[2] - 0x40) << 16 |
+ (UINT32) ((UINT8) (InString[0] - 0x40)) << 26 |
+ (UINT32) ((UINT8) (InString[1] - 0x40)) << 21 |
+ (UINT32) ((UINT8) (InString[2] - 0x40)) << 16 |
(UtHexCharToValue (InString[3])) << 12 |
(UtHexCharToValue (InString[4])) << 8 |
diff --git a/compiler/aslpredef.c b/compiler/aslpredef.c
index 49056ed..f2c3f59 100644
--- a/compiler/aslpredef.c
+++ b/compiler/aslpredef.c
@@ -117,8 +117,6 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
-#include "amlcode.h"
-#include "acparser.h"
#include "acpredef.h"
diff --git a/compiler/aslrestype1.c b/compiler/aslrestype1.c
index 381fb53..5c1bd0e 100644
--- a/compiler/aslrestype1.c
+++ b/compiler/aslrestype1.c
@@ -224,7 +224,6 @@ RsDoMemory24Descriptor (
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
- ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
@@ -270,7 +269,6 @@ RsDoMemory24Descriptor (
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
- AlignOp = InitializerOp;
break;
case 4: /* Length */
diff --git a/compiler/aslrestype2d.c b/compiler/aslrestype2d.c
index 7725bf9..17ce270 100644
--- a/compiler/aslrestype2d.c
+++ b/compiler/aslrestype2d.c
@@ -347,10 +347,10 @@ RsDoDwordIoDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
- Descriptor->Address32.Minimum,
- Descriptor->Address32.Maximum,
- Descriptor->Address32.AddressLength,
- Descriptor->Address32.Granularity,
+ (UINT64) Descriptor->Address32.Minimum,
+ (UINT64) Descriptor->Address32.Maximum,
+ (UINT64) Descriptor->Address32.AddressLength,
+ (UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@@ -583,10 +583,10 @@ RsDoDwordMemoryDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
- Descriptor->Address32.Minimum,
- Descriptor->Address32.Maximum,
- Descriptor->Address32.AddressLength,
- Descriptor->Address32.Granularity,
+ (UINT64) Descriptor->Address32.Minimum,
+ (UINT64) Descriptor->Address32.Maximum,
+ (UINT64) Descriptor->Address32.AddressLength,
+ (UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@@ -801,10 +801,10 @@ RsDoDwordSpaceDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
- Descriptor->Address32.Minimum,
- Descriptor->Address32.Maximum,
- Descriptor->Address32.AddressLength,
- Descriptor->Address32.Granularity,
+ (UINT64) Descriptor->Address32.Minimum,
+ (UINT64) Descriptor->Address32.Maximum,
+ (UINT64) Descriptor->Address32.AddressLength,
+ (UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
diff --git a/compiler/aslrestype2e.c b/compiler/aslrestype2e.c
index 46f56ce..e5b2bd9 100644
--- a/compiler/aslrestype2e.c
+++ b/compiler/aslrestype2e.c
@@ -116,7 +116,6 @@
#include "aslcompiler.h"
-#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype2e")
diff --git a/compiler/aslrestype2w.c b/compiler/aslrestype2w.c
index 45f1858..a6e6774 100644
--- a/compiler/aslrestype2w.c
+++ b/compiler/aslrestype2w.c
@@ -338,10 +338,10 @@ RsDoWordIoDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
- Descriptor->Address16.Minimum,
- Descriptor->Address16.Maximum,
- Descriptor->Address16.AddressLength,
- Descriptor->Address16.Granularity,
+ (UINT64) Descriptor->Address16.Minimum,
+ (UINT64) Descriptor->Address16.Maximum,
+ (UINT64) Descriptor->Address16.AddressLength,
+ (UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@@ -544,10 +544,10 @@ RsDoWordBusNumberDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
- Descriptor->Address16.Minimum,
- Descriptor->Address16.Maximum,
- Descriptor->Address16.AddressLength,
- Descriptor->Address16.Granularity,
+ (UINT64) Descriptor->Address16.Minimum,
+ (UINT64) Descriptor->Address16.Maximum,
+ (UINT64) Descriptor->Address16.AddressLength,
+ (UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@@ -761,10 +761,10 @@ RsDoWordSpaceDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
- Descriptor->Address16.Minimum,
- Descriptor->Address16.Maximum,
- Descriptor->Address16.AddressLength,
- Descriptor->Address16.Granularity,
+ (UINT64) Descriptor->Address16.Minimum,
+ (UINT64) Descriptor->Address16.Maximum,
+ (UINT64) Descriptor->Address16.AddressLength,
+ (UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
diff --git a/compiler/aslstartup.c b/compiler/aslstartup.c
index 11c4004..0d10143 100644
--- a/compiler/aslstartup.c
+++ b/compiler/aslstartup.c
@@ -124,9 +124,8 @@
#define ASL_MAX_FILES 256
-char *FileList[ASL_MAX_FILES];
-int FileCount;
-BOOLEAN AslToFile = TRUE;
+static char *FileList[ASL_MAX_FILES];
+static BOOLEAN AslToFile = TRUE;
/* Local prototypes */
@@ -136,7 +135,7 @@ AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
-UINT8
+static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
@@ -210,6 +209,7 @@ AsDoWildcard (
#ifdef WIN32
void *DirInfo;
char *Filename;
+ int FileCount;
FileCount = 0;
@@ -277,7 +277,7 @@ AsDoWildcard (
*
******************************************************************************/
-UINT8
+static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info)
{
@@ -397,7 +397,7 @@ AslDoOneFile (
/* Shutdown compiler and ACPICA subsystem */
AeClearErrorLog ();
- AcpiTerminate ();
+ (void) AcpiTerminate ();
/*
* Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
@@ -487,7 +487,7 @@ AslDoOneFile (
}
Status = CmDoCompile ();
- AcpiTerminate ();
+ (void) AcpiTerminate ();
/*
* Return non-zero exit code if there have been errors, unless the
@@ -533,7 +533,7 @@ AslDoOnePathname (
ASL_PATHNAME_CALLBACK PathCallback)
{
ACPI_STATUS Status = AE_OK;
- char **FileList;
+ char **WildcardList;
char *Filename;
char *FullPathname;
@@ -548,16 +548,16 @@ AslDoOnePathname (
/* Expand possible wildcard into a file list (Windows/DOS only) */
- FileList = AsDoWildcard (Gbl_DirectoryPath, Filename);
- while (*FileList)
+ WildcardList = AsDoWildcard (Gbl_DirectoryPath, Filename);
+ while (*WildcardList)
{
FullPathname = ACPI_ALLOCATE (
- strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1);
+ strlen (Gbl_DirectoryPath) + strlen (*WildcardList) + 1);
/* Construct a full path to the file */
strcpy (FullPathname, Gbl_DirectoryPath);
- strcat (FullPathname, *FileList);
+ strcat (FullPathname, *WildcardList);
/*
* If -p not specified, we will use the input filename as the
@@ -573,9 +573,9 @@ AslDoOnePathname (
Status |= (*PathCallback) (FullPathname);
ACPI_FREE (FullPathname);
- ACPI_FREE (*FileList);
- *FileList = NULL;
- FileList++;
+ ACPI_FREE (*WildcardList);
+ *WildcardList = NULL;
+ WildcardList++;
}
ACPI_FREE (Gbl_DirectoryPath);
diff --git a/compiler/dtcompile.c b/compiler/dtcompile.c
index 651bdfa..c287c5b 100644
--- a/compiler/dtcompile.c
+++ b/compiler/dtcompile.c
@@ -127,7 +127,7 @@ static char VersionString[9];
/* Local prototypes */
-static void
+static ACPI_STATUS
DtInitialize (
void);
@@ -166,7 +166,12 @@ DtDoCompile (
/* Initialize globals */
- DtInitialize ();
+ Status = DtInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("Error during compiler initialization, 0x%X\n", Status);
+ return (Status);
+ }
/*
* Scan the input file (file is already open) and
@@ -236,26 +241,38 @@ CleanupAndExit:
*
* PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Initialize data table compiler globals. Enables multiple
* compiles per invocation.
*
*****************************************************************************/
-static void
+static ACPI_STATUS
DtInitialize (
void)
{
+ ACPI_STATUS Status;
- AcpiOsInitialize ();
- AcpiUtInitGlobals ();
+
+ Status = AcpiOsInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtInitGlobals ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
Gbl_FieldList = NULL;
Gbl_RootTable = NULL;
Gbl_SubtableStack = NULL;
sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
+ return (AE_OK);
}
diff --git a/compiler/dtio.c b/compiler/dtio.c
index 4c19ad0..a18ab5f 100644
--- a/compiler/dtio.c
+++ b/compiler/dtio.c
@@ -158,7 +158,7 @@ DtWriteBinary (
#define DT_SLASH_SLASH_COMMENT 4
#define DT_END_COMMENT 5
-UINT32 Gbl_NextLineOffset;
+static UINT32 Gbl_NextLineOffset;
/******************************************************************************
diff --git a/debugger/dbexec.c b/debugger/dbexec.c
index 3555e8f6..56e7de7 100644
--- a/debugger/dbexec.c
+++ b/debugger/dbexec.c
@@ -567,14 +567,12 @@ AcpiDbMethodThread (
if (Info->InitArgs)
{
AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr);
- AcpiDbUInt32ToHexString (ACPI_TO_INTEGER (AcpiOsGetThreadId ()),
- Info->IdOfThreadStr);
+ AcpiDbUInt32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr);
}
if (Info->Threads && (Info->NumCreated < Info->NumThreads))
{
- Info->Threads[Info->NumCreated++] =
- ACPI_TO_INTEGER (AcpiOsGetThreadId());
+ Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId();
}
LocalInfo = *Info;
@@ -722,8 +720,8 @@ AcpiDbCreateExecutionThreads (
/* Array to store IDs of threads */
AcpiGbl_DbMethodInfo.NumThreads = NumThreads;
- Size = 4 * AcpiGbl_DbMethodInfo.NumThreads;
- AcpiGbl_DbMethodInfo.Threads = (UINT32 *) AcpiOsAllocate (Size);
+ Size = sizeof (ACPI_THREAD_ID) * AcpiGbl_DbMethodInfo.NumThreads;
+ AcpiGbl_DbMethodInfo.Threads = AcpiOsAllocate (Size);
if (AcpiGbl_DbMethodInfo.Threads == NULL)
{
AcpiOsPrintf ("No memory for thread IDs array\n");
diff --git a/events/evrgnini.c b/events/evrgnini.c
index 1cce564..9fdda23 100644
--- a/events/evrgnini.c
+++ b/events/evrgnini.c
@@ -395,8 +395,8 @@ AcpiEvPciConfigRegionSetup (
}
/*
- * Get the PCI device and function numbers from the _ADR object contained
- * in the parent's scope.
+ * Get the PCI device and function numbers from the _ADR object
+ * contained in the parent's scope.
*/
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
PciDeviceNode, &PciValue);
@@ -429,9 +429,14 @@ AcpiEvPciConfigRegionSetup (
PciId->Bus = ACPI_LOWORD (PciValue);
}
- /* Complete this device's PciId */
+ /* Complete/update the PCI ID for this device */
- AcpiOsDerivePciId (PciRootNode, RegionObj->Region.Node, &PciId);
+ Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_FREE (PciId);
+ return_ACPI_STATUS (Status);
+ }
*RegionContext = PciId;
return_ACPI_STATUS (AE_OK);
diff --git a/executer/exmutex.c b/executer/exmutex.c
index e9646ca..4f7421d 100644
--- a/executer/exmutex.c
+++ b/executer/exmutex.c
@@ -513,10 +513,10 @@ AcpiExReleaseMutex (
(ObjDesc != AcpiGbl_GlobalLockMutex))
{
ACPI_ERROR ((AE_INFO,
- "Thread %p cannot release Mutex [%4.4s] acquired by thread %p",
- ACPI_CAST_PTR (void, WalkState->Thread->ThreadId),
+ "Thread %u cannot release Mutex [%4.4s] acquired by thread %u",
+ (UINT32) WalkState->Thread->ThreadId,
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
- ACPI_CAST_PTR (void, OwnerThread->ThreadId)));
+ (UINT32) OwnerThread->ThreadId));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
diff --git a/hardware/hwpci.c b/hardware/hwpci.c
new file mode 100644
index 0000000..74c5f87
--- /dev/null
+++ b/hardware/hwpci.c
@@ -0,0 +1,531 @@
+/*******************************************************************************
+ *
+ * Module Name: hwpci - Obtain PCI bus, device, and function numbers
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __HWPCI_C__
+
+#include "acpi.h"
+#include "accommon.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("hwpci")
+
+
+/* PCI configuration space values */
+
+#define PCI_CFG_HEADER_TYPE_REG 0x0E
+#define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18
+#define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19
+
+/* PCI header values */
+
+#define PCI_HEADER_TYPE_MASK 0x7F
+#define PCI_TYPE_BRIDGE 0x01
+#define PCI_TYPE_CARDBUS_BRIDGE 0x02
+
+typedef struct acpi_pci_device
+{
+ ACPI_HANDLE Device;
+ struct acpi_pci_device *Next;
+
+} ACPI_PCI_DEVICE;
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiHwBuildPciList (
+ ACPI_HANDLE RootPciDevice,
+ ACPI_HANDLE PciRegion,
+ ACPI_PCI_DEVICE **ReturnListHead);
+
+static ACPI_STATUS
+AcpiHwProcessPciList (
+ ACPI_PCI_ID *PciId,
+ ACPI_PCI_DEVICE *ListHead);
+
+static void
+AcpiHwDeletePciList (
+ ACPI_PCI_DEVICE *ListHead);
+
+static ACPI_STATUS
+AcpiHwGetPciDeviceInfo (
+ ACPI_PCI_ID *PciId,
+ ACPI_HANDLE PciDevice,
+ UINT16 *BusNumber,
+ BOOLEAN *IsBridge);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwDerivePciId
+ *
+ * PARAMETERS: PciId - Initial values for the PCI ID. May be
+ * modified by this function.
+ * RootPciDevice - A handle to a PCI device object. This
+ * object must be a PCI Root Bridge having a
+ * _HID value of either PNP0A03 or PNP0A08
+ * PciRegion - A handle to a PCI configuration space
+ * Operation Region being initialized
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function derives a full PCI ID for a PCI device,
+ * consisting of a Segment number, Bus number, Device number,
+ * and function code.
+ *
+ * The PCI hardware dynamically configures PCI bus numbers
+ * depending on the bus topology discovered during system
+ * initialization. This function is invoked during configuration
+ * of a PCI_Config Operation Region in order to (possibly) update
+ * the Bus/Device/Function numbers in the PciId with the actual
+ * values as determined by the hardware and operating system
+ * configuration.
+ *
+ * The PciId parameter is initially populated during the Operation
+ * Region initialization. This function is then called, and is
+ * will make any necessary modifications to the Bus, Device, or
+ * Function number PCI ID subfields as appropriate for the
+ * current hardware and OS configuration.
+ *
+ * NOTE: Created 08/2010. Replaces the previous OSL AcpiOsDerivePciId
+ * interface since this feature is OS-independent. This module
+ * specifically avoids any use of recursion by building a local
+ * temporary device list.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwDerivePciId (
+ ACPI_PCI_ID *PciId,
+ ACPI_HANDLE RootPciDevice,
+ ACPI_HANDLE PciRegion)
+{
+ ACPI_STATUS Status;
+ ACPI_PCI_DEVICE *ListHead = NULL;
+
+
+ ACPI_FUNCTION_TRACE (HwDerivePciId);
+
+
+ if (!PciId)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Build a list of PCI devices, from PciRegion up to RootPciDevice */
+
+ Status = AcpiHwBuildPciList (RootPciDevice, PciRegion, &ListHead);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Walk the list, updating the PCI device/function/bus numbers */
+
+ Status = AcpiHwProcessPciList (PciId, ListHead);
+ }
+
+ /* Always delete the list */
+
+ AcpiHwDeletePciList (ListHead);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwBuildPciList
+ *
+ * PARAMETERS: RootPciDevice - A handle to a PCI device object. This
+ * object is guaranteed to be a PCI Root
+ * Bridge having a _HID value of either
+ * PNP0A03 or PNP0A08
+ * PciRegion - A handle to the PCI configuration space
+ * Operation Region
+ * ReturnListHead - Where the PCI device list is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Builds a list of devices from the input PCI region up to the
+ * Root PCI device for this namespace subtree.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwBuildPciList (
+ ACPI_HANDLE RootPciDevice,
+ ACPI_HANDLE PciRegion,
+ ACPI_PCI_DEVICE **ReturnListHead)
+{
+ ACPI_HANDLE CurrentDevice;
+ ACPI_HANDLE ParentDevice;
+ ACPI_STATUS Status;
+ ACPI_PCI_DEVICE *ListElement;
+ ACPI_PCI_DEVICE *ListHead = NULL;
+
+
+ /*
+ * Ascend namespace branch until the RootPciDevice is reached, building
+ * a list of device nodes. Loop will exit when either the PCI device is
+ * found, or the root of the namespace is reached.
+ */
+ CurrentDevice = PciRegion;
+ while (1)
+ {
+ Status = AcpiGetParent (CurrentDevice, &ParentDevice);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */
+
+ if (ParentDevice == RootPciDevice)
+ {
+ *ReturnListHead = ListHead;
+ return (AE_OK);
+ }
+
+ ListElement = ACPI_ALLOCATE (sizeof (ACPI_PCI_DEVICE));
+ if (!ListElement)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Put new element at the head of the list */
+
+ ListElement->Next = ListHead;
+ ListElement->Device = ParentDevice;
+ ListHead = ListElement;
+
+ CurrentDevice = ParentDevice;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwProcessPciList
+ *
+ * PARAMETERS: PciId - Initial values for the PCI ID. May be
+ * modified by this function.
+ * ListHead - Device list created by
+ * AcpiHwBuildPciList
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk downward through the PCI device list, getting the device
+ * info for each, via the PCI configuration space and updating
+ * the PCI ID as necessary. Deletes the list during traversal.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwProcessPciList (
+ ACPI_PCI_ID *PciId,
+ ACPI_PCI_DEVICE *ListHead)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PCI_DEVICE *Info;
+ UINT16 BusNumber;
+ BOOLEAN IsBridge = TRUE;
+
+
+ ACPI_FUNCTION_NAME (HwProcessPciList);
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n",
+ PciId->Segment, PciId->Bus, PciId->Device, PciId->Function));
+
+ BusNumber = PciId->Bus;
+
+ /*
+ * Descend down the namespace tree, collecting PCI device, function,
+ * and bus numbers. BusNumber is only important for PCI bridges.
+ * Algorithm: As we descend the tree, use the last valid PCI device,
+ * function, and bus numbers that are discovered, and assign them
+ * to the PCI ID for the target device.
+ */
+ Info = ListHead;
+ while (Info)
+ {
+ Status = AcpiHwGetPciDeviceInfo (PciId, Info->Device,
+ &BusNumber, &IsBridge);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Info = Info->Next;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X "
+ "Status %X BusNumber %X IsBridge %X\n",
+ PciId->Segment, PciId->Bus, PciId->Device, PciId->Function,
+ Status, BusNumber, IsBridge));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwDeletePciList
+ *
+ * PARAMETERS: ListHead - Device list created by
+ * AcpiHwBuildPciList
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Free the entire PCI list.
+ *
+ ******************************************************************************/
+
+static void
+AcpiHwDeletePciList (
+ ACPI_PCI_DEVICE *ListHead)
+{
+ ACPI_PCI_DEVICE *Next;
+ ACPI_PCI_DEVICE *Previous;
+
+
+ Next = ListHead;
+ while (Next)
+ {
+ Previous = Next;
+ Next = Previous->Next;
+ ACPI_FREE (Previous);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwGetPciDeviceInfo
+ *
+ * PARAMETERS: PciId - Initial values for the PCI ID. May be
+ * modified by this function.
+ * PciDevice - Handle for the PCI device object
+ * BusNumber - Where a PCI bridge bus number is returned
+ * IsBridge - Return value, indicates if this PCI
+ * device is a PCI bridge
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get the device info for a single PCI device object. Get the
+ * _ADR (contains PCI device and function numbers), and for PCI
+ * bridge devices, get the bus number from PCI configuration
+ * space.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwGetPciDeviceInfo (
+ ACPI_PCI_ID *PciId,
+ ACPI_HANDLE PciDevice,
+ UINT16 *BusNumber,
+ BOOLEAN *IsBridge)
+{
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE ObjectType;
+ UINT64 ReturnValue;
+ UINT64 PciValue;
+
+
+ /* We only care about objects of type Device */
+
+ Status = AcpiGetType (PciDevice, &ObjectType);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ if (ObjectType != ACPI_TYPE_DEVICE)
+ {
+ return (AE_OK);
+ }
+
+ /* We need an _ADR. Ignore device if not present */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
+ PciDevice, &ReturnValue);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * From _ADR, get the PCI Device and Function and
+ * update the PCI ID.
+ */
+ PciId->Device = ACPI_HIWORD (ACPI_LODWORD (ReturnValue));
+ PciId->Function = ACPI_LOWORD (ACPI_LODWORD (ReturnValue));
+
+ /*
+ * If the previous device was a bridge, use the previous
+ * device bus number
+ */
+ if (*IsBridge)
+ {
+ PciId->Bus = *BusNumber;
+ }
+
+ /*
+ * Get the bus numbers from PCI Config space:
+ *
+ * First, get the PCI HeaderType
+ */
+ *IsBridge = FALSE;
+ Status = AcpiOsReadPciConfiguration (PciId,
+ PCI_CFG_HEADER_TYPE_REG, &PciValue, 8);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* We only care about bridges (1=PciBridge, 2=CardBusBridge) */
+
+ PciValue &= PCI_HEADER_TYPE_MASK;
+
+ if ((PciValue != PCI_TYPE_BRIDGE) &&
+ (PciValue != PCI_TYPE_CARDBUS_BRIDGE))
+ {
+ return (AE_OK);
+ }
+
+ /* Bridge: Get the Primary BusNumber */
+
+ Status = AcpiOsReadPciConfiguration (PciId,
+ PCI_CFG_PRIMARY_BUS_NUMBER_REG, &PciValue, 8);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ *IsBridge = TRUE;
+ PciId->Bus = (UINT16) PciValue;
+
+ /* Bridge: Get the Secondary BusNumber */
+
+ Status = AcpiOsReadPciConfiguration (PciId,
+ PCI_CFG_SECONDARY_BUS_NUMBER_REG, &PciValue, 8);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ *BusNumber = (UINT16) PciValue;
+ return (AE_OK);
+}
diff --git a/include/acglobal.h b/include/acglobal.h
index 581fc76..2e158fb 100644
--- a/include/acglobal.h
+++ b/include/acglobal.h
@@ -214,6 +214,7 @@ ACPI_TABLE_FADT AcpiGbl_FADT;
UINT32 AcpiCurrentGpeCount;
UINT32 AcpiGbl_TraceFlags;
ACPI_NAME AcpiGbl_TraceMethodName;
+BOOLEAN AcpiGbl_SystemAwakeAndRunning;
#endif
@@ -334,7 +335,6 @@ ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
-ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning;
ACPI_EXTERN UINT8 AcpiGbl_OsiData;
ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces;
diff --git a/include/achware.h b/include/achware.h
index db08293..e63fe3f 100644
--- a/include/achware.h
+++ b/include/achware.h
@@ -251,6 +251,16 @@ AcpiHwEnableRuntimeGpeBlock (
/*
+ * hwpci - PCI configuration support
+ */
+ACPI_STATUS
+AcpiHwDerivePciId (
+ ACPI_PCI_ID *PciId,
+ ACPI_HANDLE RootPciDevice,
+ ACPI_HANDLE PciRegion);
+
+
+/*
* hwtimer - ACPI Timer prototypes
*/
ACPI_STATUS
diff --git a/include/aclocal.h b/include/aclocal.h
index 39b6616..eec3ffc 100644
--- a/include/aclocal.h
+++ b/include/aclocal.h
@@ -1270,7 +1270,7 @@ typedef struct acpi_db_method_info
ACPI_HANDLE MainThreadGate;
ACPI_HANDLE ThreadCompleteGate;
ACPI_HANDLE InfoGate;
- UINT32 *Threads;
+ ACPI_THREAD_ID *Threads;
UINT32 NumThreads;
UINT32 NumCreated;
UINT32 NumCompleted;
diff --git a/include/acmacros.h b/include/acmacros.h
index e9a6f42..417cdc3 100644
--- a/include/acmacros.h
+++ b/include/acmacros.h
@@ -400,8 +400,8 @@
* the plist contains a set of parens to allow variable-length lists.
* These macros are used for both the debug and non-debug versions of the code.
*/
-#define ACPI_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e);
-#define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e);
+#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e);
+#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e);
#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist
#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist
diff --git a/include/acnamesp.h b/include/acnamesp.h
index 5895e06..5840bbc 100644
--- a/include/acnamesp.h
+++ b/include/acnamesp.h
@@ -514,22 +514,6 @@ AcpiNsLocal (
ACPI_OBJECT_TYPE Type);
void
-AcpiNsReportError (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *InternalName,
- ACPI_STATUS LookupStatus);
-
-void
-AcpiNsReportMethodError (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *Message,
- ACPI_NAMESPACE_NODE *Node,
- const char *Path,
- ACPI_STATUS LookupStatus);
-
-void
AcpiNsPrintNodePathname (
ACPI_NAMESPACE_NODE *Node,
const char *Msg);
diff --git a/include/acpiosxf.h b/include/acpiosxf.h
index 3b4e112..9187a4a 100644
--- a/include/acpiosxf.h
+++ b/include/acpiosxf.h
@@ -406,16 +406,6 @@ AcpiOsWritePciConfiguration (
/*
- * Interim function needed for PCI IRQ routing
- */
-void
-AcpiOsDerivePciId(
- ACPI_HANDLE Device,
- ACPI_HANDLE Region,
- ACPI_PCI_ID **PciId);
-
-
-/*
* Miscellaneous
*/
BOOLEAN
diff --git a/include/acpixf.h b/include/acpixf.h
index bf10168..7fac29f 100644
--- a/include/acpixf.h
+++ b/include/acpixf.h
@@ -120,7 +120,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20100806
+#define ACPI_CA_VERSION 0x20100915
#include "actypes.h"
#include "actbl.h"
@@ -130,6 +130,7 @@
*/
extern UINT32 AcpiCurrentGpeCount;
extern ACPI_TABLE_FADT AcpiGbl_FADT;
+extern BOOLEAN AcpiGbl_SystemAwakeAndRunning;
/* Runtime configuration of debug print levels */
diff --git a/include/actypes.h b/include/actypes.h
index 0486f8e..e4290ae 100644
--- a/include/actypes.h
+++ b/include/actypes.h
@@ -188,7 +188,6 @@
*
* ACPI_SIZE 16/32/64-bit unsigned value
* ACPI_NATIVE_INT 16/32/64-bit signed value
- *
*/
/*******************************************************************************
@@ -205,6 +204,16 @@ typedef COMPILER_DEPENDENT_INT64 INT64;
/*! [End] no source code translation !*/
+/*
+ * Value returned by AcpiOsGetThreadId. There is no standard "thread_id"
+ * across operating systems or even the various UNIX systems. Since ACPICA
+ * only needs the thread ID as a unique thread identifier, we use a UINT64
+ * as the only common data type - it will accommodate any type of pointer or
+ * any type of integer. It is up to the host-dependent OSL to cast the
+ * native thread ID type to a UINT64 (in AcpiOsGetThreadId).
+ */
+#define ACPI_THREAD_ID UINT64
+
/*******************************************************************************
*
@@ -286,12 +295,6 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS;
*
******************************************************************************/
-/* Value returned by AcpiOsGetThreadId */
-
-#ifndef ACPI_THREAD_ID
-#define ACPI_THREAD_ID ACPI_SIZE
-#endif
-
/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
#ifndef ACPI_CPU_FLAGS
@@ -456,21 +459,6 @@ typedef UINT8 ACPI_OWNER_ID;
#define ACPI_OWNER_ID_MAX 0xFF
-typedef struct uint64_struct
-{
- UINT32 Lo;
- UINT32 Hi;
-
-} UINT64_STRUCT;
-
-typedef union uint64_overlay
-{
- UINT64 Full;
- UINT64_STRUCT Part;
-
-} UINT64_OVERLAY;
-
-
#define ACPI_INTEGER_BIT_SIZE 64
#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
#define ACPI_MAX64_DECIMAL_DIGITS 20
diff --git a/include/acutils.h b/include/acutils.h
index f729399..2d73da6 100644
--- a/include/acutils.h
+++ b/include/acutils.h
@@ -818,24 +818,6 @@ AcpiUtStrtoul64 (
UINT32 Base,
UINT64 *RetInteger);
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtPredefinedWarning (
- const char *ModuleName,
- UINT32 LineNumber,
- char *Pathname,
- UINT8 NodeFlags,
- const char *Format,
- ...);
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtPredefinedInfo (
- const char *ModuleName,
- UINT32 LineNumber,
- char *Pathname,
- UINT8 NodeFlags,
- const char *Format,
- ...);
-
/* Values for Base above (16=Hex, 10=Decimal) */
#define ACPI_ANY_BASE 0
@@ -985,7 +967,44 @@ AcpiUtCreateList (
UINT16 ObjectSize,
ACPI_MEMORY_LIST **ReturnCache);
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
-#endif
+
+/*
+ * utxferror - various error/warning output functions
+ */
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtPredefinedWarning (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ char *Pathname,
+ UINT8 NodeFlags,
+ const char *Format,
+ ...);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtPredefinedInfo (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ char *Pathname,
+ UINT8 NodeFlags,
+ const char *Format,
+ ...);
+
+void
+AcpiUtNamespaceError (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *InternalName,
+ ACPI_STATUS LookupStatus);
+
+void
+AcpiUtMethodError (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *Message,
+ ACPI_NAMESPACE_NODE *Node,
+ const char *Path,
+ ACPI_STATUS LookupStatus);
#endif /* _ACUTILS_H */
diff --git a/include/platform/accygwin.h b/include/platform/accygwin.h
index 6936024..36c0d6d 100644
--- a/include/platform/accygwin.h
+++ b/include/platform/accygwin.h
@@ -121,7 +121,6 @@
*/
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
-#define ACPI_THREAD_ID pthread_t
#define ACPI_FLUSH_CPU_CACHE()
/*
* This is needed since sem_timedwait does not appear to work properly
@@ -151,13 +150,12 @@
#define __cdecl
#endif
-#ifdef _ANSI
-#define inline
-#endif
-
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (GLptr) Acq=1; else Acq=0;
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 1
+/* On Cygwin, pthread_t is a pointer */
+
+#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread))
/* Cygwin uses GCC */
diff --git a/include/platform/acenv.h b/include/platform/acenv.h
index 0567a00..c709f44 100644
--- a/include/platform/acenv.h
+++ b/include/platform/acenv.h
@@ -275,6 +275,12 @@
#define ACPI_FLUSH_CPU_CACHE()
#endif
+/* "inline" keywords - configurable since inline is not standardized */
+
+#ifndef ACPI_INLINE
+#define ACPI_INLINE
+#endif
+
/*
* Configurable calling conventions:
*
diff --git a/include/platform/acfreebsd.h b/include/platform/acfreebsd.h
index 145b7bb..6c087da 100644
--- a/include/platform/acfreebsd.h
+++ b/include/platform/acfreebsd.h
@@ -139,7 +139,6 @@
#include "opt_acpi.h"
-#define ACPI_THREAD_ID lwpid_t
#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
#ifdef ACPI_DEBUG
@@ -166,8 +165,6 @@
#include <ctype.h>
#endif
-#define ACPI_THREAD_ID pthread_t
-
#define ACPI_USE_STANDARD_HEADERS
#define ACPI_FLUSH_CPU_CACHE()
diff --git a/include/platform/acgcc.h b/include/platform/acgcc.h
index d0098b1..9c7c9b9 100644
--- a/include/platform/acgcc.h
+++ b/include/platform/acgcc.h
@@ -116,6 +116,8 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
+#define ACPI_INLINE __inline__
+
/* Function name is used for debug output. Non-ANSI, compiler-dependent */
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
diff --git a/include/platform/acintel.h b/include/platform/acintel.h
index a7e75ec..415e9b0 100644
--- a/include/platform/acintel.h
+++ b/include/platform/acintel.h
@@ -116,11 +116,11 @@
#ifndef __ACINTEL_H__
#define __ACINTEL_H__
+/* Configuration specific to Intel 64-bit C compiler */
-#define COMPILER_DEPENDENT_INT64 __int64
-#define COMPILER_DEPENDENT_UINT64 unsigned __int64
-
-#define inline __inline
+#define COMPILER_DEPENDENT_INT64 __int64
+#define COMPILER_DEPENDENT_UINT64 unsigned __int64
+#define ACPI_INLINE __inline
/*
* Calling conventions:
@@ -135,20 +135,6 @@
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
-/*
- * Math helper functions
- */
-#define ACPI_DIV_64_BY_32(n, n_hi, n_lo, d32, q32, r32) \
-{ \
- q32 = n / d32; \
- r32 = n % d32; \
-}
-
-#define ACPI_SHIFT_RIGHT_64(n, n_hi, n_lo) \
-{ \
- n <<= 1; \
-}
-
/* remark 981 - operands evaluated in no particular order */
#pragma warning(disable:981)
diff --git a/include/platform/aclinux.h b/include/platform/aclinux.h
index 9009689..4497746 100644
--- a/include/platform/aclinux.h
+++ b/include/platform/aclinux.h
@@ -147,7 +147,6 @@
#define ACPI_CACHE_T struct kmem_cache
#define ACPI_SPINLOCK spinlock_t *
#define ACPI_CPU_FLAGS unsigned long
-#define ACPI_THREAD_ID struct task_struct *
#else /* !__KERNEL__ */
@@ -160,7 +159,7 @@
/* Host-dependent types and defines for user-space ACPICA */
#define ACPI_FLUSH_CPU_CACHE()
-#define ACPI_THREAD_ID pthread_t
+#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread))
#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
diff --git a/include/platform/acmsvc.h b/include/platform/acmsvc.h
index 62e69d1..28a0727 100644
--- a/include/platform/acmsvc.h
+++ b/include/platform/acmsvc.h
@@ -116,8 +116,9 @@
#ifndef __ACMSVC_H__
#define __ACMSVC_H__
-#define COMPILER_DEPENDENT_INT64 __int64
-#define COMPILER_DEPENDENT_UINT64 unsigned __int64
+#define COMPILER_DEPENDENT_INT64 __int64
+#define COMPILER_DEPENDENT_UINT64 unsigned __int64
+#define ACPI_INLINE __inline
/*
* Calling conventions:
@@ -179,5 +180,4 @@
/* warn C4131: uses old-style declarator (iASL compiler only) */
#pragma warning(disable:4131)
-
#endif /* __ACMSVC_H__ */
diff --git a/include/platform/acos2.h b/include/platform/acos2.h
index 90e6b2e..95f97eb 100644
--- a/include/platform/acos2.h
+++ b/include/platform/acos2.h
@@ -158,12 +158,6 @@ unsigned short OSPMReleaseGlobalLock (void *);
n_lo = (unsigned long)(val & 0xffffffff); \
}
-/* IBM VAC does not have inline */
-
-#if __IBMC__ || __IBMCPP__
-#define inline
-#endif
-
#ifndef ACPI_ASL_COMPILER
#define ACPI_USE_LOCAL_CACHE
#undef ACPI_DEBUGGER
diff --git a/include/platform/acwin.h b/include/platform/acwin.h
index 583f677..a6ae807 100644
--- a/include/platform/acwin.h
+++ b/include/platform/acwin.h
@@ -126,8 +126,6 @@
#define ACPI_MACHINE_WIDTH 32
-#define inline __inline
-
#define ACPI_USE_STANDARD_HEADERS
#ifdef ACPI_DEFINE_ALTERNATE_TYPES
diff --git a/include/platform/acwin64.h b/include/platform/acwin64.h
index 64c1f99..076f586 100644
--- a/include/platform/acwin64.h
+++ b/include/platform/acwin64.h
@@ -1,6 +1,6 @@
/******************************************************************************
*
- * Name: acwin.h - OS specific defines, etc.
+ * Name: acwin64.h - OS specific defines, etc.
*
*****************************************************************************/
diff --git a/namespace/nsrepair2.c b/namespace/nsrepair2.c
index 6ac7d6c..1464a3b 100644
--- a/namespace/nsrepair2.c
+++ b/namespace/nsrepair2.c
@@ -153,11 +153,21 @@ AcpiNsRepair_ALR (
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
+AcpiNsRepair_CID (
+ ACPI_PREDEFINED_DATA *Data,
+ ACPI_OPERAND_OBJECT **ReturnObjectPtr);
+
+static ACPI_STATUS
AcpiNsRepair_FDE (
ACPI_PREDEFINED_DATA *Data,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
+AcpiNsRepair_HID (
+ ACPI_PREDEFINED_DATA *Data,
+ ACPI_OPERAND_OBJECT **ReturnObjectPtr);
+
+static ACPI_STATUS
AcpiNsRepair_PSS (
ACPI_PREDEFINED_DATA *Data,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
@@ -196,8 +206,10 @@ AcpiNsSortList (
* As necessary:
*
* _ALR: Sort the list ascending by AmbientIlluminance
+ * _CID: Strings: uppercase all, remove any leading asterisk
* _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
* _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
+ * _HID: Strings: uppercase all, remove any leading asterisk
* _PSS: Sort the list descending by Power
* _TSS: Sort the list descending by Power
*
@@ -211,8 +223,10 @@ AcpiNsSortList (
static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] =
{
{"_ALR", AcpiNsRepair_ALR},
+ {"_CID", AcpiNsRepair_CID},
{"_FDE", AcpiNsRepair_FDE},
{"_GTM", AcpiNsRepair_FDE}, /* _GTM has same repair as _FDE */
+ {"_HID", AcpiNsRepair_HID},
{"_PSS", AcpiNsRepair_PSS},
{"_TSS", AcpiNsRepair_TSS},
{{0,0,0,0}, NULL} /* Table terminator */
@@ -427,6 +441,172 @@ AcpiNsRepair_FDE (
/******************************************************************************
*
+ * FUNCTION: AcpiNsRepair_CID
+ *
+ * PARAMETERS: Data - Pointer to validation data structure
+ * ReturnObjectPtr - Pointer to the object returned from the
+ * evaluation of a method or object
+ *
+ * RETURN: Status. AE_OK if object is OK or was repaired successfully
+ *
+ * DESCRIPTION: Repair for the _CID object. If a string, ensure that all
+ * letters are uppercase and that there is no leading asterisk.
+ * If a Package, ensure same for all string elements.
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+AcpiNsRepair_CID (
+ ACPI_PREDEFINED_DATA *Data,
+ ACPI_OPERAND_OBJECT **ReturnObjectPtr)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
+ ACPI_OPERAND_OBJECT **ElementPtr;
+ ACPI_OPERAND_OBJECT *OriginalElement;
+ UINT16 OriginalRefCount;
+ UINT32 i;
+
+
+ /* Check for _CID as a simple string */
+
+ if (ReturnObject->Common.Type == ACPI_TYPE_STRING)
+ {
+ Status = AcpiNsRepair_HID (Data, ReturnObjectPtr);
+ return (Status);
+ }
+
+ /* Exit if not a Package */
+
+ if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE)
+ {
+ return (AE_OK);
+ }
+
+ /* Examine each element of the _CID package */
+
+ ElementPtr = ReturnObject->Package.Elements;
+ for (i = 0; i < ReturnObject->Package.Count; i++)
+ {
+ OriginalElement = *ElementPtr;
+ OriginalRefCount = OriginalElement->Common.ReferenceCount;
+
+ Status = AcpiNsRepair_HID (Data, ElementPtr);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Take care with reference counts */
+
+ if (OriginalElement != *ElementPtr)
+ {
+ /* Element was replaced */
+
+ (*ElementPtr)->Common.ReferenceCount =
+ OriginalRefCount;
+
+ AcpiUtRemoveReference (OriginalElement);
+ }
+
+ ElementPtr++;
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiNsRepair_HID
+ *
+ * PARAMETERS: Data - Pointer to validation data structure
+ * ReturnObjectPtr - Pointer to the object returned from the
+ * evaluation of a method or object
+ *
+ * RETURN: Status. AE_OK if object is OK or was repaired successfully
+ *
+ * DESCRIPTION: Repair for the _HID object. If a string, ensure that all
+ * letters are uppercase and that there is no leading asterisk.
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+AcpiNsRepair_HID (
+ ACPI_PREDEFINED_DATA *Data,
+ ACPI_OPERAND_OBJECT **ReturnObjectPtr)
+{
+ ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
+ ACPI_OPERAND_OBJECT *NewString;
+ char *Source;
+ char *Dest;
+
+
+ ACPI_FUNCTION_NAME (NsRepair_HID);
+
+
+ /* We only care about string _HID objects (not integers) */
+
+ if (ReturnObject->Common.Type != ACPI_TYPE_STRING)
+ {
+ return (AE_OK);
+ }
+
+ if (ReturnObject->String.Length == 0)
+ {
+ ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
+ "Invalid zero-length _HID or _CID string"));
+
+ /* Return AE_OK anyway, let driver handle it */
+
+ Data->Flags |= ACPI_OBJECT_REPAIRED;
+ return (AE_OK);
+ }
+
+ /* It is simplest to always create a new string object */
+
+ NewString = AcpiUtCreateStringObject (ReturnObject->String.Length);
+ if (!NewString)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /*
+ * Remove a leading asterisk if present. For some unknown reason, there
+ * are many machines in the field that contains IDs like this.
+ *
+ * Examples: "*PNP0C03", "*ACPI0003"
+ */
+ Source = ReturnObject->String.Pointer;
+ if (*Source == '*')
+ {
+ Source++;
+ NewString->String.Length--;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+ "%s: Removed invalid leading asterisk\n", Data->Pathname));
+ }
+
+ /*
+ * Copy and uppercase the string. From the ACPI specification:
+ *
+ * A valid PNP ID must be of the form "AAA####" where A is an uppercase
+ * letter and # is a hex digit. A valid ACPI ID must be of the form
+ * "ACPI####" where # is a hex digit.
+ */
+ for (Dest = NewString->String.Pointer; *Source; Dest++, Source++)
+ {
+ *Dest = (char) ACPI_TOUPPER (*Source);
+ }
+
+ AcpiUtRemoveReference (ReturnObject);
+ *ReturnObjectPtr = NewString;
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AcpiNsRepair_TSS
*
* PARAMETERS: Data - Pointer to validation data structure
diff --git a/namespace/nsutils.c b/namespace/nsutils.c
index fc6140c..aee9adc 100644
--- a/namespace/nsutils.c
+++ b/namespace/nsutils.c
@@ -139,118 +139,6 @@ AcpiNsFindParentName (
/*******************************************************************************
*
- * FUNCTION: AcpiNsReportError
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * InternalName - Name or path of the namespace node
- * LookupStatus - Exception code from NS lookup
- *
- * RETURN: None
- *
- * DESCRIPTION: Print warning message with full pathname
- *
- ******************************************************************************/
-
-void
-AcpiNsReportError (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *InternalName,
- ACPI_STATUS LookupStatus)
-{
- ACPI_STATUS Status;
- UINT32 BadName;
- char *Name = NULL;
-
-
- AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
-
- if (LookupStatus == AE_BAD_CHARACTER)
- {
- /* There is a non-ascii character in the name */
-
- ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
- AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName);
- }
- else
- {
- /* Convert path to external format */
-
- Status = AcpiNsExternalizeName (ACPI_UINT32_MAX,
- InternalName, NULL, &Name);
-
- /* Print target name */
-
- if (ACPI_SUCCESS (Status))
- {
- AcpiOsPrintf ("[%s]", Name);
- }
- else
- {
- AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
- }
-
- if (Name)
- {
- ACPI_FREE (Name);
- }
- }
-
- AcpiOsPrintf (" Namespace lookup failure, %s\n",
- AcpiFormatException (LookupStatus));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsReportMethodError
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * Message - Error message to use on failure
- * PrefixNode - Prefix relative to the path
- * Path - Path to the node (optional)
- * MethodStatus - Execution status
- *
- * RETURN: None
- *
- * DESCRIPTION: Print warning message with full pathname
- *
- ******************************************************************************/
-
-void
-AcpiNsReportMethodError (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *Message,
- ACPI_NAMESPACE_NODE *PrefixNode,
- const char *Path,
- ACPI_STATUS MethodStatus)
-{
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node = PrefixNode;
-
-
- AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
-
- if (Path)
- {
- Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
- &Node);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("[Could not get node by pathname]");
- }
- }
-
- AcpiNsPrintNodePathname (Node, Message);
- AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus));
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsPrintNodePathname
*
* PARAMETERS: Node - Object
diff --git a/os_specific/service_layers/osunixxf.c b/os_specific/service_layers/osunixxf.c
index 70c40d8..78fa435 100644
--- a/os_specific/service_layers/osunixxf.c
+++ b/os_specific/service_layers/osunixxf.c
@@ -972,16 +972,6 @@ AcpiOsWritePciConfiguration (
return (AE_OK);
}
-/* TEMPORARY STUB FUNCTION */
-void
-AcpiOsDerivePciId(
- ACPI_HANDLE Device,
- ACPI_HANDLE Region,
- ACPI_PCI_ID **PciId)
-{
-
-}
-
/******************************************************************************
*
@@ -1168,16 +1158,14 @@ AcpiOsWritable (
*
* DESCRIPTION: Get the Id of the current (running) thread
*
- * NOTE: The environment header should contain this line:
- * #define ACPI_THREAD_ID pthread_t
- *
*****************************************************************************/
ACPI_THREAD_ID
-AcpiOsGetThreadId (void)
+AcpiOsGetThreadId (
+ void)
{
- return (pthread_self ());
+ return (ACPI_CAST_PTHREAD_T (pthread_self()));
}
diff --git a/os_specific/service_layers/oswintbl.c b/os_specific/service_layers/oswintbl.c
index db609ee..62df4c0 100644
--- a/os_specific/service_layers/oswintbl.c
+++ b/os_specific/service_layers/oswintbl.c
@@ -116,16 +116,13 @@
#ifdef WIN32
#pragma warning(disable:4115) /* warning C4115: (caused by rpcasync.h) */
-
#include <windows.h>
-#include <winbase.h>
#elif WIN64
#include <windowsx.h>
#endif
#include "acpi.h"
-#include "accommon.h"
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("oswintbl")
diff --git a/os_specific/service_layers/oswinxf.c b/os_specific/service_layers/oswinxf.c
index 8a799b0..cf19603 100644
--- a/os_specific/service_layers/oswinxf.c
+++ b/os_specific/service_layers/oswinxf.c
@@ -1077,7 +1077,7 @@ AcpiOsGetThreadId (
/* Ensure ID is never 0 */
ThreadId = GetCurrentThreadId ();
- return (ThreadId + 1);
+ return ((ACPI_THREAD_ID) (ThreadId + 1));
}
@@ -1209,17 +1209,6 @@ AcpiOsWritePciConfiguration (
return (AE_OK);
}
-/* TEMPORARY STUB FUNCTION */
-void
-AcpiOsDerivePciId(
- ACPI_HANDLE Device,
- ACPI_HANDLE Region,
- ACPI_PCI_ID **PciId)
-{
-
- return;
-}
-
/******************************************************************************
*
diff --git a/osunixxf.c b/osunixxf.c
index 70c40d8..78fa435 100644
--- a/osunixxf.c
+++ b/osunixxf.c
@@ -972,16 +972,6 @@ AcpiOsWritePciConfiguration (
return (AE_OK);
}
-/* TEMPORARY STUB FUNCTION */
-void
-AcpiOsDerivePciId(
- ACPI_HANDLE Device,
- ACPI_HANDLE Region,
- ACPI_PCI_ID **PciId)
-{
-
-}
-
/******************************************************************************
*
@@ -1168,16 +1158,14 @@ AcpiOsWritable (
*
* DESCRIPTION: Get the Id of the current (running) thread
*
- * NOTE: The environment header should contain this line:
- * #define ACPI_THREAD_ID pthread_t
- *
*****************************************************************************/
ACPI_THREAD_ID
-AcpiOsGetThreadId (void)
+AcpiOsGetThreadId (
+ void)
{
- return (pthread_self ());
+ return (ACPI_CAST_PTHREAD_T (pthread_self()));
}
diff --git a/tables/tbfadt.c b/tables/tbfadt.c
index 9ae4669..a86a55c 100644
--- a/tables/tbfadt.c
+++ b/tables/tbfadt.c
@@ -124,7 +124,7 @@
/* Local prototypes */
-static inline void
+static ACPI_INLINE void
AcpiTbInitGenericAddress (
ACPI_GENERIC_ADDRESS *GenericAddress,
UINT8 SpaceId,
@@ -273,7 +273,7 @@ static ACPI_FADT_PM_INFO FadtPmInfoTable[] =
*
******************************************************************************/
-static inline void
+static ACPI_INLINE void
AcpiTbInitGenericAddress (
ACPI_GENERIC_ADDRESS *GenericAddress,
UINT8 SpaceId,
diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile
index 5fbe795..102c33d 100644
--- a/tools/acpiexec/Makefile
+++ b/tools/acpiexec/Makefile
@@ -89,6 +89,7 @@ OBJS = \
getopt.o \
hwacpi.o \
hwgpe.o \
+ hwpci.o \
hwregs.o \
hwsleep.o \
hwvalid.o \
@@ -158,6 +159,7 @@ OBJS = \
utstate.o \
uttrack.o \
utosi.o \
+ utxferror.o \
utxface.o
@@ -396,6 +398,9 @@ hwacpi.o : $(ACPICA_CORE)/hardware/hwacpi.c
hwgpe.o : $(ACPICA_CORE)/hardware/hwgpe.c
$(COMPILE)
+hwpci.o : $(ACPICA_CORE)/hardware/hwpci.c
+ $(COMPILE)
+
hwregs.o : $(ACPICA_CORE)/hardware/hwregs.c
$(COMPILE)
@@ -600,6 +605,9 @@ uttrack.o : $(ACPICA_CORE)/utilities/uttrack.c
utosi.o : $(ACPICA_CORE)/utilities/utosi.c
$(COMPILE)
+utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
+ $(COMPILE)
+
utxface.o : $(ACPICA_CORE)/utilities/utxface.c
$(COMPILE)
diff --git a/tools/acpiexec/aecommon.h b/tools/acpiexec/aecommon.h
index 7608c5d..3b7d36d 100644
--- a/tools/acpiexec/aecommon.h
+++ b/tools/acpiexec/aecommon.h
@@ -139,6 +139,18 @@ extern FILE *AcpiGbl_DebugFile;
extern BOOLEAN AcpiGbl_IgnoreErrors;
extern UINT8 AcpiGbl_RegionFillValue;
+/* Check for unexpected exceptions */
+
+#define AE_CHECK_STATUS(Name, Status, Expected) \
+ if (Status != Expected) \
+ { \
+ AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
+ AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
+ }
+
+/* Check for unexpected non-AE_OK errors */
+
+#define AE_CHECK_OK(Name, Status) AE_CHECK_STATUS (Name, Status, AE_OK);
typedef struct ae_table_desc
{
@@ -173,7 +185,7 @@ typedef struct ae_debug_regions
#define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
AcpiOsPrintf PARAM_LIST(fp);}
-void __cdecl
+void ACPI_SYSTEM_XFACE
AeCtrlCHandler (
int Sig);
diff --git a/tools/acpiexec/aeexec.c b/tools/acpiexec/aeexec.c
index 948b227..baf1aeb 100644
--- a/tools/acpiexec/aeexec.c
+++ b/tools/acpiexec/aeexec.c
@@ -120,39 +120,39 @@
/* Local prototypes */
-ACPI_STATUS
+static ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr);
-void
+static void
AfInstallGpeBlock (
void);
-void
+static void
AeTestBufferArgument (
void);
-void
+static void
AeTestPackageArgument (
void);
-ACPI_STATUS
+static ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
-ACPI_STATUS
+static ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT32 ExpectedResult);
-void
+static void
AeHardwareInterfaces (
void);
-void
+static void
AeGenericRegisters (
void);
@@ -172,11 +172,10 @@ extern unsigned char Ssdt3Code[];
*
*****************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr)
{
- ACPI_STATUS Status;
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg[3];
@@ -190,8 +189,7 @@ AeSetupConfiguration (
Arg[0].Type = ACPI_TYPE_INTEGER;
Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
- Status = AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
-
+ (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
return (AE_OK);
}
@@ -209,7 +207,7 @@ AeSetupConfiguration (
*
*****************************************************************************/
-void
+static void
AfInstallGpeBlock (
void)
{
@@ -235,33 +233,46 @@ AfInstallGpeBlock (
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
+ AE_CHECK_OK (AcpiInstallGpeBlock, Status);
- AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (Handle2, 8);
+ Status = AcpiInstallGpeHandler (Handle2, 8,
+ ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiEnableGpe (Handle2, 8);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiGetGpeDevice (0x30, &GpeDevice);
+ AE_CHECK_OK (AcpiGetGpeDevice, Status);
+
Status = AcpiGetGpeDevice (0x42, &GpeDevice);
+ AE_CHECK_OK (AcpiGetGpeDevice, Status);
+
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
+ AE_CHECK_OK (AcpiGetGpeDevice, Status);
+
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
+ AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
- AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
+ Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
+ AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
}
Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
+ AE_CHECK_OK (AcpiInstallGpeBlock, Status);
}
}
/* Test using a Buffer object as a method argument */
-void
+static void
AeTestBufferArgument (
void)
{
- ACPI_STATUS Status;
ACPI_OBJECT_LIST Params;
ACPI_OBJECT BufArg;
UINT8 Buffer[] = {
@@ -277,26 +288,23 @@ AeTestBufferArgument (
Params.Count = 1;
Params.Pointer = &BufArg;
-
- Status = AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
+ (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
}
-ACPI_OBJECT PkgArg;
-ACPI_OBJECT PkgElements[5];
-ACPI_OBJECT Pkg2Elements[5];
-ACPI_OBJECT_LIST Params;
+static ACPI_OBJECT PkgArg;
+static ACPI_OBJECT PkgElements[5];
+static ACPI_OBJECT Pkg2Elements[5];
+static ACPI_OBJECT_LIST Params;
/*
* Test using a Package object as an method argument
*/
-void
+static void
AeTestPackageArgument (
void)
{
- ACPI_STATUS Status;
-
/* Main package */
@@ -335,11 +343,11 @@ AeTestPackageArgument (
Params.Count = 1;
Params.Pointer = &PkgArg;
- Status = AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
+ (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
}
-ACPI_STATUS
+static ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -364,7 +372,7 @@ AeGetDevices (
*
*****************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT32 ExpectedResult)
@@ -434,9 +442,9 @@ ExecuteOSI (
*
*****************************************************************************/
-ACPI_GENERIC_ADDRESS GenericRegister;
+static ACPI_GENERIC_ADDRESS GenericRegister;
-void
+static void
AeGenericRegisters (
void)
{
@@ -450,14 +458,20 @@ AeGenericRegisters (
GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
Status = AcpiRead (&Value, &GenericRegister);
+ AE_CHECK_OK (AcpiRead, Status);
+
Status = AcpiWrite (Value, &GenericRegister);
+ AE_CHECK_OK (AcpiWrite, Status);
GenericRegister.Address = 0x12345678;
GenericRegister.BitOffset = 0;
GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
Status = AcpiRead (&Value, &GenericRegister);
+ AE_CHECK_OK (AcpiRead, Status);
+
Status = AcpiWrite (Value, &GenericRegister);
+ AE_CHECK_OK (AcpiWrite, Status);
}
@@ -469,7 +483,7 @@ AeGenericRegisters (
*
*****************************************************************************/
-void
+static void
AeHardwareInterfaces (
void)
{
@@ -478,14 +492,29 @@ AeHardwareInterfaces (
Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
+ AE_CHECK_OK (AcpiWriteBitRegister, Status);
+
Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
+ AE_CHECK_OK (AcpiWriteBitRegister, Status);
+
Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
+ AE_CHECK_OK (AcpiWriteBitRegister, Status);
+
Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
+ AE_CHECK_OK (AcpiWriteBitRegister, Status);
+
Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
+ AE_CHECK_OK (AcpiReadBitRegister, Status);
+
Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
+ AE_CHECK_OK (AcpiReadBitRegister, Status);
+
Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
+ AE_CHECK_OK (AcpiReadBitRegister, Status);
+
Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
+ AE_CHECK_OK (AcpiReadBitRegister, Status);
}
@@ -519,52 +548,108 @@ AeMiscellaneousTests (
AeTestPackageArgument ();
- AcpiInstallInterface ("");
- AcpiInstallInterface ("TestString");
- AcpiInstallInterface ("TestString");
- AcpiRemoveInterface ("Windows 2006");
- AcpiRemoveInterface ("TestString");
- AcpiRemoveInterface ("XXXXXX");
- AcpiInstallInterface ("AnotherTestString");
+ Status = AcpiInstallInterface ("");
+ AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
+
+ Status = AcpiInstallInterface ("TestString");
+ AE_CHECK_OK (AcpiInstallInterface, Status);
+
+ Status = AcpiInstallInterface ("TestString");
+ AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
+
+ Status = AcpiRemoveInterface ("Windows 2006");
+ AE_CHECK_OK (AcpiRemoveInterface, Status);
+
+ Status = AcpiRemoveInterface ("TestString");
+ AE_CHECK_OK (AcpiRemoveInterface, Status);
+
+ Status = AcpiRemoveInterface ("XXXXXX");
+ AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
+
+ Status = AcpiInstallInterface ("AnotherTestString");
+ AE_CHECK_OK (AcpiInstallInterface, Status);
+
+
+ Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
+ AE_CHECK_OK (ExecuteOSI, Status);
- ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
- ExecuteOSI ("MichiganTerminalSystem", 0);
+ Status = ExecuteOSI ("MichiganTerminalSystem", 0);
+ AE_CHECK_OK (ExecuteOSI, Status);
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
- AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
- AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
+ Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
+ AE_CHECK_OK (AcpiGetName, Status);
+
+ Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
+ AE_CHECK_OK (AcpiEnableEvent, Status);
/*
* GPEs: Handlers, enable/disable, etc.
*/
- AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (NULL, 0);
- AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
+ Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiEnableGpe (NULL, 0);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
+
+ Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
+ AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
+
+ Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiEnableGpe (NULL, 0);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
+
+ Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
+ AE_CHECK_OK (AcpiSetGpe, Status);
+
+ Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
+ AE_CHECK_OK (AcpiSetGpe, Status);
+
+
+ Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiEnableGpe (NULL, 1);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
+
+
+ Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiEnableGpe (NULL, 2);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
+
+
+ Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
+ Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
+
- AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (NULL, 0);
- AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
- AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
+ Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
- AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (NULL, 1);
+ Status = AcpiEnableGpe (NULL, 0x19);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
- AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (NULL, 2);
- AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
- AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
+ Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
+ AE_CHECK_OK (AcpiInstallGpeHandler, Status);
- AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (NULL, 0x19);
+ Status = AcpiEnableGpe (NULL, 0x62);
+ AE_CHECK_OK (AcpiEnableGpe, Status);
- AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
- AcpiEnableGpe (NULL, 0x62);
- AcpiDisableGpe (NULL, 0x62);
+ Status = AcpiDisableGpe (NULL, 0x62);
+ AE_CHECK_OK (AcpiDisableGpe, Status);
AfInstallGpeBlock ();
@@ -584,41 +669,23 @@ AeMiscellaneousTests (
/* Test global lock */
Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status);
- }
+ AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status);
- }
+ AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle1);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status);
- }
+ AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle2);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status);
- }
+ AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
/* Get Devices */
Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not AcpiGetDevices, %X\n", Status);
- }
+ AE_CHECK_OK (AcpiGetDevices, Status);
Status = AcpiGetStatistics (&Stats);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not AcpiGetStatistics, %X\n", Status);
- }
+ AE_CHECK_OK (AcpiGetStatistics, Status);
}
diff --git a/tools/acpiexec/aehandlers.c b/tools/acpiexec/aehandlers.c
index d4749c9..1f9b1f6 100644
--- a/tools/acpiexec/aehandlers.c
+++ b/tools/acpiexec/aehandlers.c
@@ -120,19 +120,19 @@
/* Local prototypes */
-void
+static void
AeNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
void *Context);
-void
+static void
AeDeviceNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
void *Context);
-ACPI_STATUS
+static ACPI_STATUS
AeExceptionHandler (
ACPI_STATUS AmlStatus,
ACPI_NAME Name,
@@ -140,31 +140,31 @@ AeExceptionHandler (
UINT32 AmlOffset,
void *Context);
-ACPI_STATUS
+static ACPI_STATUS
AeTableHandler (
UINT32 Event,
void *Table,
void *Context);
-ACPI_STATUS
+static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
void *HandlerContext,
void **RegionContext);
-void
+static void
AeAttachedDataHandler (
ACPI_HANDLE Object,
void *Data);
-UINT32
+static UINT32
AeInterfaceHandler (
ACPI_STRING InterfaceName,
UINT32 Supported);
-UINT32 SigintCount = 0;
-AE_DEBUG_REGIONS AeRegions;
+static UINT32 SigintCount = 0;
+static AE_DEBUG_REGIONS AeRegions;
/******************************************************************************
@@ -179,7 +179,7 @@ AE_DEBUG_REGIONS AeRegions;
*
*****************************************************************************/
-void __cdecl
+void ACPI_SYSTEM_XFACE
AeCtrlCHandler (
int Sig)
{
@@ -218,7 +218,7 @@ AeCtrlCHandler (
*
*****************************************************************************/
-void
+static void
AeNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
@@ -268,7 +268,6 @@ AeNotifyHandler (
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
break;
}
-
}
@@ -286,7 +285,7 @@ AeNotifyHandler (
*
*****************************************************************************/
-void
+static void
AeDeviceNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
@@ -317,7 +316,7 @@ AeDeviceNotifyHandler (
*
*****************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AeExceptionHandler (
ACPI_STATUS AmlStatus,
ACPI_NAME Name,
@@ -361,7 +360,7 @@ AeExceptionHandler (
Arg[1].String.Length = ACPI_STRLEN (Exception);
Arg[2].Type = ACPI_TYPE_INTEGER;
- Arg[2].Integer.Value = ACPI_TO_INTEGER (AcpiOsGetThreadId());
+ Arg[2].Integer.Value = AcpiOsGetThreadId();
/* Setup return buffer */
@@ -416,14 +415,14 @@ AeExceptionHandler (
*
*****************************************************************************/
-char *TableEvents[] =
+static char *TableEvents[] =
{
"LOAD",
"UNLOAD",
"UNKNOWN"
};
-ACPI_STATUS
+static ACPI_STATUS
AeTableHandler (
UINT32 Event,
void *Table,
@@ -469,7 +468,7 @@ AeGpeHandler (
*
*****************************************************************************/
-void
+static void
AeAttachedDataHandler (
ACPI_HANDLE Object,
void *Data)
@@ -490,7 +489,7 @@ AeAttachedDataHandler (
*
*****************************************************************************/
-UINT32
+static UINT32
AeInterfaceHandler (
ACPI_STRING InterfaceName,
UINT32 Supported)
@@ -518,7 +517,7 @@ AeInterfaceHandler (
*
*****************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
@@ -530,7 +529,7 @@ AeRegionInit (
*/
*RegionContext = RegionHandle;
- return AE_OK;
+ return (AE_OK);
}
@@ -544,10 +543,13 @@ AeRegionInit (
*
* DESCRIPTION: Install handlers for the AcpiExec utility.
*
+ * Notes: Don't install handler for PCI_Config, we want to use the
+ * default handler to exercise that code.
+ *
*****************************************************************************/
-ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 5, 6, 7, 0x80};
-#define AEXEC_NUM_REGIONS 9
+static ACPI_ADR_SPACE_TYPE SpaceIdList[] = {0, 1, 3, 4, 5, 6, 7, 0x80};
+#define AEXEC_NUM_REGIONS 8
ACPI_STATUS
AeInstallHandlers (void)
@@ -620,8 +622,12 @@ AeInstallHandlers (void)
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
AeNotifyHandler, NULL);
+ AE_CHECK_OK (AcpiInstallNotifyHandler, Status);
+
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
AeNotifyHandler);
+ AE_CHECK_OK (AcpiRemoveNotifyHandler, Status);
+
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
AeNotifyHandler, NULL);
if (ACPI_FAILURE (Status))
@@ -631,8 +637,13 @@ AeInstallHandlers (void)
}
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
+ AE_CHECK_OK (AcpiAttachData, Status);
+
Status = AcpiDetachData (Handle, AeAttachedDataHandler);
+ AE_CHECK_OK (AcpiDetachData, Status);
+
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
+ AE_CHECK_OK (AcpiAttachData, Status);
}
else
{
@@ -643,19 +654,21 @@ AeInstallHandlers (void)
for (i = 0; i < AEXEC_NUM_REGIONS; i++)
{
- Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
- SpaceId[i], AeRegionHandler);
+ /* Remove any existing handler */
+
+ (void) AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
+ SpaceIdList[i], AeRegionHandler);
/* Install handler at the root object.
* TBD: all default handlers should be installed here!
*/
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
- SpaceId[i], AeRegionHandler, AeRegionInit, NULL);
+ SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
- AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i]));
+ AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
return (Status);
}
}
@@ -667,7 +680,7 @@ AeInstallHandlers (void)
AeRegions.NumberOfRegions = 0;
AeRegions.RegionList = NULL;
- return Status;
+ return (Status);
}
@@ -714,7 +727,7 @@ AeRegionHandler (
*/
if (RegionObject->Region.Type != ACPI_TYPE_REGION)
{
- return AE_OK;
+ return (AE_OK);
}
/*
@@ -756,10 +769,12 @@ AeRegionHandler (
{
case ACPI_READ:
Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth);
+ AE_CHECK_OK (AcpiHwReadPort, Status);
break;
case ACPI_WRITE:
Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth);
+ AE_CHECK_OK (AcpiHwWritePort, Status);
break;
default:
@@ -903,14 +918,14 @@ AeRegionHandler (
RegionElement = AcpiOsAllocate (sizeof (AE_REGION));
if (!RegionElement)
{
- return AE_NO_MEMORY;
+ return (AE_NO_MEMORY);
}
RegionElement->Buffer = AcpiOsAllocate (Length);
if (!RegionElement->Buffer)
{
AcpiOsFree (RegionElement);
- return AE_NO_MEMORY;
+ return (AE_NO_MEMORY);
}
/* Initialize the region with the default fill value */
@@ -963,7 +978,7 @@ AeRegionHandler (
ByteWidth, (UINT32)(RegionElement->Address),
RegionElement->Length));
- return AE_AML_REGION_LIMIT;
+ return (AE_AML_REGION_LIMIT);
}
/*
@@ -994,9 +1009,10 @@ DoFunction:
break;
default:
- return AE_BAD_PARAMETER;
+ return (AE_BAD_PARAMETER);
}
- return AE_OK;
+
+ return (AE_OK);
}
diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c
index 050ba28..5773a69 100644
--- a/tools/acpiexec/aemain.c
+++ b/tools/acpiexec/aemain.c
@@ -122,17 +122,18 @@
#define _COMPONENT PARSER
ACPI_MODULE_NAME ("aemain")
-UINT8 AcpiGbl_BatchMode = 0;
-UINT8 AcpiGbl_RegionFillValue = 0;
-BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
-BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
-BOOLEAN AcpiGbl_DebugTimeout = FALSE;
-char BatchBuffer[128];
-AE_TABLE_DESC *AeTableListHead = NULL;
+
+UINT8 AcpiGbl_RegionFillValue = 0;
+BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
+BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
+BOOLEAN AcpiGbl_DebugTimeout = FALSE;
+
+static UINT8 AcpiGbl_BatchMode = 0;
+static char BatchBuffer[128];
+static AE_TABLE_DESC *AeTableListHead = NULL;
#define ASL_MAX_FILES 256
-char *FileList[ASL_MAX_FILES];
-int FileCount;
+static char *FileList[ASL_MAX_FILES];
#define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:"
@@ -203,6 +204,7 @@ AcpiDbRunBatchMode (
char *Cmd = Ptr;
UINT8 Run = 0;
+
AcpiGbl_MethodExecuting = FALSE;
AcpiGbl_StepToNextCall = FALSE;
@@ -360,6 +362,7 @@ AsDoWildcard (
#ifdef WIN32
void *DirInfo;
char *Filename;
+ int FileCount;
FileCount = 0;
@@ -441,7 +444,7 @@ main (
ACPI_TABLE_HEADER *Table = NULL;
UINT32 TableCount;
AE_TABLE_DESC *TableDesc;
- char **FileList;
+ char **WildcardList;
char *Filename;
char *Directory;
char *FullPathname;
@@ -459,7 +462,7 @@ main (
if (argc < 2)
{
usage ();
- return 0;
+ return (0);
}
signal (SIGINT, AeCtrlCHandler);
@@ -471,7 +474,8 @@ main (
/* Init ACPI and start debugger thread */
- AcpiInitializeSubsystem ();
+ Status = AcpiInitializeSubsystem ();
+ AE_CHECK_OK (AcpiInitializeSubsystem, Status);
/* Get the command line options */
@@ -482,7 +486,7 @@ main (
{
printf ("**** The length of command line (%u) exceeded maximum (127)\n",
(UINT32) strlen (AcpiGbl_Optarg));
- return -1;
+ return (-1);
}
AcpiGbl_BatchMode = 1;
strcpy (BatchBuffer, AcpiGbl_Optarg);
@@ -586,7 +590,7 @@ main (
case 'h':
default:
usage();
- return -1;
+ return (-1);
}
@@ -617,21 +621,21 @@ main (
/* Expand wildcards (Windows only) */
- FileList = AsDoWildcard (Directory, Filename);
- if (!FileList)
+ WildcardList = AsDoWildcard (Directory, Filename);
+ if (!WildcardList)
{
- return -1;
+ return (-1);
}
- while (*FileList)
+ while (*WildcardList)
{
FullPathname = AcpiOsAllocate (
- strlen (Directory) + strlen (*FileList) + 1);
+ strlen (Directory) + strlen (*WildcardList) + 1);
/* Construct a full path to the file */
strcpy (FullPathname, Directory);
- strcat (FullPathname, *FileList);
+ strcat (FullPathname, *WildcardList);
/* Get one table */
@@ -644,9 +648,9 @@ main (
}
AcpiOsFree (FullPathname);
- AcpiOsFree (*FileList);
- *FileList = NULL;
- FileList++;
+ AcpiOsFree (*WildcardList);
+ *WildcardList = NULL;
+ WildcardList++;
/*
* Ignore an FACS or RSDT, we can't use them.
@@ -676,7 +680,7 @@ main (
Status = AeBuildLocalTables (TableCount, AeTableListHead);
if (ACPI_FAILURE (Status))
{
- return -1;
+ return (-1);
}
Status = AeInstallTables ();
@@ -730,6 +734,6 @@ enterloop:
AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL);
}
- return 0;
+ return (0);
}
diff --git a/tools/acpiexec/aetables.c b/tools/acpiexec/aetables.c
index e1f61c6..a2ccdab 100644
--- a/tools/acpiexec/aetables.c
+++ b/tools/acpiexec/aetables.c
@@ -135,7 +135,7 @@ AeLocalGetRootPointer (
/* Default DSDT. This will be replaced with the input DSDT */
-unsigned char DsdtCode[] =
+static unsigned char DsdtCode[] =
{
0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */
0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".oIntel." */
@@ -144,7 +144,7 @@ unsigned char DsdtCode[] =
0x04,0x12,0x08,0x20,
};
-unsigned char LocalDsdtCode[] =
+static unsigned char LocalDsdtCode[] =
{
0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */
0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".,Intel." */
@@ -155,7 +155,7 @@ unsigned char LocalDsdtCode[] =
/* Several example SSDTs */
-unsigned char Ssdt1Code[] = /* Has method _T98 */
+static unsigned char Ssdt1Code[] = /* Has method _T98 */
{
0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */
0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@@ -165,7 +165,7 @@ unsigned char Ssdt1Code[] = /* Has method _T98 */
0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "98.p..`." */
};
-unsigned char Ssdt2Code[] = /* Has method _T99 */
+static unsigned char Ssdt2Code[] = /* Has method _T99 */
{
0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */
0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@@ -175,7 +175,7 @@ unsigned char Ssdt2Code[] = /* Has method _T99 */
0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "99.p..`." */
};
-unsigned char Ssdt3Code[] = /* Has method _T97 */
+unsigned char Ssdt3Code[] = /* Has method _T97 */
{
0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "TSDT0..." */
0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@@ -187,7 +187,7 @@ unsigned char Ssdt3Code[] = /* Has method _T97 */
/* Example OEM table */
-unsigned char Oem1Code[] =
+static unsigned char Oem1Code[] =
{
0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00, /* 00000000 "OEM18..." */
0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".KIntel." */
@@ -200,7 +200,7 @@ unsigned char Oem1Code[] =
/* ASL source for this table is at the end of this file */
-unsigned char OemxCode[] =
+static unsigned char OemxCode[] =
{
0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */
0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */
@@ -241,7 +241,7 @@ unsigned char OemxCode[] =
*
* Compiled byte code below.
*/
-unsigned char MethodCode[] =
+static unsigned char MethodCode[] =
{
0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00, /* 00000000 "DSDTS..." */
0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@@ -262,19 +262,19 @@ unsigned char MethodCode[] =
* even though the underlying OSD HW access functions don't do
* anything.
*/
-ACPI_TABLE_HEADER *DsdtToInstallOverride;
-ACPI_TABLE_RSDP LocalRSDP;
-ACPI_TABLE_FADT LocalFADT;
-ACPI_TABLE_FACS LocalFACS;
-ACPI_TABLE_HEADER LocalTEST;
-ACPI_TABLE_HEADER LocalBADTABLE;
-ACPI_TABLE_RSDT *LocalRSDT;
+static ACPI_TABLE_HEADER *DsdtToInstallOverride;
+static ACPI_TABLE_RSDP LocalRSDP;
+static ACPI_TABLE_FADT LocalFADT;
+static ACPI_TABLE_FACS LocalFACS;
+static ACPI_TABLE_HEADER LocalTEST;
+static ACPI_TABLE_HEADER LocalBADTABLE;
+static ACPI_TABLE_RSDT *LocalRSDT;
-#define BASE_RSDT_TABLES 7
-#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32)))
+#define BASE_RSDT_TABLES 7
+#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32)))
-#define ACPI_MAX_INIT_TABLES (32)
-static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES];
+#define ACPI_MAX_INIT_TABLES (32)
+static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES];
/******************************************************************************
@@ -357,7 +357,7 @@ AeBuildLocalTables (
LocalRSDT = AcpiOsAllocate (RsdtSize);
if (!LocalRSDT)
{
- return AE_NO_MEMORY;
+ return (AE_NO_MEMORY);
}
ACPI_MEMSET (LocalRSDT, 0, RsdtSize);
@@ -398,7 +398,7 @@ AeBuildLocalTables (
if (DsdtAddress)
{
printf ("Already found a DSDT, only one allowed\n");
- return AE_ALREADY_EXISTS;
+ return (AE_ALREADY_EXISTS);
}
/* The incoming user table is a DSDT */
@@ -488,21 +488,25 @@ AeBuildLocalTables (
/* Miscellaneous FADT fields */
LocalFADT.Gpe0BlockLength = 16;
+ LocalFADT.Gpe0Block = 0x00001234;
+
LocalFADT.Gpe1BlockLength = 6;
+ LocalFADT.Gpe1Block = 0x00005678;
LocalFADT.Gpe1Base = 96;
LocalFADT.Pm1EventLength = 4;
- LocalFADT.Pm1ControlLength = 2;
- LocalFADT.PmTimerLength = 4;
-
- LocalFADT.Gpe0Block = 0x00001234;
- LocalFADT.Gpe1Block = 0x00005678;
-
LocalFADT.Pm1aEventBlock = 0x00001aaa;
LocalFADT.Pm1bEventBlock = 0x00001bbb;
- LocalFADT.PmTimerBlock = 0xA0;
+
+ LocalFADT.Pm1ControlLength = 2;
LocalFADT.Pm1aControlBlock = 0xB0;
+ LocalFADT.PmTimerLength = 4;
+ LocalFADT.PmTimerBlock = 0xA0;
+
+ LocalFADT.Pm2ControlBlock = 0xC0;
+ LocalFADT.Pm2ControlLength = 1;
+
/* Setup one example X-64 field */
LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
@@ -566,9 +570,15 @@ AeInstallTables (
{
ACPI_STATUS Status;
+
Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);
+ AE_CHECK_OK (AcpiInitializeTables, Status);
+
Status = AcpiReallocateRootTable ();
+ AE_CHECK_OK (AcpiReallocateRootTable, Status);
+
Status = AcpiLoadTables ();
+ AE_CHECK_OK (AcpiLoadTables, Status);
/*
* Test run-time control method installation. Do it twice to test code
diff --git a/tools/acpisrc/asfile.c b/tools/acpisrc/asfile.c
index dd24941..c82a98b 100644
--- a/tools/acpisrc/asfile.c
+++ b/tools/acpisrc/asfile.c
@@ -132,7 +132,7 @@ AsDetectLoneLineFeeds (
char *Filename,
char *Buffer);
-static inline int
+static ACPI_INLINE int
AsMaxInt (int a, int b)
{
return (a > b ? a : b);
@@ -409,7 +409,8 @@ AsConvertFile (
Gbl_StructDefs = strstr (FileBuffer, "/* acpisrc:StructDefs");
Gbl_Files++;
- VERBOSE_PRINT (("Processing %u bytes\n", strlen (FileBuffer)));
+ VERBOSE_PRINT (("Processing %u bytes\n",
+ (unsigned int) strlen (FileBuffer)));
if (ConversionTable->LowerCaseTable)
{
diff --git a/tools/acpisrc/astable.c b/tools/acpisrc/astable.c
index 058d5a2..c850891 100644
--- a/tools/acpisrc/astable.c
+++ b/tools/acpisrc/astable.c
@@ -378,6 +378,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_PARSE_STATE", SRC_TYPE_STRUCT},
{"ACPI_PARSE_UPWARDS", SRC_TYPE_SIMPLE},
{"ACPI_PARSE_VALUE", SRC_TYPE_UNION},
+ {"ACPI_PCI_DEVICE", SRC_TYPE_STRUCT},
{"ACPI_PCI_ID", SRC_TYPE_STRUCT},
{"ACPI_PCI_ROUTING_TABLE", SRC_TYPE_STRUCT},
{"ACPI_PHYSICAL_ADDRESS", SRC_TYPE_SIMPLE},
diff --git a/tools/acpixtract/acpixtract.c b/tools/acpixtract/acpixtract.c
index e3d6b75..543d0bd 100644
--- a/tools/acpixtract/acpixtract.c
+++ b/tools/acpixtract/acpixtract.c
@@ -130,46 +130,46 @@
/* Local prototypes */
-void
+static void
CheckAscii (
char *Name,
int Count);
-void
+static void
NormalizeSignature (
char *Signature);
-unsigned int
+static unsigned int
GetNextInstance (
char *InputPathname,
char *Signature);
-int
+static int
ExtractTables (
char *InputPathname,
char *Signature,
unsigned int MinimumInstances);
-size_t
+static size_t
GetTableHeader (
FILE *InputFile,
unsigned char *OutputData);
-unsigned int
+static unsigned int
CountTableInstances (
char *InputPathname,
char *Signature);
-int
+static int
ListTables (
char *InputPathname);
-size_t
+static size_t
ConvertLine (
char *InputLine,
unsigned char *OutputData);
-void
+static void
DisplayUsage (
void);
@@ -196,9 +196,9 @@ struct TableInfo
struct TableInfo *Next;
};
-struct TableInfo *ListHead = NULL;
-char Filename[16];
-unsigned char Data[16];
+static struct TableInfo *ListHead = NULL;
+static char Filename[16];
+static unsigned char Data[16];
/******************************************************************************
@@ -209,7 +209,7 @@ unsigned char Data[16];
*
******************************************************************************/
-void
+static void
DisplayUsage (
void)
{
@@ -240,7 +240,7 @@ DisplayUsage (
*
******************************************************************************/
-void
+static void
CheckAscii (
char *Name,
int Count)
@@ -270,7 +270,7 @@ CheckAscii (
*
******************************************************************************/
-void
+static void
NormalizeSignature (
char *Signature)
{
@@ -295,7 +295,7 @@ NormalizeSignature (
*
******************************************************************************/
-size_t
+static size_t
ConvertLine (
char *InputLine,
unsigned char *OutputData)
@@ -353,7 +353,7 @@ ConvertLine (
*
******************************************************************************/
-size_t
+static size_t
GetTableHeader (
FILE *InputFile,
unsigned char *OutputData)
@@ -401,7 +401,7 @@ GetTableHeader (
*
******************************************************************************/
-unsigned int
+static unsigned int
CountTableInstances (
char *InputPathname,
char *Signature)
@@ -459,7 +459,7 @@ CountTableInstances (
*
******************************************************************************/
-unsigned int
+static unsigned int
GetNextInstance (
char *InputPathname,
char *Signature)
@@ -520,7 +520,7 @@ GetNextInstance (
*
******************************************************************************/
-int
+static int
ExtractTables (
char *InputPathname,
char *Signature,
@@ -639,8 +639,8 @@ ExtractTables (
OutputFile = NULL;
State = FIND_HEADER;
- printf ("Acpi table [%4.4s] - % 7d bytes written to %s\n",
- ThisSignature, TotalBytesWritten, Filename);
+ printf ("Acpi table [%4.4s] - %u bytes written to %s\n",
+ ThisSignature, (unsigned int) TotalBytesWritten, Filename);
continue;
}
@@ -684,8 +684,8 @@ CleanupAndExit:
{
/* Received an EOF while extracting data */
- printf ("Acpi table [%4.4s] - % 7d bytes written to %s\n",
- ThisSignature, TotalBytesWritten, Filename);
+ printf ("Acpi table [%4.4s] - %u bytes written to %s\n",
+ ThisSignature, (unsigned int) TotalBytesWritten, Filename);
}
}
@@ -707,7 +707,7 @@ CleanupAndExit:
*
******************************************************************************/
-int
+static int
ListTables (
char *InputPathname)
{
diff --git a/utilities/utdebug.c b/utilities/utdebug.c
index 0a91716..ad15846 100644
--- a/utilities/utdebug.c
+++ b/utilities/utdebug.c
@@ -279,9 +279,8 @@ AcpiDebugPrint (
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
AcpiOsPrintf (
- "\n**** Context Switch from TID %p to TID %p ****\n\n",
- ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId),
- ACPI_CAST_PTR (void, ThreadId));
+ "\n**** Context Switch from TID %u to TID %u ****\n\n",
+ (UINT32) AcpiGbl_PrevThreadId, (UINT32) ThreadId);
}
AcpiGbl_PrevThreadId = ThreadId;
@@ -295,7 +294,7 @@ AcpiDebugPrint (
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
- AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId));
+ AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
}
AcpiOsPrintf ("[%02ld] %-22.22s: ",
diff --git a/utilities/utmath.c b/utilities/utmath.c
index 54d492f..90f3cd5 100644
--- a/utilities/utmath.c
+++ b/utilities/utmath.c
@@ -124,12 +124,32 @@
ACPI_MODULE_NAME ("utmath")
/*
- * Support for double-precision integer divide. This code is included here
- * in order to support kernel environments where the double-precision math
- * library is not available.
+ * Optional support for 64-bit double-precision integer divide. This code
+ * is configurable and is implemented in order to support 32-bit kernel
+ * environments where a 64-bit double-precision math library is not available.
+ *
+ * Support for a more normal 64-bit divide/modulo (with check for a divide-
+ * by-zero) appears after this optional section of code.
*/
-
#ifndef ACPI_USE_NATIVE_DIVIDE
+
+/* Structures used only for 64-bit divide */
+
+typedef struct uint64_struct
+{
+ UINT32 Lo;
+ UINT32 Hi;
+
+} UINT64_STRUCT;
+
+typedef union uint64_overlay
+{
+ UINT64 Full;
+ UINT64_STRUCT Part;
+
+} UINT64_OVERLAY;
+
+
/*******************************************************************************
*
* FUNCTION: AcpiUtShortDivide
diff --git a/utilities/utmisc.c b/utilities/utmisc.c
index f3e2d18..1867a31 100644
--- a/utilities/utmisc.c
+++ b/utilities/utmisc.c
@@ -124,12 +124,6 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utmisc")
-/*
- * Common suffix for messages
- */
-#define ACPI_COMMON_MSG_SUFFIX \
- AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
-
/*******************************************************************************
*
@@ -1337,191 +1331,3 @@ AcpiUtWalkPackageTree (
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiError, AcpiException, AcpiWarning, AcpiInfo
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * Format - Printf format string + additional args
- *
- * RETURN: None
- *
- * DESCRIPTION: Print message with module/line/version info
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiError (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *Format,
- ...)
-{
- va_list args;
-
-
- AcpiOsPrintf ("ACPI Error: ");
-
- va_start (args, Format);
- AcpiOsVprintf (Format, args);
- ACPI_COMMON_MSG_SUFFIX;
- va_end (args);
-}
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiException (
- const char *ModuleName,
- UINT32 LineNumber,
- ACPI_STATUS Status,
- const char *Format,
- ...)
-{
- va_list args;
-
-
- AcpiOsPrintf ("ACPI Exception: %s, ", AcpiFormatException (Status));
-
- va_start (args, Format);
- AcpiOsVprintf (Format, args);
- ACPI_COMMON_MSG_SUFFIX;
- va_end (args);
-}
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiWarning (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *Format,
- ...)
-{
- va_list args;
-
-
- AcpiOsPrintf ("ACPI Warning: ");
-
- va_start (args, Format);
- AcpiOsVprintf (Format, args);
- ACPI_COMMON_MSG_SUFFIX;
- va_end (args);
-}
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiInfo (
- const char *ModuleName,
- UINT32 LineNumber,
- const char *Format,
- ...)
-{
- va_list args;
-
-
- AcpiOsPrintf ("ACPI: ");
-
- va_start (args, Format);
- AcpiOsVprintf (Format, args);
- AcpiOsPrintf ("\n");
- va_end (args);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiError)
-ACPI_EXPORT_SYMBOL (AcpiException)
-ACPI_EXPORT_SYMBOL (AcpiWarning)
-ACPI_EXPORT_SYMBOL (AcpiInfo)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtPredefinedWarning
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * Pathname - Full pathname to the node
- * NodeFlags - From Namespace node for the method/object
- * Format - Printf format string + additional args
- *
- * RETURN: None
- *
- * DESCRIPTION: Warnings for the predefined validation module. Messages are
- * only emitted the first time a problem with a particular
- * method/object is detected. This prevents a flood of error
- * messages for methods that are repeatedly evaluated.
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtPredefinedWarning (
- const char *ModuleName,
- UINT32 LineNumber,
- char *Pathname,
- UINT8 NodeFlags,
- const char *Format,
- ...)
-{
- va_list args;
-
-
- /*
- * Warning messages for this method/object will be disabled after the
- * first time a validation fails or an object is successfully repaired.
- */
- if (NodeFlags & ANOBJ_EVALUATED)
- {
- return;
- }
-
- AcpiOsPrintf ("ACPI Warning for %s: ", Pathname);
-
- va_start (args, Format);
- AcpiOsVprintf (Format, args);
- ACPI_COMMON_MSG_SUFFIX;
- va_end (args);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtPredefinedInfo
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * Pathname - Full pathname to the node
- * NodeFlags - From Namespace node for the method/object
- * Format - Printf format string + additional args
- *
- * RETURN: None
- *
- * DESCRIPTION: Info messages for the predefined validation module. Messages
- * are only emitted the first time a problem with a particular
- * method/object is detected. This prevents a flood of
- * messages for methods that are repeatedly evaluated.
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtPredefinedInfo (
- const char *ModuleName,
- UINT32 LineNumber,
- char *Pathname,
- UINT8 NodeFlags,
- const char *Format,
- ...)
-{
- va_list args;
-
-
- /*
- * Warning messages for this method/object will be disabled after the
- * first time a validation fails or an object is successfully repaired.
- */
- if (NodeFlags & ANOBJ_EVALUATED)
- {
- return;
- }
-
- AcpiOsPrintf ("ACPI Info for %s: ", Pathname);
-
- va_start (args, Format);
- AcpiOsVprintf (Format, args);
- ACPI_COMMON_MSG_SUFFIX;
- va_end (args);
-}
diff --git a/utilities/utmutex.c b/utilities/utmutex.c
index f4d7175..92a95e1 100644
--- a/utilities/utmutex.c
+++ b/utilities/utmutex.c
@@ -348,16 +348,16 @@ AcpiUtAcquireMutex (
if (i == MutexId)
{
ACPI_ERROR ((AE_INFO,
- "Mutex [%s] already acquired by this thread [%p]",
+ "Mutex [%s] already acquired by this thread [%u]",
AcpiUtGetMutexName (MutexId),
- ACPI_CAST_PTR (void, ThisThreadId)));
+ (UINT32) ThisThreadId));
return (AE_ALREADY_ACQUIRED);
}
ACPI_ERROR ((AE_INFO,
- "Invalid acquire order: Thread %p owns [%s], wants [%s]",
- ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (i),
+ "Invalid acquire order: Thread %u owns [%s], wants [%s]",
+ (UINT32) ThisThreadId, AcpiUtGetMutexName (i),
AcpiUtGetMutexName (MutexId)));
return (AE_ACQUIRE_DEADLOCK);
@@ -367,15 +367,15 @@ AcpiUtAcquireMutex (
#endif
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %p attempting to acquire Mutex [%s]\n",
- ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId)));
+ "Thread %u attempting to acquire Mutex [%s]\n",
+ (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId)));
Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex,
ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p acquired Mutex [%s]\n",
- ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]\n",
+ (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId)));
AcpiGbl_MutexInfo[MutexId].UseCount++;
AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId;
@@ -383,8 +383,8 @@ AcpiUtAcquireMutex (
else
{
ACPI_EXCEPTION ((AE_INFO, Status,
- "Thread %p could not acquire Mutex [0x%X]",
- ACPI_CAST_PTR (void, ThisThreadId), MutexId));
+ "Thread %u could not acquire Mutex [0x%X]",
+ (UINT32) ThisThreadId, MutexId));
}
return (Status);
@@ -414,8 +414,8 @@ AcpiUtReleaseMutex (
ThisThreadId = AcpiOsGetThreadId ();
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
- ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n",
+ (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId)));
if (MutexId > ACPI_MAX_MUTEX)
{
diff --git a/utilities/utxferror.c b/utilities/utxferror.c
new file mode 100644
index 0000000..b397a40
--- /dev/null
+++ b/utilities/utxferror.c
@@ -0,0 +1,550 @@
+/*******************************************************************************
+ *
+ * Module Name: utxferror - Various error/warning output functions
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTXFERROR_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utxferror")
+
+/*
+ * This module is used for the in-kernel ACPICA as well as the ACPICA
+ * tools/applications.
+ *
+ * For the iASL compiler case, the output is redirected to stderr so that
+ * any of the various ACPI errors and warnings do not appear in the output
+ * files, for either the compiler or disassembler portions of the tool.
+ */
+#ifdef ACPI_ASL_COMPILER
+#include <stdio.h>
+
+extern FILE *AcpiGbl_OutputFile;
+
+#define ACPI_MSG_REDIRECT_BEGIN \
+ FILE *OutputFile = AcpiGbl_OutputFile; \
+ AcpiOsRedirectOutput (stderr);
+
+#define ACPI_MSG_REDIRECT_END \
+ AcpiOsRedirectOutput (OutputFile);
+
+#else
+/*
+ * non-iASL case - no redirection, nothing to do
+ */
+#define ACPI_MSG_REDIRECT_BEGIN
+#define ACPI_MSG_REDIRECT_END
+#endif
+
+/*
+ * Common message prefixes
+ */
+#define ACPI_MSG_ERROR "ACPI Error: "
+#define ACPI_MSG_EXCEPTION "ACPI Exception: "
+#define ACPI_MSG_WARNING "ACPI Warning: "
+#define ACPI_MSG_INFO "ACPI: "
+
+/*
+ * Common message suffix
+ */
+#define ACPI_MSG_SUFFIX \
+ AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiError
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Format - Printf format string + additional args
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print "ACPI Error" message with module/line/version info
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiError (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *Format,
+ ...)
+{
+ va_list ArgList;
+
+
+ ACPI_MSG_REDIRECT_BEGIN;
+ AcpiOsPrintf (ACPI_MSG_ERROR);
+
+ va_start (ArgList, Format);
+ AcpiOsVprintf (Format, ArgList);
+ ACPI_MSG_SUFFIX;
+ va_end (ArgList);
+
+ ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL (AcpiError)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiException
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Status - Status to be formatted
+ * Format - Printf format string + additional args
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
+ * and decoded ACPI_STATUS.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiException (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ ACPI_STATUS Status,
+ const char *Format,
+ ...)
+{
+ va_list ArgList;
+
+
+ ACPI_MSG_REDIRECT_BEGIN;
+ AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status));
+
+ va_start (ArgList, Format);
+ AcpiOsVprintf (Format, ArgList);
+ ACPI_MSG_SUFFIX;
+ va_end (ArgList);
+
+ ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL (AcpiException)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiWarning
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Format - Printf format string + additional args
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiWarning (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *Format,
+ ...)
+{
+ va_list ArgList;
+
+
+ ACPI_MSG_REDIRECT_BEGIN;
+ AcpiOsPrintf (ACPI_MSG_WARNING);
+
+ va_start (ArgList, Format);
+ AcpiOsVprintf (Format, ArgList);
+ ACPI_MSG_SUFFIX;
+ va_end (ArgList);
+
+ ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL (AcpiWarning)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInfo
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Format - Printf format string + additional args
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print generic "ACPI:" information message. There is no
+ * module/line/version info in order to keep the message simple.
+ *
+ * TBD: ModuleName and LineNumber args are not needed, should be removed.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiInfo (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *Format,
+ ...)
+{
+ va_list ArgList;
+
+
+ ACPI_MSG_REDIRECT_BEGIN;
+ AcpiOsPrintf (ACPI_MSG_INFO);
+
+ va_start (ArgList, Format);
+ AcpiOsVprintf (Format, ArgList);
+ AcpiOsPrintf ("\n");
+ va_end (ArgList);
+
+ ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL (AcpiInfo)
+
+
+/*
+ * The remainder of this module contains internal error functions that may
+ * be configured out.
+ */
+#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPredefinedWarning
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Pathname - Full pathname to the node
+ * NodeFlags - From Namespace node for the method/object
+ * Format - Printf format string + additional args
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Warnings for the predefined validation module. Messages are
+ * only emitted the first time a problem with a particular
+ * method/object is detected. This prevents a flood of error
+ * messages for methods that are repeatedly evaluated.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtPredefinedWarning (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ char *Pathname,
+ UINT8 NodeFlags,
+ const char *Format,
+ ...)
+{
+ va_list ArgList;
+
+
+ /*
+ * Warning messages for this method/object will be disabled after the
+ * first time a validation fails or an object is successfully repaired.
+ */
+ if (NodeFlags & ANOBJ_EVALUATED)
+ {
+ return;
+ }
+
+ AcpiOsPrintf (ACPI_MSG_WARNING "For %s: ", Pathname);
+
+ va_start (ArgList, Format);
+ AcpiOsVprintf (Format, ArgList);
+ ACPI_MSG_SUFFIX;
+ va_end (ArgList);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPredefinedInfo
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Pathname - Full pathname to the node
+ * NodeFlags - From Namespace node for the method/object
+ * Format - Printf format string + additional args
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Info messages for the predefined validation module. Messages
+ * are only emitted the first time a problem with a particular
+ * method/object is detected. This prevents a flood of
+ * messages for methods that are repeatedly evaluated.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtPredefinedInfo (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ char *Pathname,
+ UINT8 NodeFlags,
+ const char *Format,
+ ...)
+{
+ va_list ArgList;
+
+
+ /*
+ * Warning messages for this method/object will be disabled after the
+ * first time a validation fails or an object is successfully repaired.
+ */
+ if (NodeFlags & ANOBJ_EVALUATED)
+ {
+ return;
+ }
+
+ AcpiOsPrintf (ACPI_MSG_INFO "For %s: ", Pathname);
+
+ va_start (ArgList, Format);
+ AcpiOsVprintf (Format, ArgList);
+ ACPI_MSG_SUFFIX;
+ va_end (ArgList);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtNamespaceError
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * InternalName - Name or path of the namespace node
+ * LookupStatus - Exception code from NS lookup
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print error message with the full pathname for the NS node.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtNamespaceError (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *InternalName,
+ ACPI_STATUS LookupStatus)
+{
+ ACPI_STATUS Status;
+ UINT32 BadName;
+ char *Name = NULL;
+
+
+ ACPI_MSG_REDIRECT_BEGIN;
+ AcpiOsPrintf (ACPI_MSG_ERROR);
+
+ if (LookupStatus == AE_BAD_CHARACTER)
+ {
+ /* There is a non-ascii character in the name */
+
+ ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
+ AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName);
+ }
+ else
+ {
+ /* Convert path to external format */
+
+ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX,
+ InternalName, NULL, &Name);
+
+ /* Print target name */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf ("[%s]", Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
+ }
+
+ if (Name)
+ {
+ ACPI_FREE (Name);
+ }
+ }
+
+ AcpiOsPrintf (" Namespace lookup failure, %s",
+ AcpiFormatException (LookupStatus));
+
+ ACPI_MSG_SUFFIX;
+ ACPI_MSG_REDIRECT_END;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMethodError
+ *
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Message - Error message to use on failure
+ * PrefixNode - Prefix relative to the path
+ * Path - Path to the node (optional)
+ * MethodStatus - Execution status
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print error message with the full pathname for the method.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtMethodError (
+ const char *ModuleName,
+ UINT32 LineNumber,
+ const char *Message,
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ const char *Path,
+ ACPI_STATUS MethodStatus)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = PrefixNode;
+
+
+ ACPI_MSG_REDIRECT_BEGIN;
+ AcpiOsPrintf (ACPI_MSG_ERROR);
+
+ if (Path)
+ {
+ Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
+ &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("[Could not get node by pathname]");
+ }
+ }
+
+ AcpiNsPrintNodePathname (Node, Message);
+ AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus));
+
+ ACPI_MSG_SUFFIX;
+ ACPI_MSG_REDIRECT_END;
+}
+
+#endif /* ACPI_NO_ERROR_MESSAGES */
OpenPOWER on IntegriCloud