diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index b746bc1fa329..ce7d3cd88e6d 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 112 $ + * $Revision: 118 $ * *****************************************************************************/ @@ -145,7 +145,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20021002 +#define ACPI_CA_VERSION 0x20021115 /* Version of ACPI supported */ @@ -257,6 +257,10 @@ #define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_XCHECKSUM_LENGTH 36 +/* SMBus bidirectional buffer size */ + +#define ACPI_SMBUS_BUFFER_SIZE 34 + /****************************************************************************** * diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h index f038f727688e..f35842e84ba9 100644 --- a/sys/contrib/dev/acpica/acpiosxf.h +++ b/sys/contrib/dev/acpica/acpiosxf.h @@ -209,7 +209,7 @@ ACPI_STATUS AcpiOsWaitSemaphore ( ACPI_HANDLE Handle, UINT32 Units, - UINT32 Timeout); + UINT16 Timeout); ACPI_STATUS AcpiOsSignalSemaphore ( diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h index 8ea681e17743..7dddf89138de 100644 --- a/sys/contrib/dev/acpica/acpixf.h +++ b/sys/contrib/dev/acpica/acpixf.h @@ -372,7 +372,7 @@ AcpiInstallGpeHandler ( ACPI_STATUS AcpiAcquireGlobalLock ( - UINT32 Timeout, + UINT16 Timeout, UINT32 *Handle); ACPI_STATUS diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index f2470fe2ab4f..e20dec647c19 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 146 $ + * $Revision: 148 $ * *****************************************************************************/ @@ -622,6 +622,10 @@ BOOLEAN AcpiUtValidInternalObject ( void *Object); +ACPI_OPERAND_OBJECT * +AcpiUtCreateBufferObject ( + ACPI_SIZE BufferSize); + /* * UtRefCnt - Object reference count management @@ -728,6 +732,11 @@ AcpiUtDeleteObjectCache ( * utmisc */ +void +AcpiUtPrintString ( + char *String, + UINT8 MaxLength); + ACPI_STATUS AcpiUtDivide ( ACPI_INTEGER *InDividend, diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index d33cbf3ca1b9..fb17c9c4168e 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 88 $ + * $Revision: 90 $ * ******************************************************************************/ @@ -412,7 +412,6 @@ AcpiDbSetMethodCallBreakpoint ( return; } - AcpiGbl_StepToNextCall = TRUE; } @@ -1055,7 +1054,7 @@ AcpiDbSetScope ( * * RETURN: None * - * DESCRIPTION: + * DESCRIPTION: Display the resource objects associated with a device. * ******************************************************************************/ @@ -1222,7 +1221,7 @@ AcpiDbIntegrityWalk ( Node, ACPI_GET_DESCRIPTOR_TYPE (Node)); } - if (Node->Type > INTERNAL_TYPE_MAX) + if (Node->Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", Node, Node->Type); diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index 84c6f0a76851..89927810a69b 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/dbfileio.c @@ -2,7 +2,7 @@ * * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 68 $ + * $Revision: 69 $ * ******************************************************************************/ @@ -329,6 +329,10 @@ AcpiDbLoadTable( Actual = fread (AmlStart, 1, (size_t) AmlLength, fp); if (Actual == AmlLength) { + /* Now validate the checksum */ + + Status = AcpiTbVerifyTableChecksum (*TablePtr); + return (AE_OK); } @@ -417,6 +421,18 @@ AeLocalLoadTable ( #ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiDbGetAcpiTable + * + * PARAMETERS: Filname - File where table is located + * + * RETURN: Status + * + * DESCRIPTION: Get an ACPI table from a file + * + ******************************************************************************/ + ACPI_STATUS AcpiDbGetAcpiTable ( NATIVE_CHAR *Filename) @@ -425,6 +441,7 @@ AcpiDbGetAcpiTable ( UINT32 TableLength; ACPI_STATUS Status; + /* Open the file */ fp = fopen (Filename, "rb"); @@ -451,6 +468,7 @@ AcpiDbGetAcpiTable ( } #endif + /******************************************************************************* * * FUNCTION: AcpiDbLoadAcpiTable diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index 60c3f7bf1518..9ddd6e8f9b76 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 88 $ + * $Revision: 90 $ * *****************************************************************************/ @@ -157,6 +157,8 @@ AcpiExSetupRegion ( RgnDesc = ObjDesc->CommonField.RegionObj; + /* We must have a valid region */ + if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n", @@ -179,6 +181,13 @@ AcpiExSetupRegion ( } } + if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + /* SMBus has a non-linear address space */ + + return_ACPI_STATUS (AE_OK); + } + /* * Validate the request. The entire request from the byte offset for a * length of one field datum (access width) must fit within the region. @@ -225,8 +234,10 @@ AcpiExSetupRegion ( * PARAMETERS: *ObjDesc - Field to be read * FieldDatumByteOffset - Byte offset of this datum within the * parent field - * *Value - Where to store value (must be 32 bits) - * ReadWrite - Read or Write flag + * *Value - Where to store value (must at least + * the size of ACPI_INTEGER) + * Function - Read or Write flag plus other region- + * dependent flags * * RETURN: Status * @@ -239,7 +250,7 @@ AcpiExAccessRegion ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, ACPI_INTEGER *Value, - UINT32 ReadWrite) + UINT32 Function) { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *RgnDesc; @@ -249,6 +260,16 @@ AcpiExAccessRegion ( ACPI_FUNCTION_TRACE ("ExAccessRegion"); + /* + * Ensure that the region operands are fully evaluated and verify + * the validity of the request + */ + Status = AcpiExSetupRegion (ObjDesc, FieldDatumByteOffset); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* * The physical address of this field datum is: * @@ -261,7 +282,7 @@ AcpiExAccessRegion ( + ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset; - if (ReadWrite == ACPI_READ) + if ((Function & ACPI_IO_MASK) == ACPI_READ) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); } @@ -281,7 +302,7 @@ AcpiExAccessRegion ( /* Invoke the appropriate AddressSpace/OpRegion handler */ - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ReadWrite, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) @@ -293,7 +314,6 @@ AcpiExAccessRegion ( AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } - else if (Status == AE_NOT_EXIST) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -450,7 +470,7 @@ AcpiExFieldDatumIo ( break; - case INTERNAL_TYPE_BANK_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: /* Ensure that the BankValue is not beyond the capacity of the register */ @@ -480,23 +500,17 @@ AcpiExFieldDatumIo ( /*lint -fallthrough */ - case INTERNAL_TYPE_REGION_FIELD: + case ACPI_TYPE_LOCAL_REGION_FIELD: /* * For simple RegionFields, we just directly access the owning * Operation Region. */ - Status = AcpiExSetupRegion (ObjDesc, FieldDatumByteOffset); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - Status = AcpiExAccessRegion (ObjDesc, FieldDatumByteOffset, Value, ReadWrite); break; - case INTERNAL_TYPE_INDEX_FIELD: + case ACPI_TYPE_LOCAL_INDEX_FIELD: /* Ensure that the IndexValue is not beyond the capacity of the register */ diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c index 0ec8d84ed351..04119b2f9dd6 100644 --- a/sys/contrib/dev/acpica/exsystem.c +++ b/sys/contrib/dev/acpica/exsystem.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exsystem - Interface to OS services - * $Revision: 73 $ + * $Revision: 74 $ * *****************************************************************************/ @@ -143,7 +143,7 @@ ACPI_STATUS AcpiExSystemWaitSemaphore ( ACPI_HANDLE Semaphore, - UINT32 Timeout) + UINT16 Timeout) { ACPI_STATUS Status; ACPI_STATUS Status2; @@ -300,12 +300,12 @@ AcpiExSystemAcquireMutex ( */ if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore) { - Status = AcpiEvAcquireGlobalLock ((UINT32) TimeDesc->Integer.Value); + Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value); return_ACPI_STATUS (Status); } Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore, - (UINT32) TimeDesc->Integer.Value); + (UINT16) TimeDesc->Integer.Value); return_ACPI_STATUS (Status); } @@ -415,7 +415,7 @@ AcpiExSystemWaitEvent ( if (ObjDesc) { Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore, - (UINT32) TimeDesc->Integer.Value); + (UINT16) TimeDesc->Integer.Value); } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index 61fbe722cf98..dd085b903deb 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 46 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -432,6 +432,12 @@ AcpiEnterSleepState ( } while (!InValue); + Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index 63c7cf105df8..488adc7b751c 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 133 $ + * $Revision: 135 $ * *****************************************************************************/ @@ -580,7 +580,8 @@ AcpiPsParseLoop ( Status = AcpiPsNextParseState (WalkState, Op, Status); } - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op)); } else if (WalkState->PrevOp) @@ -603,7 +604,8 @@ AcpiPsParseLoop ( { /* Get the next opcode from the AML stream */ - WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart); + WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); WalkState->Opcode = AcpiPsPeekOpcode (ParserState); /* @@ -663,9 +665,8 @@ AcpiPsParseLoop ( while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME)) { - Status = AcpiPsGetNextArg (ParserState, - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), - &WalkState->ArgCount, &Arg); + Status = AcpiPsGetNextArg (WalkState, ParserState, + GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); if (ACPI_FAILURE (Status)) { goto CloseThisOp; @@ -726,7 +727,7 @@ AcpiPsParseLoop ( * Defer final parsing of an OperationRegion body, * because we don't have enough info in the first pass * to parse it correctly (i.e., there may be method - * calls within the TermArg elements of the body. + * calls within the TermArg elements of the body.) * * However, we must continue parsing because * the opregion is not a standalone package -- @@ -815,22 +816,15 @@ AcpiPsParseLoop ( /* Fill in constant or string argument directly */ AcpiPsGetNextSimpleArg (ParserState, - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op); + GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op); break; case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - Status = AcpiPsGetNextNamepath (ParserState, Op, &WalkState->ArgCount, 1); + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1); if (ACPI_FAILURE (Status)) { - /* NOT_FOUND is an error only if we are actually executing a method */ - - if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) && - (Status == AE_NOT_FOUND)) || - (Status != AE_NOT_FOUND)) - { - goto CloseThisOp; - } + goto CloseThisOp; } WalkState->ArgTypes = 0; @@ -841,24 +835,16 @@ AcpiPsParseLoop ( /* Op is not a constant or string, append each argument */ - while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) + while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && + !WalkState->ArgCount) { WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart); - Status = AcpiPsGetNextArg (ParserState, - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), - &WalkState->ArgCount, &Arg); + Status = AcpiPsGetNextArg (WalkState, ParserState, + GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); if (ACPI_FAILURE (Status)) { - /* NOT_FOUND is an error only if we are actually executing a method */ - - if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) && - (Status == AE_NOT_FOUND) && - (Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) || - (Status != AE_NOT_FOUND)) - { - goto CloseThisOp; - } + goto CloseThisOp; } if (Arg) @@ -936,7 +922,8 @@ AcpiPsParseLoop ( { /* There are arguments (complex ones), push Op and prepare for argument */ - Status = AcpiPsPushScope (ParserState, Op, WalkState->ArgTypes, WalkState->ArgCount); + Status = AcpiPsPushScope (ParserState, Op, + WalkState->ArgTypes, WalkState->ArgCount); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -1026,7 +1013,8 @@ AcpiPsParseLoop ( case AE_CTRL_END: - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); if (Op) { @@ -1051,7 +1039,8 @@ AcpiPsParseLoop ( while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP)) { - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); } /* Close this iteration of the While loop */ @@ -1081,7 +1070,8 @@ AcpiPsParseLoop ( { AcpiPsCompleteThisOp (WalkState, Op); } - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); } while (Op); @@ -1096,7 +1086,8 @@ AcpiPsParseLoop ( { AcpiPsCompleteThisOp (WalkState, Op); } - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); } while (Op); @@ -1107,7 +1098,8 @@ AcpiPsParseLoop ( #if 0 if (Op == NULL) { - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); } #endif WalkState->PrevOp = Op; @@ -1119,7 +1111,8 @@ AcpiPsParseLoop ( if (AcpiPsHasCompletedScope (ParserState)) { - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op)); } else @@ -1167,7 +1160,8 @@ AcpiPsParseLoop ( AcpiPsCompleteThisOp (WalkState, Op); } - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, + &WalkState->ArgTypes, &WalkState->ArgCount); } while (Op); @@ -1184,7 +1178,8 @@ AcpiPsParseLoop ( AcpiPsCompleteThisOp (WalkState, Op); } - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); + AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, + &WalkState->ArgCount); } while (Op); @@ -1264,7 +1259,8 @@ AcpiPsParseAml ( } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Completed one call to walk loop, State=%p\n", WalkState)); + "Completed one call to walk loop, %s State=%p\n", + AcpiFormatException (Status), WalkState)); if (Status == AE_CTRL_TRANSFER) { @@ -1281,11 +1277,17 @@ AcpiPsParseAml ( WalkState = AcpiDsGetCurrentWalkState (Thread); continue; } - else if (Status == AE_CTRL_TERMINATE) { Status = AE_OK; } + else if (Status != AE_OK) + { + ACPI_REPORT_ERROR (("Method execution failed, %s\n", + AcpiFormatException (Status))); + ACPI_DUMP_PATHNAME (WalkState->MethodNode, "Method pathname: ", + ACPI_LV_ERROR, _COMPONENT); + } /* We are done with this walk, move on to the parent if any */ @@ -1312,7 +1314,8 @@ AcpiPsParseAml ( TerminateStatus = AcpiDsTerminateControlMethod (WalkState); if (ACPI_FAILURE (TerminateStatus)) { - ACPI_REPORT_ERROR (("Could not terminate control method properly\n")); + ACPI_REPORT_ERROR (( + "Could not terminate control method properly\n")); /* Ignore error and continue */ } @@ -1339,7 +1342,8 @@ AcpiPsParseAml ( * If the method return value is not used by the parent, * The object is deleted */ - Status = AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ReturnDesc); + Status = AcpiDsRestartControlMethod (WalkState, + PreviousWalkState->ReturnDesc); if (ACPI_SUCCESS (Status)) { WalkState->WalkType |= ACPI_WALK_METHOD_RESTART; @@ -1350,10 +1354,6 @@ AcpiPsParseAml ( /* On error, delete any return object */ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); - - ACPI_REPORT_ERROR (("Method execution failed, %s\n", AcpiFormatException (Status))); - ACPI_DUMP_PATHNAME (WalkState->MethodNode, "Method pathname: ", - ACPI_LV_ERROR, _COMPONENT); } } @@ -1376,7 +1376,6 @@ AcpiPsParseAml ( *(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */ } - else if (PreviousWalkState->ReturnDesc) { /* Caller doesn't want it, must delete it */ diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index e0831e717955..22355504dced 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/rscreate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 58 $ + * $Revision: 61 $ * ******************************************************************************/ @@ -159,7 +159,8 @@ AcpiRsCreateResourceList ( ACPI_FUNCTION_TRACE ("RsCreateResourceList"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", ByteStreamBuffer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", + ByteStreamBuffer)); /* * Params already validated, so we don't re-validate here @@ -231,13 +232,13 @@ AcpiRsCreatePciRoutingTable ( ACPI_BUFFER *OutputBuffer) { UINT8 *Buffer; - ACPI_OPERAND_OBJECT **TopObjectList = NULL; - ACPI_OPERAND_OBJECT **SubObjectList = NULL; - ACPI_OPERAND_OBJECT *PackageElement = NULL; + ACPI_OPERAND_OBJECT **TopObjectList; + ACPI_OPERAND_OBJECT **SubObjectList; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_SIZE BufferSizeNeeded = 0; - UINT32 NumberOfElements = 0; - UINT32 Index = 0; - ACPI_PCI_ROUTING_TABLE *UserPrt = NULL; + UINT32 NumberOfElements; + UINT32 Index; + ACPI_PCI_ROUTING_TABLE *UserPrt; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_BUFFER PathBuffer; @@ -258,7 +259,8 @@ AcpiRsCreatePciRoutingTable ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", (UINT32) BufferSizeNeeded)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", + (UINT32) BufferSizeNeeded)); /* Validate/Allocate/Clear caller buffer */ @@ -269,7 +271,8 @@ AcpiRsCreatePciRoutingTable ( } /* - * Loop through the ACPI_INTERNAL_OBJECTS - Each object should contain an + * Loop through the ACPI_INTERNAL_OBJECTS - Each object + * should be a package that in turn contains an * ACPI_INTEGER Address, a UINT8 Pin, a Name and a UINT8 SourceIndex. */ TopObjectList = PackageObject->Package.Elements; @@ -293,87 +296,106 @@ AcpiRsCreatePciRoutingTable ( * The minus four is to subtract the size of the UINT8 Source[4] member * because it is added below. */ - UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) -4); + UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); /* - * Dereference the sub-package + * Each element of the top-level package must also be a package */ - PackageElement = *TopObjectList; + if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X]) Need sub-package, found %s\n", + Index, AcpiUtGetObjectTypeName (*TopObjectList))); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + + /* Each sub-package must be of length 4 */ + + if ((*TopObjectList)->Package.Count != 4) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X]) Need package of length 4, found length %d\n", + Index, (*TopObjectList)->Package.Count)); + return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); + } /* + * Dereference the sub-package. * The SubObjectList will now point to an array of the four IRQ - * elements: Address, Pin, Source and SourceIndex + * elements: [Address, Pin, Source, SourceIndex] */ - SubObjectList = PackageElement->Package.Elements; + SubObjectList = (*TopObjectList)->Package.Elements; /* - * 1) First subobject: Dereference the Address + * 1) First subobject: Dereference the PRT.Address */ - if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_INTEGER) + ObjDesc = SubObjectList[0]; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - UserPrt->Address = (*SubObjectList)->Integer.Value; + UserPrt->Address = ObjDesc->Integer.Value; } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetObjectTypeName (*SubObjectList))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Address) Need Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } /* - * 2) Second subobject: Dereference the Pin + * 2) Second subobject: Dereference the PRT.Pin */ - SubObjectList++; - - if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_INTEGER) + ObjDesc = SubObjectList[1]; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value; + UserPrt->Pin = (UINT32) ObjDesc->Integer.Value; } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetObjectTypeName (*SubObjectList))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Pin) Need Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } /* - * 3) Third subobject: Dereference the Source Name + * 3) Third subobject: Dereference the PRT.SourceName */ - SubObjectList++; - - switch (ACPI_GET_OBJECT_TYPE (*SubObjectList)) + ObjDesc = SubObjectList[2]; + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { - case INTERNAL_TYPE_REFERENCE: + case ACPI_TYPE_LOCAL_REFERENCE: - if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP) + if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n", - (*SubObjectList)->Reference.Opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Source) Need name, found reference op %X\n", + Index, ObjDesc->Reference.Opcode)); return_ACPI_STATUS (AE_BAD_DATA); } - Node = (*SubObjectList)->Reference.Node; + Node = ObjDesc->Reference.Node; /* Use *remaining* length of the buffer as max for pathname */ PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->Source - (UINT8 *) OutputBuffer->Pointer); + (UINT32) ((UINT8 *) UserPrt->Source - + (UINT8 *) OutputBuffer->Pointer); PathBuffer.Pointer = UserPrt->Source; Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer); - UserPrt->Length += ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */ + UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */ break; case ACPI_TYPE_STRING: - ACPI_STRCPY (UserPrt->Source, - (*SubObjectList)->String.Pointer); + ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer); /* Add to the Length field the length of the string */ - UserPrt->Length += (*SubObjectList)->String.Length; + UserPrt->Length += ObjDesc->String.Length; break; @@ -390,8 +412,9 @@ AcpiRsCreatePciRoutingTable ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetObjectTypeName (*SubObjectList))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -400,22 +423,22 @@ AcpiRsCreatePciRoutingTable ( UserPrt->Length = ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); /* - * 4) Fourth subobject: Dereference the Source Index + * 4) Fourth subobject: Dereference the PRT.SourceIndex */ - SubObjectList++; - - if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_INTEGER) + ObjDesc = SubObjectList[3]; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value; + UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value; } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetObjectTypeName (*SubObjectList))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "(PRT[%X].SourceIndex) Need Integer, found %s\n", + Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } - /* Point to the next ACPI_OPERAND_OBJECT */ + /* Point to the next ACPI_OPERAND_OBJECT in the top level package */ TopObjectList++; } @@ -456,7 +479,8 @@ AcpiRsCreateByteStream ( ACPI_FUNCTION_TRACE ("RsCreateByteStream"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", LinkedListBuffer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", + LinkedListBuffer)); /* * Params already validated, so we don't re-validate here diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c index 428ea3f8afe3..6f9b9f8c3fd7 100644 --- a/sys/contrib/dev/acpica/tbget.c +++ b/sys/contrib/dev/acpica/tbget.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines - * $Revision: 80 $ + * $Revision: 81 $ * *****************************************************************************/ @@ -492,7 +492,6 @@ AcpiTbGetThisTable ( TableInfo->Pointer = FullTable; TableInfo->Length = (ACPI_SIZE) Header->Length; TableInfo->Allocation = Allocation; - TableInfo->BasePointer = FullTable; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n", diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index bcd60b549ade..52be7a0a7476 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 171 $ + * $Revision: 172 $ * *****************************************************************************/ @@ -275,11 +275,11 @@ const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = { const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { - {"_GPE", INTERNAL_TYPE_SCOPE, NULL}, - {"_PR_", INTERNAL_TYPE_SCOPE, NULL}, + {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_SB_", ACPI_TYPE_DEVICE, NULL}, - {"_SI_", INTERNAL_TYPE_SCOPE, NULL}, - {"_TZ_", INTERNAL_TYPE_SCOPE, NULL}, + {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_TZ_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_REV", ACPI_TYPE_INTEGER, "2"}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, "0"}, @@ -324,17 +324,10 @@ const UINT8 AcpiGbl_NsProperties[] = ACPI_NS_NORMAL, /* 23 Address Handler */ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */ - ACPI_NS_NORMAL, /* 26 DefFieldDefn */ - ACPI_NS_NORMAL, /* 27 BankFieldDefn */ - ACPI_NS_NORMAL, /* 28 IndexFieldDefn */ - ACPI_NS_NORMAL, /* 29 If */ - ACPI_NS_NORMAL, /* 30 Else */ - ACPI_NS_NORMAL, /* 31 While */ - ACPI_NS_NEWSCOPE, /* 32 Scope */ - ACPI_NS_LOCAL, /* 33 DefAny */ - ACPI_NS_NORMAL, /* 34 Extra */ - ACPI_NS_NORMAL, /* 35 Data */ - ACPI_NS_NORMAL /* 36 Invalid */ + ACPI_NS_NEWSCOPE, /* 26 Scope */ + ACPI_NS_NORMAL, /* 27 Extra */ + ACPI_NS_NORMAL, /* 28 Data */ + ACPI_NS_NORMAL /* 29 Invalid */ }; @@ -580,17 +573,10 @@ static const NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC /* 23 */ "AddrHandler", /* 24 */ "ResourceDesc", /* 25 */ "ResourceFld", - /* 26 */ "RegionFldDfn", - /* 27 */ "BankFldDfn", - /* 28 */ "IndexFldDfn", - /* 29 */ "If", - /* 30 */ "Else", - /* 31 */ "While", - /* 32 */ "Scope", - /* 33 */ "DefAny", - /* 34 */ "Extra", - /* 35 */ "Data", - /* 36 */ "Invalid" + /* 26 */ "Scope", + /* 27 */ "Extra", + /* 28 */ "Data", + /* 39 */ "Invalid" }; @@ -599,7 +585,7 @@ AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type) { - if (Type > INTERNAL_TYPE_INVALID) + if (Type > ACPI_TYPE_INVALID) { return ((NATIVE_CHAR *) AcpiGbl_BadType); } @@ -662,7 +648,7 @@ AcpiUtGetMutexName ( * * FUNCTION: AcpiUtValidObjectType * - * PARAMETERS: None. + * PARAMETERS: Type - Object type to be validated * * RETURN: TRUE if valid object type * @@ -675,13 +661,11 @@ AcpiUtValidObjectType ( ACPI_OBJECT_TYPE Type) { - if (Type > ACPI_TYPE_MAX) + if (Type > ACPI_TYPE_LOCAL_MAX) { - if ((Type < INTERNAL_TYPE_BEGIN) || - (Type > INTERNAL_TYPE_MAX)) - { - return (FALSE); - } + /* Note: Assumes all TYPEs are contiguous (external/local) */ + + return (FALSE); } return (TRUE); @@ -866,7 +850,7 @@ AcpiUtInitGlobals ( AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; + AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; AcpiGbl_RootNodeStruct.Child = NULL; AcpiGbl_RootNodeStruct.Peer = NULL; AcpiGbl_RootNodeStruct.Object = NULL; diff --git a/sys/dev/acpica/Osd/OsdSynch.c b/sys/dev/acpica/Osd/OsdSynch.c index 9c80485c7aeb..718e3c73bb84 100644 --- a/sys/dev/acpica/Osd/OsdSynch.c +++ b/sys/dev/acpica/Osd/OsdSynch.c @@ -144,7 +144,7 @@ AcpiOsDeleteSemaphore (ACPI_HANDLE Handle) * use getmicrotime() to correctly adjust the timeout after being woken up. */ ACPI_STATUS -AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT32 Timeout) +AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout) { #ifndef ACPI_NO_SEMAPHORES struct acpi_semaphore *as = (struct acpi_semaphore *)Handle; @@ -179,8 +179,8 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT32 Timeout) } #endif - /* a timeout of WAIT_FOREVER means "forever" */ - if (Timeout == WAIT_FOREVER) { + /* a timeout of ACPI_WAIT_FOREVER means "forever" */ + if (Timeout == ACPI_WAIT_FOREVER) { tmo = 0; timeouttv.tv_sec = ((0xffff/1000) + 1); /* cf. ACPI spec */ timeouttv.tv_usec = 0; diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index f41cebff69e9..680d3f4b730a 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -254,8 +254,8 @@ EcLock(struct acpi_ec_softc *sc) { ACPI_STATUS status; - /* XXX WAIT_FOREVER is probably a bad idea, what is a better time? */ - if (ACPI_SUCCESS(status = AcpiAcquireGlobalLock(WAIT_FOREVER, &sc->ec_lockhandle))) + /* XXX ACPI_WAIT_FOREVER is probably a bad idea, what is a better time? */ + if (ACPI_SUCCESS(status = AcpiAcquireGlobalLock(ACPI_WAIT_FOREVER, &sc->ec_lockhandle))) (sc)->ec_locked = 1; return(status); diff --git a/sys/sys/ctype.h b/sys/sys/ctype.h index b306e85e762c..212f6d841175 100644 --- a/sys/sys/ctype.h +++ b/sys/sys/ctype.h @@ -52,6 +52,7 @@ #define isxdigit(c) (isdigit(c) \ || ((c) >= 'A' && (c) <= 'F') \ || ((c) >= 'a' && (c) <= 'f')) +#define isprint(c) ((c) >= ' ' && (c) <= '~') #define toupper(c) ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z'))) #define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z')))