summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/acpibin/abcompare.c52
-rw-r--r--source/tools/acpibin/abmain.c15
-rw-r--r--source/tools/acpibin/acpibin.h4
-rw-r--r--source/tools/acpiexec/aecommon.h1
-rw-r--r--source/tools/acpiexec/aeexec.c1
-rw-r--r--source/tools/acpiexec/aehandlers.c8
-rw-r--r--source/tools/acpiexec/aetables.c10
-rw-r--r--source/tools/acpinames/acpinames.h1
-rw-r--r--source/tools/acpinames/anmain.c1
-rw-r--r--source/tools/acpinames/anstubs.c14
-rw-r--r--source/tools/acpinames/antables.c6
-rw-r--r--source/tools/acpisrc/acpisrc.h14
-rw-r--r--source/tools/acpisrc/ascase.c11
-rw-r--r--source/tools/acpisrc/asconvrt.c118
-rw-r--r--source/tools/acpisrc/asfile.c53
-rw-r--r--source/tools/acpisrc/asmain.c25
-rw-r--r--source/tools/acpisrc/asremove.c13
-rw-r--r--source/tools/acpisrc/astable.c14
-rw-r--r--source/tools/acpisrc/asutils.c12
-rw-r--r--source/tools/acpixtract/acpixtract.c8
20 files changed, 235 insertions, 146 deletions
diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c
index 46122274d4a92..a0b241f5c4fde 100644
--- a/source/tools/acpibin/abcompare.c
+++ b/source/tools/acpibin/abcompare.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: abcompare - compare AML files
@@ -158,10 +157,10 @@ AbValidateHeader (
if (!AcpiUtValidAcpiName (* (UINT32 *) &Header->Signature))
{
printf ("Header signature is invalid\n");
- return FALSE;
+ return (FALSE);
}
- return TRUE;
+ return (TRUE);
}
@@ -398,14 +397,14 @@ AbCompareAmlFiles (
if (!File1)
{
printf ("Could not open file %s\n", File1Path);
- return -1;
+ return (-1);
}
File2 = fopen (File2Path, "rb");
if (!File2)
{
printf ("Could not open file %s\n", File2Path);
- return -1;
+ return (-1);
}
/* Read the ACPI header from each file */
@@ -414,20 +413,20 @@ AbCompareAmlFiles (
if (Actual1 < sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
- return -1;
+ return (-1);
}
Actual2 = fread (&Header2, 1, sizeof (ACPI_TABLE_HEADER), File2);
if (Actual2 < sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File2Path);
- return -1;
+ return (-1);
}
if ((!AbValidateHeader (&Header1)) ||
(!AbValidateHeader (&Header2)))
{
- return -1;
+ return (-1);
}
/* Table signatures must match */
@@ -435,7 +434,7 @@ AbCompareAmlFiles (
if (*((UINT32 *) Header1.Signature) != *((UINT32 *) Header2.Signature))
{
printf ("Table signatures do not match\n");
- return -1;
+ return (-1);
}
if (!Gbl_TerseMode)
@@ -446,7 +445,7 @@ AbCompareAmlFiles (
AbPrintHeaderInfo (&Header2);
}
- if (memcmp (Header1.Signature, Header2.Signature, sizeof (ACPI_TABLE_HEADER)))
+ if (memcmp (&Header1, &Header2, sizeof (ACPI_TABLE_HEADER)))
{
printf ("Headers do not match exactly\n");
HeaderMismatch = TRUE;
@@ -468,7 +467,7 @@ AbCompareAmlFiles (
if (Mismatches > 100)
{
printf ("100 Mismatches: Too many mismatches\n");
- return -1;
+ return (-1);
}
}
@@ -500,7 +499,7 @@ AbCompareAmlFiles (
}
printf ("%u Mismatches found\n", Mismatches);
- return 0;
+ return (0);
}
@@ -528,7 +527,7 @@ AbGetFile (
if (!FileHandle)
{
printf ("Could not open %s\n", Filename);
- return NULL;
+ return (NULL);
}
/* Need file size to allocate a buffer */
@@ -596,12 +595,12 @@ AbDumpAmlFile (
if (!FileOutHandle)
{
printf ("Could not open %s\n", File2Path);
- return -1;
+ return (-1);
}
if (!AbValidateHeader ((ACPI_TABLE_HEADER *) FileBuffer))
{
- return -1;
+ return (-1);
}
/* Convert binary AML to text, using common dump buffer routine */
@@ -611,10 +610,10 @@ AbDumpAmlFile (
AcpiOsPrintf ("%4.4s\n", ((ACPI_TABLE_HEADER *) FileBuffer)->Signature);
AcpiDbgLevel = ACPI_UINT32_MAX;
- AcpiUtDumpBuffer ((UINT8 *) FileBuffer, FileSize,
+ AcpiUtDebugDumpBuffer ((UINT8 *) FileBuffer, FileSize,
DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
- return 0;
+ return (0);
}
@@ -648,14 +647,14 @@ AbExtractAmlFile (
if (!FileHandle)
{
printf ("Could not open %s\n", File1Path);
- return -1;
+ return (-1);
}
FileOutHandle = fopen (File2Path, "w+b");
if (!FileOutHandle)
{
printf ("Could not open %s\n", File2Path);
- return -1;
+ return (-1);
}
/* Force input table sig to uppercase */
@@ -672,7 +671,7 @@ AbExtractAmlFile (
{
/* The 4-char ACPI signature appears at the beginning of a line */
- if (!strncmp (Buffer, TableSig, 4))
+ if (ACPI_COMPARE_NAME (Buffer, TableSig))
{
printf ("Found table [%4.4s]\n", TableSig);
@@ -710,7 +709,12 @@ AbExtractAmlFile (
/* Write the converted (binary) byte */
- fwrite (&Value, 1, 1, FileOutHandle);
+ if (fwrite (&Value, 1, 1, FileOutHandle) < 1)
+ {
+ printf ("Error writing byte %u to output file: %s\n",
+ Count, File2Path);
+ goto Exit;
+ }
Count++;
}
}
@@ -725,13 +729,13 @@ AbExtractAmlFile (
printf ("Could not match table signature\n");
fclose (FileHandle);
- return -1;
+ return (-1);
Exit:
printf ("%u (0x%X) bytes written to %s\n", Count, Count, File2Path);
fclose (FileHandle);
fclose (FileOutHandle);
- return 0;
+ return (0);
}
@@ -747,7 +751,7 @@ ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
void)
{
- return AE_OK;
+ return (AE_OK);
}
ACPI_THREAD_ID
diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c
index cb9c329521f06..b09ab846747fc 100644
--- a/source/tools/acpibin/abmain.c
+++ b/source/tools/acpibin/abmain.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: abmain - Main module for the acpi binary utility
@@ -109,7 +108,7 @@ main (
if (argc < 2)
{
AbDisplayUsage (0);
- return 0;
+ return (0);
}
/* Command line options */
@@ -121,7 +120,7 @@ main (
if (argc < 4)
{
AbDisplayUsage (2);
- return -1;
+ return (-1);
}
Status = AbCompareAmlFiles (AcpiGbl_Optarg, argv[AcpiGbl_Optind]);
@@ -132,7 +131,7 @@ main (
if (argc < 4)
{
AbDisplayUsage (2);
- return -1;
+ return (-1);
}
Status = AbDumpAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind]);
@@ -143,7 +142,7 @@ main (
if (argc < 5)
{
AbDisplayUsage (3);
- return -1;
+ return (-1);
}
Status = AbExtractAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind],
@@ -155,7 +154,7 @@ main (
if (argc < 3)
{
AbDisplayUsage (1);
- return -1;
+ return (-1);
}
AbDisplayHeader (AcpiGbl_Optarg);
@@ -166,7 +165,7 @@ main (
if (argc < 3)
{
AbDisplayUsage (1);
- return -1;
+ return (-1);
}
AbComputeChecksum (AcpiGbl_Optarg);
@@ -179,7 +178,7 @@ main (
default:
AbDisplayUsage (0);
- return -1;
+ return (-1);
}
return Status;
diff --git a/source/tools/acpibin/acpibin.h b/source/tools/acpibin/acpibin.h
index 63109cc738cfe..e831f51098736 100644
--- a/source/tools/acpibin/acpibin.h
+++ b/source/tools/acpibin/acpibin.h
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: acpibinh - Include file for AcpiBin utility
@@ -67,7 +66,7 @@
#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
/*
- * Global variables. Defined in main.c only, externed in all other files
+ * Global variables. Defined in main.c only, externed in all other files
*/
#ifdef _DECLARE_GLOBALS
@@ -110,4 +109,3 @@ AbComputeChecksum (
void
AbDisplayHeader (
char *File1Path);
-
diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h
index 66995e7ecd0e5..111e995d390ba 100644
--- a/source/tools/acpiexec/aecommon.h
+++ b/source/tools/acpiexec/aecommon.h
@@ -197,4 +197,3 @@ AeGlobalEventHandler (
void *Context);
#endif /* _AECOMMON */
-
diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c
index 6bc138138c875..8c0ec265aea75 100644
--- a/source/tools/acpiexec/aeexec.c
+++ b/source/tools/acpiexec/aeexec.c
@@ -770,4 +770,3 @@ AeMiscellaneousTests (
#endif /* !ACPI_REDUCED_HARDWARE */
}
-
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index 84ed57e1b3408..d830d804276c8 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -167,7 +167,7 @@ static ACPI_CONNECTION_INFO AeMyContext;
*
* RETURN: none
*
- * DESCRIPTION: Control-C handler. Abort running control method if any.
+ * DESCRIPTION: Control-C handler. Abort running control method if any.
*
*****************************************************************************/
@@ -299,7 +299,7 @@ AeCommonNotifyHandler (
*
* RETURN: Status
*
- * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
+ * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
* test suite(s) to communicate errors and other information to
* this utility via the Notify() operator.
*
@@ -332,7 +332,7 @@ AeSystemNotifyHandler (
*
* RETURN: Status
*
- * DESCRIPTION: Device notify handler for AcpiExec utility. Used by the ASL
+ * DESCRIPTION: Device notify handler for AcpiExec utility. Used by the ASL
* test suite(s) to communicate errors and other information to
* this utility via the Notify() operator.
*
@@ -1366,5 +1366,3 @@ DoFunction:
return (AE_OK);
}
-
-
diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c
index afada0d714170..fb530e1dabf86 100644
--- a/source/tools/acpiexec/aetables.c
+++ b/source/tools/acpiexec/aetables.c
@@ -173,7 +173,7 @@ AeBuildLocalTables (
}
ACPI_MEMSET (LocalXSDT, 0, XsdtSize);
- ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4);
+ ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT);
LocalXSDT->Header.Length = XsdtSize;
LocalXSDT->Header.Revision = 1;
@@ -307,7 +307,7 @@ AeBuildLocalTables (
* Build a local FADT so we can test the hardware/event init
*/
ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT));
- ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4);
+ ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT);
/* Setup FADT header and DSDT/FACS addresses */
@@ -358,7 +358,7 @@ AeBuildLocalTables (
/* Build a FACS */
ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
- ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4);
+ ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS);
LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
LocalFACS.GlobalLock = 0x11AA0011;
@@ -368,7 +368,7 @@ AeBuildLocalTables (
* ACPICA core ignores it
*/
ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER));
- ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4);
+ ACPI_MOVE_NAME (LocalTEST.Signature, "TEST");
LocalTEST.Revision = 1;
LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
@@ -380,7 +380,7 @@ AeBuildLocalTables (
* sure that the ACPICA core ignores it
*/
ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER));
- ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4);
+ ACPI_MOVE_NAME (LocalBADTABLE.Signature, "BAD!");
LocalBADTABLE.Revision = 1;
LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
diff --git a/source/tools/acpinames/acpinames.h b/source/tools/acpinames/acpinames.h
index 260124af8ee6b..3439f8f673fdc 100644
--- a/source/tools/acpinames/acpinames.h
+++ b/source/tools/acpinames/acpinames.h
@@ -54,4 +54,3 @@
#define ACPI_MAX_INIT_TABLES (32)
#endif
-
diff --git a/source/tools/acpinames/anmain.c b/source/tools/acpinames/anmain.c
index 682cc5f615706..5fb51bafe8f01 100644
--- a/source/tools/acpinames/anmain.c
+++ b/source/tools/acpinames/anmain.c
@@ -272,4 +272,3 @@ main (
*/
return (NsDumpEntireNamespace (argv[AcpiGbl_Optind]));
}
-
diff --git a/source/tools/acpinames/anstubs.c b/source/tools/acpinames/anstubs.c
index a69c425e3776d..b823f3253122d 100644
--- a/source/tools/acpinames/anstubs.c
+++ b/source/tools/acpinames/anstubs.c
@@ -77,7 +77,7 @@ AcpiUtExecute_STA (
ACPI_STATUS
AcpiUtExecute_HID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID **ReturnId)
+ ACPI_PNP_DEVICE_ID **ReturnId)
{
return (AE_NOT_IMPLEMENTED);
}
@@ -85,7 +85,7 @@ AcpiUtExecute_HID (
ACPI_STATUS
AcpiUtExecute_CID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID_LIST **ReturnCidList)
+ ACPI_PNP_DEVICE_ID_LIST **ReturnCidList)
{
return (AE_NOT_IMPLEMENTED);
}
@@ -93,7 +93,15 @@ AcpiUtExecute_CID (
ACPI_STATUS
AcpiUtExecute_UID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID **ReturnId)
+ ACPI_PNP_DEVICE_ID **ReturnId)
+{
+ return (AE_NOT_IMPLEMENTED);
+}
+
+ACPI_STATUS
+AcpiUtExecute_SUB (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_PNP_DEVICE_ID **ReturnId)
{
return (AE_NOT_IMPLEMENTED);
}
diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c
index 37fa24ae5f9f0..c6545b8342737 100644
--- a/source/tools/acpinames/antables.c
+++ b/source/tools/acpinames/antables.c
@@ -129,7 +129,7 @@ AeBuildLocalTables (
}
ACPI_MEMSET (LocalXSDT, 0, XsdtSize);
- ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4);
+ ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT);
LocalXSDT->Header.Length = XsdtSize;
LocalXSDT->Header.Revision = 1;
@@ -222,7 +222,7 @@ AeBuildLocalTables (
* Build a local FADT so we can test the hardware/event init
*/
ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT));
- ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4);
+ ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT);
/* Setup FADT header and DSDT/FACS addresses */
@@ -273,7 +273,7 @@ AeBuildLocalTables (
/* Build a FACS */
ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
- ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4);
+ ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS);
LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
LocalFACS.GlobalLock = 0x11AA0011;
diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h
index bc3f497e89c1d..1d2e8dc50124c 100644
--- a/source/tools/acpisrc/acpisrc.h
+++ b/source/tools/acpisrc/acpisrc.h
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: acpisrc.h - Include file for AcpiSrc utility
@@ -135,6 +134,7 @@ extern BOOLEAN Gbl_Overwrite;
extern BOOLEAN Gbl_WidenDeclarations;
extern BOOLEAN Gbl_IgnoreLoneLineFeeds;
extern BOOLEAN Gbl_HasLoneLineFeeds;
+extern BOOLEAN Gbl_Cleanup;
extern void *Gbl_StructDefs;
#define PARAM_LIST(pl) pl
@@ -367,6 +367,16 @@ AsCheckForDirectory (
char **SourcePath,
char **TargetPath);
+void
+AsRemoveExtraLines (
+ char *FileBuffer,
+ char *Filename);
+
+void
+AsRemoveSpacesAfterPeriod (
+ char *FileBuffer,
+ char *Filename);
+
BOOLEAN
AsMatchExactWord (
char *Word,
@@ -402,5 +412,3 @@ AsInsertCarriageReturns (
void
AsConvertToLineFeeds (
char *Buffer);
-
-
diff --git a/source/tools/acpisrc/ascase.c b/source/tools/acpisrc/ascase.c
index 7e115b7aeb653..96e1269eaaf39 100644
--- a/source/tools/acpisrc/ascase.c
+++ b/source/tools/acpisrc/ascase.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: ascase - Source conversion - lower/upper case utilities
@@ -57,7 +56,7 @@ AsUppercaseTokens (
* FUNCTION: AsLowerCaseString
*
* DESCRIPTION: LowerCase all instances of a target string with a replacement
- * string. Returns count of the strings replaced.
+ * string. Returns count of the strings replaced.
*
******************************************************************************/
@@ -86,7 +85,7 @@ AsLowerCaseString (
SubString1 = strstr (SubBuffer, Target);
if (!SubString1)
{
- return LowerCaseCount;
+ return (LowerCaseCount);
}
/*
@@ -105,7 +104,7 @@ AsLowerCaseString (
{
/* Didn't find terminator */
- return LowerCaseCount;
+ return (LowerCaseCount);
}
/* Move buffer to end of escape block and continue */
@@ -142,7 +141,7 @@ AsLowerCaseString (
}
}
- return LowerCaseCount;
+ return (LowerCaseCount);
}
@@ -465,7 +464,7 @@ AsMixedCaseToUnderscores (
*
* FUNCTION: AsLowerCaseIdentifiers
*
- * DESCRIPTION: Converts mixed case identifiers to lower case. Leaves comments,
+ * DESCRIPTION: Converts mixed case identifiers to lower case. Leaves comments,
* quoted strings, and all-upper-case macros alone.
*
******************************************************************************/
diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c
index 1669f9d20e79a..ff2804d72fce3 100644
--- a/source/tools/acpisrc/asconvrt.c
+++ b/source/tools/acpisrc/asconvrt.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: asconvrt - Source conversion code
@@ -63,6 +62,89 @@ char *HeaderBegin = "/***************************************************
/******************************************************************************
*
+ * FUNCTION: AsRemoveExtraLines
+ *
+ * DESCRIPTION: Remove all extra lines at the start and end of the file.
+ *
+ ******************************************************************************/
+
+void
+AsRemoveExtraLines (
+ char *FileBuffer,
+ char *Filename)
+{
+ char *FileEnd;
+ int Length;
+
+
+ /* Remove any extra lines at the start of the file */
+
+ while (*FileBuffer == '\n')
+ {
+ printf ("Removing extra line at start of file: %s\n", Filename);
+ AsRemoveData (FileBuffer, FileBuffer + 1);
+ }
+
+ /* Remove any extra lines at the end of the file */
+
+ Length = strlen (FileBuffer);
+ FileEnd = FileBuffer + (Length - 2);
+
+ while (*FileEnd == '\n')
+ {
+ printf ("Removing extra line at end of file: %s\n", Filename);
+ AsRemoveData (FileEnd, FileEnd + 1);
+ FileEnd--;
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AsRemoveSpacesAfterPeriod
+ *
+ * DESCRIPTION: Remove an extra space after a period.
+ *
+ ******************************************************************************/
+
+void
+AsRemoveSpacesAfterPeriod (
+ char *FileBuffer,
+ char *Filename)
+{
+ int ReplaceCount = 0;
+ char *Possible;
+
+
+ Possible = FileBuffer;
+ while (Possible)
+ {
+ Possible = strstr (Possible, ". ");
+ if (Possible)
+ {
+ if ((*(Possible -1) == '.') ||
+ (*(Possible -1) == '\"') ||
+ (*(Possible -1) == '\n'))
+ {
+ Possible += 3;
+ continue;
+ }
+
+ Possible = AsReplaceData (Possible, 3, ". ", 2);
+ ReplaceCount++;
+ }
+ }
+
+ if (ReplaceCount)
+ {
+ printf ("Removed %d extra blanks after a period: %s\n",
+ ReplaceCount, Filename);
+ }
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AsMatchExactWord
*
* DESCRIPTION: Check previous and next characters for whitespace
@@ -146,7 +228,7 @@ AsCheckAndSkipLiterals (
if (!LiteralEnd)
{
- return SubBuffer;
+ return (SubBuffer);
}
while (SubBuffer < LiteralEnd)
@@ -170,7 +252,7 @@ AsCheckAndSkipLiterals (
LiteralEnd = AsSkipPastChar (SubBuffer, '\"');
if (!LiteralEnd)
{
- return SubBuffer;
+ return (SubBuffer);
}
}
@@ -178,7 +260,7 @@ AsCheckAndSkipLiterals (
{
(*TotalLines) += NewLines;
}
- return SubBuffer;
+ return (SubBuffer);
}
@@ -278,7 +360,7 @@ AsCheckForBraces (
*
* FUNCTION: AsTrimLines
*
- * DESCRIPTION: Remove extra blanks from the end of source lines. Does not
+ * DESCRIPTION: Remove extra blanks from the end of source lines. Does not
* check for tabs.
*
******************************************************************************/
@@ -404,7 +486,7 @@ AsReplaceHeader (
* FUNCTION: AsReplaceString
*
* DESCRIPTION: Replace all instances of a target string with a replacement
- * string. Returns count of the strings replaced.
+ * string. Returns count of the strings replaced.
*
******************************************************************************/
@@ -436,7 +518,7 @@ AsReplaceString (
SubString1 = strstr (SubBuffer, Target);
if (!SubString1)
{
- return ReplaceCount;
+ return (ReplaceCount);
}
/*
@@ -455,7 +537,7 @@ AsReplaceString (
{
/* Didn't find terminator */
- return ReplaceCount;
+ return (ReplaceCount);
}
/* Move buffer to end of escape block and continue */
@@ -488,7 +570,7 @@ AsReplaceString (
}
}
- return ReplaceCount;
+ return (ReplaceCount);
}
@@ -725,7 +807,7 @@ AsBracesOnSameLine (
*
* FUNCTION: AsTabify4
*
- * DESCRIPTION: Convert the text to tabbed text. Alignment of text is
+ * DESCRIPTION: Convert the text to tabbed text. Alignment of text is
* preserved.
*
******************************************************************************/
@@ -815,7 +897,7 @@ AsTabify4 (
*
* FUNCTION: AsTabify8
*
- * DESCRIPTION: Convert the text to tabbed text. Alignment of text is
+ * DESCRIPTION: Convert the text to tabbed text. Alignment of text is
* preserved.
*
******************************************************************************/
@@ -863,7 +945,7 @@ AsTabify8 (
/*
* This mechanism limits the difference in tab counts from
- * line to line. It helps avoid the situation where a second
+ * line to line. It helps avoid the situation where a second
* continuation line (which was indented correctly for tabs=4) would
* get indented off the screen if we just blindly converted to tabs.
*/
@@ -1015,7 +1097,7 @@ AsTabify8 (
*
* FUNCTION: AsCountLines
*
- * DESCRIPTION: Count the number of lines in the input buffer. Also count
+ * DESCRIPTION: Count the number of lines in the input buffer. Also count
* the number of long lines (lines longer than 80 chars).
*
******************************************************************************/
@@ -1037,7 +1119,7 @@ AsCountLines (
if (!EndOfLine)
{
Gbl_TotalLines += LineCount;
- return LineCount;
+ return (LineCount);
}
if ((EndOfLine - SubBuffer) > 80)
@@ -1057,7 +1139,7 @@ AsCountLines (
}
Gbl_TotalLines += LineCount;
- return LineCount;
+ return (LineCount);
}
@@ -1100,7 +1182,7 @@ AsCountTabs (
*
* FUNCTION: AsCountNonAnsiComments
*
- * DESCRIPTION: Count the number of "//" comments. This type of comment is
+ * DESCRIPTION: Count the number of "//" comments. This type of comment is
* non-ANSI C.
*
******************************************************************************/
@@ -1136,7 +1218,7 @@ AsCountNonAnsiComments (
*
* FUNCTION: AsCountSourceLines
*
- * DESCRIPTION: Count the number of C source lines. Defined by 1) not a
+ * DESCRIPTION: Count the number of C source lines. Defined by 1) not a
* comment, and 2) not a blank line.
*
******************************************************************************/
@@ -1444,5 +1526,3 @@ Exit:
}
}
#endif
-
-
diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c
index d3257385ff9ad..70be229928eac 100644
--- a/source/tools/acpisrc/asfile.c
+++ b/source/tools/acpisrc/asfile.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: asfile - Main module for the acpi source processor utility
@@ -159,7 +158,7 @@ AsDoWildcard (
*
* FUNCTION: AsProcessTree
*
- * DESCRIPTION: Process the directory tree. Files with the extension ".C" and
+ * DESCRIPTION: Process the directory tree. Files with the extension ".C" and
* ".H" are processed as the tree is traversed.
*
******************************************************************************/
@@ -188,7 +187,7 @@ AsProcessTree (
if (errno != EEXIST)
{
printf ("Could not create target directory\n");
- return -1;
+ return (-1);
}
}
}
@@ -223,7 +222,7 @@ AsProcessTree (
AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength,
FILE_TYPE_DIRECTORY, "*");
- return 0;
+ return (0);
}
@@ -247,7 +246,7 @@ AsDetectLoneLineFeeds (
if (!Buffer[0])
{
- return FALSE;
+ return (FALSE);
}
while (Buffer[i])
@@ -277,7 +276,7 @@ AsDetectLoneLineFeeds (
{
printf ("%s: %u lone linefeeds in file\n", Filename, LfCount);
}
- return TRUE;
+ return (TRUE);
}
return (FALSE);
@@ -340,6 +339,12 @@ AsConvertFile (
VERBOSE_PRINT (("Processing %u bytes\n",
(unsigned int) strlen (FileBuffer)));
+ if (Gbl_Cleanup)
+ {
+ AsRemoveExtraLines (FileBuffer, Filename);
+ AsRemoveSpacesAfterPeriod (FileBuffer, Filename);
+ }
+
if (ConversionTable->LowerCaseTable)
{
for (i = 0; ConversionTable->LowerCaseTable[i].Identifier; i++)
@@ -514,7 +519,7 @@ AsConvertFile (
*
* FUNCTION: AsProcessOneFile
*
- * DESCRIPTION: Process one source file. The file is opened, read entirely
+ * DESCRIPTION: Process one source file. The file is opened, read entirely
* into a buffer, converted, then written to a new file.
*
******************************************************************************/
@@ -538,7 +543,7 @@ AsProcessOneFile (
if (!Pathname)
{
printf ("Could not allocate buffer for file pathnames\n");
- return -1;
+ return (-1);
}
Gbl_FileType = FileType;
@@ -555,7 +560,7 @@ AsProcessOneFile (
if (AsGetFile (Pathname, &Gbl_FileBuffer, &Gbl_FileSize))
{
- return -1;
+ return (-1);
}
Gbl_HeaderSize = 0;
@@ -597,7 +602,7 @@ AsProcessOneFile (
if (!OutPathname)
{
printf ("Could not allocate buffer for file pathnames\n");
- return -1;
+ return (-1);
}
strcpy (OutPathname, TargetPath);
@@ -618,7 +623,7 @@ AsProcessOneFile (
free (OutPathname);
}
- return 0;
+ return (0);
}
@@ -626,7 +631,7 @@ AsProcessOneFile (
*
* FUNCTION: AsCheckForDirectory
*
- * DESCRIPTION: Check if the current file is a valid directory. If not,
+ * DESCRIPTION: Check if the current file is a valid directory. If not,
* construct the full pathname for the source and target paths.
* Checks for the dot and dot-dot files (they are ignored)
*
@@ -647,14 +652,14 @@ AsCheckForDirectory (
if (!(strcmp (Filename, ".")) ||
!(strcmp (Filename, "..")))
{
- return -1;
+ return (-1);
}
SrcPath = calloc (strlen (SourceDirPath) + strlen (Filename) + 2, 1);
if (!SrcPath)
{
printf ("Could not allocate buffer for directory source pathname\n");
- return -1;
+ return (-1);
}
TgtPath = calloc (strlen (TargetDirPath) + strlen (Filename) + 2, 1);
@@ -662,7 +667,7 @@ AsCheckForDirectory (
{
printf ("Could not allocate buffer for directory target pathname\n");
free (SrcPath);
- return -1;
+ return (-1);
}
strcpy (SrcPath, SourceDirPath);
@@ -675,7 +680,7 @@ AsCheckForDirectory (
*SourcePath = SrcPath;
*TargetPath = TgtPath;
- return 0;
+ return (0);
}
@@ -705,7 +710,7 @@ AsGetFile (
if (!FileHandle)
{
printf ("Could not open %s\n", Filename);
- return -1;
+ return (-1);
}
if (fstat (FileHandle, &Gbl_StatBuf))
@@ -745,7 +750,7 @@ AsGetFile (
Gbl_HasLoneLineFeeds = AsDetectLoneLineFeeds (Filename, Buffer);
/*
- * Convert all CR/LF pairs to LF only. We do this locally so that
+ * Convert all CR/LF pairs to LF only. We do this locally so that
* this code is portable across operating systems.
*/
AsConvertToLineFeeds (Buffer);
@@ -753,13 +758,13 @@ AsGetFile (
*FileBuffer = Buffer;
*FileSize = Size;
- return 0;
+ return (0);
ErrorExit:
close (FileHandle);
- return -1;
+ return (-1);
}
@@ -768,7 +773,7 @@ ErrorExit:
* FUNCTION: AsPutFile
*
* DESCRIPTION: Create a new output file and write the entire contents of the
- * buffer to the new file. Buffer must be a zero terminated string
+ * buffer to the new file. Buffer must be a zero terminated string
*
******************************************************************************/
@@ -799,7 +804,7 @@ AsPutFile (
{
perror ("Could not create destination file");
printf ("Could not create destination file \"%s\"\n", Pathname);
- return -1;
+ return (-1);
}
/* Write the buffer to the file */
@@ -809,7 +814,5 @@ AsPutFile (
close (DestHandle);
- return 0;
+ return (0);
}
-
-
diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c
index e36855b5d8721..2e38e3481f571 100644
--- a/source/tools/acpisrc/asmain.c
+++ b/source/tools/acpisrc/asmain.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: asmain - Main module for the acpi source processor utility
@@ -97,6 +96,7 @@ BOOLEAN Gbl_Overwrite = FALSE;
BOOLEAN Gbl_WidenDeclarations = FALSE;
BOOLEAN Gbl_IgnoreLoneLineFeeds = FALSE;
BOOLEAN Gbl_HasLoneLineFeeds = FALSE;
+BOOLEAN Gbl_Cleanup = FALSE;
/******************************************************************************
@@ -154,7 +154,7 @@ AsExaminePaths (
if (Status)
{
printf ("Source path \"%s\" does not exist\n", Source);
- return -1;
+ return (-1);
}
/* Return the filetype -- file or a directory */
@@ -171,7 +171,7 @@ AsExaminePaths (
if ((ConversionTable->Flags & FLG_NO_FILE_OUTPUT) ||
(Gbl_BatchMode))
{
- return 0;
+ return (0);
}
if (!AsStricmp (Source, Target))
@@ -183,7 +183,7 @@ AsExaminePaths (
if (Response != 'y')
{
- return -1;
+ return (-1);
}
Gbl_Overwrite = TRUE;
@@ -200,12 +200,12 @@ AsExaminePaths (
if (Response != 'y')
{
- return -1;
+ return (-1);
}
}
}
- return 0;
+ return (0);
}
@@ -325,7 +325,7 @@ main (
if (argc < 2)
{
AsDisplayUsage ();
- return 0;
+ return (0);
}
/* Command line options */
@@ -346,6 +346,7 @@ main (
printf ("Code cleanup\n");
ConversionTable = &CleanupConversionTable;
+ Gbl_Cleanup = TRUE;
break;
case 'h':
@@ -393,7 +394,7 @@ main (
default:
AsDisplayUsage ();
- return -1;
+ return (-1);
}
@@ -402,14 +403,14 @@ main (
{
printf ("Missing source path\n");
AsDisplayUsage ();
- return -1;
+ return (-1);
}
TargetPath = argv[AcpiGbl_Optind+1];
if (!ConversionTable)
{
- /* Just generate statistics. Ignore target path */
+ /* Just generate statistics. Ignore target path */
TargetPath = SourcePath;
@@ -430,7 +431,7 @@ main (
if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType))
{
- return -1;
+ return (-1);
}
/* Source/target can be either directories or a files */
@@ -461,5 +462,5 @@ main (
AsDisplayStats ();
- return 0;
+ return (0);
}
diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c
index 8fe29e158a2a7..54da0af0b1919 100644
--- a/source/tools/acpisrc/asremove.c
+++ b/source/tools/acpisrc/asremove.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: asremove - Source conversion - removal functions
@@ -59,7 +58,7 @@ AsRemoveStatement (
*
* DESCRIPTION: Remove all statements that contain the given keyword.
* Limitations: Removes text from the start of the line that
- * contains the keyword to the next semicolon. Currently
+ * contains the keyword to the next semicolon. Currently
* doesn't ignore comments.
*
******************************************************************************/
@@ -297,7 +296,7 @@ AsRemoveConditionalCompile (
*
* FUNCTION: AsRemoveMacro
*
- * DESCRIPTION: Remove every line that contains the keyword. Does not
+ * DESCRIPTION: Remove every line that contains the keyword. Does not
* skip comments.
*
******************************************************************************/
@@ -368,7 +367,7 @@ AsRemoveMacro (
*
* FUNCTION: AsRemoveLine
*
- * DESCRIPTION: Remove every line that contains the keyword. Does not
+ * DESCRIPTION: Remove every line that contains the keyword. Does not
* skip comments.
*
******************************************************************************/
@@ -459,7 +458,7 @@ AsReduceTypedefs (
}
SubString++;
- /* Find the closing brace. Handles nested braces */
+ /* Find the closing brace. Handles nested braces */
NestLevel = 1;
while (*SubString)
@@ -505,7 +504,7 @@ AsReduceTypedefs (
*
* FUNCTION: AsRemoveEmptyBlocks
*
- * DESCRIPTION: Remove any C blocks (e.g., if {}) that contain no code. This
+ * DESCRIPTION: Remove any C blocks (e.g., if {}) that contain no code. This
* can happen as a result of removing lines such as DEBUG_PRINT.
*
******************************************************************************/
@@ -612,5 +611,3 @@ AsRemoveDebugMacros (
AsReplaceString ("return_acpi_status", "return", REPLACE_WHOLE_WORD, Buffer);
AsReplaceString ("return_VALUE", "return", REPLACE_WHOLE_WORD, Buffer);
}
-
-
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 3159b4435074b..fa04e8b644759 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: astable - Tables used for source conversion
@@ -206,8 +205,6 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_DEBUG_MEM_HEADER", SRC_TYPE_STRUCT},
{"ACPI_DEBUG_PRINT_INFO", SRC_TYPE_STRUCT},
{"ACPI_DESCRIPTOR", SRC_TYPE_UNION},
- {"ACPI_DEVICE_ID", SRC_TYPE_STRUCT},
- {"ACPI_DEVICE_ID_LIST", SRC_TYPE_STRUCT},
{"ACPI_DEVICE_INFO", SRC_TYPE_STRUCT},
{"ACPI_DEVICE_WALK_INFO", SRC_TYPE_STRUCT},
{"ACPI_DMTABLE_DATA", SRC_TYPE_STRUCT},
@@ -331,6 +328,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_PKG_INFO", SRC_TYPE_STRUCT},
{"ACPI_PKG_STATE", SRC_TYPE_STRUCT},
{"ACPI_PMTT_HEADER", SRC_TYPE_STRUCT},
+ {"ACPI_PNP_DEVICE_ID", SRC_TYPE_STRUCT},
+ {"ACPI_PNP_DEVICE_ID_LIST", SRC_TYPE_STRUCT},
{"ACPI_POINTER", SRC_TYPE_STRUCT},
{"ACPI_POINTERS", SRC_TYPE_UNION},
{"ACPI_PORT_INFO", SRC_TYPE_STRUCT},
@@ -818,10 +817,12 @@ ACPI_CONVERSION_TABLE LicenseConversionTable = {
ACPI_STRING_TABLE CustomReplacements[] = {
- {"(c) 1999 - 2012", "(c) 1999 - 2012", REPLACE_WHOLE_WORD}, /* Main ACPICA source */
- {"(c) 2006 - 2012", "(c) 2006 - 2012", REPLACE_WHOLE_WORD}, /* Test suites */
-
#if 0
+ {"SUPPORT, ASSISTANCE", "SUPPORT, ASSISTANCE", REPLACE_WHOLE_WORD}, /* Fix intel header */
+
+ {"(c) 1999 - 2012", "(c) 1999 - 2012", REPLACE_WHOLE_WORD}, /* Main ACPICA source */
+ {"(c) 2006 - 2012", "(c) 2006 - 2012", REPLACE_WHOLE_WORD}, /* Test suites */
+
{"(ACPI_INTEGER)", "(UINT64)", REPLACE_WHOLE_WORD},
{"ACPI_INTEGER ", "UINT64 ", REPLACE_WHOLE_WORD},
{"ACPI_INTEGER", "UINT64", REPLACE_WHOLE_WORD},
@@ -894,4 +895,3 @@ ACPI_CONVERSION_TABLE CustomConversionTable = {
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
};
-
diff --git a/source/tools/acpisrc/asutils.c b/source/tools/acpisrc/asutils.c
index a596ea8cee061..f3d9350a3108f 100644
--- a/source/tools/acpisrc/asutils.c
+++ b/source/tools/acpisrc/asutils.c
@@ -1,4 +1,3 @@
-
/******************************************************************************
*
* Module Name: asutils - common utilities
@@ -63,7 +62,7 @@ AsSkipUntilChar (
{
if (!*Buffer)
{
- return NULL;
+ return (NULL);
}
Buffer++;
@@ -92,7 +91,7 @@ AsSkipPastChar (
{
if (!*Buffer)
{
- return NULL;
+ return (NULL);
}
Buffer++;
@@ -110,7 +109,7 @@ AsSkipPastChar (
*
* DESCRIPTION: This function inserts and removes data from the file buffer.
* if more data is inserted than is removed, the data in the buffer
- * is moved to make room. If less data is inserted than is removed,
+ * is moved to make room. If less data is inserted than is removed,
* the remaining data is moved to close the hole.
*
******************************************************************************/
@@ -163,7 +162,7 @@ AsReplaceData (
*
* DESCRIPTION: This function inserts and removes data from the file buffer.
* if more data is inserted than is removed, the data in the buffer
- * is moved to make room. If less data is inserted than is removed,
+ * is moved to make room. If less data is inserted than is removed,
* the remaining data is moved to close the hole.
*
******************************************************************************/
@@ -208,7 +207,7 @@ AsInsertData (
*
* DESCRIPTION: This function inserts and removes data from the file buffer.
* if more data is inserted than is removed, the data in the buffer
- * is moved to make room. If less data is inserted than is removed,
+ * is moved to make room. If less data is inserted than is removed,
* the remaining data is moved to close the hole.
*
******************************************************************************/
@@ -231,4 +230,3 @@ AsRemoveData (
return (StartPointer);
}
-
diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c
index 85ce346af152e..ef5b28a1d91ba 100644
--- a/source/tools/acpixtract/acpixtract.c
+++ b/source/tools/acpixtract/acpixtract.c
@@ -352,7 +352,7 @@ AxCountTableInstances (
}
AxNormalizeSignature (InstanceBuffer);
- if (!strncmp (InstanceBuffer, Signature, 4))
+ if (ACPI_COMPARE_NAME (InstanceBuffer, Signature))
{
Instances++;
}
@@ -527,13 +527,13 @@ AxExtractTables (
}
AxNormalizeSignature (LineBuffer);
- strncpy (ThisSignature, LineBuffer, 4);
+ ACPI_MOVE_NAME (ThisSignature, LineBuffer);
if (Signature)
{
/* Ignore signatures that don't match */
- if (strncmp (ThisSignature, Signature, 4))
+ if (!ACPI_COMPARE_NAME (ThisSignature, Signature))
{
continue;
}
@@ -716,7 +716,7 @@ AxListTables (
/* FACS has only signature and length */
- if (!strncmp (TableHeader->Signature, "FACS", 4))
+ if (ACPI_COMPARE_NAME (TableHeader->Signature, "FACS"))
{
printf ("\n");
continue;