diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2014-06-27 19:10:35 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2014-06-27 19:10:35 +0000 |
commit | e599b42ef5047e5546af949d87d2cfd2e17062b0 (patch) | |
tree | eeef1a6644e518893667349342fa66f9f0249fec /source/tools/acpidump/apdump.c | |
parent | 6b8f78e0a6a7880856440b372097482adb326592 (diff) |
Notes
Diffstat (limited to 'source/tools/acpidump/apdump.c')
-rw-r--r-- | source/tools/acpidump/apdump.c | 76 |
1 files changed, 24 insertions, 52 deletions
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index 0bd0294988b4..ab5c32cde606 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -76,7 +76,7 @@ ApIsValidHeader ( if (!AcpiUtValidAcpiName (Table->Signature)) { - fprintf (stderr, "Table signature (0x%8.8X) is invalid\n", + AcpiLogError ("Table signature (0x%8.8X) is invalid\n", *(UINT32 *) Table->Signature); return (FALSE); } @@ -85,7 +85,7 @@ ApIsValidHeader ( if (Table->Length < sizeof (ACPI_TABLE_HEADER)) { - fprintf (stderr, "Table length (0x%8.8X) is invalid\n", + AcpiLogError ("Table length (0x%8.8X) is invalid\n", Table->Length); return (FALSE); } @@ -131,7 +131,7 @@ ApIsValidChecksum ( if (ACPI_FAILURE (Status)) { - fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n", + AcpiLogError ("%4.4s: Warning: wrong checksum in table\n", Table->Signature); } @@ -223,12 +223,13 @@ ApDumpTableBuffer ( * Note: simplest to just always emit a 64-bit address. AcpiXtract * utility can handle this. */ - printf ("%4.4s @ 0x%8.8X%8.8X\n", Table->Signature, - ACPI_FORMAT_UINT64 (Address)); + AcpiUtFilePrintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n", + Table->Signature, ACPI_FORMAT_UINT64 (Address)); - AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), TableLength, + AcpiUtDumpBufferToFile (Gbl_OutputFile, + ACPI_CAST_PTR (UINT8, Table), TableLength, DB_BYTE_DISPLAY, 0); - printf ("\n"); + AcpiUtFilePrintf (Gbl_OutputFile, "\n"); return (0); } @@ -273,20 +274,20 @@ ApDumpAllTables ( } else if (i == 0) { - fprintf (stderr, "Could not get ACPI tables, %s\n", + AcpiLogError ("Could not get ACPI tables, %s\n", AcpiFormatException (Status)); return (-1); } else { - fprintf (stderr, "Could not get ACPI table at index %u, %s\n", + AcpiLogError ("Could not get ACPI table at index %u, %s\n", i, AcpiFormatException (Status)); continue; } } TableStatus = ApDumpTableBuffer (Table, Instance, Address); - free (Table); + ACPI_FREE (Table); if (TableStatus) { @@ -328,7 +329,7 @@ ApDumpTableByAddress ( Status = AcpiUtStrtoul64 (AsciiAddress, 0, &LongAddress); if (ACPI_FAILURE (Status)) { - fprintf (stderr, "%s: Could not convert to a physical address\n", + AcpiLogError ("%s: Could not convert to a physical address\n", AsciiAddress); return (-1); } @@ -337,14 +338,14 @@ ApDumpTableByAddress ( Status = AcpiOsGetTableByAddress (Address, &Table); if (ACPI_FAILURE (Status)) { - fprintf (stderr, "Could not get table at 0x%8.8X%8.8X, %s\n", + AcpiLogError ("Could not get table at 0x%8.8X%8.8X, %s\n", ACPI_FORMAT_UINT64 (Address), AcpiFormatException (Status)); return (-1); } TableStatus = ApDumpTableBuffer (Table, 0, Address); - free (Table); + ACPI_FREE (Table); return (TableStatus); } @@ -374,9 +375,9 @@ ApDumpTableByName ( int TableStatus; - if (strlen (Signature) != ACPI_NAME_SIZE) + if (ACPI_STRLEN (Signature) != ACPI_NAME_SIZE) { - fprintf (stderr, + AcpiLogError ( "Invalid table signature [%s]: must be exactly 4 characters\n", Signature); return (-1); @@ -384,18 +385,18 @@ ApDumpTableByName ( /* Table signatures are expected to be uppercase */ - strcpy (LocalSignature, Signature); + ACPI_STRCPY (LocalSignature, Signature); AcpiUtStrupr (LocalSignature); /* To be friendly, handle tables whose signatures do not match the name */ if (ACPI_COMPARE_NAME (LocalSignature, "FADT")) { - strcpy (LocalSignature, ACPI_SIG_FADT); + ACPI_STRCPY (LocalSignature, ACPI_SIG_FADT); } else if (ACPI_COMPARE_NAME (LocalSignature, "MADT")) { - strcpy (LocalSignature, ACPI_SIG_MADT); + ACPI_STRCPY (LocalSignature, ACPI_SIG_MADT); } /* Dump all instances of this signature (to handle multiple SSDTs) */ @@ -413,14 +414,14 @@ ApDumpTableByName ( return (0); } - fprintf (stderr, + AcpiLogError ( "Could not get ACPI table with signature [%s], %s\n", LocalSignature, AcpiFormatException (Status)); return (-1); } TableStatus = ApDumpTableBuffer (Table, Instance, Address); - free (Table); + ACPI_FREE (Table); if (TableStatus) { @@ -467,7 +468,7 @@ ApDumpTableFromFile ( if (Table->Length > FileSize) { - fprintf (stderr, + AcpiLogError ( "Table length (0x%X) is too large for input file (0x%X) %s\n", Table->Length, FileSize, Pathname); goto Exit; @@ -475,7 +476,7 @@ ApDumpTableFromFile ( if (Gbl_VerboseMode) { - fprintf (stderr, + AcpiLogError ( "Input file: %s contains table [%4.4s], 0x%X (%u) bytes\n", Pathname, Table->Signature, FileSize, FileSize); } @@ -483,35 +484,6 @@ ApDumpTableFromFile ( TableStatus = ApDumpTableBuffer (Table, 0, 0); Exit: - free (Table); + ACPI_FREE (Table); return (TableStatus); } - - -/****************************************************************************** - * - * FUNCTION: AcpiOs* print functions - * - * DESCRIPTION: Used for linkage with ACPICA modules - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiOsPrintf ( - const char *Fmt, - ...) -{ - va_list Args; - - va_start (Args, Fmt); - vfprintf (stdout, Fmt, Args); - va_end (Args); -} - -void -AcpiOsVprintf ( - const char *Fmt, - va_list Args) -{ - vfprintf (stdout, Fmt, Args); -} |