diff options
author | jkim <jkim@FreeBSD.org> | 2010-09-16 20:08:00 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2010-09-16 20:08:00 +0000 |
commit | ddeb148f3efdd930ab31c3975094d7115bca6e40 (patch) | |
tree | f70f94cd7c27ae47515d31be78c40b03574a2e07 /sys/contrib | |
parent | 9ec9faa74565cd85da140c68d73c827afe182cc2 (diff) | |
parent | c5863557e158eb3876688e611d5915c27657e18a (diff) | |
download | FreeBSD-src-ddeb148f3efdd930ab31c3975094d7115bca6e40.zip FreeBSD-src-ddeb148f3efdd930ab31c3975094d7115bca6e40.tar.gz |
Merge ACPICA 20100915.
Diffstat (limited to 'sys/contrib')
49 files changed, 1593 insertions, 537 deletions
diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 6ac171f..9bb84d4 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index d72f369..f148068 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index da754a0..5af7dfc 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c index c30ad6a..8c45609 100644 --- a/sys/contrib/dev/acpica/common/adwalk.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index 70ded1d..ed2a7e1 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c index b4a5b9e..34a66ee 100644 --- a/sys/contrib/dev/acpica/common/getopt.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index 1929b86..c29d7e8 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index 00fa31d..ff86970 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 91ea273..80856be 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -686,6 +686,10 @@ ACPI_STATUS LsDisplayNamespace ( void); +void +LsSetupNsList ( + void *Handle); + /* * aslutils - common compiler utilites diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c index 262dd20..383e617 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 3557b1f..55dc0b3 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index 9458b92..28027bc 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c index 9dd6bf3..fd29c88 100644 --- a/sys/contrib/dev/acpica/compiler/asllookup.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 662742f..2187b13e 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c index b1a5692..d67efbe 100644 --- a/sys/contrib/dev/acpica/compiler/aslopcodes.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslpredef.c b/sys/contrib/dev/acpica/compiler/aslpredef.c index f50138d..cb40bc9 100644 --- a/sys/contrib/dev/acpica/compiler/aslpredef.c +++ b/sys/contrib/dev/acpica/compiler/aslpredef.c @@ -117,8 +117,6 @@ #include <contrib/dev/acpica/compiler/aslcompiler.h> #include "aslcompiler.y.h" -#include <contrib/dev/acpica/include/amlcode.h> -#include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acpredef.h> diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1.c b/sys/contrib/dev/acpica/compiler/aslrestype1.c index 32f2cfc..dcd6c36 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype1.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslrestype2d.c b/sys/contrib/dev/acpica/compiler/aslrestype2d.c index db0a2a7..65485b9 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2d.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslrestype2e.c b/sys/contrib/dev/acpica/compiler/aslrestype2e.c index b75d174..01584ff 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2e.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2e.c @@ -116,7 +116,6 @@ #include <contrib/dev/acpica/compiler/aslcompiler.h> -#include "aslcompiler.y.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslrestype2e") diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2w.c b/sys/contrib/dev/acpica/compiler/aslrestype2w.c index fa0bb22..c35b9b0 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2w.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index 14b362c..fc4ad5c 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index 5bdc6b2..d80bb10 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index a2fc713..c81f919 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/debugger/dbexec.c b/sys/contrib/dev/acpica/debugger/dbexec.c index 9a080b2..07b6ad9 100644 --- a/sys/contrib/dev/acpica/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/events/evrgnini.c b/sys/contrib/dev/acpica/events/evrgnini.c index 9ca4608..1680654 100644 --- a/sys/contrib/dev/acpica/events/evrgnini.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/executer/exmutex.c b/sys/contrib/dev/acpica/executer/exmutex.c index 315ad10..865c634 100644 --- a/sys/contrib/dev/acpica/executer/exmutex.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/hardware/hwpci.c b/sys/contrib/dev/acpica/hardware/hwpci.c new file mode 100644 index 0000000..d0da8e3 --- /dev/null +++ b/sys/contrib/dev/acpica/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 <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index 581fc76..2e158fb 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/achware.h b/sys/contrib/dev/acpica/include/achware.h index db08293..e63fe3f 100644 --- a/sys/contrib/dev/acpica/include/achware.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index 39b6616..eec3ffc 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index e9a6f42..417cdc3 100644 --- a/sys/contrib/dev/acpica/include/acmacros.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 5895e06..5840bbc 100644 --- a/sys/contrib/dev/acpica/include/acnamesp.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acpiosxf.h b/sys/contrib/dev/acpica/include/acpiosxf.h index dd08618..5e7a2aa 100644 --- a/sys/contrib/dev/acpica/include/acpiosxf.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 2321e34..ec55398 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/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 <contrib/dev/acpica/include/actypes.h> #include <contrib/dev/acpica/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/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 0486f8e..e4290ae 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index f729399..2d73da6 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/platform/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index b9ef33f..ebf09d6 100644 --- a/sys/contrib/dev/acpica/include/platform/acenv.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/include/platform/acfreebsd.h b/sys/contrib/dev/acpica/include/platform/acfreebsd.h index c835aaf..ad18a2d 100644 --- a/sys/contrib/dev/acpica/include/platform/acfreebsd.h +++ b/sys/contrib/dev/acpica/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,7 +165,7 @@ #include <ctype.h> #endif -#define ACPI_THREAD_ID pthread_t +#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread)) #define ACPI_USE_STANDARD_HEADERS diff --git a/sys/contrib/dev/acpica/include/platform/acgcc.h b/sys/contrib/dev/acpica/include/platform/acgcc.h index d0098b1..9c7c9b9 100644 --- a/sys/contrib/dev/acpica/include/platform/acgcc.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/namespace/nsrepair2.c b/sys/contrib/dev/acpica/namespace/nsrepair2.c index 25fdcbb..1cf0395 100644 --- a/sys/contrib/dev/acpica/namespace/nsrepair2.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/namespace/nsutils.c b/sys/contrib/dev/acpica/namespace/nsutils.c index 681f85d..1ddfc38 100644 --- a/sys/contrib/dev/acpica/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c index 2e3e728..85f7759 100644 --- a/sys/contrib/dev/acpica/osunixxf.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/tables/tbfadt.c b/sys/contrib/dev/acpica/tables/tbfadt.c index af7d068..d03dae4 100644 --- a/sys/contrib/dev/acpica/tables/tbfadt.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h b/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h index 0ceddea..06bdece 100644 --- a/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/utilities/utdebug.c b/sys/contrib/dev/acpica/utilities/utdebug.c index 99670b5..8d7b942 100644 --- a/sys/contrib/dev/acpica/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/utilities/utmath.c b/sys/contrib/dev/acpica/utilities/utmath.c index f6d5f7c..508ed2a 100644 --- a/sys/contrib/dev/acpica/utilities/utmath.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/utilities/utmisc.c b/sys/contrib/dev/acpica/utilities/utmisc.c index f3ada2f..7bcfd57 100644 --- a/sys/contrib/dev/acpica/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/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,196 +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; - -#ifdef _KERNEL - /* Temporarily hide too verbose printfs. */ - if (!bootverbose) - return; -#endif - - 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/sys/contrib/dev/acpica/utilities/utmutex.c b/sys/contrib/dev/acpica/utilities/utmutex.c index 14cab79..43204ba 100644 --- a/sys/contrib/dev/acpica/utilities/utmutex.c +++ b/sys/contrib/dev/acpica/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/sys/contrib/dev/acpica/utilities/utxferror.c b/sys/contrib/dev/acpica/utilities/utxferror.c new file mode 100644 index 0000000..8e2cd93 --- /dev/null +++ b/sys/contrib/dev/acpica/utilities/utxferror.c @@ -0,0 +1,555 @@ +/******************************************************************************* + * + * 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 <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/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; + +#ifdef _KERNEL + /* Temporarily hide too verbose printfs. */ + if (!bootverbose) + return; +#endif + + 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 */ |