diff options
author | jkim <jkim@FreeBSD.org> | 2013-06-27 00:16:54 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-06-27 00:16:54 +0000 |
commit | faabc5353932108c96a32e7422578294fe30ab63 (patch) | |
tree | e9a0e51088d3c1e15addea9cd33b6f472b9a6b53 /sys | |
parent | c15f698fb461ff5e7a9135b74eede196265fc6ca (diff) | |
download | FreeBSD-src-faabc5353932108c96a32e7422578294fe30ab63.zip FreeBSD-src-faabc5353932108c96a32e7422578294fe30ab63.tar.gz |
Merge ACPICA 20130626.
Diffstat (limited to 'sys')
40 files changed, 508 insertions, 240 deletions
diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index 44f5e5e..b82586d 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -20,8 +20,8 @@ fulldirs="common compiler components include os_specific" stripdirs="generate libraries tests tools" stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \ aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h \ - acwin64.h new_table.txt oslinuxtbl.c osunixdir.c oswindir.c \ - oswintbl.c oswinxf.c readme.txt utclib.c" + acwin64.h new_table.txt osfreebsdtbl.c oslinuxtbl.c osunixdir.c \ + oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" # include files to canonify src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \ diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index a16fc69..0eb04f9 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,4 +1,60 @@ ---------------------------------------- +26 June 2013. Summary of changes for version 20130626: + +1) ACPICA kernel-resident subsystem: + +Fixed an issue with runtime repair of the _CST object. Null or invalid +elements were not always removed properly. Lv Zheng. + +Removed an arbitrary restriction of 256 GPEs per GPE block (such as the +FADT-defined GPE0 and GPE1). For GPE0, GPE1, and each GPE Block Device, +the maximum number of GPEs is 1016. Use of multiple GPE block devices +makes the system-wide number of GPEs essentially unlimited. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 95.9K Code, 26.9K Data, 122.8K Total + Debug Version: 184.1K Code, 76.7K Data, 260.8K Total + Previous Release: + Non-Debug Version: 96.0K Code, 27.0K Data, 123.0K Total + Debug Version: 184.1K Code, 76.8K Data, 260.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +Portable AcpiDump: Implemented full support for the Linux and FreeBSD +hosts. Now supports Linux, FreeBSD, and Windows. + +Disassembler: Added some missing types for the HEST and EINJ tables: "Set +Error Type With Address", "CMCI", "MCE", and "Flush Cacheline". + +iASL/Preprocessor: Implemented full support for nested +#if/#else/#elif/#endif blocks. Allows arbitrary depth of nested blocks. + +Disassembler: Expanded maximum output string length to 64K. Was 256 bytes +max. The original purpose of this constraint was to limit the amount of +debug output. However, the string function in question (UtPrintString) is +now used for the disassembler also, where 256 bytes is insufficient. +Reported by RehabMan@GitHub. + +iASL/DataTables: Fixed some problems and issues with compilation of DMAR +tables. ACPICA BZ 999. Lv Zheng. + +iASL: Fixed a couple of error exit issues that could result in a "Could +not delete <file>" message during ASL compilation. + +AcpiDump: Allow "FADT" and "MADT" as valid table signatures, even though +the actual signatures for these tables are "FACP" and "APIC", +respectively. + +AcpiDump: Added support for multiple UEFI tables. Only SSDT and UEFI +tables are allowed to have multiple instances. + +---------------------------------------- 17 May 2013. Summary of changes for version 20130517: 1) ACPICA kernel-resident subsystem: diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index e6fa462..9b85498 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -666,6 +666,7 @@ AcpiGetTagPathname ( Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); if (ACPI_FAILURE (Status)) { + ACPI_FREE (Pathname); return (NULL); } diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 1fb9e3c..6aab9e5 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -100,6 +100,7 @@ static const char *AcpiDmEinjActions[] = "Execute Operation", "Check Busy Status", "Get Command Status", + "Set Error Type With Address", "Unknown Action" }; @@ -110,6 +111,7 @@ static const char *AcpiDmEinjInstructions[] = "Write Register", "Write Register Value", "Noop", + "Flush Cacheline", "Unknown Instruction" }; @@ -180,6 +182,8 @@ static const char *AcpiDmHestNotifySubnames[] = "Local Interrupt", "SCI", "NMI", + "CMCI", /* ACPI 5.0 */ + "MCE", /* ACPI 5.0 */ "Unknown Notify Type" /* Reserved */ }; @@ -744,6 +748,11 @@ AcpiDmDumpTable ( ByteLength = 8; break; + case ACPI_DMT_BUF10: + + ByteLength = 10; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: @@ -862,6 +871,7 @@ AcpiDmDumpTable ( break; case ACPI_DMT_BUF7: + case ACPI_DMT_BUF10: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: /* diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 6f75fa1..89d38e7 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -872,6 +872,7 @@ AcpiDmDumpDmar ( { return; } + AcpiOsPrintf ("\n"); switch (SubTable->Type) { @@ -924,6 +925,7 @@ AcpiDmDumpDmar ( { return; } + AcpiOsPrintf ("\n"); /* Dump the PCI Path entries for this device scope */ @@ -941,6 +943,7 @@ AcpiDmDumpDmar ( PathOffset += 2; PciPath += 2; + AcpiOsPrintf ("\n"); } /* Point to next device scope entry */ diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index dd67774..4272a33 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -780,6 +780,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] = { {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width", 0}, {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_BUF10, ACPI_DMAR_OFFSET (Reserved[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index fd17c26..7b2393c 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -966,7 +966,19 @@ CmCleanupAndExit ( /* Close all open files */ - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ + /* + * Take care with the preprocessor file (.i), it might be the same + * as the "input" file, depending on where the compiler has terminated + * or aborted. Prevent attempt to close the same file twice in + * loop below. + */ + if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle == + Gbl_Files[ASL_FILE_INPUT].Handle) + { + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; + } + + /* Close the standard I/O files */ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h index a104a44..9fb7229 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/compiler/aslmessages.h @@ -248,7 +248,7 @@ typedef enum ASL_MSG_TOO_MANY_ARGUMENTS, ASL_MSG_UNKNOWN_DIRECTIVE, ASL_MSG_UNKNOWN_PRAGMA, - + ASL_MSG_WARNING_DIRECTIVE, /* These messages are used by the data table compiler only */ @@ -433,6 +433,7 @@ char *AslMessages [] = /* ASL_MSG_TOO_MANY_ARGUMENTS */ "Too many macro arguments", /* ASL_MSG_UNKNOWN_DIRECTIVE */ "Unknown directive", /* ASL_MSG_UNKNOWN_PRAGMA */ "Unknown pragma", +/* ASL_MSG_WARNING_DIRECTIVE */ "#warning", /* Table compiler */ diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index 572a038..b2bbbfd 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -823,6 +823,7 @@ TrLinkChildren ( { AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, "Child node list invalid"); + va_end(ap); return (Op); } @@ -869,8 +870,8 @@ TrLinkChildren ( } PrevChild = Child; } - va_end(ap); + va_end(ap); DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); return (Op); } diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 4353fac..eea5d68 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -353,8 +353,6 @@ DbgPrint ( va_list Args; - va_start (Args, Fmt); - if (!Gbl_DebugFlag) { return; @@ -366,6 +364,7 @@ DbgPrint ( return; } + va_start (Args, Fmt); (void) vfprintf (stderr, Fmt, Args); va_end (Args); return; diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c index 7f77665..1f273d9 100644 --- a/sys/contrib/dev/acpica/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/compiler/dtfield.c @@ -467,12 +467,13 @@ DtCompileBuffer ( if (ACPI_FAILURE (Status)) { DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer); - return (ByteLength - Count); + goto Exit; } Buffer[i] = (UINT8) Value; } +Exit: ACPI_FREE (StringValue); return (ByteLength - Count); } diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index 1495e96..39fb9da 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -287,31 +287,21 @@ DtParseLine ( while (Start < Colon) { - if (*Start == ' ') - { - Start++; - continue; - } - - /* Found left bracket, go to the right bracket */ - if (*Start == '[') { + /* Found left bracket, go to the right bracket */ + while (Start < Colon && *Start != ']') { Start++; } - - if (Start == Colon) - { - break; - } - - Start++; - continue; + } + else if (*Start != ' ') + { + break; } - break; + Start++; } /* @@ -1138,4 +1128,5 @@ DtWriteTableToListing ( AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0); AcpiOsRedirectOutput (stdout); + ACPI_FREE (Buffer); } diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index fe15822..bb6c7cb 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -541,8 +541,9 @@ DtCompileDmar ( DT_FIELD *SubtableStart; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMAR_HEADER *DmarHeader; - UINT8 *ReservedBuffer; - UINT32 ReservedSize; + ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope; + UINT32 DeviceScopeLength; + UINT32 PciPathLength; Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE); @@ -553,17 +554,7 @@ DtCompileDmar ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); - - /* DMAR Reserved area */ - - ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved); - ReservedBuffer = UtLocalCalloc (ReservedSize); - - DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable); - - ACPI_FREE (ReservedBuffer); - ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); while (*PFieldList) { @@ -621,10 +612,13 @@ DtCompileDmar ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); /* Optional Device Scope subtables */ - while (*PFieldList) + DeviceScopeLength = DmarHeader->Length - Subtable->Length - + ParentTable->Length; + while (DeviceScopeLength) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, &Subtable, FALSE); @@ -637,9 +631,12 @@ DtCompileDmar ( DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); + DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer); + /* Optional PCI Paths */ - while (*PFieldList) + PciPathLength = DmarDeviceScope->Length - Subtable->Length; + while (PciPathLength) { Status = DtCompileTable (PFieldList, TableInfoDmarPciPath, &Subtable, FALSE); @@ -651,10 +648,15 @@ DtCompileDmar ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); + PciPathLength -= Subtable->Length; } + + DtPopSubtable (); + DeviceScopeLength -= DmarDeviceScope->Length; } DtPopSubtable (); + DtPopSubtable (); } return (AE_OK); diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index d3fadf5..f620abd 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -188,22 +188,22 @@ const unsigned char TemplateDbgp[] = const unsigned char TemplateDmar[] = { 0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00, /* 00000000 "DMAR...." */ - 0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x01,0x03,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00, /* 00000020 "(.. /..." */ + 0x17,0x05,0x13,0x20,0x2F,0x01,0x00,0x00, /* 00000020 "... /..." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ - 0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000038 "........" */ - 0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x03,0x08,0x00,0x00,0x08,0x00,0x00,0x01, /* 00000040 "........" */ 0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00, /* 00000048 ".. ....." */ - 0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000050 "...x...." */ - 0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000058 ".?.x...." */ - 0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x02, /* 00000060 "........" */ 0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ - 0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000070 "........" */ + 0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x03, /* 00000070 "........" */ 0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ - 0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x00,0x00,0x00,0x00 /* 00000088 "...." */ }; diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index a348c0f..d7ef56e 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -397,6 +397,7 @@ DtGetFieldType ( case ACPI_DMT_BUFFER: case ACPI_DMT_BUF7: + case ACPI_DMT_BUF10: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: case ACPI_DMT_PCI_PATH: @@ -630,6 +631,11 @@ DtGetFieldLength ( } break; + case ACPI_DMT_BUF10: + + ByteLength = 10; + break; + case ACPI_DMT_BUF16: case ACPI_DMT_UUID: diff --git a/sys/contrib/dev/acpica/compiler/preprocess.h b/sys/contrib/dev/acpica/compiler/preprocess.h index 6decc00..ae32a8c 100644 --- a/sys/contrib/dev/acpica/compiler/preprocess.h +++ b/sys/contrib/dev/acpica/compiler/preprocess.h @@ -124,6 +124,17 @@ typedef struct pr_file_node } PR_FILE_NODE; +#define MAX_ARGUMENT_LENGTH 24 + +typedef struct directive_info +{ + struct directive_info *Next; + char Argument[MAX_ARGUMENT_LENGTH]; + int Directive; + BOOLEAN IgnoringThisCodeBlock; + +} DIRECTIVE_INFO; + /* * Globals @@ -136,12 +147,13 @@ PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MainTokenBuffer, NULL); /* PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ PR_EXTERN char PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ -PR_EXTERN PR_FILE_NODE *Gbl_InputFileList; -PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL); PR_EXTERN UINT32 Gbl_PreprocessorLineNumber; PR_EXTERN int Gbl_IfDepth; +PR_EXTERN PR_FILE_NODE *Gbl_InputFileList; +PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL); PR_EXTERN BOOLEAN PR_INIT_GLOBAL (Gbl_PreprocessorError, FALSE); - +PR_EXTERN BOOLEAN PR_INIT_GLOBAL (Gbl_IgnoringThisCodeBlock, FALSE); +PR_EXTERN DIRECTIVE_INFO PR_INIT_GLOBAL (*Gbl_DirectiveStack, NULL); /* * prscan - Preprocessor entry @@ -158,7 +170,7 @@ void PrTerminatePreprocessor ( void); -BOOLEAN +void PrDoPreprocess ( void); diff --git a/sys/contrib/dev/acpica/compiler/prscan.c b/sys/contrib/dev/acpica/compiler/prscan.c index dad91bd..a3ac0c2 100644 --- a/sys/contrib/dev/acpica/compiler/prscan.c +++ b/sys/contrib/dev/acpica/compiler/prscan.c @@ -65,13 +65,27 @@ PrPreprocessInputFile ( static void PrDoDirective ( char *DirectiveToken, - char **Next, - BOOLEAN *IgnoringThisCodeBlock); + char **Next); static int PrMatchDirective ( char *Directive); +static void +PrPushDirective ( + int Directive, + char *Argument); + +static ACPI_STATUS +PrPopDirective ( + void); + +static void +PrDbgPrint ( + char *Action, + char *DirectiveName); + + /* * Supported preprocessor directives */ @@ -156,11 +170,16 @@ PrInitializeGlobals ( { /* Init globals */ - Gbl_IfDepth = 0; Gbl_InputFileList = NULL; Gbl_CurrentLineNumber = 0; Gbl_PreprocessorLineNumber = 1; Gbl_PreprocessorError = FALSE; + + /* These are used to track #if/#else blocks (possibly nested) */ + + Gbl_IfDepth = 0; + Gbl_IgnoringThisCodeBlock = FALSE; + Gbl_DirectiveStack = NULL; } @@ -207,7 +226,7 @@ PrTerminatePreprocessor ( * * PARAMETERS: None * - * RETURN: Error Status. TRUE if error, FALSE if OK. + * RETURN: None * * DESCRIPTION: Main entry point for the iASL Preprocessor. Input file must * be already open. Handles multiple input files via the @@ -215,7 +234,7 @@ PrTerminatePreprocessor ( * ******************************************************************************/ -BOOLEAN +void PrDoPreprocess ( void) { @@ -237,20 +256,7 @@ PrDoPreprocess ( } while (MoreInputFiles); - - /* - * TBD: is this necessary? (Do we abort on any preprocessing errors?) - */ - if (Gbl_PreprocessorError) - { - /* TBD: can't use source_output file for preprocessor error reporting */ - - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL; - PrTerminatePreprocessor (); - return (TRUE); - } - - /* Point compiler input to the new preprocessor file (.i) */ + /* Point compiler input to the new preprocessor output file (.i) */ FlCloseFile (ASL_FILE_INPUT); Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle; @@ -262,7 +268,6 @@ PrDoPreprocess ( Gbl_CurrentLineNumber = 1; DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n"); - return (FALSE); } @@ -290,7 +295,6 @@ PrPreprocessInputFile ( char *ReplaceString; PR_DEFINE_INFO *DefineInfo; ACPI_SIZE TokenOffset; - BOOLEAN IgnoringThisCodeBlock = FALSE; char *Next; int OffsetAdjust; @@ -320,7 +324,7 @@ PrPreprocessInputFile ( /* Execute the directive, do not write line to output file */ - PrDoDirective (Token, &Next, &IgnoringThisCodeBlock); + PrDoDirective (Token, &Next); continue; } @@ -329,7 +333,7 @@ PrPreprocessInputFile ( * FALSE, ignore the line and do not write it to the output file. * This continues until an #else or #endif is encountered. */ - if (IgnoringThisCodeBlock == TRUE) + if (Gbl_IgnoringThisCodeBlock) { continue; } @@ -416,12 +420,8 @@ PrPreprocessInputFile ( * * PARAMETERS: Directive - Pointer to directive name token * Next - "Next" buffer from GetNextToken - * IgnoringThisCodeBlock - Where the "ignore code" flag is - * returned. * - * RETURN: IgnoringThisCodeBlock: Set to TRUE if we are skipping the FALSE - * part of an #if or #else block. Set to FALSE when the - * corresponding #else or #endif is encountered. + * RETURN: None. * * DESCRIPTION: Main processing for all preprocessor directives * @@ -430,8 +430,7 @@ PrPreprocessInputFile ( static void PrDoDirective ( char *DirectiveToken, - char **Next, - BOOLEAN *IgnoringThisCodeBlock) + char **Next) { char *Token = Gbl_MainTokenBuffer; char *Token2; @@ -459,14 +458,28 @@ PrDoDirective ( return; } - /* TBD: Need a faster way to do this: */ - - if ((Directive == PR_DIRECTIVE_ELIF) || - (Directive == PR_DIRECTIVE_ELSE) || - (Directive == PR_DIRECTIVE_ENDIF)) + /* + * If we are currently ignoring this block and we encounter a #else or + * #elif, we must ignore their blocks also if the parent block is also + * being ignored. + */ + if (Gbl_IgnoringThisCodeBlock) { - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n", - Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name); + switch (Directive) + { + case PR_DIRECTIVE_ELSE: + case PR_DIRECTIVE_ELIF: + + if (Gbl_DirectiveStack && Gbl_DirectiveStack->IgnoringThisCodeBlock) + { + PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); + return; + } + break; + + default: + break; + } } /* @@ -476,57 +489,54 @@ PrDoDirective ( */ switch (Directive) { + case PR_DIRECTIVE_ELSE: + + Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock); + PrDbgPrint ("Executing", "else block"); + return; + case PR_DIRECTIVE_ELIF: - *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock); - if (*IgnoringThisCodeBlock == TRUE) + Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock); + Directive = PR_DIRECTIVE_IF; + + if (Gbl_IgnoringThisCodeBlock == TRUE) { /* Not executing the ELSE part -- all done here */ + PrDbgPrint ("Ignoring", "elif block"); return; } - /* Will execute the ELSE..IF part */ + /* + * After this, we will execute the IF part further below. + * First, however, pop off the original #if directive. + */ + if (ACPI_FAILURE (PrPopDirective ())) + { + PrError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + THIS_TOKEN_OFFSET (DirectiveToken)); + } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "#elif - Executing else block\n", - Gbl_CurrentLineNumber); - Directive = PR_DIRECTIVE_IF; + PrDbgPrint ("Executing", "elif block"); break; - case PR_DIRECTIVE_ELSE: + case PR_DIRECTIVE_ENDIF: - *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock); - return; + PrDbgPrint ("Executing", "endif"); - case PR_DIRECTIVE_ENDIF: + /* Pop the owning #if/#ifdef/#ifndef */ - *IgnoringThisCodeBlock = FALSE; - Gbl_IfDepth--; - if (Gbl_IfDepth < 0) + if (ACPI_FAILURE (PrPopDirective ())) { PrError (ASL_ERROR, ASL_MSG_ENDIF_MISMATCH, THIS_TOKEN_OFFSET (DirectiveToken)); - Gbl_IfDepth = 0; } return; default: - break; } - /* - * At this point, if we are ignoring the current code block, - * do not process any more directives (i.e., ignore them also.) - */ - if (*IgnoringThisCodeBlock == TRUE) - { - return; - } - - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n", - Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name); - /* Most directives have at least one argument */ if (Gbl_DirectiveInfo[Directive].ArgCount == 1) @@ -538,8 +548,85 @@ PrDoDirective ( } } + /* + * At this point, if we are ignoring the current code block, + * do not process any more directives (i.e., ignore them also.) + * For "if" style directives, open/push a new block anyway. We + * must do this to keep track of #endif directives + */ + if (Gbl_IgnoringThisCodeBlock) + { + switch (Directive) + { + case PR_DIRECTIVE_IF: + case PR_DIRECTIVE_IFDEF: + case PR_DIRECTIVE_IFNDEF: + + PrPushDirective (Directive, Token); + PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name); + break; + + default: + break; + } + + return; + } + + /* + * Execute the directive + */ + PrDbgPrint ("Begin execution", Gbl_DirectiveInfo[Directive].Name); + switch (Directive) { + case PR_DIRECTIVE_IF: + + TokenOffset = Token - Gbl_MainTokenBuffer; + + /* Need to expand #define macros in the expression string first */ + + Status = PrResolveIntegerExpression ( + &Gbl_CurrentLineBuffer[TokenOffset-1], &Value); + if (ACPI_FAILURE (Status)) + { + return; + } + + PrPushDirective (Directive, Token); + if (!Value) + { + Gbl_IgnoringThisCodeBlock = TRUE; + } + + DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + "Resolved #if: %8.8X%8.8X %s\n", + Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), + Gbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>"); + break; + + case PR_DIRECTIVE_IFDEF: + + PrPushDirective (Directive, Token); + if (!PrMatchDefine (Token)) + { + Gbl_IgnoringThisCodeBlock = TRUE; + } + + PrDbgPrint ("Evaluated", "ifdef"); + break; + + case PR_DIRECTIVE_IFNDEF: + + PrPushDirective (Directive, Token); + if (PrMatchDefine (Token)) + { + Gbl_IgnoringThisCodeBlock = TRUE; + } + + PrDbgPrint ("Evaluated", "ifndef"); + break; + case PR_DIRECTIVE_DEFINE: /* * By definition, if first char after the name is a paren, @@ -595,64 +682,15 @@ PrDoDirective ( case PR_DIRECTIVE_ERROR: - /* TBD compiler should abort */ /* Note: No macro expansion */ PrError (ASL_ERROR, ASL_MSG_ERROR_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); - break; - - case PR_DIRECTIVE_IF: - TokenOffset = Token - Gbl_MainTokenBuffer; - - /* Need to expand #define macros in the expression string first */ - - Status = PrResolveIntegerExpression ( - &Gbl_CurrentLineBuffer[TokenOffset-1], &Value); - if (ACPI_FAILURE (Status)) - { - return; - } - - if (!Value) - { - *IgnoringThisCodeBlock = TRUE; - } - - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Resolved #if: %8.8X%8.8X %s\n", - Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), - *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>"); - - Gbl_IfDepth++; - break; - - case PR_DIRECTIVE_IFDEF: - - if (!PrMatchDefine (Token)) - { - *IgnoringThisCodeBlock = TRUE; - } - - Gbl_IfDepth++; - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Start #ifdef %s\n", Gbl_CurrentLineNumber, - *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>"); - break; - - case PR_DIRECTIVE_IFNDEF: - - if (PrMatchDefine (Token)) - { - *IgnoringThisCodeBlock = TRUE; - } - - Gbl_IfDepth++; - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Start #ifndef %2.2X\n", Gbl_CurrentLineNumber, - *IgnoringThisCodeBlock, Gbl_CurrentLineNumber); - break; + Gbl_SourceLine = 0; + Gbl_NextError = Gbl_ErrorLog; + CmCleanupAndExit (); + exit(1); case PR_DIRECTIVE_INCLUDE: @@ -738,7 +776,7 @@ PrDoDirective ( case PR_DIRECTIVE_WARNING: - PrError (ASL_WARNING, ASL_MSG_ERROR_DIRECTIVE, + PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE, THIS_TOKEN_OFFSET (Token)); break; @@ -753,7 +791,6 @@ PrDoDirective ( return; - SyntaxError: PrError (ASL_ERROR, ASL_MSG_DIRECTIVE_SYNTAX, @@ -796,3 +833,130 @@ PrMatchDirective ( return (ASL_DIRECTIVE_NOT_FOUND); /* Command not recognized */ } + + +/******************************************************************************* + * + * FUNCTION: PrPushDirective + * + * PARAMETERS: Directive - Encoded directive ID + * Argument - String containing argument to the + * directive + * + * RETURN: None + * + * DESCRIPTION: Push an item onto the directive stack. Used for processing + * nested #if/#else type conditional compilation directives. + * Specifically: Used on detection of #if/#ifdef/#ifndef to open + * a block. + * + ******************************************************************************/ + +static void +PrPushDirective ( + int Directive, + char *Argument) +{ + DIRECTIVE_INFO *Info; + + + /* Allocate and populate a stack info item */ + + Info = ACPI_ALLOCATE (sizeof (DIRECTIVE_INFO)); + + Info->Next = Gbl_DirectiveStack; + Info->Directive = Directive; + Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock; + strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); + + DbgPrint (ASL_DEBUG_OUTPUT, + "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n", + Gbl_CurrentLineNumber, Gbl_IfDepth, + Gbl_IgnoringThisCodeBlock ? "I" : "E", + Gbl_IfDepth * 4, " ", + Gbl_DirectiveInfo[Directive].Name, + Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); + + /* Push new item */ + + Gbl_DirectiveStack = Info; + Gbl_IfDepth++; +} + + +/******************************************************************************* + * + * FUNCTION: PrPopDirective + * + * PARAMETERS: None + * + * RETURN: Status. Error if the stack is empty. + * + * DESCRIPTION: Pop an item off the directive stack. Used for processing + * nested #if/#else type conditional compilation directives. + * Specifically: Used on detection of #elif and #endif to remove + * the original #if/#ifdef/#ifndef from the stack and close + * the block. + * + ******************************************************************************/ + +static ACPI_STATUS +PrPopDirective ( + void) +{ + DIRECTIVE_INFO *Info; + + + /* Check for empty stack */ + + Info = Gbl_DirectiveStack; + if (!Info) + { + return (AE_ERROR); + } + + /* Pop one item, keep globals up-to-date */ + + Gbl_IfDepth--; + Gbl_IgnoringThisCodeBlock = Info->IgnoringThisCodeBlock; + Gbl_DirectiveStack = Info->Next; + + DbgPrint (ASL_DEBUG_OUTPUT, + "Pr(%.4u) - [%u %s] %*s Popped [#%s %s]: IgnoreFlag now = %s\n", + Gbl_CurrentLineNumber, Gbl_IfDepth, + Gbl_IgnoringThisCodeBlock ? "I" : "E", + Gbl_IfDepth * 4, " ", + Gbl_DirectiveInfo[Info->Directive].Name, + Info->Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE"); + + ACPI_FREE (Info); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: PrDbgPrint + * + * PARAMETERS: Action - Action being performed + * DirectiveName - Directive being processed + * + * RETURN: None + * + * DESCRIPTION: Special debug print for directive processing. + * + ******************************************************************************/ + +static void +PrDbgPrint ( + char *Action, + char *DirectiveName) +{ + + DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] " + "%*s %s #%s, Depth %u\n", + Gbl_CurrentLineNumber, Gbl_IfDepth, + Gbl_IgnoringThisCodeBlock ? "I" : "E", + Gbl_IfDepth * 4, " ", + Action, DirectiveName, Gbl_IfDepth); +} diff --git a/sys/contrib/dev/acpica/components/debugger/dbcmds.c b/sys/contrib/dev/acpica/components/debugger/dbcmds.c index 3f23d3e..89c6333 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbcmds.c +++ b/sys/contrib/dev/acpica/components/debugger/dbcmds.c @@ -105,13 +105,15 @@ AcpiDbConvertToNode ( char *InString) { ACPI_NAMESPACE_NODE *Node; + ACPI_SIZE Address; if ((*InString >= 0x30) && (*InString <= 0x39)) { /* Numeric argument, convert */ - Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16)); + Address = ACPI_STRTOUL (InString, NULL, 16); + Node = ACPI_TO_POINTER (Address); if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { AcpiOsPrintf ("Address %p is invalid in this address space\n", diff --git a/sys/contrib/dev/acpica/components/debugger/dbdisply.c b/sys/contrib/dev/acpica/components/debugger/dbdisply.c index 673dccc..62edea0 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/components/debugger/dbdisply.c @@ -139,9 +139,11 @@ AcpiDbGetPointer ( void *Target) { void *ObjPtr; + ACPI_SIZE Address; - ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); + Address = ACPI_STRTOUL (Target, NULL, 16); + ObjPtr = ACPI_TO_POINTER (Address); return (ObjPtr); } diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index e5fdc2e..a54c239 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -829,7 +829,7 @@ AcpiDbCommandDispatch ( break; case CMD_EVENT: - + AcpiOsPrintf ("Event command not implemented\n"); break; @@ -888,7 +888,7 @@ AcpiDbCommandDispatch ( return (Status); case CMD_HISTORY_LAST: /* !! command */ - + CommandLine = AcpiDbGetFromHistory (NULL); if (!CommandLine) { @@ -899,12 +899,12 @@ AcpiDbCommandDispatch ( return (Status); case CMD_INFORMATION: - + AcpiDbDisplayMethodInfo (Op); break; case CMD_INTEGRITY: - + AcpiDbCheckIntegrity (); break; @@ -998,7 +998,7 @@ AcpiDbCommandDispatch ( break; case CMD_OWNER: - + AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; diff --git a/sys/contrib/dev/acpica/components/debugger/dbnames.c b/sys/contrib/dev/acpica/components/debugger/dbnames.c index 0219655..c9f3e0a 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbnames.c +++ b/sys/contrib/dev/acpica/components/debugger/dbnames.c @@ -783,11 +783,13 @@ AcpiDbFindReferences ( char *ObjectArg) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_SIZE Address; /* Convert string to object pointer */ - ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); + Address = ACPI_STRTOUL (ObjectArg, NULL, 16); + ObjDesc = ACPI_TO_POINTER (Address); /* Search all nodes in namespace */ diff --git a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c index 16db0ff..32a7ddf 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c @@ -177,7 +177,7 @@ AcpiDmByteList ( case ACPI_DASM_STRING: AcpiDmIndent (Info->Level); - AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX); + AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX); AcpiOsPrintf ("\n"); break; @@ -523,11 +523,9 @@ AcpiDmUnicode ( WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data); WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer)); - - AcpiOsPrintf ("\""); - /* Write every other byte as an ASCII character */ + AcpiOsPrintf ("\""); for (i = 0; i < (WordCount - 1); i++) { AcpiOsPrintf ("%c", (int) WordData[i]); diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index d1a09ae..5435e13 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -633,7 +633,7 @@ AcpiDmDisassembleOneOp ( case AML_STRING_OP: - AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX); + AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX); break; case AML_BUFFER_OP: diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c index d872e82..792ae80 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c @@ -565,7 +565,7 @@ AcpiDmResourceSource ( if (TotalLength > (MinimumTotalLength + 1)) { AcpiOsPrintf (" "); - AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX); + AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX); } AcpiOsPrintf (", "); diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c index 8bd2d08..f938f93 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c @@ -195,7 +195,7 @@ AcpiDmGpioCommon ( { AcpiUtPrintString ( ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), - ACPI_UINT8_MAX); + ACPI_UINT16_MAX); } AcpiOsPrintf (", "); @@ -498,7 +498,7 @@ AcpiDmI2cSerialBusDescriptor ( AcpiUtPrintString ( ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), - ACPI_UINT8_MAX); + ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -573,7 +573,7 @@ AcpiDmSpiSerialBusDescriptor ( AcpiUtPrintString ( ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), - ACPI_UINT8_MAX); + ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -651,7 +651,7 @@ AcpiDmUartSerialBusDescriptor ( AcpiUtPrintString ( ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), - ACPI_UINT8_MAX); + ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ diff --git a/sys/contrib/dev/acpica/components/events/evgpeinit.c b/sys/contrib/dev/acpica/components/events/evgpeinit.c index d87c6c6..8c74149 100644 --- a/sys/contrib/dev/acpica/components/events/evgpeinit.c +++ b/sys/contrib/dev/acpica/components/events/evgpeinit.c @@ -134,7 +134,6 @@ AcpiEvGpeInitialize ( /* GPE block 0 exists (has both length and address > 0) */ RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2); - GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1; /* Install GPE Block 0 */ @@ -209,16 +208,6 @@ AcpiEvGpeInitialize ( goto Cleanup; } - /* Check for Max GPE number out-of-range */ - - if (GpeNumberMax > ACPI_GPE_MAX) - { - ACPI_ERROR ((AE_INFO, - "Maximum GPE number from FADT is too large: 0x%X", - GpeNumberMax)); - Status = AE_BAD_VALUE; - goto Cleanup; - } Cleanup: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/sys/contrib/dev/acpica/components/executer/exdump.c b/sys/contrib/dev/acpica/components/executer/exdump.c index 1dc27bb..c37f9ae 100644 --- a/sys/contrib/dev/acpica/components/executer/exdump.c +++ b/sys/contrib/dev/acpica/components/executer/exdump.c @@ -357,6 +357,7 @@ AcpiExDumpObject ( { UINT8 *Target; char *Name; + const char *ReferenceName; UINT8 Count; @@ -441,8 +442,8 @@ AcpiExDumpObject ( case ACPI_EXD_REFERENCE: - AcpiExOutString ("Class Name", - ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc))); + ReferenceName = AcpiUtGetReferenceName (ObjDesc); + AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName)); AcpiExDumpReferenceObj (ObjDesc); break; diff --git a/sys/contrib/dev/acpica/components/namespace/nsdump.c b/sys/contrib/dev/acpica/components/namespace/nsdump.c index e5cd380..41f1214 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsdump.c +++ b/sys/contrib/dev/acpica/components/namespace/nsdump.c @@ -618,7 +618,7 @@ AcpiNsDumpOneObject ( break; case ACPI_TYPE_LOCAL_INDEX_FIELD: - + ObjDesc = (void *) ObjDesc->IndexField.IndexObj; break; diff --git a/sys/contrib/dev/acpica/components/namespace/nsrepair2.c b/sys/contrib/dev/acpica/components/namespace/nsrepair2.c index 85379e6..6bfd17a 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsrepair2.c +++ b/sys/contrib/dev/acpica/components/namespace/nsrepair2.c @@ -501,19 +501,7 @@ AcpiNsRepair_CST ( /* - * Entries (subpackages) in the _CST Package must be sorted by the - * C-state type, in ascending order. - */ - Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1, - ACPI_SORT_ASCENDING, "C-State Type"); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * We now know the list is correctly sorted by C-state type. Check if - * the C-state type values are proportional. + * Check if the C-state type values are proportional. */ OuterElementCount = ReturnObject->Package.Count - 1; i = 0; @@ -527,6 +515,7 @@ AcpiNsRepair_CST ( ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "SubPackage[%u] - removing entry due to zero count", i)); Removing = TRUE; + goto RemoveElement; } ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */ @@ -537,6 +526,7 @@ AcpiNsRepair_CST ( Removing = TRUE; } +RemoveElement: if (Removing) { AcpiNsRemoveElement (ReturnObject, i + 1); @@ -552,6 +542,18 @@ AcpiNsRepair_CST ( ObjDesc = ReturnObject->Package.Elements[0]; ObjDesc->Integer.Value = OuterElementCount; + + /* + * Entries (subpackages) in the _CST Package must be sorted by the + * C-state type, in ascending order. + */ + Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1, + ACPI_SORT_ASCENDING, "C-State Type"); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfname.c b/sys/contrib/dev/acpica/components/namespace/nsxfname.c index 582ecf3..9a7642e 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfname.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfname.c @@ -177,6 +177,7 @@ AcpiGetName ( { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; + char *NodeName; /* Parameter validation */ @@ -227,7 +228,8 @@ AcpiGetName ( /* Just copy the ACPI name from the Node and zero terminate it */ - ACPI_MOVE_NAME (Buffer->Pointer, AcpiUtGetNodeName (Node)); + NodeName = AcpiUtGetNodeName (Node); + ACPI_MOVE_NAME (Buffer->Pointer, NodeName); ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0; Status = AE_OK; @@ -423,9 +425,14 @@ AcpiGetObjectInfo ( * Get extra info for ACPI Device/Processor objects only: * Run the _STA, _ADR and, SxW, and _SxD methods. * - * Note: none of these methods are required, so they may or may + * Notes: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used * to indicate which methods were found and run successfully. + * + * For _STA, if the method does not exist, then (as per the ACPI + * specification), the returned CurrentStatus flags will indicate + * that the device is present/functional/enabled. Otherwise, the + * CurrentStatus flags reflect the value returned from _STA. */ /* Execute the Device._STA method */ diff --git a/sys/contrib/dev/acpica/components/resources/rsdump.c b/sys/contrib/dev/acpica/components/resources/rsdump.c index 81c248c..d729795 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdump.c +++ b/sys/contrib/dev/acpica/components/resources/rsdump.c @@ -203,7 +203,7 @@ AcpiRsDumpDescriptor ( break; case ACPI_RSD_UINT64: - + AcpiRsOutInteger64 (Name, ACPI_GET64 (Target)); break; diff --git a/sys/contrib/dev/acpica/components/resources/rsutils.c b/sys/contrib/dev/acpica/components/resources/rsutils.c index 57f2e6e..499efb9 100644 --- a/sys/contrib/dev/acpica/components/resources/rsutils.c +++ b/sys/contrib/dev/acpica/components/resources/rsutils.c @@ -193,7 +193,7 @@ AcpiRsMoveData ( break; case ACPI_RSC_MOVE32: - + ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i], &ACPI_CAST_PTR (UINT32, Source)[i]); break; diff --git a/sys/contrib/dev/acpica/components/tables/tbxfroot.c b/sys/contrib/dev/acpica/components/tables/tbxfroot.c index 1d8909b..3c5900c 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfroot.c @@ -53,11 +53,6 @@ /* Local prototypes */ -static UINT8 * -AcpiTbScanMemoryForRsdp ( - UINT8 *StartAddress, - UINT32 Length); - static ACPI_STATUS AcpiTbValidateRsdp ( ACPI_TABLE_RSDP *Rsdp); @@ -252,7 +247,7 @@ ACPI_EXPORT_SYMBOL (AcpiFindRootPointer) * ******************************************************************************/ -static UINT8 * +UINT8 * AcpiTbScanMemoryForRsdp ( UINT8 *StartAddress, UINT32 Length) diff --git a/sys/contrib/dev/acpica/components/utilities/uteval.c b/sys/contrib/dev/acpica/components/utilities/uteval.c index d19210f..ba4d6ee 100644 --- a/sys/contrib/dev/acpica/components/utilities/uteval.c +++ b/sys/contrib/dev/acpica/components/utilities/uteval.c @@ -260,7 +260,8 @@ AcpiUtEvaluateNumericObject ( * RETURN: Status * * DESCRIPTION: Executes _STA for selected device and stores results in - * *Flags. + * *Flags. If _STA does not exist, then the device is assumed + * to be present/functional/enabled (as per the ACPI spec). * * NOTE: Internal function, no parameter validation * @@ -284,6 +285,11 @@ AcpiUtExecute_STA ( { if (AE_NOT_FOUND == Status) { + /* + * if _STA does not exist, then (as per the ACPI specification), + * the returned flags will indicate that the device is present, + * functional, and enabled. + */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_STA on %4.4s was not found, assuming device is present\n", AcpiUtGetNodeName (DeviceNode))); diff --git a/sys/contrib/dev/acpica/components/utilities/utstring.c b/sys/contrib/dev/acpica/components/utilities/utstring.c index 4b1545e..79b5452 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstring.c +++ b/sys/contrib/dev/acpica/components/utilities/utstring.c @@ -395,7 +395,8 @@ ErrorExit: * FUNCTION: AcpiUtPrintString * * PARAMETERS: String - Null terminated ASCII string - * MaxLength - Maximum output length + * MaxLength - Maximum output length. Used to constrain the + * length of strings during debug output only. * * RETURN: None * @@ -407,7 +408,7 @@ ErrorExit: void AcpiUtPrintString ( char *String, - UINT8 MaxLength) + UINT16 MaxLength) { UINT32 i; diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index ef41385..45b8212 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -108,6 +108,7 @@ typedef enum ACPI_DMT_UINT56, ACPI_DMT_UINT64, ACPI_DMT_BUF7, + ACPI_DMT_BUF10, ACPI_DMT_BUF16, ACPI_DMT_BUF128, ACPI_DMT_SIG, diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 10f4e47..b3c76e4 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20130517 +#define ACPI_CA_VERSION 0x20130626 #include <contrib/dev/acpica/include/acconfig.h> #include <contrib/dev/acpica/include/actypes.h> diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index b16c6e3..3452a7b 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -50,6 +50,15 @@ AcpiAllocateRootTable ( UINT32 InitialTableCount); /* + * tbxfroot - Root pointer utilities + */ +UINT8 * +AcpiTbScanMemoryForRsdp ( + UINT8 *StartAddress, + UINT32 Length); + + +/* * tbfadt - FADT parse/convert/validate */ void diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 840c146..09ccfdf 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -680,13 +680,6 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 -/* - * General Purpose Events (GPE) - */ -#define ACPI_GPE_INVALID 0xFF -#define ACPI_GPE_MAX 0xFF -#define ACPI_NUM_GPE 256 - /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ #define ACPI_GPE_ENABLE 0 diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index c79240c..c0ea533 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -903,7 +903,7 @@ AcpiUtStrtoul64 ( void AcpiUtPrintString ( char *String, - UINT8 MaxLength); + UINT16 MaxLength); void UtConvertBackslashes ( |