Merge ACPICA 20110413.

This commit is contained in:
Jung-uk Kim 2011-04-15 18:34:27 +00:00
commit d052a1cc33
49 changed files with 2001 additions and 1207 deletions

View File

@ -190,6 +190,7 @@ contrib/dev/acpica/dispatcher/dswload2.c optional acpi
contrib/dev/acpica/dispatcher/dswscope.c optional acpi
contrib/dev/acpica/dispatcher/dswstate.c optional acpi
contrib/dev/acpica/events/evevent.c optional acpi
contrib/dev/acpica/events/evglock.c optional acpi
contrib/dev/acpica/events/evgpe.c optional acpi
contrib/dev/acpica/events/evgpeblk.c optional acpi
contrib/dev/acpica/events/evgpeinit.c optional acpi

View File

@ -67,7 +67,7 @@ find ${wrk} -type f -print | xargs -J % mv % ${dst}
# canonify include paths
for H in ${src_headers}; do
find ${dst} -name "*.[chy]" -type f -print | \
find ${dst} -name "*.[chly]" -type f -print | \
xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g"
done
for H in ${comp_headers}; do

File diff suppressed because it is too large Load Diff

View File

@ -62,6 +62,13 @@ AcpiDmCheckAscii (
UINT32 Count);
/* Common format strings for commented values */
#define UINT8_FORMAT "%2.2X [%s]\n"
#define UINT16_FORMAT "%4.4X [%s]\n"
#define UINT32_FORMAT "%8.8X [%s]\n"
#define STRING_FORMAT "[%s]\n"
/* These tables map a subtable type to a description string */
static const char *AcpiDmAsfSubnames[] =
@ -497,7 +504,14 @@ AcpiDmLineHeader (
}
else
{
AcpiOsPrintf ("%41s : ", Name);
if (*Name)
{
AcpiOsPrintf ("%41s : ", Name);
}
else
{
AcpiOsPrintf ("%41s ", Name);
}
}
}
else /* Normal disassembler or verbose template */
@ -509,7 +523,14 @@ AcpiDmLineHeader (
}
else
{
AcpiOsPrintf ("%44s : ", Name);
if (*Name)
{
AcpiOsPrintf ("%44s : ", Name);
}
else
{
AcpiOsPrintf ("%44s ", Name);
}
}
}
}
@ -526,7 +547,7 @@ AcpiDmLineHeader2 (
{
if (ByteLength)
{
AcpiOsPrintf ("[%.3d] %30s % 3d : ",
AcpiOsPrintf ("[%.4d] %30s %3d : ",
ByteLength, Name, Value);
}
else
@ -539,12 +560,12 @@ AcpiDmLineHeader2 (
{
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
Offset, Offset, ByteLength, Name, Value);
}
else
{
AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
Offset, Offset, Name, Value);
}
}
@ -774,6 +795,7 @@ AcpiDmDumpTable (
/*
* Buffer: Size depends on the opcode and was set above.
* Each hex byte is separated with a space.
* Multiple lines are separated by line continuation char.
*/
for (Temp16 = 0; Temp16 < ByteLength; Temp16++)
{
@ -782,7 +804,7 @@ AcpiDmDumpTable (
{
if ((Temp16 > 0) && (!((Temp16+1) % 16)))
{
AcpiOsPrintf ("\n");
AcpiOsPrintf (" \\\n"); /* Line continuation */
AcpiDmLineHeader (0, 0, NULL);
}
else
@ -817,9 +839,12 @@ AcpiDmDumpTable (
TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
if (TableData)
{
AcpiOsPrintf ("/* %s */", TableData->Name);
AcpiOsPrintf (STRING_FORMAT, TableData->Name);
}
else
{
AcpiOsPrintf ("\n");
}
AcpiOsPrintf ("\n");
break;
case ACPI_DMT_NAME4:
@ -862,7 +887,7 @@ AcpiDmDumpTable (
/* Address Space ID */
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target));
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target));
break;
case ACPI_DMT_ACCWIDTH:
@ -875,14 +900,14 @@ AcpiDmDumpTable (
Temp8 = ACPI_GAS_WIDTH_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", Temp8, AcpiDmGasAccessWidth[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]);
break;
case ACPI_DMT_GAS:
/* Generic Address Structure */
AcpiOsPrintf ("<Generic Address Structure>\n");
AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure");
AcpiDmDumpTable (TableLength, CurrentOffset, Target,
sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
AcpiOsPrintf ("\n");
@ -899,7 +924,7 @@ AcpiDmDumpTable (
Temp16 = ACPI_ASF_TYPE_RESERVED;
}
AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
break;
case ACPI_DMT_DMAR:
@ -912,7 +937,7 @@ AcpiDmDumpTable (
Temp16 = ACPI_DMAR_TYPE_RESERVED;
}
AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
break;
case ACPI_DMT_EINJACT:
@ -925,7 +950,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_EINJ_ACTION_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]);
break;
case ACPI_DMT_EINJINST:
@ -938,7 +963,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]);
break;
case ACPI_DMT_ERSTACT:
@ -951,7 +976,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_ERST_ACTION_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]);
break;
case ACPI_DMT_ERSTINST:
@ -964,7 +989,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]);
break;
case ACPI_DMT_HEST:
@ -977,12 +1002,12 @@ AcpiDmDumpTable (
Temp16 = ACPI_HEST_TYPE_RESERVED;
}
AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
break;
case ACPI_DMT_HESTNTFY:
AcpiOsPrintf ("<Hardware Error Notification Structure>\n");
AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure");
AcpiDmDumpTable (TableLength, CurrentOffset, Target,
sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
AcpiOsPrintf ("\n");
@ -999,7 +1024,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_HEST_NOTIFY_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]);
break;
case ACPI_DMT_MADT:
@ -1012,7 +1037,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_MADT_TYPE_RESERVED;
}
AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]);
break;
case ACPI_DMT_SLIC:
@ -1025,7 +1050,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_SLIC_TYPE_RESERVED;
}
AcpiOsPrintf ("%8.8X <%s>\n", *Target, AcpiDmSlicSubnames[Temp8]);
AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]);
break;
case ACPI_DMT_SRAT:
@ -1038,7 +1063,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_SRAT_TYPE_RESERVED;
}
AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]);
break;
case ACPI_DMT_FADTPM:
@ -1051,7 +1076,7 @@ AcpiDmDumpTable (
Temp8 = ACPI_FADT_PM_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]);
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]);
break;
case ACPI_DMT_IVRS:
@ -1076,7 +1101,7 @@ AcpiDmDumpTable (
break;
}
AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name);
AcpiOsPrintf (UINT8_FORMAT, *Target, Name);
break;
case ACPI_DMT_EXIT:

View File

@ -1408,12 +1408,12 @@ AcpiDmDumpSlit (
if ((j+1) < Localities)
{
AcpiOsPrintf (",");
AcpiOsPrintf (" ");
if (j && (((j+1) % 16) == 0))
{
AcpiOsPrintf ("\n");
AcpiDmLineHeader (Offset, 0, "");
AcpiOsPrintf ("\\\n"); /* With line continuation char */
AcpiDmLineHeader (Offset, 0, NULL);
}
}
}

View File

@ -483,3 +483,56 @@ ApCheckForGpeNameConflict (
return;
}
/*******************************************************************************
*
* FUNCTION: ApCheckRegMethod
*
* PARAMETERS: Op - Current parse op
*
* RETURN: None
*
* DESCRIPTION: Ensure that a _REG method has a corresponding Operation
* Region declaration within the same scope. Note: _REG is defined
* to have two arguments and must therefore be defined as a
* control method.
*
******************************************************************************/
void
ApCheckRegMethod (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *Parent;
/* We are only interested in _REG methods */
if (!ACPI_COMPARE_NAME (METHOD_NAME__REG, &Op->Asl.NameSeg))
{
return;
}
/* Get the start of the current scope */
Parent = Op->Asl.Parent;
Next = Parent->Asl.Child;
/* Search entire scope for an operation region declaration */
while (Next)
{
if (Next->Asl.ParseOpcode == PARSEOP_OPERATIONREGION)
{
return; /* Found region, OK */
}
Next = Next->Asl.Next;
}
/* No region found, issue warning */
AslError (ASL_WARNING, ASL_MSG_NO_REGION, Op, NULL);
}

View File

@ -265,6 +265,10 @@ void
ApCheckForGpeNameConflict (
ACPI_PARSE_OBJECT *Op);
void
ApCheckRegMethod (
ACPI_PARSE_OBJECT *Op);
/*
* aslerror - error handling/reporting
@ -457,7 +461,7 @@ AslMapNamedOpcodeToDataType (
/*
* aslpredef - ACPI predefined names support
*/
void
BOOLEAN
ApCheckForPredefinedMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo);
@ -763,6 +767,13 @@ UINT64
UtDoConstant (
char *String);
ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger);
/*
* asluuid - UUID support
*/

View File

