diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2017-08-31 17:21:06 +0000 |
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2017-08-31 17:21:06 +0000 |
| commit | 0810e26699e1b40b9384eca2137be6155de0a5ba (patch) | |
| tree | 2f9f57dbc41ae321c10f66c7d7985e328edbdec8 /source/tools | |
| parent | 834d4c5613e9c57c0b9fba46fa717fd7fb9d5891 (diff) | |
Notes
Diffstat (limited to 'source/tools')
| -rw-r--r-- | source/tools/acpidump/apdump.c | 3 | ||||
| -rw-r--r-- | source/tools/acpidump/apmain.c | 3 | ||||
| -rw-r--r-- | source/tools/acpiexec/aeinitfile.c | 3 | ||||
| -rw-r--r-- | source/tools/acpiexec/aemain.c | 5 | ||||
| -rw-r--r-- | source/tools/acpiexec/aetables.c | 8 | ||||
| -rw-r--r-- | source/tools/acpisrc/acpisrc.h | 1 | ||||
| -rw-r--r-- | source/tools/acpisrc/asfile.c | 67 | ||||
| -rw-r--r-- | source/tools/acpisrc/asmain.c | 24 |
8 files changed, 100 insertions, 14 deletions
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index abc5c4f784f0..cd83dcc4c591 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -434,8 +434,7 @@ ApDumpTableByAddress ( /* Convert argument to an integer physical address */ - Status = AcpiUtStrtoul64 (AsciiAddress, ACPI_STRTOUL_64BIT, - &LongAddress); + Status = AcpiUtStrtoul64 (AsciiAddress, &LongAddress); if (ACPI_FAILURE (Status)) { fprintf (stderr, "%s: Could not convert to a physical address\n", diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 6491fe9e51a2..99962797d702 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -343,8 +343,7 @@ ApDoOptions ( case 'r': /* Dump tables from specified RSDP */ - Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, ACPI_STRTOUL_64BIT, - &Gbl_RsdpBase); + Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, &Gbl_RsdpBase); if (ACPI_FAILURE (Status)) { fprintf (stderr, "%s: Could not convert to a physical address\n", diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index 393e53877563..72ccc0f8242c 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -311,8 +311,7 @@ AeDoOneOverride ( /* Extract the 64-bit integer */ - Status = AcpiUtStrtoul64 (ValueString, - (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &Value); + Status = AcpiUtStrtoul64 (ValueString, &Value); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("%s %s\n", ValueString, diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 3ea512100da4..323e2bfa1700 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -598,11 +598,6 @@ main ( goto ErrorExit; } - /* ACPICA runtime configuration */ - - AcpiGbl_MaxLoopIterations = 400; - - /* Initialize the AML debugger */ Status = AcpiInitializeDebugger (); diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c index 671b2a1d058b..8d2ea56eb372 100644 --- a/source/tools/acpiexec/aetables.c +++ b/source/tools/acpiexec/aetables.c @@ -598,6 +598,14 @@ AeInstallTables ( Status = AcpiInitializeTables (NULL, ACPI_MAX_INIT_TABLES, TRUE); ACPI_CHECK_OK (AcpiInitializeTables, Status); + /* + * The following code is prepared to test the deferred table + * verification mechanism. When AcpiGbl_EnableTableValidation is set + * to FALSE by default, AcpiReallocateRootTable() sets it back to TRUE + * and triggers the deferred table verification mechanism accordingly. + */ + (void) AcpiReallocateRootTable (); + if (AcpiGbl_LoadTestTables) { /* Test multiple table/UEFI support. First, get the headers */ diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h index 32d48b4c4b58..645d3d06c24e 100644 --- a/source/tools/acpisrc/acpisrc.h +++ b/source/tools/acpisrc/acpisrc.h @@ -230,6 +230,7 @@ extern BOOLEAN Gbl_IgnoreLoneLineFeeds; extern BOOLEAN Gbl_HasLoneLineFeeds; extern BOOLEAN Gbl_Cleanup; extern BOOLEAN Gbl_IgnoreTranslationEscapes; +extern BOOLEAN Gbl_CheckAscii; extern void *Gbl_StructDefs; #define PARAM_LIST(pl) pl diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index 05660b001527..b5308d38277a 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -167,6 +167,11 @@ AsDetectLoneLineFeeds ( char *Filename, char *Buffer); +static BOOLEAN +AsCheckForNonPrintableChars ( + char *FileBuffer, + UINT32 FileSize); + static ACPI_INLINE int AsMaxInt (int a, int b) { @@ -636,6 +641,45 @@ AsConvertFile ( } } +/******************************************************************************* + * + * FUNCTION: AsCheckForNonPrintableChars + * + * PARAMETERS: FileBuffer - Buffer with contents of entire file + * FileSize - Size of the file and buffer + * + * RETURN: TRUE if there are no non-printable characters + * + * DESCRIPTION: Scan a file for any non-printable ASCII bytes. + * + ******************************************************************************/ + +static BOOLEAN +AsCheckForNonPrintableChars ( + char *FileBuffer, + UINT32 FileSize) +{ + BOOLEAN Found = TRUE; + UINT8 Byte; + UINT32 i; + + + /* Scan entire file for any non-printable characters */ + + for (i = 0; i < FileSize; i++) + { + Byte = FileBuffer[i]; + if (!isprint (Byte) && !isspace (Byte)) + { + printf ( "Non-printable character (0x%2.2X) " + "at file offset: %8u (0x%X)\n", Byte, i, i); + Found = FALSE; + } + } + + return (Found); +} + /****************************************************************************** * @@ -680,13 +724,20 @@ AsProcessOneFile ( } strcat (Pathname, Filename); - if (AsGetFile (Pathname, &Gbl_FileBuffer, &Gbl_FileSize)) { Status = -1; goto Exit1; } + /* Exit now if simply checking the file for printable ascii chars */ + + if (Gbl_CheckAscii) + { + Status = 0; + goto Exit2; + } + Gbl_HeaderSize = 0; if (strstr (Filename, ".asl")) { @@ -873,6 +924,19 @@ AsGetFile ( Buffer [Size] = 0; /* Null terminate the buffer */ fclose (File); + /* This option checks the entire file for non-printable chars */ + + if (Gbl_CheckAscii) + { + if (AsCheckForNonPrintableChars (Buffer, Size)) + { + printf ("File contains only printable ASCII characters\n"); + } + + free (Buffer); + return (0); + } + /* Check for unix contamination */ Gbl_HasLoneLineFeeds = AsDetectLoneLineFeeds (Filename, Buffer); @@ -891,7 +955,6 @@ ErrorFree: free (Buffer); ErrorExit: - fclose (File); return (-1); } diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c index 23816c387f88..a14af868a451 100644 --- a/source/tools/acpisrc/asmain.c +++ b/source/tools/acpisrc/asmain.c @@ -188,6 +188,7 @@ struct stat Gbl_StatBuf; char *Gbl_FileBuffer; UINT32 Gbl_FileSize; UINT32 Gbl_FileType; +BOOLEAN Gbl_CheckAscii = FALSE; BOOLEAN Gbl_VerboseMode = FALSE; BOOLEAN Gbl_QuietMode = FALSE; BOOLEAN Gbl_BatchMode = FALSE; @@ -201,7 +202,7 @@ BOOLEAN Gbl_Cleanup = FALSE; BOOLEAN Gbl_IgnoreTranslationEscapes = FALSE; #define AS_UTILITY_NAME "ACPI Source Code Conversion Utility" -#define AS_SUPPORTED_OPTIONS "cdhilqsuv^y" +#define AS_SUPPORTED_OPTIONS "acdhilqsuv^y" /****************************************************************************** @@ -361,6 +362,7 @@ AsDisplayUsage ( ACPI_USAGE_HEADER ("acpisrc [-c|l|u] [-dsvy] <SourceDir> <DestinationDir>"); + ACPI_OPTION ("-a <file>", "Check entire file for non-printable characters"); 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"); @@ -505,6 +507,11 @@ main ( Gbl_QuietMode = TRUE; break; + case 'a': + + Gbl_CheckAscii = TRUE; + break; + default: AsDisplayUsage (); @@ -520,6 +527,14 @@ main ( return (-1); } + /* This option checks the entire file for printable ascii chars */ + + if (Gbl_CheckAscii) + { + AsProcessOneFile (NULL, NULL, NULL, 0, SourcePath, FILE_TYPE_SOURCE); + return (0); + } + TargetPath = argv[AcpiGbl_Optind+1]; if (!ConversionTable) @@ -558,6 +573,13 @@ main ( } else { + if (Gbl_CheckAscii) + { + AsProcessOneFile (NULL, NULL, NULL, 0, + SourcePath, FILE_TYPE_SOURCE); + return (0); + } + /* Process a single file */ /* Differentiate between source and header files */ |
