mirror of
https://github.com/acpica/acpica/
synced 2025-02-24 17:34:43 +03:00
iASL: Support for Data Table Compiler.
Modifications to existing compiler that are required for the data table compiler.
This commit is contained in:
parent
48ed9d4f7a
commit
d6027aa4c5
@ -117,6 +117,7 @@
|
||||
#include "accommon.h"
|
||||
#include "acdisasm.h"
|
||||
#include "actables.h"
|
||||
#include "dtcompiler.h"
|
||||
|
||||
/* This module used for application-level code only */
|
||||
|
||||
@ -125,10 +126,6 @@
|
||||
|
||||
/* Local Prototypes */
|
||||
|
||||
static ACPI_DMTABLE_DATA *
|
||||
AcpiDmGetTableData (
|
||||
char *Signature);
|
||||
|
||||
static void
|
||||
AcpiDmCheckAscii (
|
||||
UINT8 *Target,
|
||||
@ -247,37 +244,37 @@ static const char *AcpiDmFadtProfiles[] =
|
||||
|
||||
static ACPI_DMTABLE_DATA AcpiDmTableData[] =
|
||||
{
|
||||
{ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"},
|
||||
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"},
|
||||
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"},
|
||||
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"},
|
||||
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"},
|
||||
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"},
|
||||
{ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"},
|
||||
{ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"},
|
||||
{ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"},
|
||||
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
|
||||
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"},
|
||||
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
|
||||
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"},
|
||||
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
|
||||
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
|
||||
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, "Management Controller Host Interface table"},
|
||||
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"},
|
||||
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
|
||||
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
|
||||
{ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"},
|
||||
{ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"},
|
||||
{ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"},
|
||||
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
|
||||
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
|
||||
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
|
||||
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, "UEFI Boot Optimization Table"},
|
||||
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, "Windows ACPI Emulated Devices Table"},
|
||||
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, "Watchdog Action Table"},
|
||||
{ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
|
||||
{ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
{ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, "Alert Standard Format table"},
|
||||
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, "Simple Boot Flag Table"},
|
||||
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, "Boot Error Record Table"},
|
||||
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, "Corrected Platform Error Polling table"},
|
||||
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, "Debug Port table"},
|
||||
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, "DMA Remapping table"},
|
||||
{ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, "Embedded Controller Boot Resources Table"},
|
||||
{ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, "Error Injection table"},
|
||||
{ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, "Error Record Serialization Table"},
|
||||
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, "Fixed ACPI Description Table"},
|
||||
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, "Hardware Error Source Table"},
|
||||
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, "High Precision Event Timer table"},
|
||||
{ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, "I/O Virtualization Reporting Structure"},
|
||||
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, "Multiple APIC Description Table"},
|
||||
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, "Memory Mapped Configuration table"},
|
||||
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, "Management Controller Host Interface table"},
|
||||
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, "Maximum System Characteristics Table"},
|
||||
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, "Root System Description Table"},
|
||||
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, "Smart Battery Specification Table"},
|
||||
{ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, "Software Licensing Description Table"},
|
||||
{ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, "System Locality Information Table"},
|
||||
{ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, "Serial Port Console Redirection table"},
|
||||
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, "Server Platform Management Interface table"},
|
||||
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, "System Resource Affinity Table"},
|
||||
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, "Trusted Computing Platform Alliance table"},
|
||||
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, "UEFI Boot Optimization Table"},
|
||||
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, "Windows ACPI Emulated Devices Table"},
|
||||
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, "Watchdog Action Table"},
|
||||
{ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, "Watchdog Resource Table"},
|
||||
{ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, "Extended System Description Table"},
|
||||
{NULL, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
@ -328,7 +325,7 @@ AcpiTbGenerateChecksum (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_DMTABLE_DATA *
|
||||
ACPI_DMTABLE_DATA *
|
||||
AcpiDmGetTableData (
|
||||
char *Signature)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -127,10 +127,6 @@ static void
|
||||
CmFlushSourceCode (
|
||||
void);
|
||||
|
||||
static ACPI_STATUS
|
||||
FlCheckForAscii (
|
||||
ASL_FILE_INFO *FileInfo);
|
||||
|
||||
void
|
||||
FlConsumeAnsiComment (
|
||||
ASL_FILE_INFO *FileInfo,
|
||||
@ -433,7 +429,7 @@ FlConsumeNewComment (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
ACPI_STATUS
|
||||
FlCheckForAscii (
|
||||
ASL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -543,31 +539,6 @@ CmDoCompile (
|
||||
|
||||
FullCompile = UtBeginEvent ("*** Total Compile time ***");
|
||||
Event = UtBeginEvent ("Open input and output files");
|
||||
|
||||
/* Open the required input and output files */
|
||||
|
||||
Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AePrintErrorLog (ASL_FILE_STDERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check for 100% ASCII source file (comments are ignored) */
|
||||
|
||||
Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AePrintErrorLog (ASL_FILE_STDERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AePrintErrorLog (ASL_FILE_STDERR);
|
||||
return -1;
|
||||
}
|
||||
UtEndEvent (Event);
|
||||
|
||||
/* Build the parse tree */
|
||||
@ -888,19 +859,24 @@ CmCleanupAndExit (
|
||||
|
||||
if (Gbl_NsLookupCount)
|
||||
{
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n");
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u\n", "Total Namespace searches",
|
||||
Gbl_NsLookupCount);
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u usec\n", "Time per search",
|
||||
((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
|
||||
AslGbl_Events[AslGbl_NamespaceEvent].StartTime) /
|
||||
10) / Gbl_NsLookupCount);
|
||||
}
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"\n\nMiscellaneous compile statistics\n\n");
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%32s : %u\n", "Total Namespace searches",
|
||||
Gbl_NsLookupCount);
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||
"%32s : %u usec\n", "Time per search", ((UINT32)
|
||||
(AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
|
||||
AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) /
|
||||
Gbl_NsLookupCount);
|
||||
}
|
||||
|
||||
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
|
||||
{
|
||||
printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
|
||||
printf ("\nMaximum error count (%u) exceeded\n",
|
||||
ASL_MAX_ERROR_COUNT);
|
||||
}
|
||||
|
||||
UtDisplaySummary (ASL_FILE_STDOUT);
|
||||
@ -916,7 +892,12 @@ CmCleanupAndExit (
|
||||
|
||||
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
|
||||
{
|
||||
remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
|
||||
if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename))
|
||||
{
|
||||
printf ("%s: ",
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
|
||||
perror ("Could not delete AML file");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -928,8 +909,9 @@ CmCleanupAndExit (
|
||||
{
|
||||
if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename))
|
||||
{
|
||||
printf ("Could not remove SRC file, %s\n",
|
||||
printf ("%s: ",
|
||||
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
|
||||
perror ("Could not delete SRC file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,6 +222,10 @@ void
|
||||
CmCleanupAndExit (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
FlCheckForAscii (
|
||||
ASL_FILE_INFO *FileInfo);
|
||||
|
||||
|
||||
/*
|
||||
* aslanalyze - semantic analysis
|
||||
@ -425,6 +429,16 @@ CgGenerateAmlOutput (
|
||||
void);
|
||||
|
||||
|
||||
/*
|
||||
* aslfile
|
||||
*/
|
||||
void
|
||||
FlOpenFile (
|
||||
UINT32 FileId,
|
||||
char *Filename,
|
||||
char *Mode);
|
||||
|
||||
|
||||
/*
|
||||
* asllength - calculate/adjust AML package lengths
|
||||
*/
|
||||
@ -1003,5 +1017,12 @@ RsDoWordBusNumberDescriptor (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 CurrentByteOffset);
|
||||
|
||||
/*
|
||||
* Entry to data table compiler subsystem
|
||||
*/
|
||||
ACPI_STATUS
|
||||
DtDoCompile(
|
||||
void);
|
||||
|
||||
#endif /* __ASLCOMPILER_H */
|
||||
|
||||
|
@ -184,6 +184,13 @@
|
||||
#define FILE_SUFFIX_C_INCLUDE "h"
|
||||
|
||||
|
||||
/* Types for input files */
|
||||
|
||||
#define ASL_INPUT_TYPE_BINARY 0
|
||||
#define ASL_INPUT_TYPE_ASCII_ASL 1
|
||||
#define ASL_INPUT_TYPE_ASCII_DATA 2
|
||||
|
||||
|
||||
/* Misc */
|
||||
|
||||
#define ASL_EXTERNAL_METHOD 255
|
||||
|
@ -122,12 +122,6 @@
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void
|
||||
FlOpenFile (
|
||||
UINT32 FileId,
|
||||
char *Filename,
|
||||
char *Mode);
|
||||
|
||||
FILE *
|
||||
FlOpenIncludeWithPrefix (
|
||||
char *PrefixDir,
|
||||
@ -212,7 +206,7 @@ FlFileError (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
void
|
||||
FlOpenFile (
|
||||
UINT32 FileId,
|
||||
char *Filename,
|
||||
|
@ -145,7 +145,7 @@ extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
|
||||
extern char *AslCompilertext;
|
||||
extern char HexLookup[];
|
||||
|
||||
#define ASL_LINE_BUFFER_SIZE 512
|
||||
#define ASL_LINE_BUFFER_SIZE 1024
|
||||
#define ASL_MSG_BUFFER_SIZE 4096
|
||||
#define HEX_TABLE_LINE_SIZE 8
|
||||
#define HEX_LISTING_LINE_SIZE 8
|
||||
@ -196,6 +196,8 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFl
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
|
||||
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE);
|
||||
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DataTableCompilerAvailable, FALSE);
|
||||
|
||||
|
||||
#define HEX_OUTPUT_NONE 0
|
||||
@ -223,6 +225,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE)
|
||||
/* Statistics */
|
||||
|
||||
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0);
|
||||
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0);
|
||||
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0);
|
||||
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0);
|
||||
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0);
|
||||
@ -247,6 +250,8 @@ ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
|
||||
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
|
||||
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
|
||||
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
|
||||
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0);
|
||||
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
|
||||
|
||||
|
||||
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);
|
||||
|
@ -167,7 +167,7 @@ AslDoResponseFile (
|
||||
|
||||
|
||||
#define ASL_TOKEN_SEPARATORS " \t\n"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:"
|
||||
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:yz"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -268,6 +268,8 @@ HelpMessage (
|
||||
printf (" -n Parse only, no output generation\n");
|
||||
printf (" -ot Display compile times\n");
|
||||
printf (" -x<level> Set debug level for trace output\n");
|
||||
printf (" -y Temporary: Enable data table compiler\n");
|
||||
printf (" -z Do not insert new compiler ID for DataTables\n");
|
||||
}
|
||||
|
||||
|
||||
@ -831,6 +833,18 @@ AslDoOptions (
|
||||
break;
|
||||
|
||||
|
||||
case 'y':
|
||||
|
||||
Gbl_DataTableCompilerAvailable = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case 'z':
|
||||
|
||||
Gbl_UseOriginalCompilerId = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
return (-1);
|
||||
|
@ -140,6 +140,10 @@ AsDoWildcard (
|
||||
char *DirectoryPathname,
|
||||
char *FileSpecifier);
|
||||
|
||||
UINT8
|
||||
AslDetectSourceFileType (
|
||||
ASL_FILE_INFO *Info);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -167,10 +171,13 @@ AslInitializeGlobals (
|
||||
Gbl_CurrentLineNumber = 1;
|
||||
Gbl_LogicalLineNumber = 1;
|
||||
Gbl_CurrentLineOffset = 0;
|
||||
Gbl_InputFieldCount = 0;
|
||||
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
|
||||
|
||||
Gbl_ErrorLog = NULL;
|
||||
Gbl_NextError = NULL;
|
||||
Gbl_Signature = NULL;
|
||||
Gbl_FileType = 0;
|
||||
|
||||
AslGbl_NextEvent = 0;
|
||||
for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++)
|
||||
@ -179,6 +186,7 @@ AslInitializeGlobals (
|
||||
}
|
||||
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -257,6 +265,77 @@ AsDoWildcard (
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslDetectSourceFileType
|
||||
*
|
||||
* PARAMETERS: Info - Name/Handle for the file (must be open)
|
||||
*
|
||||
* RETURN: File Type
|
||||
*
|
||||
* DESCRIPTION: Determine the type of the input file. Either binary (contains
|
||||
* non-ASCII characters), ASL file, or an ACPI Data Table file.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT8
|
||||
AslDetectSourceFileType (
|
||||
ASL_FILE_INFO *Info)
|
||||
{
|
||||
char *FileChar;
|
||||
UINT8 Type;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Check for 100% ASCII source file (comments are ignored) */
|
||||
|
||||
Status = FlCheckForAscii (Info);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
printf ("Non-ascii input file - %s\n", Info->Filename);
|
||||
Type = ASL_INPUT_TYPE_BINARY;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* File is ASCII. Determine if this is an ASL file or an ACPI data
|
||||
* table file.
|
||||
*/
|
||||
while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Info->Handle))
|
||||
{
|
||||
/* Uppercase the buffer for caseless compare */
|
||||
|
||||
FileChar = Gbl_CurrentLineBuffer;
|
||||
while (*FileChar)
|
||||
{
|
||||
*FileChar = (char) toupper ((int) *FileChar);
|
||||
FileChar++;
|
||||
}
|
||||
|
||||
/* Presence of "DefinitionBlock" indicates actual ASL code */
|
||||
|
||||
if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK"))
|
||||
{
|
||||
/* Appears to be an ASL file */
|
||||
|
||||
Type = ASL_INPUT_TYPE_ASCII_ASL;
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not an ASL source file, default to a data table source file */
|
||||
|
||||
Type = ASL_INPUT_TYPE_ASCII_DATA;
|
||||
|
||||
Cleanup:
|
||||
|
||||
/* Must seek back to the start of the file */
|
||||
|
||||
fseek (Info->Handle, 0, SEEK_SET);
|
||||
return (Type);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AslDoOneFile
|
||||
@ -287,7 +366,7 @@ AslDoOneFile (
|
||||
*/
|
||||
if (Gbl_DisasmFlag || Gbl_GetAllTables)
|
||||
{
|
||||
/* ACPI CA subsystem initialization */
|
||||
/* ACPICA subsystem initialization */
|
||||
|
||||
Status = AdInitialize ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -330,23 +409,90 @@ AslDoOneFile (
|
||||
AcpiOsPrintf ("\nCompiling \"%s\"\n",
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_FREE (Gbl_Files[ASL_FILE_INPUT].Filename);
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the input file. Here, this should be an ASCII source file,
|
||||
* either an ASL file or a Data Table file
|
||||
*/
|
||||
Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AePrintErrorLog (ASL_FILE_STDERR);
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/* Determine input file type */
|
||||
|
||||
Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]);
|
||||
if (Gbl_FileType == ASL_INPUT_TYPE_BINARY)
|
||||
{
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* If -p not specified, we will use the input filename as the
|
||||
* output filename prefix
|
||||
*/
|
||||
if (Gbl_UseDefaultAmlFilename)
|
||||
{
|
||||
Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
|
||||
}
|
||||
|
||||
/* Open the optional output files (listings, etc.) */
|
||||
|
||||
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AePrintErrorLog (ASL_FILE_STDERR);
|
||||
return (AE_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compilation of ASL source versus DataTable source uses different
|
||||
* compiler subsystems
|
||||
*/
|
||||
switch (Gbl_FileType)
|
||||
{
|
||||
/*
|
||||
* Data Table Compilation
|
||||
*/
|
||||
case ASL_INPUT_TYPE_ASCII_DATA:
|
||||
|
||||
/*
|
||||
* Require use of command-line option to enable the data table
|
||||
* compiler -- for now, until development of the compiler is
|
||||
* complete.
|
||||
*/
|
||||
if (!Gbl_DataTableCompilerAvailable)
|
||||
{
|
||||
printf ("Data Table Compiler is not available yet\n");
|
||||
return (AE_SUPPORT);
|
||||
}
|
||||
|
||||
Status = DtDoCompile ();
|
||||
|
||||
if (Gbl_Signature)
|
||||
{
|
||||
ACPI_FREE (Gbl_Signature);
|
||||
Gbl_Signature = NULL;
|
||||
}
|
||||
AeClearErrorLog ();
|
||||
return (Status);
|
||||
|
||||
/*
|
||||
* ASL Compilation (Optional)
|
||||
*/
|
||||
if (Gbl_DoCompile)
|
||||
{
|
||||
/*
|
||||
* If -p not specified, we will use the input filename as the
|
||||
* output filename prefix
|
||||
*/
|
||||
if (Gbl_UseDefaultAmlFilename)
|
||||
{
|
||||
Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
|
||||
}
|
||||
case ASL_INPUT_TYPE_ASCII_ASL:
|
||||
|
||||
/* ACPI CA subsystem initialization (Must be re-initialized) */
|
||||
|
||||
/* ACPICA subsystem initialization */
|
||||
|
||||
Status = AdInitialize ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -367,9 +513,17 @@ AslDoOneFile (
|
||||
}
|
||||
|
||||
AeClearErrorLog ();
|
||||
}
|
||||
return (AE_OK);
|
||||
|
||||
return (AE_OK);
|
||||
case ASL_INPUT_TYPE_BINARY:
|
||||
|
||||
AePrintErrorLog (ASL_FILE_STDERR);
|
||||
return (AE_ERROR);
|
||||
|
||||
default:
|
||||
printf ("Unknown file type %X\n", Gbl_FileType);
|
||||
return (AE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -391,7 +545,7 @@ ACPI_STATUS
|
||||
AslDoOnePathname (
|
||||
char *Pathname)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
char **FileList;
|
||||
char *Filename;
|
||||
char *FullPathname;
|
||||
@ -427,11 +581,9 @@ AslDoOnePathname (
|
||||
Gbl_OutputFilenamePrefix = FullPathname;
|
||||
}
|
||||
|
||||
Status = AslDoOneFile (FullPathname);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
/* Save status from all compiles */
|
||||
|
||||
Status |= AslDoOneFile (FullPathname);
|
||||
|
||||
ACPI_FREE (FullPathname);
|
||||
ACPI_FREE (*FileList);
|
||||
@ -441,6 +593,6 @@ AslDoOnePathname (
|
||||
|
||||
ACPI_FREE (Gbl_DirectoryPath);
|
||||
ACPI_FREE (Filename);
|
||||
return (AE_OK);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
@ -279,11 +279,17 @@ typedef struct asl_listing_node
|
||||
|
||||
/* Callback interface for a parse tree walk */
|
||||
|
||||
/*
|
||||
* TBD - another copy of this is in adisasm.h, fix
|
||||
*/
|
||||
#ifndef ASL_WALK_CALLBACK_DEFINED
|
||||
typedef
|
||||
ACPI_STATUS (*ASL_WALK_CALLBACK) (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
#define ASL_WALK_CALLBACK_DEFINED
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct asl_event_info
|
||||
@ -429,14 +435,24 @@ typedef enum
|
||||
ASL_MSG_INVALID_GRANULARITY,
|
||||
ASL_MSG_INVALID_GRAN_FIXED,
|
||||
ASL_MSG_INVALID_ACCESS_SIZE,
|
||||
ASL_MSG_INVALID_ADDR_FLAGS
|
||||
ASL_MSG_INVALID_ADDR_FLAGS,
|
||||
ASL_MSG_INVALID_FIELD_NAME,
|
||||
ASL_MSG_INTEGER_SIZE,
|
||||
ASL_MSG_INVALID_HEX_INTEGER,
|
||||
ASL_MSG_BUFFER_ELEMENT,
|
||||
ASL_MSG_RESERVED_VALUE,
|
||||
ASL_MSG_FLAG_VALUE,
|
||||
ASL_MSG_ZERO_VALUE,
|
||||
ASL_MSG_UNKNOWN_TABLE,
|
||||
ASL_MSG_UNKNOWN_SUBTABLE,
|
||||
ASL_MSG_OEM_TABLE
|
||||
|
||||
} ASL_MESSAGE_IDS;
|
||||
|
||||
#ifdef ASL_EXCEPTIONS
|
||||
|
||||
char *AslMessages [] = {
|
||||
/* The zeroth message is resesrved */ "",
|
||||
/* The zeroth message is reserved */ "",
|
||||
/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
|
||||
/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
|
||||
/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
|
||||
@ -558,7 +574,20 @@ char *AslMessages [] = {
|
||||
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
|
||||
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
|
||||
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
|
||||
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags"
|
||||
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags",
|
||||
|
||||
/* These messages are used by the data table compiler only */
|
||||
|
||||
/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
|
||||
/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target",
|
||||
/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
|
||||
/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list",
|
||||
/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero",
|
||||
/* ASL_MSG_FLAG_VALUE */ "Flag value is too large",
|
||||
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
|
||||
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
|
||||
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
|
||||
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents"
|
||||
|
||||
};
|
||||
|
||||
|
@ -214,6 +214,8 @@ UtLocalCalloc (
|
||||
Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
|
||||
Gbl_InputByteCount, Gbl_CurrentColumn,
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
|
||||
|
||||
CmCleanupAndExit ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -523,33 +525,57 @@ UtDisplaySummary (
|
||||
CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__);
|
||||
}
|
||||
|
||||
/* Input/Output summary */
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"ASL Input: %s - %u lines, %u bytes, %u keywords\n",
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
|
||||
Gbl_InputByteCount, TotalKeywords);
|
||||
|
||||
/* AML summary */
|
||||
|
||||
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
|
||||
if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
|
||||
{
|
||||
FlPrintFile (FileId,
|
||||
"AML Output: %s - %u bytes, %u named objects, %u executable opcodes\n\n",
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
|
||||
TotalNamedObjects, TotalExecutableOpcodes);
|
||||
"Table Input: %s - %u lines, %u bytes, %u fields\n",
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
|
||||
Gbl_InputByteCount, Gbl_InputFieldCount);
|
||||
|
||||
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
|
||||
{
|
||||
FlPrintFile (FileId,
|
||||
"Binary Output: %s - %u bytes\n\n",
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Input/Output summary */
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"ASL Input: %s - %u lines, %u bytes, %u keywords\n",
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
|
||||
Gbl_InputByteCount, TotalKeywords);
|
||||
|
||||
/* AML summary */
|
||||
|
||||
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
|
||||
{
|
||||
FlPrintFile (FileId,
|
||||
"AML Output: %s - %u bytes, %u named objects, %u executable opcodes\n\n",
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
|
||||
TotalNamedObjects, TotalExecutableOpcodes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Error summary */
|
||||
|
||||
FlPrintFile (FileId,
|
||||
"Compilation complete. %u Errors, %u Warnings, %u Remarks, %u Optimizations\n",
|
||||
"Compilation complete. %u Errors, %u Warnings, %u Remarks",
|
||||
Gbl_ExceptionCount[ASL_ERROR],
|
||||
Gbl_ExceptionCount[ASL_WARNING] +
|
||||
Gbl_ExceptionCount[ASL_WARNING2] +
|
||||
Gbl_ExceptionCount[ASL_WARNING3],
|
||||
Gbl_ExceptionCount[ASL_REMARK],
|
||||
Gbl_ExceptionCount[ASL_OPTIMIZATION]);
|
||||
Gbl_ExceptionCount[ASL_REMARK]);
|
||||
|
||||
if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA)
|
||||
{
|
||||
FlPrintFile (FileId,
|
||||
", %u Optimizations", Gbl_ExceptionCount[ASL_OPTIMIZATION]);
|
||||
}
|
||||
|
||||
FlPrintFile (FileId, "\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,9 +131,19 @@ typedef const struct acpi_dmtable_info
|
||||
UINT8 Opcode;
|
||||
UINT8 Offset;
|
||||
char *Name;
|
||||
UINT8 Flags;
|
||||
|
||||
} ACPI_DMTABLE_INFO;
|
||||
|
||||
#define DT_LENGTH 0x01 /* Field is a subtable length */
|
||||
#define DT_FLAG 0x02 /* Field is a flag value */
|
||||
#define DT_NON_ZERO 0x04 /* Field must be non-zero */
|
||||
|
||||
/* TBD: Not used at this time */
|
||||
|
||||
#define DT_OPTIONAL 0x08
|
||||
#define DT_COUNT 0x10
|
||||
|
||||
/*
|
||||
* Values for Opcode above.
|
||||
* Note: 0-7 must not change, used as a flag shift value
|
||||
@ -173,17 +183,24 @@ typedef const struct acpi_dmtable_info
|
||||
#define ACPI_DMT_FADTPM 32
|
||||
#define ACPI_DMT_BUF16 33
|
||||
#define ACPI_DMT_IVRS 34
|
||||
#define ACPI_DMT_BUFFER 35
|
||||
#define ACPI_DMT_PCI_PATH 36
|
||||
|
||||
|
||||
typedef
|
||||
void (*ACPI_DMTABLE_HANDLER) (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
||||
typedef
|
||||
ACPI_STATUS (*ACPI_CMTABLE_HANDLER) (
|
||||
void **PFieldList);
|
||||
|
||||
typedef struct acpi_dmtable_data
|
||||
{
|
||||
char *Signature;
|
||||
ACPI_DMTABLE_INFO *TableInfo;
|
||||
ACPI_DMTABLE_HANDLER TableHandler;
|
||||
ACPI_CMTABLE_HANDLER CmTableHandler;
|
||||
char *Name;
|
||||
|
||||
} ACPI_DMTABLE_DATA;
|
||||
@ -200,11 +217,18 @@ typedef struct acpi_op_walk_info
|
||||
|
||||
} ACPI_OP_WALK_INFO;
|
||||
|
||||
/*
|
||||
* TBD - another copy of this is in asltypes.h, fix
|
||||
*/
|
||||
#ifndef ASL_WALK_CALLBACK_DEFINED
|
||||
typedef
|
||||
ACPI_STATUS (*ASL_WALK_CALLBACK) (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
UINT32 Level,
|
||||
void *Context);
|
||||
#define ASL_WALK_CALLBACK_DEFINED
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct acpi_resource_tag
|
||||
{
|
||||
@ -312,6 +336,11 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[];
|
||||
/*
|
||||
* dmtable
|
||||
*/
|
||||
|
||||
ACPI_DMTABLE_DATA *
|
||||
AcpiDmGetTableData (
|
||||
char *Signature);
|
||||
|
||||
void
|
||||
AcpiDmDumpDataTable (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
Loading…
x
Reference in New Issue
Block a user