@ -1484,7 +1484,7 @@ ReturnTerm
: PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
OptionalReturnArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));}
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
| PARSEOP_RETURN '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@ -3061,7 +3061,7 @@ OptionalTermArg
;
OptionalReturnArg
: {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
: {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */
| TermArg {$$ = $1;}
;

View File

@ -123,6 +123,7 @@
#define ASL_EXTERNAL_METHOD 255
#define ASL_ABORT TRUE
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
/* Support for reserved method names */

View File

@ -69,6 +69,7 @@
extern int yydebug;
extern FILE *AslCompilerin;
extern int AslCompilerdebug;
extern int DtParserdebug;
extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;

View File

@ -1251,8 +1251,8 @@ LkNamespaceLocateBegin (
SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
{
case REGION_EC:
case REGION_CMOS:
case ACPI_ADR_SPACE_EC:
case ACPI_ADR_SPACE_CMOS:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
{
@ -1260,8 +1260,8 @@ LkNamespaceLocateBegin (
}
break;
case REGION_SMBUS:
case REGION_IPMI:
case ACPI_ADR_SPACE_SMBUS:
case ACPI_ADR_SPACE_IPMI:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
{

View File

@ -148,7 +148,7 @@ Options (
printf (" -ls Create combined source file (expanded includes) (*.src)\n");
printf ("\nACPI Data Tables:\n");
printf (" -T <Sig> Create table template file for <Sig> (or \"ALL\")\n");
printf (" -T <Sig>|ALL|* Create table template file(s) for <Sig>\n");
printf (" -vt Create verbose templates (full disassembly)\n");
printf ("\nAML Disassembler:\n");
@ -425,10 +425,12 @@ AslDoOptions (
{
case 'b':
AslCompilerdebug = 1; /* same as yydebug */
DtParserdebug = 1;
break;
case 'p':
AslCompilerdebug = 1; /* same as yydebug */
DtParserdebug = 1;
break;
case 't':

View File

@ -141,7 +141,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0),
/* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, REGION_FIXED_HW, 0, 0),
/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0),
/* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
@ -321,14 +321,14 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE),
/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0),
/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0),
/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0),
/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0),
/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0),
/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0),
/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0),
/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0),
/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0),
/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0),
/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_IO, 0, 0),
/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_IPMI, 0, 0),
/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_MEMORY, 0, 0),
/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_CONFIG, 0, 0),
/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_BAR_TARGET, 0, 0),
/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SMBUS, 0, 0),
/* REGISTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* RELEASE */ OP_TABLE_ENTRY (AML_RELEASE_OP, 0, 0, 0),
/* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0),

View File

@ -190,6 +190,7 @@ typedef enum
ASL_MSG_LEADING_ASTERISK,
ASL_MSG_RESERVED_NO_RETURN_VAL,
ASL_MSG_GPE_NAME_CONFLICT,
ASL_MSG_NO_REGION,
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
@ -343,6 +344,7 @@ char *AslMessages [] = {
/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk",
/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value",
/* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method",
/* ASL_MSG_NO_REGION */ "_REG has no corresponding Operation Region",
/* These messages are used by the data table compiler only */
@ -359,7 +361,6 @@ char *AslMessages [] = {
/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
/* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression",
/* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero"
};

View File

@ -150,7 +150,7 @@ static const ACPI_PREDEFINED_INFO ScopeNames[] = {
*
******************************************************************************/
void
BOOLEAN
ApCheckForPredefinedMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo)
@ -171,7 +171,7 @@ ApCheckForPredefinedMethod (
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
/* Just return, nothing to do */
break;
return (FALSE);
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
@ -238,6 +238,8 @@ ApCheckForPredefinedMethod (
}
break;
}
return (TRUE);
}

View File

@ -76,6 +76,7 @@
#define NODE_COMPILER_EMITTED 0x00020000
#define NODE_IS_DUPLICATE 0x00040000
#define NODE_IS_RESOURCE_DATA 0x00080000
#define NODE_IS_NULL_RETURN 0x00100000
/* Keeps information about individual control methods */

View File

@ -68,12 +68,6 @@ char AslHexLookup[] =
/* Local prototypes */
static ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger);
static void
UtPadNameWithUnderscores (
char *NameSeg,
@ -884,7 +878,7 @@ UtDoConstant (
*
******************************************************************************/
static ACPI_STATUS
ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,

View File

@ -302,10 +302,17 @@ AnMethodAnalysisWalkBegin (
return (AE_ERROR);
}
/* Child indicates a return value */
/*
* A child indicates a possible return value. A simple Return or
* Return() is marked with NODE_IS_NULL_RETURN by the parser so
* that it is not counted as a "real" return-with-value, although
* the AML code that is actually emitted is Return(0). The AML
* definition of Return has a required parameter, so we are
* forced to convert a null return to Return(0).
*/
if ((Op->Asl.Child) &&
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
(!(Op->Asl.Child->Asl.CompileFlags & NODE_IS_NULL_RETURN)))
{
MethodInfo->NumReturnWithValue++;
}
@ -510,13 +517,22 @@ AnMethodAnalysisWalkEnd (
/*
* Check predefined method names for correct return behavior
* and correct number of arguments
* and correct number of arguments. Also, some special checks
* For GPE and _REG methods.
*/
ApCheckForPredefinedMethod (Op, MethodInfo);
if (ApCheckForPredefinedMethod (Op, MethodInfo))
{
/* Special check for two names like _L01 and _E01 in same scope */
/* Special check for two names like _L01 and _E01 in same scope */
ApCheckForGpeNameConflict (Op);
/*
* Special check for _REG: Must have an operation region definition
* within the same scope!
*/
ApCheckRegMethod (Op);
}
ApCheckForGpeNameConflict (Op);
ACPI_FREE (MethodInfo);
break;

View File

@ -277,7 +277,7 @@ DtCompileDataTable (
/* Verify that we at least have a table signature and save it */
Signature = DtGetFieldValue (*FieldList, "Signature");
Signature = DtGetFieldValue (*FieldList);
if (!Signature)
{
sprintf (MsgBuffer, "Expected \"%s\"", "Signature");
@ -310,20 +310,6 @@ DtCompileDataTable (
Status = DtCompileRsdp (FieldList);
return (Status);
}
else if (!ACPI_STRNCMP (Signature, "OEM", 3))
{
DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature);
return (AE_ERROR);
}
/* Validate the signature via the ACPI table list */
TableData = AcpiDmGetTableData (Signature);
if (!TableData)
{
DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature);
return (AE_ERROR);
}
/*
* All other tables must use the common ACPI table header. Insert the
@ -340,6 +326,15 @@ DtCompileDataTable (
DtPushSubtable (Gbl_RootTable);
/* Validate the signature via the ACPI table list */
TableData = AcpiDmGetTableData (Signature);
if (!TableData)
{
DtCompileGeneric ((void **) FieldList);
goto Out;
}
/* Dispatch to per-table compile */
if (TableData->CmTableHandler)
@ -374,6 +369,7 @@ DtCompileDataTable (
return (AE_ERROR);
}
Out:
/* Set the final table length and then the checksum */
DtSetTableLength ();
@ -424,6 +420,11 @@ DtCompileTable (
}
Length = DtGetSubtableLength (*Field, Info);
if (Length == ASL_EOF)
{
return (AE_ERROR);
}
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
if (Length > 0)
@ -450,29 +451,6 @@ DtCompileTable (
goto Error;
}
/* Does input field name match what is expected? */
if (ACPI_STRCMP (LocalField->Name, Info->Name))
{
/*
* If Required = TRUE, the subtable must exist.
* If Required = FALSE, the subtable is optional
* (For example, AcpiDmTableInfoDmarScope in DMAR table is
* optional)
*/
if (Required)
{
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
LocalField, MsgBuffer);
}
else
{
Status = AE_NOT_FOUND;
goto Error;
}
}
/* Maintain table offsets */
LocalField->TableOffset = Gbl_CurrentTableOffset;
@ -518,7 +496,6 @@ DtCompileTable (
* Recursion (one level max): compile GAS (Generic Address)
* or Notify in-line subtable
*/
LocalField = LocalField->Next;
*Field = LocalField;
if (Info->Opcode == ACPI_DMT_GAS)

View File

@ -220,9 +220,20 @@ DtGetParentSubtable (
/* dtexpress - Integer expressions and labels */
UINT64
ACPI_STATUS
DtResolveIntegerExpression (
DT_FIELD *Field);
DT_FIELD *Field,
UINT64 *ReturnValue);
UINT64
DtDoOperator (
UINT64 LeftValue,
UINT32 Operator,
UINT64 RightValue);
UINT64
DtResolveLabel (
char *LabelString);
void
DtDetectAllLabels (
@ -260,6 +271,25 @@ DtCompileFlag (
ACPI_DMTABLE_INFO *Info);
/* dtparser - lex/yacc files */
UINT64
DtEvaluateExpression (
char *ExprString);
int
DtInitLexer (
char *String);
void
DtTerminateLexer (
void);
char *
DtGetOpName (
UINT32 ParseOpcode);
/* dtutils - Miscellaneous utilities */
typedef
@ -306,8 +336,7 @@ DtGetFileSize (
char*
DtGetFieldValue (
DT_FIELD *Field,
char *Name);
DT_FIELD *Field);
UINT8
DtGetFieldType (
@ -417,6 +446,10 @@ ACPI_STATUS
DtCompileXsdt (
void **PFieldList);
ACPI_STATUS
DtCompileGeneric (
void **PFieldList);
ACPI_DMTABLE_INFO *
DtGetGenericTableInfo (
char *Name);

View File

@ -45,6 +45,7 @@
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/compiler/dtcompiler.h>
#include "dtparser.y.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtexpress")
@ -52,11 +53,6 @@
/* Local prototypes */
static UINT64
DtResolveInteger (
DT_FIELD *Field,
char *IntegerString);
static void
DtInsertLabelField (
DT_FIELD *Field);
@ -65,204 +61,226 @@ static DT_FIELD *
DtLookupLabel (
char *Name);
/* Global used for errors during parse and related functions */
DT_FIELD *Gbl_CurrentField;
/******************************************************************************
*
* FUNCTION: DtResolveIntegerExpression
*
* PARAMETERS: Field - Field object with Integer expression
* ReturnValue - Where the integer is returned
*
* RETURN: A 64-bit integer value
* RETURN: Status, and the resolved 64-bit integer value
*
* DESCRIPTION: Resolve an integer expression to a single value. Supports
* both integer constants and labels. Supported operators are:
* +,-,*,/,%,|,&,^
* both integer constants and labels.
*
*****************************************************************************/
UINT64
ACPI_STATUS
DtResolveIntegerExpression (
DT_FIELD *Field)
DT_FIELD *Field,
UINT64 *ReturnValue)
{
char *IntegerString;
char *Operator;
UINT64 Value;
UINT64 Value2;
UINT64 Result;
DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n",
Field->Value);
strcpy (MsgBuffer, Field->Value); /* Must take a copy for strtok() */
Gbl_CurrentField = Field;
/* Obtain and resolve the first operand */
IntegerString = strtok (MsgBuffer, " ");
if (!IntegerString)
{
DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
return (0);
}
Value = DtResolveInteger (Field, IntegerString);
DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V1: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value));
/*
* Consume the entire expression string. For the rest of the
* expression string, values are of the form:
* <operator> <integer>
*/
while (1)
{
Operator = strtok (NULL, " ");
if (!Operator)
{
/* Normal exit */
DbgPrint (ASL_DEBUG_OUTPUT, "Expression Resolved to: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value));
return (Value);
}
IntegerString = strtok (NULL, " ");
if (!IntegerString ||
(strlen (Operator) > 1))
{
/* No corresponding operand for operator or invalid operator */
DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
return (0);
}
Value2 = DtResolveInteger (Field, IntegerString);
DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V2: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value2));
/* Perform the requested operation */
switch (*Operator)
{
case '-':
Value -= Value2;
break;
case '+':
Value += Value2;
break;
case '*':
Value *= Value2;
break;
case '|':
Value |= Value2;
break;
case '&':
Value &= Value2;
break;
case '^':
Value ^= Value2;
break;
case '/':
if (!Value2)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
return (0);
}
Value /= Value2;
break;
case '%':
if (!Value2)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
return (0);
}
Value %= Value2;
break;
default:
/* Unknown operator */
DtFatal (ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
break;
}
}
return (Value);
Result = DtEvaluateExpression (Field->Value);
*ReturnValue = Result;
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: DtResolveInteger
* FUNCTION: DtDoOperator
*
* PARAMETERS: Field - Field object with string to be resolved
* IntegerString - Integer to be resolved
* PARAMETERS: LeftValue - First 64-bit operand
* Operator - Parse token for the operator (EXPOP_*)
* RightValue - Second 64-bit operand
*
* RETURN: A 64-bit integer value
* RETURN: 64-bit result of the requested operation
*
* DESCRIPTION: Resolve a single integer string to a value. Supports both
* integer constants and labels.
*
* NOTE: References to labels must begin with a dollar sign ($)
* DESCRIPTION: Perform the various 64-bit integer math functions
*
*****************************************************************************/
static UINT64
DtResolveInteger (
DT_FIELD *Field,
char *IntegerString)
UINT64
DtDoOperator (
UINT64 LeftValue,
UINT32 Operator,
UINT64 RightValue)
{
UINT64 Result;
/* Perform the requested operation */
switch (Operator)
{
case EXPOP_ONES_COMPLIMENT:
Result = ~RightValue;
break;
case EXPOP_LOGICAL_NOT:
Result = !RightValue;
break;
case EXPOP_MULTIPLY:
Result = LeftValue * RightValue;
break;
case EXPOP_DIVIDE:
if (!RightValue)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO,
Gbl_CurrentField, Gbl_CurrentField->Value);
return (0);
}
Result = LeftValue / RightValue;
break;
case EXPOP_MODULO:
if (!RightValue)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO,
Gbl_CurrentField, Gbl_CurrentField->Value);
return (0);
}
Result = LeftValue % RightValue;
break;
case EXPOP_ADD:
Result = LeftValue + RightValue;
break;
case EXPOP_SUBTRACT:
Result = LeftValue - RightValue;
break;
case EXPOP_SHIFT_RIGHT:
Result = LeftValue >> RightValue;
break;
case EXPOP_SHIFT_LEFT:
Result = LeftValue << RightValue;
break;
case EXPOP_LESS:
Result = LeftValue < RightValue;
break;
case EXPOP_GREATER:
Result = LeftValue > RightValue;
break;
case EXPOP_LESS_EQUAL:
Result = LeftValue <= RightValue;
break;
case EXPOP_GREATER_EQUAL:
Result = LeftValue >= RightValue;
break;
case EXPOP_EQUAL:
Result = LeftValue = RightValue;
break;
case EXPOP_NOT_EQUAL:
Result = LeftValue != RightValue;
break;
case EXPOP_AND:
Result = LeftValue & RightValue;
break;
case EXPOP_XOR:
Result = LeftValue ^ RightValue;
break;
case EXPOP_OR:
Result = LeftValue | RightValue;
break;
case EXPOP_LOGICAL_AND:
Result = LeftValue && RightValue;
break;
case EXPOP_LOGICAL_OR:
Result = LeftValue || RightValue;
break;
default:
/* Unknown operator */
DtFatal (ASL_MSG_INVALID_EXPRESSION,
Gbl_CurrentField, Gbl_CurrentField->Value);
return (0);
}
DbgPrint (ASL_DEBUG_OUTPUT,
"IntegerEval: %s (%8.8X%8.8X %s %8.8X%8.8X) = %8.8X%8.8X\n",
Gbl_CurrentField->Value,
ACPI_FORMAT_UINT64 (LeftValue),
DtGetOpName (Operator),
ACPI_FORMAT_UINT64 (RightValue),
ACPI_FORMAT_UINT64 (Result));
return (Result);
}
/******************************************************************************
*
* FUNCTION: DtResolveLabel
*
* PARAMETERS: LabelString - Contains the label
*
* RETURN: Table offset associated with the label
*
* DESCRIPTION: Lookup a lable and return its value.
*
*****************************************************************************/
UINT64
DtResolveLabel (
char *LabelString)
{
DT_FIELD *LabelField;
UINT64 Value = 0;
char *Message = NULL;
ACPI_STATUS Status;
DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Integer: %s\n", IntegerString);
DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Label: %s\n", LabelString);
/* Resolve a label reference to an integer (table offset) */
if (*IntegerString == '$')
if (*LabelString != '$')
{
LabelField = DtLookupLabel (IntegerString);
if (!LabelField)
{
DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, Field, IntegerString);
return (0);
}
/* All we need from the label is the offset in the table */
Value = LabelField->TableOffset;
return (Value);
return (0);
}
/* Convert string to an actual integer */
Status = DtStrtoul64 (IntegerString, &Value);
if (ACPI_FAILURE (Status))
LabelField = DtLookupLabel (LabelString);
if (!LabelField)
{
if (Status == AE_LIMIT)
{
Message = "Constant larger than 64 bits";
}
else if (Status == AE_BAD_CHARACTER)
{
Message = "Invalid character in constant";
}
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL,
Gbl_CurrentField, LabelString);
return (0);
}
return (Value);
/* All we need from the label is the offset in the table */
DbgPrint (ASL_DEBUG_OUTPUT, "Resolved Label: 0x%8.8X\n",
LabelField->TableOffset);
return (LabelField->TableOffset);
}

