summaryrefslogtreecommitdiff
path: root/source/tools/acpidump
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2016-07-22 23:48:21 +0800
committerLv Zheng <lv.zheng@intel.com>2016-07-22 23:48:21 +0800
commit189429fb7d06cdb89043ae32d615faf553467f1d (patch)
tree84308ac4ccb05d2162dc0fe879aa1f51e2c5985c /source/tools/acpidump
parentd261d40ea168f8e4c4e3986de720b8651c4aba1c (diff)
downloadacpica-189429fb7d06cdb89043ae32d615faf553467f1d.tar.gz
Clib: Eliminate AcpiOsXXXFile()/AcpiLogError and link clibrary fxxx()/errno/perror() instead
This patch follows new ACPICA design, eliminates old portable OSLs, and implements fopen/fread/fwrite/fclose/fseek/ftell for GNU EFI environment. This patch also eliminates AcpiLogError(), convering them into fprintf(stderr)/perror(). Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Diffstat (limited to 'source/tools/acpidump')
-rw-r--r--source/tools/acpidump/apdump.c24
-rw-r--r--source/tools/acpidump/apfiles.c36
-rw-r--r--source/tools/acpidump/apmain.c14
3 files changed, 36 insertions, 38 deletions
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c
index bb5bd545b..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);
}
@@ -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 c01fc6988..b7583ea50 100644
--- a/source/tools/acpidump/apfiles.c
+++ b/source/tools/acpidump/apfiles.c
@@ -145,7 +145,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')
{
@@ -187,10 +187,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);
}
@@ -261,30 +261,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);
}
@@ -315,10 +314,10 @@ ApGetTableFromFile (
/* 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);
}
@@ -327,7 +326,7 @@ ApGetTableFromFile (
FileSize = CmGetFileSize (File);
if (FileSize == ACPI_UINT32_MAX)
{
- AcpiLogError (
+ fprintf (stderr,
"Could not get input file size: %s\n", Pathname);
goto Cleanup;
}
@@ -337,18 +336,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;
@@ -357,6 +355,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 a897aedde..88630c94e 100644
--- a/source/tools/acpidump/apmain.c
+++ b/source/tools/acpidump/apmain.c
@@ -232,7 +232,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);
}
@@ -286,7 +286,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);
}
@@ -312,7 +312,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);
}
@@ -343,7 +343,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;
/*
@@ -469,7 +469,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 +487,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);