Index: bus/acpi/acpica/dispatcher/dsmethod.c =================================================================== --- bus/acpi/acpica/dispatcher/dsmethod.c (revision 73899) +++ bus/acpi/acpica/dispatcher/dsmethod.c (working copy) @@ -460,6 +460,9 @@ { ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = ObjDesc->Method.Mutex->Mutex.SyncLevel; + + ObjDesc->Method.Mutex->Mutex.ThreadId = + AcpiOsGetThreadId (); } } Index: bus/acpi/acpica/dispatcher/dsutils.c =================================================================== --- bus/acpi/acpica/dispatcher/dsutils.c (revision 73899) +++ bus/acpi/acpica/dispatcher/dsutils.c (working copy) @@ -603,12 +603,14 @@ } else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP) { - /* TBD: May only be temporary */ - - ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength); - - strncpy (ObjDesc->String.Pointer, NameString, NameLength); - Status = AE_OK; + /* + * This opcode should never appear here. It is used only + * by AML disassemblers and is surrounded by an If(0) + * by the ASL compiler. + * + * Therefore, if we see it here, it is a serious error. + */ + Status = AE_AML_BAD_OPCODE; } else { Index: bus/acpi/acpica/executer/exnames.c =================================================================== --- bus/acpi/acpica/executer/exnames.c (revision 73899) +++ bus/acpi/acpica/executer/exnames.c (working copy) @@ -204,7 +204,7 @@ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n")); for (Index = 0; - (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiChar (*AmlAddress, 0)); + (Index < ACPI_NAME_SIZE) && (AcpiUtValidNameChar (*AmlAddress, 0)); Index++) { CharBuf[Index] = *AmlAddress++; Index: bus/acpi/acpica/include/acdisasm.h =================================================================== --- bus/acpi/acpica/include/acdisasm.h (revision 73899) +++ bus/acpi/acpica/include/acdisasm.h (working copy) @@ -385,6 +385,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; Index: bus/acpi/acpica/include/acglobal.h =================================================================== --- bus/acpi/acpica/include/acglobal.h (revision 73899) +++ bus/acpi/acpica/include/acglobal.h (working copy) @@ -321,6 +321,7 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmEmitExternalOpcodes, FALSE); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); Index: bus/acpi/acpica/include/aclocal.h =================================================================== --- bus/acpi/acpica/include/aclocal.h (revision 73899) +++ bus/acpi/acpica/include/aclocal.h (working copy) @@ -1025,24 +1025,24 @@ /* Parse object flags */ -#define ACPI_PARSEOP_GENERIC 0x01 -#define ACPI_PARSEOP_NAMED 0x02 -#define ACPI_PARSEOP_DEFERRED 0x04 -#define ACPI_PARSEOP_BYTELIST 0x08 -#define ACPI_PARSEOP_IN_STACK 0x10 -#define ACPI_PARSEOP_TARGET 0x20 -#define ACPI_PARSEOP_IN_CACHE 0x80 +#define ACPI_PARSEOP_GENERIC 0x01 +#define ACPI_PARSEOP_NAMED_OBJECT 0x02 +#define ACPI_PARSEOP_DEFERRED 0x04 +#define ACPI_PARSEOP_BYTELIST 0x08 +#define ACPI_PARSEOP_IN_STACK 0x10 +#define ACPI_PARSEOP_TARGET 0x20 +#define ACPI_PARSEOP_IN_CACHE 0x80 /* Parse object DisasmFlags */ -#define ACPI_PARSEOP_IGNORE 0x01 -#define ACPI_PARSEOP_PARAMLIST 0x02 -#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 -#define ACPI_PARSEOP_PREDEF_CHECKED 0x08 -#define ACPI_PARSEOP_CLOSING_PAREN 0x10 -#define ACPI_PARSEOP_COMPOUND 0x20 -#define ACPI_PARSEOP_ASSIGNMENT 0x40 -#define ACPI_PARSEOP_ELSEIF 0x80 +#define ACPI_PARSEOP_IGNORE 0x01 +#define ACPI_PARSEOP_PARAMETER_LIST 0x02 +#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 +#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x08 +#define ACPI_PARSEOP_CLOSING_PAREN 0x10 +#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x20 +#define ACPI_PARSEOP_ASSIGNMENT 0x40 +#define ACPI_PARSEOP_ELSEIF 0x80 /***************************************************************************** Index: bus/acpi/acpica/include/acmacros.h =================================================================== --- bus/acpi/acpica/include/acmacros.h (revision 73899) +++ bus/acpi/acpica/include/acmacros.h (working copy) @@ -264,10 +264,6 @@ #define ACPI_IS_MISALIGNED(value) (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1)) -/* Generic (power-of-two) rounding */ - -#define ACPI_IS_POWER_OF_TWO(a) (((a) & ((a) - 1)) == 0) - /* * Bitmask creation * Bit positions start at zero. @@ -291,10 +287,10 @@ /* Generic bitfield macros and masks */ #define ACPI_GET_BITS(SourcePtr, Position, Mask) \ - ((*SourcePtr >> Position) & Mask) + ((*(SourcePtr) >> (Position)) & (Mask)) #define ACPI_SET_BITS(TargetPtr, Position, Mask, Value) \ - (*TargetPtr |= ((Value & Mask) << Position)) + (*(TargetPtr) |= (((Value) & (Mask)) << (Position))) #define ACPI_1BIT_MASK 0x00000001 #define ACPI_2BIT_MASK 0x00000003 Index: bus/acpi/acpica/include/acoutput.h =================================================================== --- bus/acpi/acpica/include/acoutput.h (revision 73899) +++ bus/acpi/acpica/include/acoutput.h (working copy) @@ -372,7 +372,7 @@ ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, UINT32, Value) #define ACPI_FUNCTION_TRACE_STR(Name, String) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, char *, String) + ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, const char *, String) #define ACPI_FUNCTION_ENTRY() \ AcpiUtTrackStackPtr() @@ -432,6 +432,9 @@ #define return_PTR(Pointer) \ ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer) +#define return_STR(String) \ + ACPI_TRACE_EXIT (AcpiUtStrExit, const char *, String) + #define return_VALUE(Value) \ ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value) @@ -486,6 +489,7 @@ #define return_VOID return #define return_ACPI_STATUS(s) return(s) #define return_PTR(s) return(s) +#define return_STR(s) return(s) #define return_VALUE(s) return(s) #define return_UINT8(s) return(s) #define return_UINT32(s) return(s) Index: bus/acpi/acpica/include/acpixf.h =================================================================== --- bus/acpi/acpica/include/acpixf.h (revision 73899) +++ bus/acpi/acpica/include/acpixf.h (working copy) @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20160318 +#define ACPI_CA_VERSION 0x20160527 #include "acconfig.h" #include "actypes.h" Index: bus/acpi/acpica/include/acpredef.h =================================================================== --- bus/acpi/acpica/include/acpredef.h (revision 73899) +++ bus/acpi/acpica/include/acpredef.h (working copy) @@ -131,7 +131,8 @@ ACPI_PTYPE2_REV_FIXED = 9, ACPI_PTYPE2_FIX_VAR = 10, ACPI_PTYPE2_VAR_VAR = 11, - ACPI_PTYPE2_UUID_PAIR = 12 + ACPI_PTYPE2_UUID_PAIR = 12, + ACPI_PTYPE_CUSTOM = 13 }; @@ -344,7 +345,7 @@ {{"_BIX", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ - PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING, 4,0), + PACKAGE_INFO (ACPI_PTYPE_CUSTOM, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING, 4,0), {{"_BLT", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), METHOD_NO_RETURN_VALUE}}, Index: bus/acpi/acpica/include/acrestyp.h =================================================================== --- bus/acpi/acpica/include/acrestyp.h (revision 73899) +++ bus/acpi/acpica/include/acrestyp.h (working copy) @@ -485,6 +485,7 @@ UINT8 Type; \ UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\ UINT8 SlaveMode; \ + UINT8 ConnectionSharing; \ UINT8 TypeRevisionId; \ UINT16 TypeDataLength; \ UINT16 VendorLength; \ Index: bus/acpi/acpica/include/actables.h =================================================================== --- bus/acpi/acpica/include/actables.h (revision 73899) +++ bus/acpi/acpica/include/actables.h (working copy) @@ -246,11 +246,7 @@ AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress); -BOOLEAN -AcpiIsValidSignature ( - char *Signature); - /* * tbxfload */ Index: bus/acpi/acpica/include/actbl3.h =================================================================== --- bus/acpi/acpica/include/actbl3.h (revision 73899) +++ bus/acpi/acpica/include/actbl3.h (working copy) @@ -563,9 +563,10 @@ enum AcpiPcctType { - ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, - ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, - ACPI_PCCT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ + ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */ + ACPI_PCCT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ }; /* @@ -609,6 +610,30 @@ } ACPI_PCCT_HW_REDUCED; + +/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */ + +typedef struct acpi_pcct_hw_reduced_type2 +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 DoorbellInterrupt; + UINT8 Flags; + UINT8 Reserved; + UINT64 BaseAddress; + UINT64 Length; + ACPI_GENERIC_ADDRESS DoorbellRegister; + UINT64 PreserveMask; + UINT64 WriteMask; + UINT32 Latency; + UINT32 MaxAccessRate; + UINT16 MinTurnaroundTime; + ACPI_GENERIC_ADDRESS DoorbellAckRegister; + UINT64 AckPreserveMask; + UINT64 AckWriteMask; + +} ACPI_PCCT_HW_REDUCED_TYPE2; + + /* Values for doorbell flags above */ #define ACPI_PCCT_INTERRUPT_POLARITY (1) Index: bus/acpi/acpica/include/acutils.h =================================================================== --- bus/acpi/acpica/include/acutils.h (revision 73899) +++ bus/acpi/acpica/include/acutils.h (working copy) @@ -115,13 +115,25 @@ /* * Common error message prefixes */ +#ifndef ACPI_MSG_ERROR #define ACPI_MSG_ERROR "ACPI Error: " +#endif +#ifndef ACPI_MSG_EXCEPTION #define ACPI_MSG_EXCEPTION "ACPI Exception: " +#endif +#ifndef ACPI_MSG_WARNING #define ACPI_MSG_WARNING "ACPI Warning: " +#endif +#ifndef ACPI_MSG_INFO #define ACPI_MSG_INFO "ACPI: " +#endif +#ifndef ACPI_MSG_BIOS_ERROR #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " +#endif +#ifndef ACPI_MSG_BIOS_WARNING #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " +#endif /* * Common message suffix @@ -175,6 +187,25 @@ /* + * utascii - ASCII utilities + */ +BOOLEAN +AcpiUtValidNameseg ( + char *Signature); + +BOOLEAN +AcpiUtValidNameChar ( + char Character, + UINT32 Position); + +void +AcpiUtCheckAndRepairAscii ( + UINT8 *Name, + char *RepairedName, + UINT32 Count); + + +/* * utnonansi - Non-ANSI C library functions */ void @@ -397,6 +428,14 @@ UINT8 *Ptr); void +AcpiUtStrExit ( + UINT32 LineNumber, + const char *FunctionName, + const char *ModuleName, + UINT32 ComponentId, + const char *String); + +void AcpiUtDebugDumpBuffer ( UINT8 *Buffer, UINT32 Count, @@ -832,15 +871,6 @@ char *Pathname); #endif -BOOLEAN -AcpiUtValidAcpiName ( - char *Name); - -BOOLEAN -AcpiUtValidAcpiChar ( - char Character, - UINT32 Position); - void AcpiUtRepairName ( char *Name); Index: bus/acpi/acpica/include/platform/aclinux.h =================================================================== --- bus/acpi/acpica/include/platform/aclinux.h (revision 73899) +++ bus/acpi/acpica/include/platform/aclinux.h (working copy) @@ -163,6 +163,14 @@ #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory +#define ACPI_MSG_ERROR KERN_ERR "ACPI Error: " +#define ACPI_MSG_EXCEPTION KERN_ERR "ACPI Exception: " +#define ACPI_MSG_WARNING KERN_WARNING "ACPI Warning: " +#define ACPI_MSG_INFO KERN_INFO "ACPI: " + +#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): " +#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): " + #else /* !__KERNEL__ */ #include Index: bus/acpi/acpica/namespace/nsaccess.c =================================================================== --- bus/acpi/acpica/namespace/nsaccess.c (revision 73899) +++ bus/acpi/acpica/namespace/nsaccess.c (working copy) @@ -116,8 +116,8 @@ continue; } - Status = AcpiNsLookup (NULL, (char *) InitVal->Name, InitVal->Type, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, + Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name), + InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &NewNode); if (ACPI_FAILURE (Status)) { Index: bus/acpi/acpica/namespace/nsdump.c =================================================================== --- bus/acpi/acpica/namespace/nsdump.c (revision 73899) +++ bus/acpi/acpica/namespace/nsdump.c (working copy) @@ -381,7 +381,7 @@ case ACPI_TYPE_STRING: AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); - AcpiUtPrintString (ObjDesc->String.Pointer, 32); + AcpiUtPrintString (ObjDesc->String.Pointer, 80); AcpiOsPrintf ("\n"); break; Index: bus/acpi/acpica/namespace/nsinit.c =================================================================== --- bus/acpi/acpica/namespace/nsinit.c (revision 73899) +++ bus/acpi/acpica/namespace/nsinit.c (working copy) @@ -215,7 +215,7 @@ /* * Execute \_SB._INI. - * There appears to be a strict order requirement for \_SB._INI, + * There appears to be a strict order requirement for \_SB._INI, * which should be evaluated before any _REG evaluations. */ Status = AcpiGetHandle (NULL, "\\_SB", &Handle); Index: bus/acpi/acpica/namespace/nsprepkg.c =================================================================== --- bus/acpi/acpica/namespace/nsprepkg.c (revision 73899) +++ bus/acpi/acpica/namespace/nsprepkg.c (working copy) @@ -70,7 +70,13 @@ UINT32 Count2, UINT32 StartIndex); +static ACPI_STATUS +AcpiNsCustomPackage ( + ACPI_EVALUATE_INFO *Info, + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count); + /******************************************************************************* * * FUNCTION: AcpiNsCheckPackage @@ -148,6 +154,11 @@ */ switch (Package->RetInfo.Type) { + case ACPI_PTYPE_CUSTOM: + + Status = AcpiNsCustomPackage (Info, Elements, Count); + break; + case ACPI_PTYPE1_FIXED: /* * The package count is fixed and there are no subpackages @@ -626,6 +637,92 @@ /******************************************************************************* * + * FUNCTION: AcpiNsCustomPackage + * + * PARAMETERS: Info - Method execution information block + * Elements - Pointer to the package elements array + * Count - Element count for the package + * + * RETURN: Status + * + * DESCRIPTION: Check a returned package object for the correct count and + * correct type of all sub-objects. + * + * NOTE: Currently used for the _BIX method only. When needed for two or more + * methods, probably a detect/dispatch mechanism will be required. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsCustomPackage ( + ACPI_EVALUATE_INFO *Info, + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count) +{ + UINT32 ExpectedCount; + UINT32 Version; + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_NAME (NsCustomPackage); + + + /* Get version number, must be Integer */ + + if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + "Return Package has invalid object type for version number")); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + + Version = (UINT32) (*Elements)->Integer.Value; + ExpectedCount = 21; /* Version 1 */ + + if (Version == 0) + { + ExpectedCount = 20; /* Version 0 */ + } + + if (Count < ExpectedCount) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + "Return Package is too small - found %u elements, expected %u", + Count, ExpectedCount)); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); + } + else if (Count > ExpectedCount) + { + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Return Package is larger than needed - " + "found %u, expected %u\n", + Info->FullPathname, Count, ExpectedCount)); + } + + /* Validate all elements of the returned package */ + + Status = AcpiNsCheckPackageElements (Info, Elements, + ACPI_RTYPE_INTEGER, 16, + ACPI_RTYPE_STRING, 4, 0); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Version 1 has a single trailing integer */ + + if (Version > 0) + { + Status = AcpiNsCheckPackageElements (Info, Elements + 20, + ACPI_RTYPE_INTEGER, 1, 0, 0, 20); + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiNsCheckPackageElements * * PARAMETERS: Info - Method execution information block Index: bus/acpi/acpica/namespace/nsxfeval.c =================================================================== --- bus/acpi/acpica/namespace/nsxfeval.c (revision 73899) +++ bus/acpi/acpica/namespace/nsxfeval.c (working copy) @@ -305,13 +305,12 @@ } -#if 0 +#ifdef _FUTURE_FEATURE /* * Begin incoming argument count analysis. Check for too few args * and too many args. */ - switch (AcpiNsGetType (Info->Node)) { case ACPI_TYPE_METHOD: @@ -399,69 +398,74 @@ * If we are expecting a return value, and all went well above, * copy the return value to an external object. */ - if (ReturnBuffer) + if (!ReturnBuffer) { - if (!Info->ReturnObject) - { - ReturnBuffer->Length = 0; - } - else - { - if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) == - ACPI_DESC_TYPE_NAMED) - { - /* - * If we received a NS Node as a return object, this means that - * the object we are evaluating has nothing interesting to - * return (such as a mutex, etc.) We return an error because - * these types are essentially unsupported by this interface. - * We don't check up front because this makes it easier to add - * support for various types at a later date if necessary. - */ - Status = AE_TYPE; - Info->ReturnObject = NULL; /* No need to delete a NS Node */ - ReturnBuffer->Length = 0; - } + goto CleanupReturnObject; + } - if (ACPI_SUCCESS (Status)) - { - /* Dereference Index and RefOf references */ + if (!Info->ReturnObject) + { + ReturnBuffer->Length = 0; + goto Cleanup; + } - AcpiNsResolveReferences (Info); + if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) == + ACPI_DESC_TYPE_NAMED) + { + /* + * If we received a NS Node as a return object, this means that + * the object we are evaluating has nothing interesting to + * return (such as a mutex, etc.) We return an error because + * these types are essentially unsupported by this interface. + * We don't check up front because this makes it easier to add + * support for various types at a later date if necessary. + */ + Status = AE_TYPE; + Info->ReturnObject = NULL; /* No need to delete a NS Node */ + ReturnBuffer->Length = 0; + } - /* Get the size of the returned object */ + if (ACPI_FAILURE (Status)) + { + goto CleanupReturnObject; + } - Status = AcpiUtGetObjectSize (Info->ReturnObject, - &BufferSpaceNeeded); - if (ACPI_SUCCESS (Status)) - { - /* Validate/Allocate/Clear caller buffer */ + /* Dereference Index and RefOf references */ - Status = AcpiUtInitializeBuffer (ReturnBuffer, - BufferSpaceNeeded); - if (ACPI_FAILURE (Status)) - { - /* - * Caller's buffer is too small or a new one can't - * be allocated - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Needed buffer size %X, %s\n", - (UINT32) BufferSpaceNeeded, - AcpiFormatException (Status))); - } - else - { - /* We have enough space for the object, build it */ + AcpiNsResolveReferences (Info); - Status = AcpiUtCopyIobjectToEobject ( - Info->ReturnObject, ReturnBuffer); - } - } - } + /* Get the size of the returned object */ + + Status = AcpiUtGetObjectSize (Info->ReturnObject, + &BufferSpaceNeeded); + if (ACPI_SUCCESS (Status)) + { + /* Validate/Allocate/Clear caller buffer */ + + Status = AcpiUtInitializeBuffer (ReturnBuffer, + BufferSpaceNeeded); + if (ACPI_FAILURE (Status)) + { + /* + * Caller's buffer is too small or a new one can't + * be allocated + */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Needed buffer size %X, %s\n", + (UINT32) BufferSpaceNeeded, + AcpiFormatException (Status))); } + else + { + /* We have enough space for the object, build it */ + + Status = AcpiUtCopyIobjectToEobject ( + Info->ReturnObject, ReturnBuffer); + } } +CleanupReturnObject: + if (Info->ReturnObject) { /* Index: bus/acpi/acpica/parser/psutils.c =================================================================== --- bus/acpi/acpica/parser/psutils.c (revision 73899) +++ bus/acpi/acpica/parser/psutils.c (working copy) @@ -148,7 +148,7 @@ } else if (OpInfo->Flags & AML_NAMED) { - Flags = ACPI_PARSEOP_NAMED; + Flags = ACPI_PARSEOP_NAMED_OBJECT; } else if (Opcode == AML_INT_BYTELIST_OP) { Index: bus/acpi/acpica/resources/rsdumpinfo.c =================================================================== --- bus/acpi/acpica/resources/rsdumpinfo.c (revision 73899) +++ bus/acpi/acpica/resources/rsdumpinfo.c (working copy) @@ -265,6 +265,7 @@ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.Type), "Type", AcpiGbl_SbtDecode}, \ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, \ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.SlaveMode), "SlaveMode", AcpiGbl_SmDecode}, \ + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ConnectionSharing),"ConnectionSharing", AcpiGbl_ShrDecode}, \ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.TypeRevisionId), "TypeRevisionId", NULL}, \ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.TypeDataLength), "TypeDataLength", NULL}, \ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (CommonSerialBus.ResourceSource), "ResourceSource", NULL}, \ @@ -271,13 +272,13 @@ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.VendorLength), "VendorLength", NULL}, \ {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (CommonSerialBus.VendorData), "VendorData", NULL}, -ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[10] = +ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[11] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpCommonSerialBus), "Common Serial Bus", NULL}, ACPI_RS_DUMP_COMMON_SERIAL_BUS }; -ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[13] = +ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[14] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpI2cSerialBus), "I2C Serial Bus", NULL}, ACPI_RS_DUMP_COMMON_SERIAL_BUS @@ -286,7 +287,7 @@ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (I2cSerialBus.SlaveAddress), "SlaveAddress", NULL}, }; -ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[17] = +ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[18] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpSpiSerialBus), "Spi Serial Bus", NULL}, ACPI_RS_DUMP_COMMON_SERIAL_BUS @@ -299,7 +300,7 @@ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (SpiSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, }; -ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[19] = +ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[20] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpUartSerialBus), "Uart Serial Bus", NULL}, ACPI_RS_DUMP_COMMON_SERIAL_BUS Index: bus/acpi/acpica/resources/rsserial.c =================================================================== --- bus/acpi/acpica/resources/rsserial.c (revision 73899) +++ bus/acpi/acpica/resources/rsserial.c (working copy) @@ -153,7 +153,7 @@ * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[16] = +ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[17] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), @@ -179,6 +179,10 @@ AML_OFFSET (CommonSerialBus.Flags), 1}, + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ConnectionSharing), + AML_OFFSET (CommonSerialBus.Flags), + 2}, + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), AML_OFFSET (CommonSerialBus.TypeRevisionId), 1}, @@ -233,7 +237,7 @@ * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[20] = +ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[21] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), @@ -259,6 +263,10 @@ AML_OFFSET (CommonSerialBus.Flags), 1}, + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ConnectionSharing), + AML_OFFSET (CommonSerialBus.Flags), + 2}, + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), AML_OFFSET (CommonSerialBus.TypeRevisionId), 1}, @@ -329,7 +337,7 @@ * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[22] = +ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[23] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), @@ -355,6 +363,10 @@ AML_OFFSET (CommonSerialBus.Flags), 1}, + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ConnectionSharing), + AML_OFFSET (CommonSerialBus.Flags), + 2}, + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), AML_OFFSET (CommonSerialBus.TypeRevisionId), 1}, Index: bus/acpi/acpica/tables/tbdata.c =================================================================== --- bus/acpi/acpica/tables/tbdata.c (revision 73899) +++ bus/acpi/acpica/tables/tbdata.c (working copy) @@ -441,7 +441,7 @@ ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, "%4.4s 0x%8.8X%8.8X" " Attempted table install failed", - AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? + AcpiUtValidNameseg (TableDesc->Signature.Ascii) ? TableDesc->Signature.Ascii : "????", ACPI_FORMAT_UINT64 (TableDesc->Address))); Index: bus/acpi/acpica/tables/tbfind.c =================================================================== --- bus/acpi/acpica/tables/tbfind.c (revision 73899) +++ bus/acpi/acpica/tables/tbfind.c (working copy) @@ -83,7 +83,7 @@ /* Validate the input table signature */ - if (!AcpiIsValidSignature (Signature)) + if (!AcpiUtValidNameseg (Signature)) { return_ACPI_STATUS (AE_BAD_SIGNATURE); } Index: bus/acpi/acpica/tables/tbinstal.c =================================================================== --- bus/acpi/acpica/tables/tbinstal.c (revision 73899) +++ bus/acpi/acpica/tables/tbinstal.c (working copy) @@ -326,7 +326,7 @@ ACPI_BIOS_ERROR ((AE_INFO, "Table has invalid signature [%4.4s] (0x%8.8X), " "must be SSDT or OEMx", - AcpiUtValidAcpiName (NewTableDesc.Signature.Ascii) ? + AcpiUtValidNameseg (NewTableDesc.Signature.Ascii) ? NewTableDesc.Signature.Ascii : "????", NewTableDesc.Signature.Integer)); Index: bus/acpi/acpica/tables/tbutils.c =================================================================== --- bus/acpi/acpica/tables/tbutils.c (revision 73899) +++ bus/acpi/acpica/tables/tbutils.c (working copy) @@ -411,36 +411,3 @@ AcpiOsUnmapMemory (Table, Length); return_ACPI_STATUS (AE_OK); } - - -/******************************************************************************* - * - * FUNCTION: AcpiIsValidSignature - * - * PARAMETERS: Signature - Sig string to be validated - * - * RETURN: TRUE if signature is has 4 valid ACPI characters - * - * DESCRIPTION: Validate an ACPI table signature. - * - ******************************************************************************/ - -BOOLEAN -AcpiIsValidSignature ( - char *Signature) -{ - UINT32 i; - - - /* Validate each character in the signature */ - - for (i = 0; i < ACPI_NAME_SIZE; i++) - { - if (!AcpiUtValidAcpiChar (Signature[i], i)) - { - return (FALSE); - } - } - - return (TRUE); -} Index: bus/acpi/acpica/utilities/utascii.c =================================================================== --- bus/acpi/acpica/utilities/utascii.c (nonexistent) +++ bus/acpi/acpica/utilities/utascii.c (working copy) @@ -0,0 +1,161 @@ +/****************************************************************************** + * + * Module Name: utascii - Utility ascii functions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" + + +/******************************************************************************* + * + * FUNCTION: AcpiUtValidNameseg + * + * PARAMETERS: Name - The name or table signature to be examined. + * Four characters, does not have to be a + * NULL terminated string. + * + * RETURN: TRUE if signature is has 4 valid ACPI characters + * + * DESCRIPTION: Validate an ACPI table signature. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtValidNameseg ( + char *Name) +{ + UINT32 i; + + + /* Validate each character in the signature */ + + for (i = 0; i < ACPI_NAME_SIZE; i++) + { + if (!AcpiUtValidNameChar (Name[i], i)) + { + return (FALSE); + } + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtValidNameChar + * + * PARAMETERS: Char - The character to be examined + * Position - Byte position (0-3) + * + * RETURN: TRUE if the character is valid, FALSE otherwise + * + * DESCRIPTION: Check for a valid ACPI character. Must be one of: + * 1) Upper case alpha + * 2) numeric + * 3) underscore + * + * We allow a '!' as the last character because of the ASF! table + * + ******************************************************************************/ + +BOOLEAN +AcpiUtValidNameChar ( + char Character, + UINT32 Position) +{ + + if (!((Character >= 'A' && Character <= 'Z') || + (Character >= '0' && Character <= '9') || + (Character == '_'))) + { + /* Allow a '!' in the last position */ + + if (Character == '!' && Position == 3) + { + return (TRUE); + } + + return (FALSE); + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCheckAndRepairAscii + * + * PARAMETERS: Name - Ascii string + * Count - Number of characters to check + * + * RETURN: None + * + * DESCRIPTION: Ensure that the requested number of characters are printable + * Ascii characters. Sets non-printable and null chars to . + * + ******************************************************************************/ + +void +AcpiUtCheckAndRepairAscii ( + UINT8 *Name, + char *RepairedName, + UINT32 Count) +{ + UINT32 i; + + + for (i = 0; i < Count; i++) + { + RepairedName[i] = (char) Name[i]; + + if (!Name[i]) + { + return; + } + if (!isprint (Name[i])) + { + RepairedName[i] = ' '; + } + } +} Property changes on: bus/acpi/acpica/utilities/utascii.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: bus/acpi/acpica/utilities/utclib.c =================================================================== --- bus/acpi/acpica/utilities/utclib.c (revision 73899) +++ bus/acpi/acpica/utilities/utclib.c (working copy) @@ -107,6 +107,7 @@ * DESCRIPTION: Compare two Buffers, with a maximum length * ******************************************************************************/ + int memcmp ( void *VBuffer1, Index: bus/acpi/acpica/utilities/utdebug.c =================================================================== --- bus/acpi/acpica/utilities/utdebug.c (revision 73899) +++ bus/acpi/acpica/utilities/utdebug.c (working copy) @@ -632,6 +632,48 @@ /******************************************************************************* * + * FUNCTION: AcpiUtStrExit + * + * PARAMETERS: LineNumber - Caller's line number + * FunctionName - Caller's procedure name + * ModuleName - Caller's module name + * ComponentId - Caller's component ID + * String - String to display + * + * RETURN: None + * + * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is + * set in DebugLevel. Prints exit value also. + * + ******************************************************************************/ + +void +AcpiUtStrExit ( + UINT32 LineNumber, + const char *FunctionName, + const char *ModuleName, + UINT32 ComponentId, + const char *String) +{ + + /* Check if enabled up-front for performance */ + + if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) + { + AcpiDebugPrint (ACPI_LV_FUNCTIONS, + LineNumber, FunctionName, ModuleName, ComponentId, + "%s %s\n", AcpiGbl_FunctionExitPrefix, String); + } + + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiTracePoint * * PARAMETERS: Type - Trace event type Index: bus/acpi/acpica/utilities/utdecode.c =================================================================== --- bus/acpi/acpica/utilities/utdecode.c (revision 73899) +++ bus/acpi/acpica/utilities/utdecode.c (working copy) @@ -284,7 +284,7 @@ return_PTR ("Invalid object"); } - return_PTR (AcpiUtGetTypeName (ObjDesc->Common.Type)); + return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type)); } Index: bus/acpi/acpica/utilities/utstring.c =================================================================== --- bus/acpi/acpica/utilities/utstring.c (revision 73899) +++ bus/acpi/acpica/utilities/utstring.c (working copy) @@ -159,86 +159,6 @@ /******************************************************************************* * - * FUNCTION: AcpiUtValidAcpiChar - * - * PARAMETERS: Char - The character to be examined - * Position - Byte position (0-3) - * - * RETURN: TRUE if the character is valid, FALSE otherwise - * - * DESCRIPTION: Check for a valid ACPI character. Must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - * We allow a '!' as the last character because of the ASF! table - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidAcpiChar ( - char Character, - UINT32 Position) -{ - - if (!((Character >= 'A' && Character <= 'Z') || - (Character >= '0' && Character <= '9') || - (Character == '_'))) - { - /* Allow a '!' in the last position */ - - if (Character == '!' && Position == 3) - { - return (TRUE); - } - - return (FALSE); - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidAcpiName - * - * PARAMETERS: Name - The name to be examined. Does not have to - * be NULL terminated string. - * - * RETURN: TRUE if the name is valid, FALSE otherwise - * - * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidAcpiName ( - char *Name) -{ - UINT32 i; - - - ACPI_FUNCTION_ENTRY (); - - - for (i = 0; i < ACPI_NAME_SIZE; i++) - { - if (!AcpiUtValidAcpiChar (Name[i], i)) - { - return (FALSE); - } - } - - return (TRUE); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtRepairName * * PARAMETERS: Name - The ACPI name to be repaired @@ -286,7 +206,7 @@ for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (AcpiUtValidAcpiChar (Name[i], i)) + if (AcpiUtValidNameChar (Name[i], i)) { continue; } Index: bus/acpi/CMakeLists.txt =================================================================== --- bus/acpi/CMakeLists.txt (revision 73899) +++ bus/acpi/CMakeLists.txt (working copy) @@ -132,9 +132,10 @@ acpica/tables/tbxfroot.c acpica/utilities/utaddress.c acpica/utilities/utalloc.c + acpica/utilities/utascii.c acpica/utilities/utbuffer.c acpica/utilities/utcache.c - acpica/utilities/utclib.c + # acpica/utilities/utclib.c acpica/utilities/utcopy.c # acpica/utilities/utdebug.c acpica/utilities/utdecode.c