View File

@ -284,6 +284,7 @@ DtCompileInteger (
{
UINT64 Value;
UINT64 MaxValue;
ACPI_STATUS Status;
/* Output buffer byte length must be in range 1-8 */
@ -297,7 +298,11 @@ DtCompileInteger (
/* Resolve integer expression to a single integer value */
Value = DtResolveIntegerExpression (Field);
Status = DtResolveIntegerExpression (Field, &Value);
if (ACPI_FAILURE (Status))
{
return;
}
/* Ensure that reserved fields are set to zero */
/* TBD: should we set to zero, or just make this an ERROR? */

View File

@ -60,10 +60,6 @@ static void
DtLinkField (
DT_FIELD *Field);
static void
DtMergeField (
char *Value);
static ACPI_STATUS
DtParseLine (
char *LineBuffer,
@ -96,6 +92,7 @@ DtDumpBuffer (
#define DT_SLASH_ASTERISK_COMMENT 3
#define DT_SLASH_SLASH_COMMENT 4
#define DT_END_COMMENT 5
#define DT_MERGE_LINES 6
static UINT32 Gbl_NextLineOffset;
@ -224,56 +221,6 @@ DtLinkField (
}
/******************************************************************************
*
* FUNCTION: DtMergeField
*
* PARAMETERS: Value - Merge this line into previous one
*
* RETURN: None
*
* DESCRIPTION: Merge a field value to the previous one,
* probably for a multi-line buffer definition.
*
*****************************************************************************/
static void
DtMergeField (
char *Value)
{
DT_FIELD *Prev;
DT_FIELD *Next;
char *NewValue;
UINT32 PrevLength;
UINT32 ThisLength;
Prev = Next = Gbl_FieldList;
while (Next)
{
Prev = Next;
Next = Next->Next;
}
if (Prev)
{
PrevLength = ACPI_STRLEN (Prev->Value);
ThisLength = ACPI_STRLEN (Value);
/* Add two for: separator + NULL terminator */
NewValue = UtLocalCalloc (PrevLength + ThisLength + 2);
ACPI_STRNCPY (NewValue, Prev->Value, PrevLength);
NewValue[PrevLength] = ' ';
ACPI_STRNCPY ((NewValue + PrevLength + 1), Value, ThisLength);
ACPI_FREE (Prev->Value);
Prev->Value = NewValue;
}
}
/******************************************************************************
*
* FUNCTION: DtParseLine
@ -305,6 +252,7 @@ DtParseLine (
DT_FIELD *Field;
UINT32 Column;
UINT32 NameColumn;
BOOLEAN IsNullString = FALSE;
if (!LineBuffer)
@ -372,7 +320,6 @@ DtParseLine (
ACPI_FREE (TmpName);
Start = End = (Colon + 1);
while (*End)
{
/* Found left quotation, go to the right quotation and break */
@ -380,6 +327,13 @@ DtParseLine (
if (*End == '"')
{
End++;
/* Check for an explicit null string */
if (*End == '"')
{
IsNullString = TRUE;
}
while (*End && (*End != '"'))
{
End++;
@ -397,12 +351,11 @@ DtParseLine (
* TBD: Perhaps DtGetNextLine should parse the following type
* of comments also.
*/
if (*End == '(' ||
*End == '<')
if (*End == '[')
{
End--;
break;
}
End++;
}
@ -413,7 +366,9 @@ DtParseLine (
Value = DtTrim (TmpValue);
ACPI_FREE (TmpValue);
if (ACPI_STRLEN (Name) && Value)
/* Create a new field object only if we have a valid value field */
if ((Value && *Value) || IsNullString)
{
Field = UtLocalCalloc (sizeof (DT_FIELD));
Field->Name = Name;
@ -425,13 +380,7 @@ DtParseLine (
DtLinkField (Field);
}
else if (!ACPI_STRLEN (Name))
{
/* Handle multi-line buffers (length > 16) */
DtMergeField (Value);
}
else
else /* Ignore this field, it has no valid data */
{
ACPI_FREE (Name);
ACPI_FREE (Value);
@ -447,7 +396,7 @@ DtParseLine (
*
* PARAMETERS: Handle - Open file handle for the source file
*
* RETURN: Filled line buffer and offset of start-of-line (zero on EOF)
* RETURN: Filled line buffer and offset of start-of-line (ASL_EOF on EOF)
*
* DESCRIPTION: Get the next valid source line. Removes all comments.
* Ignores empty lines.
@ -464,6 +413,7 @@ UINT32
DtGetNextLine (
FILE *Handle)
{
BOOLEAN LineNotAllBlanks = FALSE;
UINT32 State = DT_NORMAL_TEXT;
UINT32 CurrentLineOffset;
UINT32 i;
@ -488,7 +438,7 @@ DtGetNextLine (
break;
}
return (0);
return (ASL_EOF);
}
switch (State)
@ -506,24 +456,45 @@ DtGetNextLine (
case '"':
State = DT_START_QUOTED_STRING;
LineNotAllBlanks = TRUE;
i++;
break;
case '\\':
/*
* The continuation char MUST be last char on this line.
* Otherwise, it will be assumed to be a valid ASL char.
*/
State = DT_MERGE_LINES;
break;
case '\n':
CurrentLineOffset = Gbl_NextLineOffset;
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
/* Exit if line is complete. Ignore blank lines */
if (i != 0)
/*
* Exit if line is complete. Ignore empty lines (only \n)
* or lines that contain nothing but blanks.
*/
if ((i != 0) && LineNotAllBlanks)
{
Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate line */
Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */
return (CurrentLineOffset);
}
/* Toss this line and start a new one */
i = 0;
LineNotAllBlanks = FALSE;
break;
default:
if (c != ' ')
{
LineNotAllBlanks = TRUE;
}
i++;
break;
}
@ -624,14 +595,46 @@ DtGetNextLine (
}
break;
case DT_MERGE_LINES:
if (c != '\n')
{
/*
* This is not a continuation backslash, it is a normal
* normal ASL backslash - for example: Scope(\_SB_)
*/
i++; /* Keep the backslash that is already in the buffer */
ungetc (c, Handle);
State = DT_NORMAL_TEXT;
}
else
{
/*
* This is a continuation line -- a backlash followed
* immediately by a newline. Insert a space between the
* lines (overwrite the backslash)
*/
Gbl_CurrentLineBuffer[i] = ' ';
i++;
/* Ignore newline, this will merge the lines */
CurrentLineOffset = Gbl_NextLineOffset;
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
State = DT_NORMAL_TEXT;
}
break;
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state");
return (0);
return (ASL_EOF);
}
}
printf ("ERROR - Input line is too long (max %u)\n", ASL_LINE_BUFFER_SIZE);
return (0);
return (ASL_EOF);
}
@ -654,6 +657,7 @@ DtScanFile (
{
ACPI_STATUS Status;
UINT32 Offset;
DT_FIELD *Next;
ACPI_FUNCTION_NAME (DtScanFile);
@ -669,7 +673,7 @@ DtScanFile (
/* Scan line-by-line */
while ((Offset = DtGetNextLine (Handle)))
while ((Offset = DtGetNextLine (Handle)) != ASL_EOF)
{
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s",
Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer));
@ -681,6 +685,30 @@ DtScanFile (
}
}
/* Dump the parse tree if debug enabled */
if (Gbl_DebugFlag)
{
Next = Gbl_FieldList;
DbgPrint (ASL_DEBUG_OUTPUT, "Tree: %32s %32s %8s %8s %8s %8s %8s %8s\n\n",
"Name", "Value", "Line", "ByteOff", "NameCol", "Column", "TableOff", "Flags");
while (Next)
{
DbgPrint (ASL_DEBUG_OUTPUT, "Field: %32.32s %32.32s %.8X %.8X %.8X %.8X %.8X %.8X\n",
Next->Name,
Next->Value,
Next->Line,
Next->ByteOffset,
Next->NameColumn,
Next->Column,
Next->TableOffset,
Next->Flags);
Next = Next->Next;
}
}
return (Gbl_FieldList);
}
@ -774,7 +802,7 @@ DtDumpBuffer (
UINT8 BufChar;
FlPrintFile (FileId, "Output: [%3.3Xh %4.4d% 3d] ",
FlPrintFile (FileId, "Output: [%3.3Xh %4.4d %3d] ",
Offset, Offset, Length);
i = 0;
@ -782,7 +810,7 @@ DtDumpBuffer (
{
if (i >= 16)
{
FlPrintFile (FileId, "%23s", "");
FlPrintFile (FileId, "%24s", "");
}
/* Print 16 hex chars */
@ -876,9 +904,16 @@ DtWriteFieldToListing (
/* Dump the line as parsed and represented internally */
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %s\n",
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %.64s",
Field->Column-4, Field->Name, Field->Value);
if (strlen (Field->Value) > 64)
{
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "...Additional data, length 0x%X\n",
strlen (Field->Value));
}
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "\n");
/* Dump the hex data that will be output for this field */
DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Field->TableOffset, Length);

View File

@ -0,0 +1,133 @@
%{
/******************************************************************************
*
* Module Name: dtparser.l - Flex input file for table compiler lexer
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
#include "dtparser.y.h"
#define YY_NO_INPUT /* No file input, we use strings only */
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("dtscanner")
%}
%option noyywrap
%option nounput
Number [0-9a-fA-F]+
HexNumber 0[xX][0-9a-fA-F]+
DecimalNumber 0[dD][0-9]+
LabelRef $[a-zA-Z][0-9a-zA-Z]*
WhiteSpace [ \t\v\r]+
NewLine [\n]
%%
\( return (EXPOP_PAREN_OPEN);
\) return (EXPOP_PAREN_CLOSE);
\~ return (EXPOP_ONES_COMPLIMENT);
\! return (EXPOP_LOGICAL_NOT);
\* return (EXPOP_MULTIPLY);
\/ return (EXPOP_DIVIDE);
\% return (EXPOP_MODULO);
\+ return (EXPOP_ADD);
\- return (EXPOP_SUBTRACT);
">>" return (EXPOP_SHIFT_RIGHT);
"<<" return (EXPOP_SHIFT_LEFT);
\< return (EXPOP_LESS);
\> return (EXPOP_GREATER);
"<=" return (EXPOP_LESS_EQUAL);
">=" return (EXPOP_GREATER_EQUAL);
"==" return (EXPOP_EQUAL);
"!=" return (EXPOP_NOT_EQUAL);
\& return (EXPOP_AND);
\^ return (EXPOP_XOR);
\| return (EXPOP_OR);
"&&" return (EXPOP_LOGICAL_AND);
"||" return (EXPOP_LOGICAL_OR);
<<EOF>> return (EXPOP_EOF); /* null end-of-string */
{LabelRef} return (EXPOP_LABEL);
{Number} return (EXPOP_NUMBER);
{HexNumber} return (EXPOP_HEX_NUMBER);
{NewLine} return (EXPOP_NEW_LINE);
{WhiteSpace} /* Ignore */
. return (EXPOP_EOF);
%%
/*
* Local support functions
*/
YY_BUFFER_STATE LexBuffer;
/******************************************************************************
*
* FUNCTION: DtInitLexer, DtTerminateLexer
*
* PARAMETERS: String - Input string to be parsed
*
* RETURN: None
*
* DESCRIPTION: Initialization and termination routines for lexer. Lexer needs
* a buffer to handle strings instead of a file.
*
*****************************************************************************/
int
DtInitLexer (
char *String)
{
LexBuffer = yy_scan_string (String);
return (LexBuffer == NULL);
}
void
DtTerminateLexer (
void)
{
yy_delete_buffer (LexBuffer);
}

View File

@ -0,0 +1,267 @@
%{
/******************************************************************************
*
* Module Name: dtparser.y - Bison input file for table compiler parser
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, 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.
*/
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/compiler/dtcompiler.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("dtparser")
UINT64 DtParserResult; /* Global for expression return value */
int DtParserlex (void);
int DtParserparse (void);
extern char* DtParsertext;
extern void DtParsererror (char const * msg);
#define YYFLAG -32768
%}
%union
{
UINT64 value;
UINT32 op;
}
%type <value> Expression
%token <op> EXPOP_EOF
%token <op> EXPOP_NEW_LINE
%token <op> EXPOP_NUMBER
%token <op> EXPOP_HEX_NUMBER
%token <op> EXPOP_DECIMAL_NUMBER
%token <op> EXPOP_LABEL
%token <op> EXPOP_PAREN_OPEN
%token <op> EXPOP_PAREN_CLOSE
%left <op> EXPOP_LOGICAL_OR
%left <op> EXPOP_LOGICAL_AND
%left <op> EXPOP_OR
%left <op> EXPOP_XOR
%left <op> EXPOP_AND
%left <op> EXPOP_EQUAL EXPOP_NOT_EQUAL
%left <op> EXPOP_GREATER EXPOP_LESS EXPOP_GREATER_EQUAL EXPOP_LESS_EQUAL
%left <op> EXPOP_SHIFT_RIGHT EXPOP_SHIFT_LEFT
%left <op> EXPOP_ADD EXPOP_SUBTRACT
%left <op> EXPOP_MULTIPLY EXPOP_DIVIDE EXPOP_MODULO
%right <op> EXPOP_ONES_COMPLIMENT EXPOP_LOGICAL_NOT
%%
/*
* Operator precedence rules (from K&R)
*
* 1) ( )
* 2) ! ~ (unary operators that are supported here)
* 3) * / %
* 4) + -
* 5) >> <<
* 6) < > <= >=
* 7) == !=
* 8) &
* 9) ^
* 10) |
* 11) &&
* 12) ||
*/
Value
: Expression EXPOP_NEW_LINE { DtParserResult=$1; return 0; } /* End of line (newline) */
| Expression EXPOP_EOF { DtParserResult=$1; return 0; } /* End of string (0) */
;
Expression
/* Unary operators */
: EXPOP_LOGICAL_NOT Expression { $$ = DtDoOperator ($2, EXPOP_LOGICAL_NOT, $2);}
| EXPOP_ONES_COMPLIMENT Expression { $$ = DtDoOperator ($2, EXPOP_ONES_COMPLIMENT, $2);}
/* Binary operators */
| Expression EXPOP_MULTIPLY Expression { $$ = DtDoOperator ($1, EXPOP_MULTIPLY, $3);}
| Expression EXPOP_DIVIDE Expression { $$ = DtDoOperator ($1, EXPOP_DIVIDE, $3);}
| Expression EXPOP_MODULO Expression { $$ = DtDoOperator ($1, EXPOP_MODULO, $3);}
| Expression EXPOP_ADD Expression { $$ = DtDoOperator ($1, EXPOP_ADD, $3);}
| Expression EXPOP_SUBTRACT Expression { $$ = DtDoOperator ($1, EXPOP_SUBTRACT, $3);}
| Expression EXPOP_SHIFT_RIGHT Expression { $$ = DtDoOperator ($1, EXPOP_SHIFT_RIGHT, $3);}
| Expression EXPOP_SHIFT_LEFT Expression { $$ = DtDoOperator ($1, EXPOP_SHIFT_LEFT, $3);}
| Expression EXPOP_GREATER Expression { $$ = DtDoOperator ($1, EXPOP_GREATER, $3);}
| Expression EXPOP_LESS Expression { $$ = DtDoOperator ($1, EXPOP_LESS, $3);}
| Expression EXPOP_GREATER_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_GREATER_EQUAL, $3);}
| Expression EXPOP_LESS_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_LESS_EQUAL, $3);}
| Expression EXPOP_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_EQUAL, $3);}
| Expression EXPOP_NOT_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_NOT_EQUAL, $3);}
| Expression EXPOP_AND Expression { $$ = DtDoOperator ($1, EXPOP_AND, $3);}
| Expression EXPOP_XOR Expression { $$ = DtDoOperator ($1, EXPOP_XOR, $3);}
| Expression EXPOP_OR Expression { $$ = DtDoOperator ($1, EXPOP_OR, $3);}
| Expression EXPOP_LOGICAL_AND Expression { $$ = DtDoOperator ($1, EXPOP_LOGICAL_AND, $3);}
| Expression EXPOP_LOGICAL_OR Expression { $$ = DtDoOperator ($1, EXPOP_LOGICAL_OR, $3);}
/* Parentheses: '(' Expression ')' */
| EXPOP_PAREN_OPEN Expression
EXPOP_PAREN_CLOSE { $$ = $2;}
/* Label references (prefixed with $) */
| EXPOP_LABEL { $$ = DtResolveLabel (DtParsertext);}
/* Default base for a non-prefixed integer is 16 */
| EXPOP_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);}
/* Standard hex number (0x1234) */
| EXPOP_HEX_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);}
/* TBD: Decimal number with prefix (0d1234) - Not supported by UtStrtoul64 at this time */
| EXPOP_DECIMAL_NUMBER { UtStrtoul64 (DtParsertext, 10, &$$);}
;
%%
/*
* Local support functions, including parser entry point
*/
extern DT_FIELD *Gbl_CurrentField;
#define PR_FIRST_PARSE_OPCODE EXPOP_EOF
#define PR_YYTNAME_START 3
#ifdef _USE_BERKELEY_YACC
#define yytname DtParsername
#endif
/******************************************************************************
*
* FUNCTION: DtParsererror
*
* PARAMETERS: Message - Parser-generated error message
*
* RETURN: None
*
* DESCRIPTION: Handler for parser errors
*
*****************************************************************************/
void
DtParsererror (
char const *Message)
{
DtError (ASL_ERROR, ASL_MSG_SYNTAX,
Gbl_CurrentField, (char *) Message);
}
/******************************************************************************
*
* FUNCTION: DtGetOpName
*
* PARAMETERS: ParseOpcode - Parser token (EXPOP_*)
*
* RETURN: Pointer to the opcode name
*
* DESCRIPTION: Get the ascii name of the parse opcode for debug output
*
*****************************************************************************/
char *
DtGetOpName (
UINT32 ParseOpcode)
{
/*
* First entries (PR_YYTNAME_START) in yytname are special reserved names.
* Ignore first 6 characters of name (EXPOP_)
*/
return ((char *) yytname
[(ParseOpcode - PR_FIRST_PARSE_OPCODE) + PR_YYTNAME_START] + 6);
}
/******************************************************************************
*
* FUNCTION: DtEvaluateExpression
*
* PARAMETERS: ExprString - Expression to be evaluated. Must be
* terminated by either a newline or a NUL
* string terminator
*
* RETURN: 64-bit value for the expression
*
* DESCRIPTION: Main entry point for the DT expression parser
*
*****************************************************************************/
UINT64
DtEvaluateExpression (
char *ExprString)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"**** Input expression: %s (Base 16)\n", ExprString);
/* Point lexer to the input string */
if (DtInitLexer (ExprString))
{
DtError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
Gbl_CurrentField, "Could not initialize lexer");
return (0);
}
/* Parse/Evaluate the input string (value returned in DtParserResult) */
DtParserparse ();
DtTerminateLexer ();
DbgPrint (ASL_DEBUG_OUTPUT,
"**** Parser returned value: %u (%8.8X%8.8X)\n",
(UINT32) DtParserResult, ACPI_FORMAT_UINT64 (DtParserResult));
return (DtParserResult);
}

