summaryrefslogtreecommitdiffstats
path: root/source/tools
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/acpidump/apdump.c2
-rw-r--r--source/tools/acpiexec/aehandlers.c1
-rw-r--r--source/tools/acpiexec/aemain.c441
-rw-r--r--source/tools/acpiexec/aetables.c24
-rw-r--r--source/tools/acpiexec/aetables.h80
-rw-r--r--source/tools/acpisrc/acpisrc.h9
-rw-r--r--source/tools/acpisrc/ascase.c9
-rw-r--r--source/tools/acpisrc/asconvrt.c9
-rw-r--r--source/tools/acpisrc/asfile.c11
-rw-r--r--source/tools/acpisrc/asmain.c14
-rw-r--r--source/tools/acpisrc/asremove.c78
-rw-r--r--source/tools/acpisrc/astable.c89
-rw-r--r--source/tools/acpixtract/acpixtract.c60
13 files changed, 457 insertions, 370 deletions
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c
index 6317b25..d216cf5 100644
--- a/source/tools/acpidump/apdump.c
+++ b/source/tools/acpidump/apdump.c
@@ -82,7 +82,7 @@ ApIsValidHeader (
/* Check for minimum table length */
- if (Table->Length <= sizeof (ACPI_TABLE_HEADER))
+ if (Table->Length < sizeof (ACPI_TABLE_HEADER))
{
fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index 5272f41..aad2705 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -214,6 +214,7 @@ AeCtrlCHandler (
}
}
+ (void) AcpiOsTerminate ();
exit (0);
}
diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c
index dbd0301..3562ff9 100644
--- a/source/tools/acpiexec/aemain.c
+++ b/source/tools/acpiexec/aemain.c
@@ -47,6 +47,20 @@
ACPI_MODULE_NAME ("aemain")
+/*
+ * Main routine for the ACPI user-space execution utility.
+ *
+ * Portability note: The utility depends upon the host for command-line
+ * wildcard support - it is not implemented locally. For example:
+ *
+ * Linux/Unix systems: Shell expands wildcards automatically.
+ *
+ * Windows: The setargv.obj module must be linked in to automatically
+ * expand wildcards.
+ */
+
+extern BOOLEAN AcpiGbl_DebugTimeout;
+
/* Local prototypes */
static int
@@ -58,15 +72,6 @@ static ACPI_STATUS
AcpiDbRunBatchMode (
void);
-static char *
-FlStrdup (
- char *String);
-
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier);
-
#define AE_BUFFER_SIZE 1024
#define ASL_MAX_FILES 256
@@ -83,12 +88,10 @@ AsDoWildcard (
UINT8 AcpiGbl_RegionFillValue = 0;
BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
-BOOLEAN AcpiGbl_DebugTimeout = FALSE;
UINT8 AcpiGbl_UseHwReducedFadt = FALSE;
BOOLEAN AcpiGbl_DoInterfaceTests = FALSE;
static UINT8 AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP;
static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buffer */
-static char *FileList[ASL_MAX_FILES];
static AE_TABLE_DESC *AeTableListHead = NULL;
#define ACPIEXEC_NAME "AML Execution/Debug Utility"
@@ -364,10 +367,6 @@ main (
ACPI_TABLE_HEADER *Table = NULL;
UINT32 TableCount;
AE_TABLE_DESC *TableDesc;
- char **WildcardList;
- char *Filename;
- char *Directory;
- char *FullPathname;
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
@@ -392,166 +391,137 @@ main (
AE_CHECK_OK (AcpiInitializeSubsystem, Status);
if (ACPI_FAILURE (Status))
{
- return (-1);
+ goto ErrorExit;
}
/* Get the command line options */
if (AeDoOptions (argc, argv))
{
- return (-1);
+ goto ErrorExit;
}
/* The remaining arguments are filenames for ACPI tables */
- if (argv[AcpiGbl_Optind])
+ if (!argv[AcpiGbl_Optind])
{
- AcpiGbl_DbOpt_tables = TRUE;
- TableCount = 0;
+ goto EnterDebugger;
+ }
- /* Get each of the ACPI table files on the command line */
+ AcpiGbl_DbOpt_tables = TRUE;
+ TableCount = 0;
- while (argv[AcpiGbl_Optind])
- {
- /* Split incoming path into a directory/filename combo */
-
- Status = FlSplitInputPathname (argv[AcpiGbl_Optind],
- &Directory, &Filename);
- if (ACPI_FAILURE (Status))
- {
- return (-1);
- }
-
- /* Expand wildcards (Windows only) */
-
- WildcardList = AsDoWildcard (Directory, Filename);
- if (!WildcardList)
- {
- return (-1);
- }
-
- while (*WildcardList)
- {
- FullPathname = AcpiOsAllocate (
- strlen (Directory) + strlen (*WildcardList) + 1);
-
- /* Construct a full path to the file */
-
- strcpy (FullPathname, Directory);
- strcat (FullPathname, *WildcardList);
-
- /* Get one table */
-
- Status = AcpiDbReadTableFromFile (FullPathname, &Table);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not get input table %s, %s\n",
- FullPathname, AcpiFormatException (Status));
- goto EnterDebugger;
- }
-
- AcpiOsFree (FullPathname);
- AcpiOsFree (*WildcardList);
- *WildcardList = NULL;
- WildcardList++;
-
- /* Ignore non-AML tables, we can't use them. Except for an FADT */
-
- if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) &&
- !AcpiUtIsAmlTable (Table))
- {
- ACPI_WARNING ((AE_INFO,
- "Table %4.4s is not an AML table, ignoring",
- Table->Signature));
- AcpiOsFree (Table);
- continue;
- }
-
- /* Allocate and link a table descriptor */
-
- TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC));
- TableDesc->Table = Table;
- TableDesc->Next = AeTableListHead;
- AeTableListHead = TableDesc;
-
- TableCount++;
- }
-
- AcpiGbl_Optind++;
- }
+ /* Get each of the ACPI table files on the command line */
- /* Build a local RSDT with all tables and let ACPICA process the RSDT */
+ while (argv[AcpiGbl_Optind])
+ {
+ /* Get one entire table */
- Status = AeBuildLocalTables (TableCount, AeTableListHead);
+ Status = AcpiDbReadTableFromFile (argv[AcpiGbl_Optind], &Table);
if (ACPI_FAILURE (Status))
{
- return (-1);
+ printf ("**** Could not get table from file %s, %s\n",
+ argv[AcpiGbl_Optind], AcpiFormatException (Status));
+ goto ErrorExit;
}
- Status = AeInstallTables ();
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not load ACPI tables, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
+ /* Ignore non-AML tables, we can't use them. Except for an FADT */
- /*
- * Install most of the handlers.
- * Override some default region handlers, especially SystemMemory
- */
- Status = AeInstallEarlyHandlers ();
- if (ACPI_FAILURE (Status))
+ if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) &&
+ !AcpiUtIsAmlTable (Table))
{
- goto EnterDebugger;
+ ACPI_INFO ((AE_INFO,
+ "Table [%4.4s] is not an AML table, ignoring",
+ Table->Signature));
+ AcpiOsFree (Table);
}
+ else
+ {
+ /* Allocate and link a table descriptor */
- /* Setup initialization flags for ACPICA */
+ TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC));
+ TableDesc->Table = Table;
+ TableDesc->Next = AeTableListHead;
+ AeTableListHead = TableDesc;
- InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
- if (!AcpiGbl_DbOpt_ini_methods)
- {
- InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT);
+ TableCount++;
}
- /*
- * Main initialization for ACPICA subsystem
- * TBD: Need a way to call this after the ACPI table "LOAD" command
- */
- Status = AcpiEnableSubsystem (InitFlags);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not EnableSubsystem, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
+ AcpiGbl_Optind++;
+ }
- /*
- * Install handlers for "device driver" space IDs (EC,SMBus, etc.)
- * and fixed event handlers
- */
- AeInstallLateHandlers ();
+ /* Build a local RSDT with all tables and let ACPICA process the RSDT */
- /* Finish the ACPICA initialization */
+ Status = AeBuildLocalTables (TableCount, AeTableListHead);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
- Status = AcpiInitializeObjects (InitFlags);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not InitializeObjects, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
+ Status = AeInstallTables ();
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not load ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
+ }
- AeMiscellaneousTests ();
+ /*
+ * Install most of the handlers.
+ * Override some default region handlers, especially SystemMemory
+ */
+ Status = AeInstallEarlyHandlers ();
+ if (ACPI_FAILURE (Status))
+ {
+ goto EnterDebugger;
+ }
+
+ /* Setup initialization flags for ACPICA */
+
+ InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
+ if (!AcpiGbl_DbOpt_ini_methods)
+ {
+ InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT);
+ }
+
+ /*
+ * Main initialization for ACPICA subsystem
+ * TBD: Need a way to call this after the ACPI table "LOAD" command
+ */
+ Status = AcpiEnableSubsystem (InitFlags);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not EnableSubsystem, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
+ }
+
+ /*
+ * Install handlers for "device driver" space IDs (EC,SMBus, etc.)
+ * and fixed event handlers
+ */
+ AeInstallLateHandlers ();
+
+ /* Finish the ACPICA initialization */
+
+ Status = AcpiInitializeObjects (InitFlags);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not InitializeObjects, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
}
+ AeMiscellaneousTests ();
+
+
EnterDebugger:
/* Exit if error above and we are in one of the batch modes */
if (ACPI_FAILURE (Status) && (AcpiGbl_ExecutionMode > 0))
{
- return (-1);
+ goto ErrorExit;
}
/* Run a batch command or enter the command loop */
@@ -572,10 +542,17 @@ EnterDebugger:
case AE_MODE_BATCH_SINGLE:
AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP);
+ Status = AcpiTerminate ();
break;
}
return (0);
+
+
+ErrorExit:
+
+ (void) AcpiOsTerminate ();
+ return (-1);
}
@@ -633,193 +610,3 @@ AcpiDbRunBatchMode (
Status = AcpiTerminate ();
return (Status);
}
-
-
-/******************************************************************************
- *
- * FUNCTION: FlStrdup
- *
- * DESCRIPTION: Local strdup function
- *
- *****************************************************************************/
-
-static char *
-FlStrdup (
- char *String)
-{
- char *NewString;
-
-
- NewString = AcpiOsAllocate (strlen (String) + 1);
- if (!NewString)
- {
- return (NULL);
- }
-
- strcpy (NewString, String);
- return (NewString);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: FlSplitInputPathname
- *
- * PARAMETERS: InputFilename - The user-specified ASL source file to be
- * compiled
- * OutDirectoryPath - Where the directory path prefix is
- * returned
- * OutFilename - Where the filename part is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Split the input path into a directory and filename part
- * 1) Directory part used to open include files
- * 2) Filename part used to generate output filenames
- *
- *****************************************************************************/
-
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename)
-{
- char *Substring;
- char *DirectoryPath;
- char *Filename;
-
-
- *OutDirectoryPath = NULL;
- *OutFilename = NULL;
-
- if (!InputPath)
- {
- return (AE_OK);
- }
-
- /* Get the path to the input filename's directory */
-
- DirectoryPath = FlStrdup (InputPath);
- if (!DirectoryPath)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Convert backslashes to slashes in the entire path */
-
- UtConvertBackslashes (DirectoryPath);
-
- /* Backup to last slash or colon */
-
- Substring = strrchr (DirectoryPath, '/');
- if (!Substring)
- {
- Substring = strrchr (DirectoryPath, ':');
- }
-
- /* Extract the simple filename */
-
- if (!Substring)
- {
- DirectoryPath[0] = 0;
- Filename = FlStrdup (InputPath);
- }
- else
- {
- Filename = FlStrdup (Substring + 1);
- *(Substring + 1) = 0;
- }
-
- if (!Filename)
- {
- return (AE_NO_MEMORY);
- }
-
- *OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
- return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AsDoWildcard
- *
- * PARAMETERS: DirectoryPathname - Path to parent directory
- * FileSpecifier - the wildcard specification (*.c, etc.)
- *
- * RETURN: Pointer to a list of filenames
- *
- * DESCRIPTION: Process files via wildcards. This function is for the Windows
- * case only.
- *
- *****************************************************************************/
-
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier)
-{
-#ifdef WIN32
- void *DirInfo;
- char *Filename;
- int FileCount;
-
-
- FileCount = 0;
-
- /* Open parent directory */
-
- DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier,
- REQUEST_FILE_ONLY);
- if (!DirInfo)
- {
- /* Either the directory or file does not exist */
-
- printf ("File or directory \"%s%s\" does not exist\n",
- DirectoryPathname, FileSpecifier);
- return (NULL);
- }
-
- /* Process each file that matches the wildcard specification */
-
- while ((Filename = AcpiOsGetNextFilename (DirInfo)))
- {
- /* Add the filename to the file list */
-
- FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1);
- strcpy (FileList[FileCount], Filename);
- FileCount++;
-
- if (FileCount >= ASL_MAX_FILES)
- {
- printf ("Max files reached\n");
- FileList[0] = NULL;
- return (FileList);
- }
- }
-
- /* Cleanup */
-
- AcpiOsCloseDirectory (DirInfo);
- FileList[FileCount] = NULL;
- return (FileList);
-
-#else
- if (!FileSpecifier)
- {
- return (NULL);
- }
-
- /*
- * Linux/Unix cases - Wildcards are expanded by the shell automatically.
- * Just return the filename in a null terminated list
- */
- FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1);
- strcpy (FileList[0], FileSpecifier);
- FileList[1] = NULL;
-
- return (FileList);
-#endif
-}
diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c
index 1ba876e..452546d 100644
--- a/source/tools/acpiexec/aetables.c
+++ b/source/tools/acpiexec/aetables.c
@@ -413,6 +413,8 @@ AeInstallTables (
void)
{
ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
+ ACPI_TABLE_HEADER *Table;
Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);
@@ -442,6 +444,28 @@ AeInstallTables (
AcpiFormatException (Status));
}
+ /* Test multiple table/UEFI support. First, get the headers */
+
+ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 1, &Header);
+ AE_CHECK_OK (AcpiGetTableHeader, Status);
+
+ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 2, &Header);
+ AE_CHECK_OK (AcpiGetTableHeader, Status);
+
+ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 3, &Header);
+ AE_CHECK_STATUS (AcpiGetTableHeader, Status, AE_NOT_FOUND);
+
+ /* Now get the actual tables */
+
+ Status = AcpiGetTable (ACPI_SIG_UEFI, 1, &Table);
+ AE_CHECK_OK (AcpiGetTable, Status);
+
+ Status = AcpiGetTable (ACPI_SIG_UEFI, 2, &Table);
+ AE_CHECK_OK (AcpiGetTable, Status);
+
+ Status = AcpiGetTable (ACPI_SIG_UEFI, 3, &Table);
+ AE_CHECK_STATUS (AcpiGetTable, Status, AE_NOT_FOUND);
+
return (AE_OK);
}
diff --git a/source/tools/acpiexec/aetables.h b/source/tools/acpiexec/aetables.h
index 410d528..dd4e621 100644
--- a/source/tools/acpiexec/aetables.h
+++ b/source/tools/acpiexec/aetables.h
@@ -219,23 +219,38 @@ unsigned char EcdtCode[] =
unsigned char Uefi1Code[] =
{
0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
- 0x01,0x03,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".. Intel" */
- 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
+ 0x01,0x6E,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".n Intel" */
+ 0x20,0x20,0x20,0x55,0x45,0x46,0x49,0x31, /* 00000010 " UEFI1" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
- 0x26,0x06,0x13,0x20,0x00,0x01,0x02,0x03, /* 00000020 "&.. ...." */
+ 0x23,0x08,0x13,0x20,0x06,0x07,0x08,0x09, /* 00000020 "#.. ...." */
0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B, /* 00000028 "........" */
0x0C,0x0D,0x0E,0x0F,0x36,0x00 /* 00000030 "....6." */
};
unsigned char Uefi2Code[] =
{
- 0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
- 0x01,0xEB,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".. Intel" */
- 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
+ 0x55,0x45,0x46,0x49,0xAA,0x00,0x00,0x00, /* 00000000 "UEFI...." */
+ 0x01,0xE0,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".. Intel" */
+ 0x20,0x20,0x20,0x55,0x45,0x46,0x49,0x32, /* 00000010 " UEFI2" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
- 0x26,0x06,0x13,0x20,0x06,0x07,0x08,0x09, /* 00000020 "&.. ...." */
+ 0x23,0x08,0x13,0x20,0x67,0x45,0x23,0x01, /* 00000020 "#.. gE#." */
0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B, /* 00000028 "........" */
- 0x0C,0x0D,0x0E,0x0F,0x36,0x00 /* 00000030 "....6." */
+ 0x0C,0x0D,0x0E,0x0F,0x36,0x00,0x04,0x19, /* 00000030 "....6..." */
+ 0x00,0x56,0x34,0xF2,0x04,0x03,0x02,0x01, /* 00000038 ".V4....." */
+ 0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x1E, /* 00000040 "wfUD3".." */
+ 0x1C,0x1F,0x14,0x10,0x0C,0x08,0x04,0xAB, /* 00000048 "........" */
+ 0x54,0x68,0x69,0x73,0x20,0x69,0x73,0x20, /* 00000050 "This is " */
+ 0x61,0x20,0x73,0x74,0x72,0x69,0x6E,0x67, /* 00000058 "a string" */
+ 0x00,0x5C,0x50,0x43,0x49,0x30,0x5C,0x41, /* 00000060 ".\PCI0\A" */
+ 0x42,0x43,0x44,0x00,0x36,0x00,0x55,0x00, /* 00000068 "BCD.6.U." */
+ 0x6E,0x00,0x69,0x00,0x63,0x00,0x6F,0x00, /* 00000070 "n.i.c.o." */
+ 0x64,0x00,0x65,0x00,0x20,0x00,0x53,0x00, /* 00000078 "d.e. .S." */
+ 0x74,0x00,0x72,0x00,0x69,0x00,0x6E,0x00, /* 00000080 "t.r.i.n." */
+ 0x67,0x00,0x00,0x00,0x58,0x5B,0x00,0x00, /* 00000088 "g...X[.." */
+ 0x00,0x00,0x00,0x00,0x41,0x42,0x43,0x44, /* 00000090 "....ABCD" */
+ 0x45,0x00,0x00,0x01,0x02,0x03,0x04,0x05, /* 00000098 "E......." */
+ 0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D, /* 000000A0 "........" */
+ 0x0E,0x0F /* 000000A8 ".." */
};
@@ -446,21 +461,7 @@ DefinitionBlock ("ssdt4.aml", "SSDT", 2, "Intel", "ssdt4", 0x00000004)
[0001] Revision : 01
[0001] Checksum : 9B
[0006] Oem ID : " Intel"
-[0008] Oem Table ID : "Template"
-[0004] Oem Revision : 00000001
-[0004] Asl Compiler ID : "INTL"
-[0004] Asl Compiler Revision : 20100528
-
-[0016] UUID Identifier : 03020100-0504-0706-0809-0A0B0C0D0E0F
-[0002] Data Offset : 0000
-
-
-[0004] Signature : "UEFI" [UEFI Boot Optimization Table]
-[0004] Table Length : 00000036
-[0001] Revision : 01
-[0001] Checksum : 9B
-[0006] Oem ID : " Intel"
-[0008] Oem Table ID : "Template"
+[0008] Oem Table ID : " UEFI1"
[0004] Oem Revision : 00000001
[0004] Asl Compiler ID : "INTL"
[0004] Asl Compiler Revision : 20100528
@@ -468,6 +469,39 @@ DefinitionBlock ("ssdt4.aml", "SSDT", 2, "Intel", "ssdt4", 0x00000004)
[0016] UUID Identifier : 09080706-0504-0706-0809-0A0B0C0D0E0F
[0002] Data Offset : 0000
+
+[004] Signature : "UEFI" /* UEFI Boot Optimization Table */
+[004] Table Length : 00000036
+[001] Revision : 01
+[001] Checksum : 9B
+[006] Oem ID : " Intel"
+[008] Oem Table ID : " UEFI2"
+[004] Oem Revision : 00000001
+[004] Asl Compiler ID : "INTL"
+[004] Asl Compiler Revision : 20100528
+
+[016] UUID Identifier : 01234567-0504-0706-0809-0A0B0C0D0E0F
+[002] Data Offset : 0000
+
+ Label : StartRecord
+ UINT8 : 4
+ UINT16 : $EndRecord - $StartRecord /* Should be 0x19 */
+ UINT24 : 123456 | F00000
+ UINT32 : 01020304
+ UINT56 : 11223344556677
+ UINT64 : 0102030405060708 * 4 - 200 / 100 | F0000
+ Label : EndRecord
+
+ UINT8 : AB
+ String : "This is a string"
+ DevicePath : "\PCI0\ABCD"
+ UINT16 : $StartRecord
+ Unicode : "Unicode String"
+ UINT64 : $EndRecord * 128
+
+ Buffer : 41 42 43 44 45
+ String : ""
+ GUID : 03020100-0504-0706-0809-0A0B0C0D0E0F
#endif
#endif /* __AETABLES_H__ */
diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h
index c1bd992..101083d 100644
--- a/source/tools/acpisrc/acpisrc.h
+++ b/source/tools/acpisrc/acpisrc.h
@@ -123,6 +123,7 @@ extern BOOLEAN Gbl_WidenDeclarations;
extern BOOLEAN Gbl_IgnoreLoneLineFeeds;
extern BOOLEAN Gbl_HasLoneLineFeeds;
extern BOOLEAN Gbl_Cleanup;
+extern BOOLEAN Gbl_IgnoreTranslationEscapes;
extern void *Gbl_StructDefs;
#define PARAM_LIST(pl) pl
@@ -177,6 +178,7 @@ typedef struct acpi_conversion_table
ACPI_IDENTIFIER_TABLE *SourceConditionalTable;
ACPI_IDENTIFIER_TABLE *SourceMacroTable;
ACPI_TYPED_IDENTIFIER_TABLE *SourceStructTable;
+ ACPI_IDENTIFIER_TABLE *SourceSpecialMacroTable;
UINT32 SourceFunctions;
ACPI_STRING_TABLE *HeaderStringTable;
@@ -184,6 +186,7 @@ typedef struct acpi_conversion_table
ACPI_IDENTIFIER_TABLE *HeaderConditionalTable;
ACPI_IDENTIFIER_TABLE *HeaderMacroTable;
ACPI_TYPED_IDENTIFIER_TABLE *HeaderStructTable;
+ ACPI_IDENTIFIER_TABLE *HeaderSpecialMacroTable;
UINT32 HeaderFunctions;
} ACPI_CONVERSION_TABLE;
@@ -196,6 +199,7 @@ extern ACPI_CONVERSION_TABLE CleanupConversionTable;
extern ACPI_CONVERSION_TABLE StatsConversionTable;
extern ACPI_CONVERSION_TABLE CustomConversionTable;
extern ACPI_CONVERSION_TABLE LicenseConversionTable;
+extern ACPI_CONVERSION_TABLE IndentConversionTable;
/* Prototypes */
@@ -282,6 +286,11 @@ AsRemoveEmptyBlocks (
char *Filename);
void
+AsCleanupSpecialMacro (
+ char *Buffer,
+ char *Keyword);
+
+void
AsCountSourceLines (
char *Buffer,
char *Filename);
diff --git a/source/tools/acpisrc/ascase.c b/source/tools/acpisrc/ascase.c
index ea669a8..919029a 100644
--- a/source/tools/acpisrc/ascase.c
+++ b/source/tools/acpisrc/ascase.c
@@ -92,7 +92,14 @@ AsLowerCaseString (
* Check for translation escape string -- means to ignore
* blocks of code while replacing
*/
- SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ if (Gbl_IgnoreTranslationEscapes)
+ {
+ SubString2 = NULL;
+ }
+ else
+ {
+ SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ }
if ((SubString2) &&
(SubString2 < SubString1))
diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c
index 0f2da2b..76db871 100644
--- a/source/tools/acpisrc/asconvrt.c
+++ b/source/tools/acpisrc/asconvrt.c
@@ -525,7 +525,14 @@ AsReplaceString (
* Check for translation escape string -- means to ignore
* blocks of code while replacing
*/
- SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ if (Gbl_IgnoreTranslationEscapes)
+ {
+ SubString2 = NULL;
+ }
+ else
+ {
+ SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ }
if ((SubString2) &&
(SubString2 < SubString1))
diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c
index d691582..e28a4cf 100644
--- a/source/tools/acpisrc/asfile.c
+++ b/source/tools/acpisrc/asfile.c
@@ -307,6 +307,7 @@ AsConvertFile (
ACPI_IDENTIFIER_TABLE *LineTable;
ACPI_IDENTIFIER_TABLE *MacroTable;
ACPI_TYPED_IDENTIFIER_TABLE *StructTable;
+ ACPI_IDENTIFIER_TABLE *SpecialMacroTable;
switch (FileType)
@@ -319,6 +320,7 @@ AsConvertFile (
ConditionalTable = ConversionTable->SourceConditionalTable;
MacroTable = ConversionTable->SourceMacroTable;
StructTable = ConversionTable->SourceStructTable;
+ SpecialMacroTable = ConversionTable->SourceSpecialMacroTable;
break;
case FILE_TYPE_HEADER:
@@ -329,6 +331,7 @@ AsConvertFile (
ConditionalTable = ConversionTable->HeaderConditionalTable;
MacroTable = ConversionTable->HeaderMacroTable;
StructTable = ConversionTable->HeaderStructTable;
+ SpecialMacroTable = ConversionTable->HeaderSpecialMacroTable;
break;
default:
@@ -401,6 +404,14 @@ AsConvertFile (
}
}
+ if (SpecialMacroTable)
+ {
+ for (i = 0; SpecialMacroTable[i].Identifier; i++)
+ {
+ AsCleanupSpecialMacro (FileBuffer, SpecialMacroTable[i].Identifier);
+ }
+ }
+
/* Process the function table */
for (i = 0; i < 32; i++)
diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c
index e34eff0..9ce25a5 100644
--- a/source/tools/acpisrc/asmain.c
+++ b/source/tools/acpisrc/asmain.c
@@ -97,9 +97,10 @@ BOOLEAN Gbl_WidenDeclarations = FALSE;
BOOLEAN Gbl_IgnoreLoneLineFeeds = FALSE;
BOOLEAN Gbl_HasLoneLineFeeds = FALSE;
BOOLEAN Gbl_Cleanup = FALSE;
+BOOLEAN Gbl_IgnoreTranslationEscapes = FALSE;
#define AS_UTILITY_NAME "ACPI Source Code Conversion Utility"
-#define AS_SUPPORTED_OPTIONS "cdhlqsuv^y"
+#define AS_SUPPORTED_OPTIONS "cdhilqsuv^y"
/******************************************************************************
@@ -292,6 +293,7 @@ AsDisplayUsage (
ACPI_OPTION ("-c", "Generate cleaned version of the source");
ACPI_OPTION ("-h", "Insert dual-license header into all modules");
+ ACPI_OPTION ("-i", "Cleanup macro indentation");
ACPI_OPTION ("-l", "Generate Linux version of the source");
ACPI_OPTION ("-u", "Generate Custom source translation");
@@ -364,6 +366,16 @@ main (
ConversionTable = &LicenseConversionTable;
break;
+ case 'i':
+
+ /* Cleanup wrong indent result */
+
+ printf ("Cleaning up macro indentation\n");
+ ConversionTable = &IndentConversionTable;
+ Gbl_IgnoreLoneLineFeeds = TRUE;
+ Gbl_IgnoreTranslationEscapes = TRUE;
+ break;
+
case 's':
/* Statistics only */
diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c
index fded3fd..37b167b 100644
--- a/source/tools/acpisrc/asremove.c
+++ b/source/tools/acpisrc/asremove.c
@@ -173,7 +173,14 @@ AsRemoveConditionalCompile (
* Check for translation escape string -- means to ignore
* blocks of code while replacing
*/
- Comment = strstr (SubString, AS_START_IGNORE);
+ if (Gbl_IgnoreTranslationEscapes)
+ {
+ Comment = NULL;
+ }
+ else
+ {
+ Comment = strstr (SubString, AS_START_IGNORE);
+ }
if ((Comment) &&
(Comment < SubBuffer))
@@ -611,3 +618,72 @@ AsRemoveDebugMacros (
AsReplaceString ("return_acpi_status", "return", REPLACE_WHOLE_WORD, Buffer);
AsReplaceString ("return_VALUE", "return", REPLACE_WHOLE_WORD, Buffer);
}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AsCleanupSpecialMacro
+ *
+ * DESCRIPTION: For special macro invocations (invoked without ";" at the end
+ * of the lines), do the following:
+ * 1. Remove spaces appended by indent at the beginning of lines.
+ * 2. Add an empty line between two special macro invocations.
+ *
+ ******************************************************************************/
+
+void
+AsCleanupSpecialMacro (
+ char *Buffer,
+ char *Keyword)
+{
+ char *SubString;
+ char *SubBuffer;
+ char *LastNonSpace;
+
+
+ SubBuffer = Buffer;
+ SubString = Buffer;
+
+ while (SubString)
+ {
+ SubString = strstr (SubBuffer, Keyword);
+
+ if (SubString)
+ {
+ /* Find start of the line */
+
+ SubBuffer = SubString;
+ while (*(SubBuffer - 1) == ' ')
+ {
+ SubBuffer--;
+ }
+
+ if (*(SubBuffer - 1) == '\n')
+ {
+ /* Find last non-space character */
+
+ LastNonSpace = SubBuffer - 1;
+ while (isspace ((int) *LastNonSpace))
+ {
+ LastNonSpace--;
+ }
+
+ if (*LastNonSpace != '\\')
+ {
+ /* Remove the extra spaces */
+
+ SubString = AsRemoveData (SubBuffer, SubString);
+
+ /* Enforce an empty line between the invocations */
+
+ if (*(SubBuffer - 2) == ')')
+ {
+ AsInsertData (SubBuffer, "\n", 1);
+ }
+ }
+ }
+
+ SubBuffer = SubString + strlen (Keyword);
+ }
+ }
+}
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index d382523..081767b 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -168,10 +168,6 @@ ACPI_STRING_TABLE LinuxDataTypes[] = {
{"INT16", "s16", REPLACE_WHOLE_WORD},
{"INT8", "s8", REPLACE_WHOLE_WORD},
- /* Include file paths */
-
- {"\"acpi.h\"", "<acpi/acpi.h>", REPLACE_WHOLE_WORD},
-
{NULL, NULL, 0}
};
@@ -694,6 +690,44 @@ ACPI_IDENTIFIER_TABLE LinuxConditionalIdentifiers[] = {
{NULL}
};
+
+ACPI_STRING_TABLE LinuxSpecialStrings[] = {
+
+ /* Include file paths */
+
+ {"\"acpi.h\"", "<acpi/acpi.h>", REPLACE_WHOLE_WORD},
+ {"\"acpiosxf.h\"", "<acpi/acpiosxf.h>", REPLACE_WHOLE_WORD},
+ {"\"acpixf.h\"", "<acpi/acpixf.h>", REPLACE_WHOLE_WORD},
+ {"\"acbuffer.h\"", "<acpi/acbuffer.h>", REPLACE_WHOLE_WORD},
+ {"\"acconfig.h\"", "<acpi/acconfig.h>", REPLACE_WHOLE_WORD},
+ {"\"acexcep.h\"", "<acpi/acexcep.h>", REPLACE_WHOLE_WORD},
+ {"\"acnames.h\"", "<acpi/acnames.h>", REPLACE_WHOLE_WORD},
+ {"\"acoutput.h\"", "<acpi/acoutput.h>", REPLACE_WHOLE_WORD},
+ {"\"acrestyp.h\"", "<acpi/acrestyp.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl.h\"", "<acpi/actbl.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl1.h\"", "<acpi/actbl1.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl2.h\"", "<acpi/actbl2.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl3.h\"", "<acpi/actbl3.h>", REPLACE_WHOLE_WORD},
+ {"\"actypes.h\"", "<acpi/actypes.h>", REPLACE_WHOLE_WORD},
+ {"\"platform/acenv.h\"", "<acpi/platform/acenv.h>", REPLACE_WHOLE_WORD},
+ {"\"acgcc.h\"", "<acpi/platform/acgcc.h>", REPLACE_WHOLE_WORD},
+ {"\"aclinux.h\"", "<acpi/platform/aclinux.h>", REPLACE_WHOLE_WORD},
+
+ {NULL, NULL, 0}
+};
+
+
+ACPI_IDENTIFIER_TABLE LinuxSpecialMacros[] = {
+
+ {"ACPI_EXPORT_SYMBOL"},
+ {"ACPI_EXPORT_SYMBOL_INIT"},
+ {"ACPI_HW_DEPENDENT_RETURN_OK"},
+ {"ACPI_HW_DEPENDENT_RETURN_STATUS"},
+ {"ACPI_HW_DEPENDENT_RETURN_VOID"},
+ {NULL}
+};
+
+
ACPI_CONVERSION_TABLE LinuxConversionTable = {
DualLicenseHeader,
@@ -708,6 +742,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
NULL,
LinuxEliminateMacros,
AcpiIdentifiers,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_BRACES_ON_SAME_LINE |
CVT_MIXED_CASE_TO_UNDERSCORES | CVT_LOWER_CASE_IDENTIFIERS |
@@ -721,6 +756,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
LinuxConditionalIdentifiers,
NULL,
AcpiIdentifiers,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_MIXED_CASE_TO_UNDERSCORES |
CVT_LOWER_CASE_IDENTIFIERS | CVT_TRIM_WHITESPACE |
@@ -746,6 +782,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
@@ -756,6 +793,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
};
@@ -774,6 +812,7 @@ ACPI_CONVERSION_TABLE StatsConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -784,6 +823,7 @@ ACPI_CONVERSION_TABLE StatsConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
};
@@ -808,6 +848,7 @@ ACPI_CONVERSION_TABLE LicenseConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -818,6 +859,7 @@ ACPI_CONVERSION_TABLE LicenseConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
};
@@ -897,6 +939,7 @@ ACPI_CONVERSION_TABLE CustomConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
@@ -907,6 +950,44 @@ ACPI_CONVERSION_TABLE CustomConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
+ (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
+ CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
+};
+
+
+/******************************************************************************
+ *
+ * Indentation result fixup table
+ *
+ ******************************************************************************/
+
+ACPI_CONVERSION_TABLE IndentConversionTable = {
+
+ NULL,
+ FLG_NO_CARRIAGE_RETURNS,
+
+ NULL,
+
+ /* C source files */
+
+ LinuxSpecialStrings,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ LinuxSpecialMacros,
+ (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
+ CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
+
+ /* C header files */
+
+ LinuxSpecialStrings,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ LinuxSpecialMacros,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
};
diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c
index efed936..c06e375 100644
--- a/source/tools/acpixtract/acpixtract.c
+++ b/source/tools/acpixtract/acpixtract.c
@@ -95,6 +95,9 @@ AxConvertLine (
char *InputLine,
unsigned char *OutputData);
+static int
+AxIsEmptyLine (
+ char *Buffer);
typedef struct AxTableInfo
{
@@ -181,6 +184,41 @@ AxCheckAscii (
}
+/******************************************************************************
+ *
+ * FUNCTION: AxIsEmptyLine
+ *
+ * PARAMETERS: Buffer - Line from input file
+ *
+ * RETURN: TRUE if line is empty (zero or more blanks only)
+ *
+ * DESCRIPTION: Determine if an input line is empty.
+ *
+ ******************************************************************************/
+
+static int
+AxIsEmptyLine (
+ char *Buffer)
+{
+
+ /* Skip all spaces */
+
+ while (*Buffer == ' ')
+ {
+ Buffer++;
+ }
+
+ /* If end-of-line, this line is empty */
+
+ if (*Buffer == '\n')
+ {
+ return (1);
+ }
+
+ return (0);
+}
+
+
/*******************************************************************************
*
* FUNCTION: AxNormalizeSignature
@@ -345,8 +383,8 @@ AxCountTableInstances (
{
/* Ignore empty lines and lines that start with a space */
- if ((InstanceBuffer[0] == ' ') ||
- (InstanceBuffer[0] == '\n'))
+ if (AxIsEmptyLine (InstanceBuffer) ||
+ (InstanceBuffer[0] == ' '))
{
continue;
}
@@ -506,8 +544,8 @@ AxExtractTables (
/* Ignore empty lines and lines that start with a space */
- if ((LineBuffer[0] == ' ') ||
- (LineBuffer[0] == '\n'))
+ if (AxIsEmptyLine (LineBuffer) ||
+ (LineBuffer[0] == ' '))
{
continue;
}
@@ -574,7 +612,7 @@ AxExtractTables (
/* Empty line or non-data line terminates the data */
- if ((LineBuffer[0] == '\n') ||
+ if (AxIsEmptyLine (LineBuffer) ||
(LineBuffer[0] != ' '))
{
fclose (OutputFile);
@@ -672,15 +710,15 @@ AxListTables (
/* Dump the headers for all tables found in the input file */
- printf ("\nSignature Length Revision OemId OemTableId"
+ printf ("\nSignature Length Revision OemId OemTableId"
" OemRevision CompilerId CompilerRevision\n\n");
while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
{
/* Ignore empty lines and lines that start with a space */
- if ((LineBuffer[0] == ' ') ||
- (LineBuffer[0] == '\n'))
+ if (AxIsEmptyLine (LineBuffer) ||
+ (LineBuffer[0] == ' '))
{
continue;
}
@@ -698,7 +736,7 @@ AxListTables (
if (!strncmp (TableHeader->Signature, "RSD PTR ", 8))
{
AxCheckAscii ((char *) &Header[9], 6);
- printf ("%8.4s \"%6.6s\"\n", "RSDP", &Header[9]);
+ printf ("%7.4s \"%6.6s\"\n", "RSDP", &Header[9]);
TableCount++;
continue;
}
@@ -713,7 +751,7 @@ AxListTables (
/* Signature and Table length */
TableCount++;
- printf ("%8.4s % 7d", TableHeader->Signature, TableHeader->Length);
+ printf ("%7.4s 0x%8.8X", TableHeader->Signature, TableHeader->Length);
/* FACS has only signature and length */
@@ -729,7 +767,7 @@ AxListTables (
AxCheckAscii (TableHeader->OemTableId, 8);
AxCheckAscii (TableHeader->AslCompilerId, 4);
- printf (" %2.2X \"%6.6s\" \"%8.8s\" %8.8X \"%4.4s\" %8.8X\n",
+ printf (" 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X \"%4.4s\" 0x%8.8X\n",
TableHeader->Revision, TableHeader->OemId,
TableHeader->OemTableId, TableHeader->OemRevision,
TableHeader->AslCompilerId, TableHeader->AslCompilerRevision);
OpenPOWER on IntegriCloud