diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2018-12-13 19:04:25 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2018-12-13 19:04:25 +0000 |
commit | d28459aaaf532373b12c80aa5b869f8b591954e7 (patch) | |
tree | 22941844047df08d63d286d7dfbf38f3a8f79e0f /source/tools | |
parent | 4d4b15a0e8524e15826ac932bd05252dbd246422 (diff) |
Notes
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/acpibin/abcompare.c | 6 | ||||
-rw-r--r-- | source/tools/acpiexec/aemain.c | 7 | ||||
-rw-r--r-- | source/tools/acpihelp/ahdecode.c | 120 | ||||
-rw-r--r-- | source/tools/acpixtract/acpixtract.c | 27 | ||||
-rw-r--r-- | source/tools/acpixtract/acpixtract.h | 7 | ||||
-rw-r--r-- | source/tools/acpixtract/axutils.c | 33 |
6 files changed, 164 insertions, 36 deletions
diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index 740d995fc2bf0..ca80def96406d 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -537,7 +537,11 @@ AbCompareAmlFiles ( printf ("Compare offset: %u\n", AbGbl_CompareOffset); if (AbGbl_CompareOffset) { - fseek (File2, AbGbl_CompareOffset, SEEK_CUR); + if (fseek (File2, AbGbl_CompareOffset, SEEK_CUR)) + { + printf ("Seek error on file %s\n", File2Path); + goto Exit2; + } } Actual1 = fread (&Char1, 1, 1, File1); diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index e8ae348cdf9b4..58e639fae8dd3 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -266,6 +266,7 @@ usage ( ACPI_OPTION ("-ef", "Enable display of final memory statistics"); ACPI_OPTION ("-ei", "Enable additional tests for ACPICA interfaces"); ACPI_OPTION ("-el", "Enable loading of additional test tables"); + ACPI_OPTION ("-eo", "Enable object evaluation log"); ACPI_OPTION ("-es", "Enable Interpreter Slack Mode"); ACPI_OPTION ("-et", "Enable debug semaphore timeout"); printf ("\n"); @@ -406,6 +407,12 @@ AeDoOptions ( AcpiGbl_LoadTestTables = TRUE; break; + case 'o': + + AcpiDbgLevel |= ACPI_LV_EVALUATION; + AcpiGbl_DbConsoleDebugLevel |= ACPI_LV_EVALUATION; + break; + case 's': AcpiGbl_EnableInterpreterSlack = TRUE; diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 4c6850385cb1a..416acf4d3787d 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -168,6 +168,10 @@ AhDisplayPredefinedInfo ( char *Name); static void +AhDoSpecialNames ( + char *Name); + +static void AhDisplayResourceName ( const ACPI_PREDEFINED_INFO *ThisName); @@ -293,15 +297,23 @@ AhFindPredefinedNames ( { UINT32 Length; BOOLEAN Found; - char Name[9]; + char Name[ACPI_NAME_SIZE + 1]; - if (!NamePrefix || (NamePrefix[0] == '*')) + if (!NamePrefix || (*NamePrefix == '*')) { Found = AhDisplayPredefinedName (NULL, 0); return; } + Length = strlen (NamePrefix); + if (Length > ACPI_NAME_SIZE) + { + printf ("%.8s: Predefined name must be 4 characters maximum\n", + NamePrefix); + return; + } + /* Contruct a local name or name prefix */ AcpiUtStrupr (NamePrefix); @@ -311,14 +323,13 @@ AhFindPredefinedNames ( } Name[0] = '_'; - AcpiUtSafeStrncpy (&Name[1], NamePrefix, 7); + AcpiUtSafeStrncpy (&Name[1], NamePrefix, 4); - Length = strlen (Name); - if (Length > ACPI_NAME_SIZE) - { - printf ("%.8s: Predefined name must be 4 characters maximum\n", Name); - return; - } + /* Check for special names such as _Exx, _ACx, etc. */ + + AhDoSpecialNames (Name); + + /* Lookup and display the name(s) */ Found = AhDisplayPredefinedName (Name, Length); if (!Found) @@ -330,6 +341,95 @@ AhFindPredefinedNames ( /******************************************************************************* * + * FUNCTION: AhDoSpecialNames + * + * PARAMETERS: Name - Name or prefix to find + * + * RETURN: None + * + * DESCRIPTION: Detect and handle the "special" names such as _Exx, _ACx, etc. + * + * Current support: + * _EJx + * _Exx + * _Lxx + * _Qxx + * _Wxx + * _ACx + * _ALx + * _T_x + * + ******************************************************************************/ + +static void +AhDoSpecialNames ( + char *Name) +{ + + /* + * Check for the special names that have one or more numeric + * suffixes. For example, _Lxx can have 256 different flavors, + * from _L00 to _LFF. + */ + switch (Name[1]) + { + case 'E': + if (Name[2] == 'J') + { + if (isdigit (Name[3]) || (Name[3] == 'X')) + { + /* _EJx */ + + Name[3] = 'x'; + break; + } + } + + /* Fallthrough */ + + case 'L': + case 'Q': + case 'W': + if ((isxdigit (Name[2]) && isxdigit (Name[3])) + || + ((Name[2] == 'X') && (Name[3] == 'X'))) + { + /* _Exx, _Lxx, _Qxx, or _Wxx */ + + Name[2] = 'x'; + Name[3] = 'x'; + } + break; + + case 'A': + if ((Name[2] == 'C') || (Name[2] == 'L')) + { + if (isdigit (Name[3]) || (Name[3] == 'X')) + { + /* _ACx or _ALx */ + + Name[3] = 'x'; + } + } + break; + + case 'T': + if (Name[2] == '_') + { + /* _T_x (Reserved for iASL compiler */ + + Name[3] = 'x'; + } + break; + + default: + break; + } +} + + +/******************************************************************************* + * * FUNCTION: AhDisplayPredefinedName * * PARAMETERS: Name - Name or name prefix @@ -420,7 +520,7 @@ AhDisplayPredefinedInfo ( /* NOTE: we check both tables always because there are some dupes */ - /* Check against the predefine methods first */ + /* Check against the predefined methods first */ ThisName = AcpiUtMatchPredefinedMethod (Name); if (ThisName) diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c index be9a5210de636..6de90de2d5bda 100644 --- a/source/tools/acpixtract/acpixtract.c +++ b/source/tools/acpixtract/acpixtract.c @@ -176,8 +176,8 @@ AxExtractTables ( { FILE *InputFile; FILE *OutputFile = NULL; - unsigned int BytesConverted; - unsigned int ThisTableBytesWritten = 0; + int BytesConverted; + int ThisTableBytesWritten = 0; unsigned int FoundTable = 0; unsigned int Instances = 0; unsigned int ThisInstance; @@ -323,8 +323,7 @@ AxExtractTables ( /* Empty line or non-data line terminates the data block */ - BytesConverted = AxConvertAndWrite (OutputFile, ThisSignature, - ThisTableBytesWritten); + BytesConverted = AxConvertAndWrite (OutputFile, ThisSignature); switch (BytesConverted) { case 0: @@ -334,6 +333,7 @@ AxExtractTables ( case -1: + Status = -1; goto CleanupAndExit; /* There was a write error */ default: /* Normal case, get next line */ @@ -397,8 +397,8 @@ AxExtractToMultiAmlFile ( FILE *InputFile; FILE *OutputFile; int Status = 0; - unsigned int TotalBytesWritten = 0; - unsigned int ThisTableBytesWritten = 0; + int TotalBytesWritten = 0; + int ThisTableBytesWritten = 0; unsigned int BytesConverted; char ThisSignature[4]; unsigned int State = AX_STATE_FIND_HEADER; @@ -494,8 +494,7 @@ AxExtractToMultiAmlFile ( /* Empty line or non-data line terminates the data block */ - BytesConverted = AxConvertAndWrite ( - OutputFile, ThisSignature, ThisTableBytesWritten); + BytesConverted = AxConvertAndWrite (OutputFile, ThisSignature); switch (BytesConverted) { case 0: @@ -505,6 +504,7 @@ AxExtractToMultiAmlFile ( case -1: + Status = -1; goto CleanupAndExit; /* There was a write error */ default: /* Normal case, get next line */ @@ -561,6 +561,7 @@ AxListAllTables ( FILE *InputFile; unsigned char Header[48]; UINT32 ByteCount = 0; + UINT32 ThisLineByteCount; unsigned int State = AX_STATE_FIND_HEADER; @@ -633,7 +634,15 @@ AxListAllTables ( /* Convert header to hex and display it */ - ByteCount += AxConvertToBinary (Gbl_LineBuffer, &Header[ByteCount]); + ThisLineByteCount = AxConvertToBinary (Gbl_LineBuffer, + &Header[ByteCount]); + if (ThisLineByteCount == EOF) + { + fclose (InputFile); + return (-1); + } + + ByteCount += ThisLineByteCount; if (ByteCount >= sizeof (ACPI_TABLE_HEADER)) { AxDumpTableHeader (Header); diff --git a/source/tools/acpixtract/acpixtract.h b/source/tools/acpixtract/acpixtract.h index 88b16670ec10d..3adf89055fe63 100644 --- a/source/tools/acpixtract/acpixtract.h +++ b/source/tools/acpixtract/acpixtract.h @@ -276,13 +276,12 @@ BOOLEAN AxIsDataBlockHeader ( void); -long +int AxConvertAndWrite ( FILE *OutputFile, - char *ThisSignature, - unsigned int ThisTableBytesWritten); + char *ThisSignature); -size_t +int AxConvertToBinary ( char *InputLine, unsigned char *OutputData); diff --git a/source/tools/acpixtract/axutils.c b/source/tools/acpixtract/axutils.c index 8fba70047f934..61cb2d8a8b6aa 100644 --- a/source/tools/acpixtract/axutils.c +++ b/source/tools/acpixtract/axutils.c @@ -427,7 +427,7 @@ AxNormalizeSignature ( * ******************************************************************************/ -size_t +int AxConvertToBinary ( char *InputLine, unsigned char *OutputData) @@ -468,14 +468,22 @@ AxConvertToBinary ( &Converted[8], &Converted[9], &Converted[10], &Converted[11], &Converted[12], &Converted[13], &Converted[14], &Converted[15]); - /* Pack converted data into a byte array */ + if (BytesConverted == EOF) + { + printf ("EOF while converting ASCII line to binary\n"); + return (-1); + } + /* + * Pack converted data into a byte array. + * Note: BytesConverted == 0 is acceptable. + */ for (i = 0; i < BytesConverted; i++) { OutputData[i] = (unsigned char) Converted[i]; } - return ((size_t) BytesConverted); + return (BytesConverted); } @@ -603,7 +611,6 @@ AxGetNextInstance ( * * PARAMETERS: OutputFile - Where to write the binary data * ThisSignature - Signature of current ACPI table - * ThisTableBytesWritten - Total count of data written * * RETURN: Length of the converted line * @@ -616,27 +623,29 @@ AxGetNextInstance ( * ******************************************************************************/ -long +int AxConvertAndWrite ( FILE *OutputFile, - char *ThisSignature, - unsigned int ThisTableBytesWritten) + char *ThisSignature) { - size_t BytesWritten; - size_t BytesConverted; + int BytesWritten; + int BytesConverted; /* Convert one line of ascii hex data to binary */ BytesConverted = AxConvertToBinary (Gbl_LineBuffer, Gbl_BinaryData); - - /* Write the binary data */ - + if (BytesConverted == EOF) + { + return (EOF); + } if (!BytesConverted) { return (0); } + /* Write the binary data */ + BytesWritten = fwrite (Gbl_BinaryData, 1, BytesConverted, OutputFile); if (BytesWritten != BytesConverted) { |