View File

@ -288,16 +288,58 @@ DtGetSubtableLength (
ACPI_DMTABLE_INFO *Info)
{
UINT32 ByteLength = 0;
UINT8 Step;
UINT8 i;
/* Walk entire Info table; Null name terminates */
for (; Info->Name; Info++)
{
if (!Field)
{
goto Error;
}
ByteLength += DtGetFieldLength (Field, Info);
switch (Info->Opcode)
{
case ACPI_DMT_GAS:
Step = 5;
break;
case ACPI_DMT_HESTNTFY:
Step = 9;
break;
default:
Step = 1;
break;
}
for (i = 0; i < Step; i++)
{
if (!Field)
{
goto Error;
}
Field = Field->Next;
}
}
return (ByteLength);
Error:
if (!Field)
{
sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
}
return (ASL_EOF);
}

View File

@ -1224,7 +1224,6 @@ DtCompileSlit (
DT_FIELD *FieldList;
UINT32 Localities;
UINT8 *LocalityBuffer;
UINT32 RemainingData;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
@ -1240,22 +1239,17 @@ DtCompileSlit (
Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
LocalityBuffer = UtLocalCalloc (Localities);
/* Compile each locality buffer */
FieldList = *PFieldList;
while (FieldList)
{
/* Handle multiple-line buffer */
RemainingData = Localities;
while (RemainingData && FieldList)
{
RemainingData = DtCompileBuffer (
LocalityBuffer + (Localities - RemainingData),
FieldList->Value, FieldList, RemainingData);
FieldList = FieldList->Next;
}
DtCompileBuffer (LocalityBuffer,
FieldList->Value, FieldList, Localities);
DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
DtInsertSubtable (ParentTable, Subtable);
FieldList = FieldList->Next;
}
ACPI_FREE (LocalityBuffer);
@ -1411,7 +1405,6 @@ DtCompileUefi (
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
ACPI_DMTABLE_INFO *Info;
UINT16 *DataOffset;
@ -1436,45 +1429,7 @@ DtCompileUefi (
* operators may be used.
*/
/* Find any and all labels in the entire generic portion */
DtDetectAllLabels (*PFieldList);
/* Now we can actually compile the parse tree */
while (*PFieldList)
{
Info = DtGetGenericTableInfo ((*PFieldList)->Name);
if (!Info)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
(*PFieldList)->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
(*PFieldList), MsgBuffer);
*PFieldList = (*PFieldList)->Next;
continue;
}
Status = DtCompileTable (PFieldList, Info,
&Subtable, TRUE);
if (ACPI_SUCCESS (Status))
{
DtInsertSubtable (ParentTable, Subtable);
}
else
{
*PFieldList = (*PFieldList)->Next;
if (Status == AE_NOT_FOUND)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
(*PFieldList)->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
(*PFieldList), MsgBuffer);
}
}
}
DtCompileGeneric ((void **) PFieldList);
return (AE_OK);
}
@ -1539,3 +1494,78 @@ DtCompileXsdt (
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: DtCompileGeneric
*
* PARAMETERS: List - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile generic unknown table.
*
*****************************************************************************/
ACPI_STATUS
DtCompileGeneric (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
ACPI_DMTABLE_INFO *Info;
ParentTable = DtPeekSubtable ();
/*
* Compile the "generic" portion of the table. This
* part of the table is not predefined and any of the generic
* operators may be used.
*/
/* Find any and all labels in the entire generic portion */
DtDetectAllLabels (*PFieldList);
/* Now we can actually compile the parse tree */
while (*PFieldList)
{
Info = DtGetGenericTableInfo ((*PFieldList)->Name);
if (!Info)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
(*PFieldList)->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
(*PFieldList), MsgBuffer);
*PFieldList = (*PFieldList)->Next;
continue;
}
Status = DtCompileTable (PFieldList, Info,
&Subtable, TRUE);
if (ACPI_SUCCESS (Status))
{
DtInsertSubtable (ParentTable, Subtable);
}
else
{
*PFieldList = (*PFieldList)->Next;
if (Status == AE_NOT_FOUND)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
(*PFieldList)->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
(*PFieldList), MsgBuffer);
}
}
}
return (AE_OK);
}

