summaryrefslogtreecommitdiff
path: root/source/tools/acpidump
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2016-06-15 10:33:47 -0700
committerGitHub <noreply@github.com>2016-06-15 10:33:47 -0700
commit8aac0be3c840747a032b63e7365c99190e2a0ba9 (patch)
treec667316883055dd53603d5343436465a14283f10 /source/tools/acpidump
parentf78ce8644e4b13f7d092348ff33e3bf9d36eeffa (diff)
parentcc7c7ebe27537840b6e0109d8ef1435c306669bc (diff)
downloadacpica-8aac0be3c840747a032b63e7365c99190e2a0ba9.tar.gz
Merge pull request #143 from zetalog/efi-edk2
Efi edk2
Diffstat (limited to 'source/tools/acpidump')
-rw-r--r--source/tools/acpidump/acpidump.h12
-rw-r--r--source/tools/acpidump/apdump.c28
-rw-r--r--source/tools/acpidump/apfiles.c42
-rw-r--r--source/tools/acpidump/apmain.c15
4 files changed, 42 insertions, 55 deletions
diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h
index 76843da28..5d6ed795c 100644
--- a/source/tools/acpidump/acpidump.h
+++ b/source/tools/acpidump/acpidump.h
@@ -128,12 +128,6 @@
#include "accommon.h"
#include "actables.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-
/* Globals */
EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE);
@@ -145,12 +139,6 @@ EXTERN ACPI_FILE INIT_GLOBAL (Gbl_OutputFile, NULL);
EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL);
EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0);
-/* Globals required for use with ACPICA modules */
-
-#ifdef _DECLARE_GLOBALS
-UINT8 AcpiGbl_IntegerByteWidth = 8;
-#endif
-
/* Action table used to defer requested options */
typedef struct ap_dump_action
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c
index 783060080..68065d733 100644
--- a/source/tools/acpidump/apdump.c
+++ b/source/tools/acpidump/apdump.c
@@ -148,7 +148,7 @@ ApIsValidHeader (
if (!AcpiUtValidNameseg (Table->Signature))
{
- AcpiLogError ("Table signature (0x%8.8X) is invalid\n",
+ fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
*(UINT32 *) Table->Signature);
return (FALSE);
}
@@ -157,7 +157,7 @@ ApIsValidHeader (
if (Table->Length < sizeof (ACPI_TABLE_HEADER))
{
- AcpiLogError ("Table length (0x%8.8X) is invalid\n",
+ fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
return (FALSE);
}
@@ -203,7 +203,7 @@ ApIsValidChecksum (
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("%4.4s: Warning: wrong checksum in table\n",
+ fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n",
Table->Signature);
}
@@ -295,13 +295,13 @@ ApDumpTableBuffer (
* Note: simplest to just always emit a 64-bit address. AcpiXtract
* utility can handle this.
*/
- AcpiUtFilePrintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
+ fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
Table->Signature, ACPI_FORMAT_UINT64 (Address));
AcpiUtDumpBufferToFile (Gbl_OutputFile,
ACPI_CAST_PTR (UINT8, Table), TableLength,
DB_BYTE_DISPLAY, 0);
- AcpiUtFilePrintf (Gbl_OutputFile, "\n");
+ fprintf (Gbl_OutputFile, "\n");
return (0);
}
@@ -346,13 +346,13 @@ ApDumpAllTables (
}
else if (i == 0)
{
- AcpiLogError ("Could not get ACPI tables, %s\n",
+ fprintf (stderr, "Could not get ACPI tables, %s\n",
AcpiFormatException (Status));
return (-1);
}
else
{
- AcpiLogError ("Could not get ACPI table at index %u, %s\n",
+ fprintf (stderr, "Could not get ACPI table at index %u, %s\n",
i, AcpiFormatException (Status));
continue;
}
@@ -402,7 +402,7 @@ ApDumpTableByAddress (
ACPI_MAX64_BYTE_WIDTH, &LongAddress);
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("%s: Could not convert to a physical address\n",
+ fprintf (stderr, "%s: Could not convert to a physical address\n",
AsciiAddress);
return (-1);
}
@@ -411,7 +411,7 @@ ApDumpTableByAddress (
Status = AcpiOsGetTableByAddress (Address, &Table);
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("Could not get table at 0x%8.8X%8.8X, %s\n",
+ fprintf (stderr, "Could not get table at 0x%8.8X%8.8X, %s\n",
ACPI_FORMAT_UINT64 (Address),
AcpiFormatException (Status));
return (-1);
@@ -450,7 +450,7 @@ ApDumpTableByName (
if (strlen (Signature) != ACPI_NAME_SIZE)
{
- AcpiLogError (
+ fprintf (stderr,
"Invalid table signature [%s]: must be exactly 4 characters\n",
Signature);
return (-1);
@@ -487,7 +487,7 @@ ApDumpTableByName (
return (0);
}
- AcpiLogError (
+ fprintf (stderr,
"Could not get ACPI table with signature [%s], %s\n",
LocalSignature, AcpiFormatException (Status));
return (-1);
@@ -539,7 +539,7 @@ ApDumpTableFromFile (
if (!AcpiUtValidNameseg (Table->Signature))
{
- AcpiLogError (
+ fprintf (stderr,
"No valid ACPI signature was found in input file %s\n",
Pathname);
}
@@ -548,7 +548,7 @@ ApDumpTableFromFile (
if (Table->Length > FileSize)
{
- AcpiLogError (
+ fprintf (stderr,
"Table length (0x%X) is too large for input file (0x%X) %s\n",
Table->Length, FileSize, Pathname);
goto Exit;
@@ -556,7 +556,7 @@ ApDumpTableFromFile (
if (Gbl_VerboseMode)
{
- AcpiLogError (
+ fprintf (stderr,
"Input file: %s contains table [%4.4s], 0x%X (%u) bytes\n",
Pathname, Table->Signature, FileSize, FileSize);
}
diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c
index 9394e98cf..ad02f6d03 100644
--- a/source/tools/acpidump/apfiles.c
+++ b/source/tools/acpidump/apfiles.c
@@ -146,7 +146,7 @@ ApIsExistingFile (
if (!stat (Pathname, &StatInfo))
{
- AcpiLogError ("Target path already exists, overwrite? [y|n] ");
+ fprintf (stderr, "Target path already exists, overwrite? [y|n] ");
if (getchar () != 'y')
{
@@ -188,10 +188,10 @@ ApOpenOutputFile (
/* Point stdout to the file */
- File = AcpiOsOpenFile (Pathname, ACPI_FILE_WRITING);
+ File = fopen (Pathname, "w");
if (!File)
{
- AcpiLogError ("Could not open output file: %s\n", Pathname);
+ fprintf (stderr, "Could not open output file: %s\n", Pathname);
return (-1);
}
@@ -225,7 +225,7 @@ ApWriteToBinaryFile (
char Filename[ACPI_NAME_SIZE + 16];
char InstanceStr [16];
ACPI_FILE File;
- size_t Actual;
+ ACPI_SIZE Actual;
UINT32 TableLength;
@@ -254,7 +254,7 @@ ApWriteToBinaryFile (
if (Instance > 0)
{
- AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
+ snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance);
strcat (Filename, InstanceStr);
}
@@ -262,30 +262,29 @@ ApWriteToBinaryFile (
if (Gbl_VerboseMode)
{
- AcpiLogError (
+ fprintf (stderr,
"Writing [%4.4s] to binary file: %s 0x%X (%u) bytes\n",
Table->Signature, Filename, Table->Length, Table->Length);
}
/* Open the file and dump the entire table in binary mode */
- File = AcpiOsOpenFile (Filename,
- ACPI_FILE_WRITING | ACPI_FILE_BINARY);
+ File = fopen (Filename, "wb");
if (!File)
{
- AcpiLogError ("Could not open output file: %s\n", Filename);
+ fprintf (stderr, "Could not open output file: %s\n", Filename);
return (-1);
}
- Actual = AcpiOsWriteFile (File, Table, 1, TableLength);
+ Actual = fwrite (Table, 1, TableLength, File);
if (Actual != TableLength)
{
- AcpiLogError ("Error writing binary output file: %s\n", Filename);
- AcpiOsCloseFile (File);
+ fprintf (stderr, "Error writing binary output file: %s\n", Filename);
+ fclose (File);
return (-1);
}
- AcpiOsCloseFile (File);
+ fclose (File);
return (0);
}
@@ -311,15 +310,15 @@ ApGetTableFromFile (
ACPI_TABLE_HEADER *Buffer = NULL;
ACPI_FILE File;
UINT32 FileSize;
- size_t Actual;
+ ACPI_SIZE Actual;
/* Must use binary mode */
- File = AcpiOsOpenFile (Pathname, ACPI_FILE_READING | ACPI_FILE_BINARY);
+ File = fopen (Pathname, "rb");
if (!File)
{
- AcpiLogError ("Could not open input file: %s\n", Pathname);
+ fprintf (stderr, "Could not open input file: %s\n", Pathname);
return (NULL);
}
@@ -328,7 +327,7 @@ ApGetTableFromFile (
FileSize = CmGetFileSize (File);
if (FileSize == ACPI_UINT32_MAX)
{
- AcpiLogError (
+ fprintf (stderr,
"Could not get input file size: %s\n", Pathname);
goto Cleanup;
}
@@ -338,18 +337,17 @@ ApGetTableFromFile (
Buffer = ACPI_ALLOCATE_ZEROED (FileSize);
if (!Buffer)
{
- AcpiLogError (
+ fprintf (stderr,
"Could not allocate file buffer of size: %u\n", FileSize);
goto Cleanup;
}
/* Read the entire file */
- Actual = AcpiOsReadFile (File, Buffer, 1, FileSize);
+ Actual = fread (Buffer, 1, FileSize, File);
if (Actual != FileSize)
{
- AcpiLogError (
- "Could not read input file: %s\n", Pathname);
+ fprintf (stderr, "Could not read input file: %s\n", Pathname);
ACPI_FREE (Buffer);
Buffer = NULL;
goto Cleanup;
@@ -358,6 +356,6 @@ ApGetTableFromFile (
*OutFileSize = FileSize;
Cleanup:
- AcpiOsCloseFile (File);
+ fclose (File);
return (Buffer);
}
diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c
index cfe0c3261..0e0e5b218 100644
--- a/source/tools/acpidump/apmain.c
+++ b/source/tools/acpidump/apmain.c
@@ -233,7 +233,7 @@ ApInsertAction (
CurrentAction++;
if (CurrentAction > AP_MAX_ACTIONS)
{
- AcpiLogError ("Too many table options (max %u)\n", AP_MAX_ACTIONS);
+ fprintf (stderr, "Too many table options (max %u)\n", AP_MAX_ACTIONS);
return (-1);
}
@@ -287,7 +287,7 @@ ApDoOptions (
}
else
{
- AcpiLogError ("%s: Cannot handle this switch, please use on|off\n",
+ fprintf (stderr, "%s: Cannot handle this switch, please use on|off\n",
AcpiGbl_Optarg);
return (-1);
}
@@ -313,7 +313,7 @@ ApDoOptions (
ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase);
if (ACPI_FAILURE (Status))
{
- AcpiLogError ("%s: Could not convert to a physical address\n",
+ fprintf (stderr, "%s: Could not convert to a physical address\n",
AcpiGbl_Optarg);
return (-1);
}
@@ -344,7 +344,7 @@ ApDoOptions (
case 'z': /* Verbose mode */
Gbl_VerboseMode = TRUE;
- AcpiLogError (ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
+ fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME));
continue;
/*
@@ -427,6 +427,7 @@ acpi_main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
AcpiOsInitialize ();
Gbl_OutputFile = ACPI_FILE_OUT;
+ AcpiGbl_IntegerByteWidth = 8;
/* Process command line options */
@@ -469,7 +470,7 @@ acpi_main (
default:
- AcpiLogError ("Internal error, invalid action: 0x%X\n",
+ fprintf (stderr, "Internal error, invalid action: 0x%X\n",
Action->ToBeDone);
return (-1);
}
@@ -487,11 +488,11 @@ acpi_main (
/* Summary for the output file */
FileSize = CmGetFileSize (Gbl_OutputFile);
- AcpiLogError ("Output file %s contains 0x%X (%u) bytes\n\n",
+ fprintf (stderr, "Output file %s contains 0x%X (%u) bytes\n\n",
Gbl_OutputFilename, FileSize, FileSize);
}
- AcpiOsCloseFile (Gbl_OutputFile);
+ fclose (Gbl_OutputFile);
}
return (Status);