diff options
author | Robert Moore <Robert.Moore@intel.com> | 2014-02-19 12:10:20 -0800 |
---|---|---|
committer | Robert Moore <Robert.Moore@intel.com> | 2014-02-19 12:10:20 -0800 |
commit | 55dfedeb9c79b15e6905e196a4b0bc38c12d8f7c (patch) | |
tree | 0324141de0ca1750c9d2472618b36035447571bc | |
parent | 99af4cd7d1bf5c67cbc6d00609071e0e62ac7e5d (diff) |
AcpiBin: Remove option to extract binary files.
This option is made obsolete by the AcpiXtract utility. Removed
to eliminate duplicate code, reduce maintenance.
-rw-r--r-- | source/tools/acpibin/abcompare.c | 183 | ||||
-rw-r--r-- | source/tools/acpibin/abmain.c | 15 | ||||
-rw-r--r-- | source/tools/acpibin/acpibin.h | 6 |
3 files changed, 1 insertions, 203 deletions
diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index b6afb4e77..ff8886758 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -154,67 +154,6 @@ AeLocalGetRootPointer ( void); -/******************************************************************************* - * - * FUNCTION: UtHexCharToValue - * - * PARAMETERS: HexChar - Hex character in Ascii - * - * RETURN: The binary value of the hex character - * - * DESCRIPTION: Perform ascii-to-hex translation - * - ******************************************************************************/ - -static UINT8 -UtHexCharToValue ( - int HexChar, - UINT8 *OutBinary) -{ - - if (HexChar >= 0x30 && HexChar <= 0x39) - { - *OutBinary = (UINT8) (HexChar - 0x30); - return (1); - } - - else if (HexChar >= 0x41 && HexChar <= 0x46) - { - *OutBinary = (UINT8) (HexChar - 0x37); - return (1); - } - - else if (HexChar >= 0x61 && HexChar <= 0x66) - { - *OutBinary = (UINT8) (HexChar - 0x57); - return (1); - } - return (0); -} - -static UINT8 -AbHexByteToBinary ( - char *HexString, - char *OutBinary) -{ - UINT8 Local1; - UINT8 Local2; - - - if (!UtHexCharToValue (HexString[0], &Local1)) - { - return (0); - } - if (!UtHexCharToValue (HexString[1], &Local2)) - { - return (0); - } - - *OutBinary = (UINT8) ((Local1 << 4) | Local2); - return (2); -} - - /****************************************************************************** * * FUNCTION: AbValidateHeader @@ -756,128 +695,6 @@ Exit1: /****************************************************************************** * - * FUNCTION: AbExtractAmlFile - * - * DESCRIPTION: Extract a binary AML file from a text file (as produced by the - * DumpAmlFile procedure or the "acpidump" table utility. - * - ******************************************************************************/ - -int -AbExtractAmlFile ( - char *TableSig, - char *File1Path, - char *File2Path) -{ - char *Table; - char Value; - UINT32 i; - FILE *FileHandle; - FILE *FileOutHandle; - UINT32 Count = 0; - int Scanned; - - - /* Open in/out files. input is in text mode, output is in binary mode */ - - FileHandle = fopen (File1Path, "rt"); - if (!FileHandle) - { - printf ("Could not open file %s\n", File1Path); - return (-1); - } - - FileOutHandle = fopen (File2Path, "w+b"); - if (!FileOutHandle) - { - printf ("Could not open file %s\n", File2Path); - return (-1); - } - - /* Force input table sig to uppercase */ - - AcpiUtStrupr (TableSig); - - - /* TBD: examine input for ASCII */ - - - /* We have an ascii file, grab one line at a time */ - - while (fgets (Buffer, BUFFER_SIZE, FileHandle)) - { - /* The 4-char ACPI signature appears at the beginning of a line */ - - if (ACPI_COMPARE_NAME (Buffer, TableSig)) - { - printf ("Found table [%4.4s]\n", TableSig); - - /* - * Eat all lines in the table, of the form: - * <offset>: <16 bytes of hex data, separated by spaces> <ASCII representation> <newline> - * - * Example: - * - * 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........ - * - */ - while (fgets (Buffer, BUFFER_SIZE, FileHandle)) - { - /* Get past the offset, terminated by a colon */ - - Table = strchr (Buffer, ':'); - if (!Table) - { - /* No colon, all done */ - goto Exit; - } - - Table += 2; /* Eat the colon + space */ - - for (i = 0; i < 16; i++) - { - Scanned = AbHexByteToBinary (Table, &Value); - if (!Scanned) - { - goto Exit; - } - - Table += 3; /* Go past this hex byte and space */ - - /* Write the converted (binary) byte */ - - if (fwrite (&Value, 1, 1, FileOutHandle) != 1) - { - printf ("Error writing byte %u to output file: %s\n", - Count, File2Path); - goto Exit; - } - Count++; - } - } - - /* No more lines, EOF, all done */ - - goto Exit; - } - } - - /* Searched entire file, no match to table signature */ - - printf ("Could not match table signature\n"); - fclose (FileHandle); - return (-1); - -Exit: - printf ("%u (0x%X) bytes written to %s\n", Count, Count, File2Path); - fclose (FileHandle); - fclose (FileOutHandle); - return (0); -} - - -/****************************************************************************** - * * FUNCTION: Stubs * * DESCRIPTION: For linkage diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c index 53d560225..cb65616bd 100644 --- a/source/tools/acpibin/abmain.c +++ b/source/tools/acpibin/abmain.c @@ -126,7 +126,7 @@ AbDisplayUsage ( #define AB_UTILITY_NAME "ACPI Binary Table Dump Utility" -#define AB_SUPPORTED_OPTIONS "c:d:e:h:s:tv" +#define AB_SUPPORTED_OPTIONS "c:d:h:s:tv" /****************************************************************************** @@ -151,7 +151,6 @@ AbDisplayUsage ( ACPI_OPTION ("-c <File1><File2>", "Compare two binary AML files"); ACPI_OPTION ("-d <In><Out>", "Dump AML binary to text file"); - ACPI_OPTION ("-e <Sig><In><Out>", "Extract binary AML table from AcpiDump file"); ACPI_OPTION ("-h <File>", "Display table header for binary AML file"); ACPI_OPTION ("-s <File>", "Update checksum for binary AML file"); ACPI_OPTION ("-t", "Terse mode"); @@ -216,18 +215,6 @@ main ( Status = AbDumpAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind]); break; - case 'e': /* Extract AML text file */ - - if (argc < 5) - { - AbDisplayUsage (3); - return (-1); - } - - Status = AbExtractAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind], - argv[AcpiGbl_Optind+1]); - break; - case 'h': /* Display ACPI table header */ if (argc < 3) diff --git a/source/tools/acpibin/acpibin.h b/source/tools/acpibin/acpibin.h index 4474c4692..f4e1685b5 100644 --- a/source/tools/acpibin/acpibin.h +++ b/source/tools/acpibin/acpibin.h @@ -148,12 +148,6 @@ AbCompareAmlFiles ( char *File2Path); int -AbExtractAmlFile ( - char *TableSig, - char *File1Path, - char *File2Path); - -int AbDumpAmlFile ( char *File1Path, char *File2Path); |