View File

@ -121,7 +121,8 @@ DtCreateTemplates (
/* Create all known templates if requested */
if (!ACPI_STRNCMP (Signature, "ALL", 3))
if (!ACPI_STRNCMP (Signature, "ALL", 3) ||
!ACPI_STRCMP (Signature, "*"))
{
Status = DtCreateAllTemplates ();
return (Status);

View File

@ -587,14 +587,62 @@ const unsigned char TemplateSlic[] =
const unsigned char TemplateSlit[] =
{
0x53,0x4C,0x49,0x54,0x3C,0x00,0x00,0x00, /* 00000000 "SLIT<..." */
0x01,0x1B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x53,0x4C,0x49,0x54,0xBC,0x01,0x00,0x00, /* 00000000 "SLIT...." */
0x01,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x0A,0x0F,0x0F,0x0F, /* 00000028 "........" */
0x0F,0x0A,0x0F,0x0F,0x0F,0x0F,0x0A,0x0F, /* 00000030 "........" */
0x0F,0x0F,0x0F,0x0A /* 00000038 "...." */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x16,0x03,0x11,0x20,0x14,0x00,0x00,0x00, /* 00000020 "... ...." */
0x00,0x00,0x00,0x00,0x0A,0x10,0x16,0x17, /* 00000028 "........" */
0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 00000030 "........" */
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, /* 00000038 " !"#$%&'" */
0x10,0x0A,0x15,0x16,0x17,0x18,0x19,0x1A, /* 00000040 "........" */
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22, /* 00000048 "..... !"" */
0x23,0x24,0x25,0x26,0x16,0x15,0x0A,0x10, /* 00000050 "#$%&...." */
0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, /* 00000058 "........" */
0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25, /* 00000060 ".. !"#$%" */
0x17,0x16,0x10,0x0A,0x15,0x16,0x17,0x18, /* 00000068 "........" */
0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20, /* 00000070 "....... " */
0x21,0x22,0x23,0x24,0x18,0x17,0x16,0x15, /* 00000078 "!"#$...." */
0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000080 "........" */
0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23, /* 00000088 ".... !"#" */
0x19,0x18,0x17,0x16,0x10,0x0A,0x15,0x16, /* 00000090 "........" */
0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E, /* 00000098 "........" */
0x1F,0x20,0x21,0x22,0x1A,0x19,0x18,0x17, /* 000000A0 ". !"...." */
0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 000000A8 "........" */
0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21, /* 000000B0 "...... !" */
0x1B,0x1A,0x19,0x18,0x17,0x16,0x10,0x0A, /* 000000B8 "........" */
0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C, /* 000000C0 "........" */
0x1D,0x1E,0x1F,0x20,0x1C,0x1B,0x1A,0x19, /* 000000C8 "... ...." */
0x18,0x17,0x16,0x15,0x0A,0x10,0x16,0x17, /* 000000D0 "........" */
0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 000000D8 "........" */
0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16, /* 000000E0 "........" */
0x10,0x0A,0x15,0x16,0x17,0x18,0x19,0x1A, /* 000000E8 "........" */
0x1B,0x1C,0x1D,0x1E,0x1E,0x1D,0x1C,0x1B, /* 000000F0 "........" */
0x1A,0x19,0x18,0x17,0x16,0x15,0x0A,0x10, /* 000000F8 "........" */
0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, /* 00000100 "........" */
0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18, /* 00000108 "........" */
0x17,0x16,0x10,0x0A,0x15,0x16,0x17,0x18, /* 00000110 "........" */
0x19,0x1A,0x1B,0x1C,0x20,0x1F,0x1E,0x1D, /* 00000118 ".... ..." */
0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16,0x15, /* 00000120 "........" */
0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000128 "........" */
0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x1A, /* 00000130 "! ......" */
0x19,0x18,0x17,0x16,0x10,0x0A,0x15,0x16, /* 00000138 "........" */
0x17,0x18,0x19,0x1A,0x22,0x21,0x20,0x1F, /* 00000140 "...."! ." */
0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17, /* 00000148 "........" */
0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 00000150 "........" */
0x23,0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C, /* 00000158 "#"! ...." */
0x1B,0x1A,0x19,0x18,0x17,0x16,0x10,0x0A, /* 00000160 "........" */
0x15,0x16,0x17,0x18,0x24,0x23,0x22,0x21, /* 00000168 "....$#"!" */
0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19, /* 00000170 " ......." */
0x18,0x17,0x16,0x15,0x0A,0x10,0x16,0x17, /* 00000178 "........" */
0x25,0x24,0x23,0x22,0x21,0x20,0x1F,0x1E, /* 00000180 "%$#"! .." */
0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16, /* 00000188 "........" */
0x10,0x0A,0x15,0x16,0x26,0x25,0x24,0x23, /* 00000190 "....&%$#" */
0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B, /* 00000198 ""! ....." */
0x1A,0x19,0x18,0x17,0x16,0x15,0x0A,0x10, /* 000001A0 "........" */
0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20, /* 000001A8 "'&%$#"! " */
0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18, /* 000001B0 "........" */
0x17,0x16,0x10,0x0A /* 000001B8 "...." */
};
const unsigned char TemplateSpcr[] =

View File

@ -189,8 +189,16 @@ DtFatal (
DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage);
/*
* TBD: remove this entire function, DtFatal
*
* We cannot abort the compiler on error, because we may be compiling a
* list of files. We must move on to the next file.
*/
#ifdef __OBSOLETE
CmCleanupAndExit ();
exit (1);
#endif
}
@ -316,7 +324,6 @@ DtGetFileSize (
* FUNCTION: DtGetFieldValue
*
* PARAMETERS: Field - Current field list pointer
* Name - Field name
*
* RETURN: Field value
*
@ -326,23 +333,14 @@ DtGetFileSize (
char *
DtGetFieldValue (
DT_FIELD *Field,
char *Name)
DT_FIELD *Field)
{
/* Search the field list for the name */
while (Field)
if (!Field)
{
if (!ACPI_STRCMP (Name, Field->Name))
{
return (Field->Value);
}
Field = Field->Next;
return (NULL);
}
return (NULL);
return (Field->Value);
}
@ -479,7 +477,7 @@ DtGetBufferLength (
*
* FUNCTION: DtGetFieldLength
*
* PARAMETERS: Field - Current field list pointer
* PARAMETERS: Field - Current field
* Info - Data table info
*
* RETURN: Field length
@ -567,7 +565,7 @@ DtGetFieldLength (
break;
case ACPI_DMT_STRING:
Value = DtGetFieldValue (Field, Info->Name);
Value = DtGetFieldValue (Field);
if (Value)
{
ByteLength = ACPI_STRLEN (Value) + 1;
@ -577,6 +575,7 @@ DtGetFieldLength (
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
return (0);
}
break;
@ -589,7 +588,7 @@ DtGetFieldLength (
break;
case ACPI_DMT_BUFFER:
Value = DtGetFieldValue (Field, Info->Name);
Value = DtGetFieldValue (Field);
if (Value)
{
ByteLength = DtGetBufferLength (Value);
@ -599,6 +598,7 @@ DtGetFieldLength (
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
return (0);
}
break;
@ -612,7 +612,7 @@ DtGetFieldLength (
break;
case ACPI_DMT_UNICODE:
Value = DtGetFieldValue (Field, Info->Name);
Value = DtGetFieldValue (Field);
/* TBD: error if Value is NULL? (as below?) */
@ -621,7 +621,7 @@ DtGetFieldLength (
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode");
break;
return (0);
}
return (ByteLength);

View File

@ -69,6 +69,50 @@ AcpiDbGetPointer (
void *Target);
/*
* System handler information.
* Used for Handlers command, in AcpiDbDisplayHandlers.
*/
#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
#define ACPI_HANDLER_NAME_STRING "%30s : "
#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
/* All predefined Address Space IDs */
static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC,
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_DATA_TABLE,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
/* Global handler information */
typedef struct acpi_handler_info
{
void *Handler;
char *Name;
} ACPI_HANDLER_INFO;
static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] =
{
{&AcpiGbl_SystemNotify.Handler, "System Notifications"},
{&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
{&AcpiGbl_TableHandler, "ACPI Table Events"},
{&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
{&AcpiGbl_InterfaceHandler, "OSI Invocations"}
};
/*******************************************************************************
*
* FUNCTION: AcpiDbGetPointer
@ -887,6 +931,7 @@ AcpiDbDisplayGpes (
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayHandlers
@ -899,46 +944,6 @@ AcpiDbDisplayGpes (
*
******************************************************************************/
#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
#define ACPI_HANDLER_NAME_STRING "%30s : "
#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
/* All predefined Space IDs */
static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC,
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_DATA_TABLE,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
/* Global handler information */
typedef struct acpi_handler_info
{
void *Handler;
char *Name;
} ACPI_HANDLER_INFO;
ACPI_HANDLER_INFO HandlerList[] =
{
{&AcpiGbl_SystemNotify.Handler, "System Notifications"},
{&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
{&AcpiGbl_TableHandler, "ACPI Table Events"},
{&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
{&AcpiGbl_InterfaceHandler, "OSI Invocations"}
};
void
AcpiDbDisplayHandlers (
void)
@ -956,9 +961,9 @@ AcpiDbDisplayHandlers (
ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
if (ObjDesc)
{
for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++)
{
SpaceId = SpaceIdList[i];
SpaceId = AcpiGbl_SpaceIdList[i];
HandlerObj = ObjDesc->Device.Handler;
AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
@ -1008,13 +1013,13 @@ AcpiDbDisplayHandlers (
AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
for (i = 0; i < ACPI_ARRAY_LENGTH (HandlerList); i++)
for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++)
{
AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, HandlerList[i].Name);
if (HandlerList[i].Handler)
AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name);
if (AcpiGbl_HandlerList[i].Handler)
{
AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
HandlerList[i].Handler);
AcpiGbl_HandlerList[i].Handler);
}
else
{

View File

@ -466,7 +466,7 @@ AcpiDsLoad1EndOp (
else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
{
Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
REGION_DATA_TABLE, WalkState);
ACPI_ADR_SPACE_DATA_TABLE, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);

View File

@ -586,7 +586,7 @@ AcpiDsLoad2EndOp (
}
else
{
RegionSpace = REGION_DATA_TABLE;
RegionSpace = ACPI_ADR_SPACE_DATA_TABLE;
}
/*

View File

@ -0,0 +1,367 @@
/******************************************************************************
*
* Module Name: evglock - Global Lock support
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, 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 <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acevents.h>
#include <contrib/dev/acpica/include/acinterp.h>
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evglock")
/* Local prototypes */
static UINT32
AcpiEvGlobalLockHandler (
void *Context);
/*******************************************************************************
*
* FUNCTION: AcpiEvInitGlobalLockHandler
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for the global lock release event
*
******************************************************************************/
ACPI_STATUS
AcpiEvInitGlobalLockHandler (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
/* Attempt installation of the global lock handler */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler, NULL);
/*
* If the global lock does not exist on this platform, the attempt to
* enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
* Map to AE_OK, but mark global lock as not present. Any attempt to
* actually use the global lock will be flagged with an error.
*/
AcpiGbl_GlobalLockPresent = FALSE;
if (Status == AE_NO_HARDWARE_RESPONSE)
{
ACPI_ERROR ((AE_INFO,
"No response from Global Lock hardware, disabling lock"));
return_ACPI_STATUS (AE_OK);
}
Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_GlobalLockPending = FALSE;
AcpiGbl_GlobalLockPresent = TRUE;
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvRemoveGlobalLockHandler
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Remove the handler for the Global Lock
*
******************************************************************************/
ACPI_STATUS
AcpiEvRemoveGlobalLockHandler (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler);
AcpiGbl_GlobalLockPresent = FALSE;
Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvGlobalLockHandler
*
* PARAMETERS: Context - From thread interface, not used
*
* RETURN: ACPI_INTERRUPT_HANDLED
*
* DESCRIPTION: Invoked directly from the SCI handler when a global lock
* release interrupt occurs. If there is actually a pending
* request for the lock, signal the waiting thread.
*
******************************************************************************/
static UINT32
AcpiEvGlobalLockHandler (
void *Context)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
/*
* If a request for the global lock is not actually pending,
* we are done. This handles "spurious" global lock interrupts
* which are possible (and have been seen) with bad BIOSs.
*/
if (!AcpiGbl_GlobalLockPending)
{
goto CleanupAndExit;
}
/*
* Send a unit to the global lock semaphore. The actual acquisition
* of the global lock will be performed by the waiting thread.
*/
Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore"));
}
AcpiGbl_GlobalLockPending = FALSE;
CleanupAndExit:
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
return (ACPI_INTERRUPT_HANDLED);
}
/******************************************************************************
*
* FUNCTION: AcpiEvAcquireGlobalLock
*
* PARAMETERS: Timeout - Max time to wait for the lock, in millisec.
*
* RETURN: Status
*
* DESCRIPTION: Attempt to gain ownership of the Global Lock.
*
* MUTEX: Interpreter must be locked
*
* Note: The original implementation allowed multiple threads to "acquire" the
* Global Lock, and the OS would hold the lock until the last thread had
* released it. However, this could potentially starve the BIOS out of the
* lock, especially in the case where there is a tight handshake between the
* Embedded Controller driver and the BIOS. Therefore, this implementation
* allows only one thread to acquire the HW Global Lock at a time, and makes
* the global lock appear as a standard mutex on the OS side.
*
*****************************************************************************/
ACPI_STATUS
AcpiEvAcquireGlobalLock (
UINT16 Timeout)
{
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
BOOLEAN Acquired = FALSE;
ACPI_FUNCTION_TRACE (EvAcquireGlobalLock);
/*
* Only one thread can acquire the GL at a time, the GlobalLockMutex
* enforces this. This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex,
Timeout);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Update the global lock handle and check for wraparound. The handle is
* only used for the external global lock interfaces, but it is updated
* here to properly handle the case where a single thread may acquire the
* lock via both the AML and the AcpiAcquireGlobalLock interfaces. The
* handle is therefore updated on the first acquire from a given thread
* regardless of where the acquisition request originated.
*/
AcpiGbl_GlobalLockHandle++;
if (AcpiGbl_GlobalLockHandle == 0)
{
AcpiGbl_GlobalLockHandle = 1;
}
/*
* Make sure that a global lock actually exists. If not, just
* treat the lock as a standard mutex.
*/
if (!AcpiGbl_GlobalLockPresent)
{
AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
do
{
/* Attempt to acquire the actual hardware lock */
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
AcpiGbl_GlobalLockAcquired = TRUE;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Acquired hardware Global Lock\n"));
break;
}
/*
* Did not get the lock. The pending bit was set above, and
* we must now wait until we receive the global lock
* released interrupt.
*/
AcpiGbl_GlobalLockPending = TRUE;
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Waiting for hardware Global Lock\n"));
/*
* Wait for handshake with the global lock interrupt handler.
* This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
ACPI_WAIT_FOREVER);
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
} while (ACPI_SUCCESS (Status));
AcpiGbl_GlobalLockPending = FALSE;
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvReleaseGlobalLock
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Releases ownership of the Global Lock.
*
******************************************************************************/
ACPI_STATUS
AcpiEvReleaseGlobalLock (
void)
{
BOOLEAN Pending = FALSE;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (EvReleaseGlobalLock);
/* Lock must be already acquired */
if (!AcpiGbl_GlobalLockAcquired)
{
ACPI_WARNING ((AE_INFO,
"Cannot release the ACPI Global Lock, it has not been acquired"));
return_ACPI_STATUS (AE_NOT_ACQUIRED);
}
if (AcpiGbl_GlobalLockPresent)
{
/* Allow any thread to release the lock */
ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending);
/*
* If the pending bit was set, we must write GBL_RLS to the control
* register
*/
if (Pending)
{
Status = AcpiWriteBitRegister (
ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
}
AcpiGbl_GlobalLockAcquired = FALSE;
/* Release the local GL mutex */
AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
return_ACPI_STATUS (Status);
}

View File

@ -45,7 +45,6 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acevents.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/acinterp.h>
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evmisc")
@ -57,14 +56,6 @@ static void ACPI_SYSTEM_XFACE
AcpiEvNotifyDispatch (
void *Context);
static UINT32
AcpiEvGlobalLockHandler (
void *Context);
static ACPI_STATUS
AcpiEvRemoveGlobalLockHandler (
void);
/*******************************************************************************
*
@ -300,316 +291,6 @@ AcpiEvNotifyDispatch (
}
/*******************************************************************************
*
* FUNCTION: AcpiEvGlobalLockHandler
*
* PARAMETERS: Context - From thread interface, not used
*
* RETURN: ACPI_INTERRUPT_HANDLED
*
* DESCRIPTION: Invoked directly from the SCI handler when a global lock
* release interrupt occurs. If there is actually a pending
* request for the lock, signal the waiting thread.
*
******************************************************************************/
static UINT32
AcpiEvGlobalLockHandler (
void *Context)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
/*
* If a request for the global lock is not actually pending,
* we are done. This handles "spurious" global lock interrupts
* which are possible (and have been seen) with bad BIOSs.
*/
if (!AcpiGbl_GlobalLockPending)
{
goto CleanupAndExit;
}
/*
* Send a unit to the global lock semaphore. The actual acquisition
* of the global lock will be performed by the waiting thread.
*/
Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore"));
}
AcpiGbl_GlobalLockPending = FALSE;
CleanupAndExit:
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
return (ACPI_INTERRUPT_HANDLED);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvInitGlobalLockHandler
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for the global lock release event
*
******************************************************************************/
ACPI_STATUS
AcpiEvInitGlobalLockHandler (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
/* Attempt installation of the global lock handler */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler, NULL);
/*
* If the global lock does not exist on this platform, the attempt to
* enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
* Map to AE_OK, but mark global lock as not present. Any attempt to
* actually use the global lock will be flagged with an error.
*/
AcpiGbl_GlobalLockPresent = FALSE;
if (Status == AE_NO_HARDWARE_RESPONSE)
{
ACPI_ERROR ((AE_INFO,
"No response from Global Lock hardware, disabling lock"));
return_ACPI_STATUS (AE_OK);
}
Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_GlobalLockPending = FALSE;
AcpiGbl_GlobalLockPresent = TRUE;
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvRemoveGlobalLockHandler
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Remove the handler for the Global Lock
*
******************************************************************************/
static ACPI_STATUS
AcpiEvRemoveGlobalLockHandler (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler);
AcpiGbl_GlobalLockPresent = FALSE;
Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiEvAcquireGlobalLock
*
* PARAMETERS: Timeout - Max time to wait for the lock, in millisec.
*
* RETURN: Status
*
* DESCRIPTION: Attempt to gain ownership of the Global Lock.
*
* MUTEX: Interpreter must be locked
*
* Note: The original implementation allowed multiple threads to "acquire" the
* Global Lock, and the OS would hold the lock until the last thread had
* released it. However, this could potentially starve the BIOS out of the
* lock, especially in the case where there is a tight handshake between the
* Embedded Controller driver and the BIOS. Therefore, this implementation
* allows only one thread to acquire the HW Global Lock at a time, and makes
* the global lock appear as a standard mutex on the OS side.
*
*****************************************************************************/
ACPI_STATUS
AcpiEvAcquireGlobalLock (
UINT16 Timeout)
{
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
BOOLEAN Acquired = FALSE;
ACPI_FUNCTION_TRACE (EvAcquireGlobalLock);
/*
* Only one thread can acquire the GL at a time, the GlobalLockMutex
* enforces this. This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex,
Timeout);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Update the global lock handle and check for wraparound. The handle is
* only used for the external global lock interfaces, but it is updated
* here to properly handle the case where a single thread may acquire the
* lock via both the AML and the AcpiAcquireGlobalLock interfaces. The
* handle is therefore updated on the first acquire from a given thread
* regardless of where the acquisition request originated.
*/
AcpiGbl_GlobalLockHandle++;
if (AcpiGbl_GlobalLockHandle == 0)
{
AcpiGbl_GlobalLockHandle = 1;
}
/*
* Make sure that a global lock actually exists. If not, just
* treat the lock as a standard mutex.
*/
if (!AcpiGbl_GlobalLockPresent)
{
AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
do
{
/* Attempt to acquire the actual hardware lock */
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
AcpiGbl_GlobalLockAcquired = TRUE;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Acquired hardware Global Lock\n"));
break;
}
/*
* Did not get the lock. The pending bit was set above, and
* we must now wait until we receive the global lock
* released interrupt.
*/
AcpiGbl_GlobalLockPending = TRUE;
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Waiting for hardware Global Lock\n"));
/*
* Wait for handshake with the global lock interrupt handler.
* This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
ACPI_WAIT_FOREVER);
Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock);
} while (ACPI_SUCCESS (Status));
AcpiGbl_GlobalLockPending = FALSE;
AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvReleaseGlobalLock
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Releases ownership of the Global Lock.
*
******************************************************************************/
ACPI_STATUS
AcpiEvReleaseGlobalLock (
void)
{
BOOLEAN Pending = FALSE;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (EvReleaseGlobalLock);
/* Lock must be already acquired */
if (!AcpiGbl_GlobalLockAcquired)
{
ACPI_WARNING ((AE_INFO,
"Cannot release the ACPI Global Lock, it has not been acquired"));
return_ACPI_STATUS (AE_NOT_ACQUIRED);
}
if (AcpiGbl_GlobalLockPresent)
{
/* Allow any thread to release the lock */
ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending);
/*
* If the pending bit was set, we must write GBL_RLS to the control
* register
*/
if (Pending)
{
Status = AcpiWriteBitRegister (
ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
}
AcpiGbl_GlobalLockAcquired = FALSE;
/* Release the local GL mutex */
AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiEvTerminate
@ -689,4 +370,3 @@ AcpiEvTerminate (
}
return_VOID;
}

View File

@ -61,6 +61,10 @@ AcpiEvHasDefaultHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId);
static void
AcpiEvOrphanEcRegMethod (
void);
static ACPI_STATUS
AcpiEvRegRun (
ACPI_HANDLE ObjHandle,
@ -611,7 +615,7 @@ AcpiEvDetachRegion(
/* Now stop region accesses by executing the _REG method */
Status = AcpiEvExecuteRegMethod (RegionObj, 0);
Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]",
@ -1142,6 +1146,13 @@ AcpiEvExecuteRegMethods (
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL,
&SpaceId, NULL);
/* Special case for EC: handle "orphan" _REG methods with no region */
if (SpaceId == ACPI_ADR_SPACE_EC)
{
AcpiEvOrphanEcRegMethod ();
}
return_ACPI_STATUS (Status);
}
@ -1208,7 +1219,122 @@ AcpiEvRegRun (
return (AE_OK);
}
Status = AcpiEvExecuteRegMethod (ObjDesc, 1);
Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvOrphanEcRegMethod
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Execute an "orphan" _REG method that appears under the EC
* device. This is a _REG method that has no corresponding region
* within the EC device scope. The orphan _REG method appears to
* have been enabled by the description of the ECDT in the ACPI
* specification: "The availability of the region space can be
* detected by providing a _REG method object underneath the
* Embedded Controller device."
*
* To quickly access the EC device, we use the EC_ID that appears
* within the ECDT. Otherwise, we would need to perform a time-
* consuming namespace walk, executing _HID methods to find the
* EC device.
*
******************************************************************************/
static void
AcpiEvOrphanEcRegMethod (
void)
{
ACPI_TABLE_ECDT *Table;
ACPI_STATUS Status;
ACPI_OBJECT_LIST Args;
ACPI_OBJECT Objects[2];
ACPI_NAMESPACE_NODE *EcDeviceNode;
ACPI_NAMESPACE_NODE *RegMethod;
ACPI_NAMESPACE_NODE *NextNode;
ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod);
/* Get the ECDT (if present in system) */
Status = AcpiGetTable (ACPI_SIG_ECDT, 0,
ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table));
if (ACPI_FAILURE (Status))
{
return_VOID;
}
/* We need a valid EC_ID string */
if (!(*Table->Id))
{
return_VOID;
}
/* Namespace is currently locked, must release */
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
/* Get a handle to the EC device referenced in the ECDT */
Status = AcpiGetHandle (NULL,
ACPI_CAST_PTR (char, Table->Id),
ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode));
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Get a handle to a _REG method immediately under the EC device */
Status = AcpiGetHandle (EcDeviceNode,
METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod));
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/*
* Execute the _REG method only if there is no Operation Region in
* this scope with the Embedded Controller space ID. Otherwise, it
* will already have been executed. Note, this allows for Regions
* with other space IDs to be present; but the code below will then
* execute the _REG method with the EC space ID argument.
*/
NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL);
while (NextNode)
{
if ((NextNode->Type == ACPI_TYPE_REGION) &&
(NextNode->Object) &&
(NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC))
{
goto Exit; /* Do not execute _REG */
}
NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode);
}
/* Evaluate the _REG(EC,Connect) method */
Args.Count = 2;
Args.Pointer = Objects;
Objects[0].Type = ACPI_TYPE_INTEGER;
Objects[0].Integer.Value = ACPI_ADR_SPACE_EC;
Objects[1].Type = ACPI_TYPE_INTEGER;
Objects[1].Integer.Value = ACPI_REG_CONNECT;
Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL);
Exit:
/* We ignore all errors from above, don't care */
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
return_VOID;
}

View File

@ -696,7 +696,7 @@ AcpiEvInitializeRegion (
}
}
Status = AcpiEvExecuteRegMethod (RegionObj, 1);
Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT);
if (AcpiNsLocked)
{

View File

@ -141,20 +141,21 @@ AcpiInstallAddressSpaceHandler (
case ACPI_ADR_SPACE_PCI_CONFIG:
case ACPI_ADR_SPACE_DATA_TABLE:
if (AcpiGbl_RegMethodsExecuted)
if (!AcpiGbl_RegMethodsExecuted)
{
/* Run all _REG methods for this address space */
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
/* We will defer execution of the _REG methods for this space */
goto UnlockAndExit;
}
break;
default:
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
break;
}
/* Run all _REG methods for this address space */
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);

View File

@ -327,7 +327,8 @@ AcpiExCreateRegion (
* range
*/
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
(RegionSpace < ACPI_USER_REGION_BEGIN))
(RegionSpace < ACPI_USER_REGION_BEGIN) &&
(RegionSpace != ACPI_ADR_SPACE_DATA_TABLE))
{
ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);

View File

@ -168,7 +168,6 @@
/* Operation regions */
#define ACPI_NUM_PREDEFINED_REGIONS 9
#define ACPI_USER_REGION_BEGIN 0x80
/* Maximum SpaceIds for Operation Regions */

View File

@ -68,6 +68,23 @@ BOOLEAN
AcpiEvIsNotifyObject (
ACPI_NAMESPACE_NODE *Node);
UINT32
AcpiEvGetGpeNumberIndex (
UINT32 GpeNumber);
ACPI_STATUS
AcpiEvQueueNotifyRequest (
ACPI_NAMESPACE_NODE *Node,
UINT32 NotifyValue);
/*
* evglock - Global Lock support
*/
ACPI_STATUS
AcpiEvInitGlobalLockHandler (
void);
ACPI_STATUS
AcpiEvAcquireGlobalLock(
UINT16 Timeout);
@ -77,18 +94,9 @@ AcpiEvReleaseGlobalLock(
void);
ACPI_STATUS
AcpiEvInitGlobalLockHandler (
AcpiEvRemoveGlobalLockHandler (
void);
UINT32
AcpiEvGetGpeNumberIndex (
UINT32 GpeNumber);
ACPI_STATUS
AcpiEvQueueNotifyRequest (
ACPI_NAMESPACE_NODE *Node,
UINT32 NotifyValue);
/*
* evgpe - Low-level GPE support

View File

@ -48,7 +48,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20110316
#define ACPI_CA_VERSION 0x20110413
#include <contrib/dev/acpica/include/actypes.h>
#include <contrib/dev/acpica/include/actbl.h>

View File

@ -716,9 +716,24 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7
#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8
#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127
#define ACPI_NUM_PREDEFINED_REGIONS 8
/*
* Special Address Spaces
*
* Note: A Data Table region is a special type of operation region
* that has its own AML opcode. However, internally, the AML
* interpreter simply creates an operation region with an an address
* space type of ACPI_ADR_SPACE_DATA_TABLE.
*/
#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */
#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F
/* Values for _REG connection code */
#define ACPI_REG_DISCONNECT 0
#define ACPI_REG_CONNECT 1
/*
* BitRegister IDs

View File

@ -402,24 +402,6 @@
#define AML_CLASS_UNKNOWN 0x0A
/* Predefined Operation Region SpaceIDs */
typedef enum
{
REGION_MEMORY = 0,
REGION_IO,
REGION_PCI_CONFIG,
REGION_EC,
REGION_SMBUS,
REGION_CMOS,
REGION_PCI_BAR,
REGION_IPMI,
REGION_DATA_TABLE, /* Internal use only */
REGION_FIXED_HW = 0x7F
} AML_REGION_TYPES;
/* Comparison operation codes for MatchOp operator */
typedef enum

View File

@ -77,7 +77,6 @@
*
* Additional possible repairs:
*
* Optional/unnecessary NULL package elements removed
* Required package elements that are NULL replaced by Integer/String/Buffer
* Incorrect standalone package wrapped with required outer package
*
@ -684,17 +683,13 @@ AcpiNsRemoveNullElements (
/*
* PTYPE1 packages contain no subpackages.
* PTYPE2 packages contain a variable number of sub-packages. We can
* safely remove all NULL elements from the PTYPE2 packages.
* We can safely remove all NULL elements from these package types:
* PTYPE1_VAR packages contain a variable number of simple data types.
* PTYPE2 packages contain a variable number of sub-packages.
*/
switch (PackageType)
{
case ACPI_PTYPE1_FIXED:
case ACPI_PTYPE1_VAR:
case ACPI_PTYPE1_OPTION:
return;
case ACPI_PTYPE2:
case ACPI_PTYPE2_COUNT:
case ACPI_PTYPE2_PKG_COUNT:
@ -704,6 +699,8 @@ AcpiNsRemoveNullElements (
break;
default:
case ACPI_PTYPE1_FIXED:
case ACPI_PTYPE1_OPTION:
return;
}

View File

@ -187,8 +187,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
"SMBus",
"SystemCMOS",
"PCIBARTarget",
"IPMI",
"DataTable"
"IPMI"
};
@ -201,6 +200,10 @@ AcpiUtGetRegionName (
{
return ("UserDefinedRegion");
}
else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE)
{
return ("DataTable");
}
else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
{
return ("FunctionalFixedHW");

View File

@ -39,7 +39,7 @@ SRCS+= dmresrcs.c dmutils.c dmwalk.c
SRCS+= dsargs.c dscontrol.c dsfield.c dsinit.c dsmethod.c dsmthdat.c
SRCS+= dsobject.c dsopcode.c dsutils.c dswexec.c dswload.c dswload2.c
SRCS+= dswscope.c dswstate.c
SRCS+= evevent.c evgpe.c evgpeblk.c evgpeinit.c evgpeutil.c evmisc.c
SRCS+= evevent.c evglock.c evgpe.c evgpeblk.c evgpeinit.c evgpeutil.c evmisc.c
SRCS+= evregion.c evrgnini.c evsci.c evxface.c evxfevnt.c evxfgpe.c evxfregn.c
SRCS+= exconfig.c exconvrt.c excreate.c exdebug.c exdump.c exfield.c
SRCS+= exfldio.c exmisc.c exmutex.c exnames.c exoparg1.c exoparg2.c

View File

@ -14,9 +14,9 @@ SRCS+= dmbuffer.c dmnames.c dmobject.c dmopcode.c dmresrc.c \
dmresrcl.c dmresrcs.c dmutils.c dmwalk.c
# events
SRCS+= evevent.c evgpe.c evgpeblk.c evgpeinit.c evgpeutil.c \
evmisc.c evregion.c evrgnini.c evsci.c evxface.c \
evxfevnt.c evxfgpe.c evxfregn.c
SRCS+= evevent.c evglock.c evgpe.c evgpeblk.c evgpeinit.c \
evgpeutil.c evmisc.c evregion.c evrgnini.c evsci.c \
evxface.c evxfevnt.c evxfgpe.c evxfregn.c
# hardware
SRCS+= hwacpi.c hwgpe.c hwpci.c hwregs.c hwsleep.c hwvalid.c \

View File

@ -10,7 +10,7 @@ SRCS+= dmextern.c dmrestag.c dmtable.c dmtbdump.c dmtbinfo.c \
# compiler
SRCS+= aslanalyze.c aslbtypes.c aslcodegen.c aslcompile.c \
aslcompiler.y.h aslcompilerlex.l aslcompilerparse.y \
aslcompiler.y.h aslcompilerlex.c aslcompilerparse.c \
aslerror.c aslfiles.c aslfold.c asllength.c \
asllisting.c aslload.c asllookup.c aslmain.c aslmap.c \
aslopcodes.c asloperands.c aslopt.c aslpredef.c \
@ -19,7 +19,8 @@ SRCS+= aslanalyze.c aslbtypes.c aslcodegen.c aslcompile.c \
aslrestype2q.c aslrestype2w.c aslstartup.c aslstubs.c \
asltransform.c asltree.c aslutils.c asluuid.c \
aslwalks.c dtcompile.c dtexpress.c dtfield.c dtio.c \
dtsubtable.c dttable.c dttemplate.c dtutils.c
dtparser.y.h dtparserlex.c dtparserparse.c dtsubtable.c \
dttable.c dttemplate.c dtutils.c
# debugger
SRCS+= dbfileio.c
@ -62,20 +63,31 @@ MAN= iasl.8
CFLAGS+= -DACPI_ASL_COMPILER -I.
CFLAGS+= -D_USE_BERKELEY_YACC
LFLAGS= -i -PAslCompiler
YFLAGS= -d -pAslCompiler
LFLAGS= -i -s
YFLAGS= -d
DPADD= ${LIBPTHREAD}
LDADD= -lpthread
CLEANFILES= aslcompiler.y.h aslcompilerlex.l aslcompilerparse.y
CLEANFILES= aslcompiler.y.h aslcompilerlex.c aslcompilerparse.c \
aslcompilerparse.h dtparser.y.h dtparserlex.c \
dtparserparse.c dtparserparse.h
aslcompiler.y.h: aslcompilerparse.h
cat ${.ALLSRC} > ${.TARGET}
aslcompilerlex.c: aslcompiler.l
${LEX} ${LFLAGS} -PAslCompiler -o${.TARGET} ${.ALLSRC}
aslcompilerlex.l: aslcompiler.l
cat ${.ALLSRC} > ${.TARGET}
aslcompilerparse.c: aslcompiler.y
${YACC} ${YFLAGS} -pAslCompiler -o${.TARGET} ${.ALLSRC}
aslcompilerparse.y: aslcompiler.y
cat ${.ALLSRC} > ${.TARGET}
aslcompiler.y.h: aslcompilerparse.c
mv -f aslcompilerparse.h ${.TARGET}
dtparserlex.c: dtparser.l
${LEX} ${LFLAGS} -PDtParser -o${.TARGET} ${.ALLSRC}
dtparserparse.c: dtparser.y
${YACC} ${YFLAGS} -pDtParser -o${.TARGET} ${.ALLSRC}
dtparser.y.h: dtparserparse.c
mv -f dtparserparse.h ${.TARGET}
.include <bsd.prog.mk>