diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2016-04-25 22:24:53 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2016-04-25 22:24:53 +0000 |
commit | 2331c681155dd7b2f78bd28ca0c183e2f98ff44f (patch) | |
tree | 299b4e7602e20d34772a23e4bdda2512f5f1706b /source/components | |
parent | 937fa60dd2f2b6264fb99f22b638190a3fef996b (diff) |
Notes
Diffstat (limited to 'source/components')
22 files changed, 503 insertions, 261 deletions
diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index f7cbb91d63596..581cc297a56c1 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -798,7 +798,7 @@ AcpiDbIntegrityWalk ( return (AE_OK); } - if (!AcpiUtValidAcpiName (Node->Name.Ascii)) + if (!AcpiUtValidNameseg (Node->Name.Ascii)) { AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); return (AE_OK); diff --git a/source/components/disassembler/dmcstyle.c b/source/components/disassembler/dmcstyle.c index 32ab5be75352a..2f61dea208464 100644 --- a/source/components/disassembler/dmcstyle.c +++ b/source/components/disassembler/dmcstyle.c @@ -215,6 +215,7 @@ AcpiDmCheckForSymbolicOpcode ( Child1->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX; Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND_ASSIGNMENT; /* Save symbol string in the next child (not peer) */ @@ -378,7 +379,7 @@ AcpiDmCheckForSymbolicOpcode ( /* Convert operator to compound assignment */ - Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND_ASSIGNMENT; Child1->Common.OperatorSymbol = NULL; return (TRUE); } @@ -406,7 +407,7 @@ AcpiDmCheckForSymbolicOpcode ( /* Convert operator to compound assignment */ - Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND_ASSIGNMENT; Child1->Common.OperatorSymbol = NULL; return (TRUE); } @@ -522,6 +523,19 @@ AcpiDmCheckForSymbolicOpcode ( break; } + /* + * Nodes marked with ACPI_PARSEOP_PARAMLIST don't need a parens + * output here. We also need to check the parent to see if this op + * is part of a compound test (!=, >=, <=). + */ + if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) || + ((Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) && + (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX))) + { + /* Do Nothing. Paren already generated */ + return (TRUE); + } + /* All other operators, emit an open paren */ AcpiOsPrintf ("("); @@ -547,6 +561,7 @@ void AcpiDmCloseOperator ( ACPI_PARSE_OBJECT *Op) { + BOOLEAN IsCStyleOp = FALSE; /* Always emit paren if ASL+ disassembly disabled */ @@ -578,7 +593,7 @@ AcpiDmCloseOperator ( /* Emit paren only if this is not a compound assignment */ - if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND) + if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND_ASSIGNMENT) { return; } @@ -589,6 +604,8 @@ AcpiDmCloseOperator ( { AcpiOsPrintf (")"); } + + IsCStyleOp = TRUE; break; case AML_INDEX_OP: @@ -616,7 +633,21 @@ AcpiDmCloseOperator ( break; } + /* + * Nodes marked with ACPI_PARSEOP_PARAMLIST don't need a parens + * output here. We also need to check the parent to see if this op + * is part of a compound test (!=, >=, <=). + */ + if (IsCStyleOp && + ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) || + ((Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) && + (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX)))) + { + return; + } + AcpiOsPrintf (")"); + return; } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 8f163ca7e5e2e..f4d13191c2f81 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -249,11 +249,11 @@ AcpiDmPredefinedDescription ( /* Ensure that the comment field is emitted only once */ - if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) + if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED) { return; } - Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED; + Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED; /* Predefined name must start with an underscore */ @@ -385,11 +385,11 @@ AcpiDmFieldPredefinedDescription ( /* Ensure that the comment field is emitted only once */ - if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) + if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED) { return; } - Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED; + Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED; /* * Op must be one of the Create* operators: CreateField, CreateBitField, @@ -1051,10 +1051,16 @@ AcpiDmConvertToElseIf ( ACPI_PARSE_OBJECT *ElseOp; - /* Examine the first child of the Else */ - + /* + * To be able to perform the conversion, two conditions must be satisfied: + * 1) The first child of the Else must be an If statement. + * 2) The If block can only be followed by an Else block and these must + * be the only blocks under the original Else. + */ IfOp = OriginalElseOp->Common.Value.Arg; - if (!IfOp || (IfOp->Common.AmlOpcode != AML_IF_OP)) + if (!IfOp || + (IfOp->Common.AmlOpcode != AML_IF_OP) || + (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP))) { /* Not an Else..If sequence, cannot convert to ElseIf */ diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index da56e4f1aaa08..c725becbb7cb6 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -500,7 +500,7 @@ AcpiDmI2cSerialBusDescriptor ( /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */ AcpiDmIndent (Level); - AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n", + AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n", Resource->I2cSerialBus.SlaveAddress, AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)], Resource->I2cSerialBus.ConnectionSpeed); @@ -529,7 +529,11 @@ AcpiDmI2cSerialBusDescriptor ( /* Insert a descriptor name */ AcpiDmDescriptorName (); - AcpiOsPrintf (",\n"); + + /* Share */ + + AcpiOsPrintf (", %s,\n", + AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]); /* Dump the vendor data */ @@ -570,7 +574,7 @@ AcpiDmSpiSerialBusDescriptor ( /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */ AcpiDmIndent (Level); - AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n", + AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n", Resource->SpiSerialBus.DeviceSelection, AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)], AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)], @@ -608,7 +612,11 @@ AcpiDmSpiSerialBusDescriptor ( /* Insert a descriptor name */ AcpiDmDescriptorName (); - AcpiOsPrintf (",\n"); + + /* Share */ + + AcpiOsPrintf (", %s,\n", + AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]); /* Dump the vendor data */ @@ -649,7 +657,7 @@ AcpiDmUartSerialBusDescriptor ( /* ConnectionSpeed, BitsPerByte, StopBits */ AcpiDmIndent (Level); - AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n", + AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n", Resource->UartSerialBus.DefaultBaudRate, AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)], AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]); @@ -690,7 +698,11 @@ AcpiDmUartSerialBusDescriptor ( /* Insert a descriptor name */ AcpiDmDescriptorName (); - AcpiOsPrintf (",\n"); + + /* Share */ + + AcpiOsPrintf (", %s,\n", + AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]); /* Dump the vendor data */ diff --git a/source/components/disassembler/dmutils.c b/source/components/disassembler/dmutils.c index 2a82e1e3f4395..02717bc6add4b 100644 --- a/source/components/disassembler/dmutils.c +++ b/source/components/disassembler/dmutils.c @@ -279,8 +279,8 @@ AcpiDmCommaIfListMember ( } } - if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) && - (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))) + if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) && + (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))) { return (FALSE); } @@ -295,8 +295,8 @@ AcpiDmCommaIfListMember ( return (TRUE); } - else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) && - (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) + else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) && + (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) { AcpiOsPrintf (", "); return (TRUE); diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 43f5686a4566e..7465e75d38048 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -460,24 +460,24 @@ AcpiDmDescendingOp ( NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; - } - - /* - * A Zero predicate indicates the possibility of one or more - * External() opcodes within the If() block. - */ - if (NextOp->Common.AmlOpcode == AML_ZERO_OP) - { - NextOp2 = NextOp->Common.Next; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - if (NextOp2 && - (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP)) + /* + * A Zero predicate indicates the possibility of one or more + * External() opcodes within the If() block. + */ + if (NextOp->Common.AmlOpcode == AML_ZERO_OP) { - /* Ignore the If 0 block and all children */ + NextOp2 = NextOp->Common.Next; - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - return (AE_CTRL_DEPTH); + if (NextOp2 && + (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP)) + { + /* Ignore the If 0 block and all children */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + return (AE_CTRL_DEPTH); + } } } } @@ -514,7 +514,7 @@ AcpiDmDescendingOp ( } } else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && + (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { @@ -668,10 +668,10 @@ AcpiDmDescendingOp ( AcpiOsPrintf (", "); NextOp = AcpiPsGetDepthNext (NULL, Op); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; NextOp = NextOp->Common.Next; - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; return (AE_OK); case AML_PROCESSOR_OP: @@ -680,13 +680,13 @@ AcpiDmDescendingOp ( AcpiOsPrintf (", "); NextOp = AcpiPsGetDepthNext (NULL, Op); - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; NextOp = NextOp->Common.Next; - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; NextOp = NextOp->Common.Next; - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; return (AE_OK); case AML_MUTEX_OP: @@ -745,12 +745,12 @@ AcpiDmDescendingOp ( * Bank Value. This is a TermArg in the middle of the parameter * list, must handle it here. * - * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST + * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMETER_LIST * eliminates newline in the output. */ NextOp = NextOp->Common.Next; - Info->Flags = ACPI_PARSEOP_PARAMLIST; + Info->Flags = ACPI_PARSEOP_PARAMETER_LIST; AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info); Info->Flags = 0; @@ -812,7 +812,7 @@ AcpiDmDescendingOp ( /* Normal Buffer, mark size as in the parameter list */ - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; return (AE_OK); case AML_IF_OP: @@ -824,7 +824,7 @@ AcpiDmDescendingOp ( NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; } return (AE_OK); @@ -835,7 +835,7 @@ AcpiDmDescendingOp ( NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { - NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; + NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; } return (AE_OK); @@ -934,14 +934,14 @@ AcpiDmAscendingOp ( if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && + (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list * start a new line */ - if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST)) + if (!(Info->Flags & ACPI_PARSEOP_PARAMETER_LIST)) { AcpiOsPrintf ("\n"); } @@ -996,7 +996,7 @@ AcpiDmAscendingOp ( if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && - (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && + (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* @@ -1013,7 +1013,7 @@ AcpiDmAscendingOp ( case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: - if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) + if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) { AcpiOsPrintf ("\n"); } @@ -1027,17 +1027,17 @@ AcpiDmAscendingOp ( break; } - if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) + if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) { if ((Op->Common.Next) && - (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) + (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) { return (AE_OK); } /* * The parent Op is guaranteed to be valid because of the flag - * ACPI_PARSEOP_PARAMLIST -- which means that this op is part of + * ACPI_PARSEOP_PARAMETER_LIST -- which means that this op is part of * a parameter list and thus has a valid parent. */ ParentOp = Op->Common.Parent; diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 25d278ca1699f..334dadcac6646 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -460,6 +460,9 @@ AcpiDsBeginMethodExecution ( { ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = ObjDesc->Method.Mutex->Mutex.SyncLevel; + + ObjDesc->Method.Mutex->Mutex.ThreadId = + AcpiOsGetThreadId (); } } diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index fd46a0c023679..a865a86ae1f31 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -946,20 +946,9 @@ AcpiExInsertIntoField ( AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth); - /* - * Create the bitmasks used for bit insertion. - * Note: This if/else is used to bypass compiler differences with the - * shift operator - */ - if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE) - { - WidthMask = ACPI_UINT64_MAX; - } - else - { - WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth); - } + /* Create the bitmasks used for bit insertion */ + WidthMask = ACPI_MASK_BITS_ABOVE_64 (AccessBitWidth); Mask = WidthMask & ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); diff --git a/source/components/executer/exnames.c b/source/components/executer/exnames.c index 4ed16649b4296..817a011b2c987 100644 --- a/source/components/executer/exnames.c +++ b/source/components/executer/exnames.c @@ -204,7 +204,7 @@ AcpiExNameSegment ( 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++; diff --git a/source/components/hardware/hwregs.c b/source/components/hardware/hwregs.c index 55cdd07be670d..87c18d1b4c649 100644 --- a/source/components/hardware/hwregs.c +++ b/source/components/hardware/hwregs.c @@ -54,6 +54,11 @@ /* Local Prototypes */ +static UINT8 +AcpiHwGetAccessBitWidth ( + ACPI_GENERIC_ADDRESS *Reg, + UINT8 MaxBitWidth); + static ACPI_STATUS AcpiHwReadMultiple ( UINT32 *Value, @@ -71,6 +76,43 @@ AcpiHwWriteMultiple ( /****************************************************************************** * + * FUNCTION: AcpiHwGetAccessBitWidth + * + * PARAMETERS: Reg - GAS register structure + * MaxBitWidth - Max BitWidth supported (32 or 64) + * + * RETURN: Status + * + * DESCRIPTION: Obtain optimal access bit width + * + ******************************************************************************/ + +static UINT8 +AcpiHwGetAccessBitWidth ( + ACPI_GENERIC_ADDRESS *Reg, + UINT8 MaxBitWidth) +{ + + if (!Reg->AccessWidth) + { + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) + { + return (32); + } + else + { + return (MaxBitWidth); + } + } + else + { + return (1 << (Reg->AccessWidth + 2)); + } +} + + +/****************************************************************************** + * * FUNCTION: AcpiHwValidateRegister * * PARAMETERS: Reg - GAS register structure @@ -134,8 +176,7 @@ AcpiHwValidateRegister ( /* Validate the BitWidth, convert AccessWidth into number of bits */ - AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1; - AccessWidth = 1 << (AccessWidth + 2); + AccessWidth = AcpiHwGetAccessBitWidth (Reg, MaxBitWidth); BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth); if (MaxBitWidth < BitWidth) { @@ -198,9 +239,8 @@ AcpiHwRead ( * into number of bits based */ *Value = 0; - AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1; - AccessWidth = 1 << (AccessWidth + 2); - BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth); + AccessWidth = AcpiHwGetAccessBitWidth (Reg, 32); + BitWidth = Reg->BitOffset + Reg->BitWidth; BitOffset = Reg->BitOffset; /* @@ -243,7 +283,7 @@ AcpiHwRead ( } ACPI_SET_BITS (Value, Index * AccessWidth, - ((1 << AccessWidth) - 1), Value32); + ACPI_MASK_BITS_ABOVE_32 (AccessWidth), Value32); BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; Index++; @@ -301,9 +341,8 @@ AcpiHwWrite ( /* Convert AccessWidth into number of bits based */ - AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1; - AccessWidth = 1 << (AccessWidth + 2); - BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth); + AccessWidth = AcpiHwGetAccessBitWidth (Reg, 32); + BitWidth = Reg->BitOffset + Reg->BitWidth; BitOffset = Reg->BitOffset; /* @@ -313,8 +352,8 @@ AcpiHwWrite ( Index = 0; while (BitWidth) { - NewValue32 = ACPI_GET_BITS (&Value, (Index * AccessWidth), - ((1 << AccessWidth) - 1)); + NewValue32 = ACPI_GET_BITS (&Value, Index * AccessWidth, + ACPI_MASK_BITS_ABOVE_32 (AccessWidth)); if (BitOffset > AccessWidth) { diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 067dffe1fd3d8..dbe6c7c09f6e8 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -215,7 +215,7 @@ AcpiNsInitializeDevices ( /* * 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); diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index 141251f8519e2..ae75c1a0185dc 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -70,6 +70,12 @@ AcpiNsCheckPackageElements ( UINT32 Count2, UINT32 StartIndex); +static ACPI_STATUS +AcpiNsCustomPackage ( + ACPI_EVALUATE_INFO *Info, + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count); + /******************************************************************************* * @@ -148,6 +154,11 @@ AcpiNsCheckPackage ( */ 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 @@ PackageTooSmall: /******************************************************************************* * + * 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 diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 91f8b72b56126..b88ecf507ec2e 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -305,13 +305,12 @@ AcpiEvaluateObject ( } -#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 @@ AcpiEvaluateObject ( * If we are expecting a return value, and all went well above, * copy the return value to an external object. */ - if (ReturnBuffer) + if (!ReturnBuffer) + { + goto CleanupReturnObject; + } + + if (!Info->ReturnObject) + { + ReturnBuffer->Length = 0; + goto Cleanup; + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) == + ACPI_DESC_TYPE_NAMED) { - if (!Info->ReturnObject) + /* + * 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; + } + + if (ACPI_FAILURE (Status)) + { + goto CleanupReturnObject; + } + + /* Dereference Index and RefOf references */ + + AcpiNsResolveReferences (Info); + + /* 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)) { - ReturnBuffer->Length = 0; + /* + * 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 { - 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; - } + /* We have enough space for the object, build it */ - if (ACPI_SUCCESS (Status)) - { - /* Dereference Index and RefOf references */ - - AcpiNsResolveReferences (Info); - - /* 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); - } - } - } + Status = AcpiUtCopyIobjectToEobject ( + Info->ReturnObject, ReturnBuffer); } } +CleanupReturnObject: + if (Info->ReturnObject) { /* diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index 29cac85af5ac9..9b1019c71151d 100644 --- a/source/components/parser/psutils.c +++ b/source/components/parser/psutils.c @@ -148,7 +148,7 @@ AcpiPsAllocOp ( } else if (OpInfo->Flags & AML_NAMED) { - Flags = ACPI_PARSEOP_NAMED; + Flags = ACPI_PARSEOP_NAMED_OBJECT; } else if (Opcode == AML_INT_BYTELIST_OP) { diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index bec10dc0576d5..bc779ce58ce61 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -265,19 +265,20 @@ ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] = {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}, \ {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_RSDUMP_INFO AcpiRsDumpI2cSerialBus[13] = {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_RSDUMP_INFO AcpiRsDumpSpiSerialBus[17] = {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 diff --git a/source/components/resources/rsserial.c b/source/components/resources/rsserial.c index bbc69000bcffc..1eae4502f7b65 100644 --- a/source/components/resources/rsserial.c +++ b/source/components/resources/rsserial.c @@ -153,7 +153,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertGpio[18] = * ******************************************************************************/ -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 @@ ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[16] = 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 AcpiRsConvertI2cSerialBus[16] = * ******************************************************************************/ -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 @@ ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[20] = 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 AcpiRsConvertSpiSerialBus[20] = * ******************************************************************************/ -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 @@ ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[22] = 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}, diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index fd69a57b38f21..31fa25b92e77e 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -441,7 +441,7 @@ AcpiTbVerifyTempTable ( 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))); diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index d144cab627858..32839a3cd3289 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -83,7 +83,7 @@ AcpiTbFindTable ( /* Validate the input table signature */ - if (!AcpiIsValidSignature (Signature)) + if (!AcpiUtValidNameseg (Signature)) { return_ACPI_STATUS (AE_BAD_SIGNATURE); } diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index 32d63eedd7215..78e8b4ec8bf68 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -326,7 +326,7 @@ AcpiTbInstallStandardTable ( 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)); diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 3e68d75f1a0ec..5fc07b76e0fb3 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -411,36 +411,3 @@ NextTable: 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); -} diff --git a/source/components/utilities/utascii.c b/source/components/utilities/utascii.c new file mode 100644 index 0000000000000..25c02e674e070 --- /dev/null +++ b/source/components/utilities/utascii.c @@ -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 <space>. + * + ******************************************************************************/ + +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] = ' '; + } + } +} diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 646307edce3c5..cb46193e6ea53 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -159,86 +159,6 @@ AcpiUtPrintString ( /******************************************************************************* * - * 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 @@ AcpiUtRepairName ( for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (AcpiUtValidAcpiChar (Name[i], i)) + if (AcpiUtValidNameChar (Name[i], i)) { continue; } |