diff options
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/acpidump/acpidump.h | 12 | ||||
-rw-r--r-- | source/tools/acpidump/apdump.c | 28 | ||||
-rw-r--r-- | source/tools/acpidump/apfiles.c | 42 | ||||
-rw-r--r-- | source/tools/acpidump/apmain.c | 15 | ||||
-rw-r--r-- | source/tools/acpiexec/aecommon.h | 7 | ||||
-rw-r--r-- | source/tools/acpiexec/aehandlers.c | 5 | ||||
-rw-r--r-- | source/tools/acpiexec/aeinitfile.c | 7 | ||||
-rw-r--r-- | source/tools/acpiexec/aemain.c | 15 |
8 files changed, 65 insertions, 66 deletions
diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h index 5d6ed795c..76843da28 100644 --- a/source/tools/acpidump/acpidump.h +++ b/source/tools/acpidump/acpidump.h @@ -128,6 +128,12 @@ #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); @@ -139,6 +145,12 @@ 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 68065d733..783060080 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -148,7 +148,7 @@ ApIsValidHeader ( if (!AcpiUtValidNameseg (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); } @@ -157,7 +157,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); } @@ -203,7 +203,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); } @@ -295,13 +295,13 @@ ApDumpTableBuffer ( * Note: simplest to just always emit a 64-bit address. AcpiXtract * utility can handle this. */ - fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n", + AcpiUtFilePrintf (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); - fprintf (Gbl_OutputFile, "\n"); + AcpiUtFilePrintf (Gbl_OutputFile, "\n"); return (0); } @@ -346,13 +346,13 @@ 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; } @@ -402,7 +402,7 @@ ApDumpTableByAddress ( ACPI_MAX64_BYTE_WIDTH, &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); } @@ -411,7 +411,7 @@ 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); @@ -450,7 +450,7 @@ ApDumpTableByName ( if (strlen (Signature) != ACPI_NAME_SIZE) { - fprintf (stderr, + AcpiLogError ( "Invalid table signature [%s]: must be exactly 4 characters\n", Signature); return (-1); @@ -487,7 +487,7 @@ ApDumpTableByName ( return (0); } - fprintf (stderr, + AcpiLogError ( "Could not get ACPI table with signature [%s], %s\n", LocalSignature, AcpiFormatException (Status)); return (-1); @@ -539,7 +539,7 @@ ApDumpTableFromFile ( if (!AcpiUtValidNameseg (Table->Signature)) { - fprintf (stderr, + AcpiLogError ( "No valid ACPI signature was found in input file %s\n", Pathname); } @@ -548,7 +548,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; @@ -556,7 +556,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); } diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index ad02f6d03..9394e98cf 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -146,7 +146,7 @@ ApIsExistingFile ( if (!stat (Pathname, &StatInfo)) { - fprintf (stderr, "Target path already exists, overwrite? [y|n] "); + AcpiLogError ("Target path already exists, overwrite? [y|n] "); if (getchar () != 'y') { @@ -188,10 +188,10 @@ ApOpenOutputFile ( /* Point stdout to the file */ - File = fopen (Pathname, "w"); + File = AcpiOsOpenFile (Pathname, ACPI_FILE_WRITING); if (!File) { - fprintf (stderr, "Could not open output file: %s\n", Pathname); + AcpiLogError ("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; - ACPI_SIZE Actual; + size_t Actual; UINT32 TableLength; @@ -254,7 +254,7 @@ ApWriteToBinaryFile ( if (Instance > 0) { - snprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); + AcpiUtSnprintf (InstanceStr, sizeof (InstanceStr), "%u", Instance); strcat (Filename, InstanceStr); } @@ -262,29 +262,30 @@ ApWriteToBinaryFile ( if (Gbl_VerboseMode) { - fprintf (stderr, + AcpiLogError ( "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 = fopen (Filename, "wb"); + File = AcpiOsOpenFile (Filename, + ACPI_FILE_WRITING | ACPI_FILE_BINARY); if (!File) { - fprintf (stderr, "Could not open output file: %s\n", Filename); + AcpiLogError ("Could not open output file: %s\n", Filename); return (-1); } - Actual = fwrite (Table, 1, TableLength, File); + Actual = AcpiOsWriteFile (File, Table, 1, TableLength); if (Actual != TableLength) { - fprintf (stderr, "Error writing binary output file: %s\n", Filename); - fclose (File); + AcpiLogError ("Error writing binary output file: %s\n", Filename); + AcpiOsCloseFile (File); return (-1); } - fclose (File); + AcpiOsCloseFile (File); return (0); } @@ -310,15 +311,15 @@ ApGetTableFromFile ( ACPI_TABLE_HEADER *Buffer = NULL; ACPI_FILE File; UINT32 FileSize; - ACPI_SIZE Actual; + size_t Actual; /* Must use binary mode */ - File = fopen (Pathname, "rb"); + File = AcpiOsOpenFile (Pathname, ACPI_FILE_READING | ACPI_FILE_BINARY); if (!File) { - fprintf (stderr, "Could not open input file: %s\n", Pathname); + AcpiLogError ("Could not open input file: %s\n", Pathname); return (NULL); } @@ -327,7 +328,7 @@ ApGetTableFromFile ( FileSize = CmGetFileSize (File); if (FileSize == ACPI_UINT32_MAX) { - fprintf (stderr, + AcpiLogError ( "Could not get input file size: %s\n", Pathname); goto Cleanup; } @@ -337,17 +338,18 @@ ApGetTableFromFile ( Buffer = ACPI_ALLOCATE_ZEROED (FileSize); if (!Buffer) { - fprintf (stderr, + AcpiLogError ( "Could not allocate file buffer of size: %u\n", FileSize); goto Cleanup; } /* Read the entire file */ - Actual = fread (Buffer, 1, FileSize, File); + Actual = AcpiOsReadFile (File, Buffer, 1, FileSize); if (Actual != FileSize) { - fprintf (stderr, "Could not read input file: %s\n", Pathname); + AcpiLogError ( + "Could not read input file: %s\n", Pathname); ACPI_FREE (Buffer); Buffer = NULL; goto Cleanup; @@ -356,6 +358,6 @@ ApGetTableFromFile ( *OutFileSize = FileSize; Cleanup: - fclose (File); + AcpiOsCloseFile (File); return (Buffer); } diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 0e0e5b218..cfe0c3261 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -233,7 +233,7 @@ ApInsertAction ( CurrentAction++; if (CurrentAction > AP_MAX_ACTIONS) { - fprintf (stderr, "Too many table options (max %u)\n", AP_MAX_ACTIONS); + AcpiLogError ("Too many table options (max %u)\n", AP_MAX_ACTIONS); return (-1); } @@ -287,7 +287,7 @@ ApDoOptions ( } else { - fprintf (stderr, "%s: Cannot handle this switch, please use on|off\n", + AcpiLogError ("%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)) { - fprintf (stderr, "%s: Could not convert to a physical address\n", + AcpiLogError ("%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; - fprintf (stderr, ACPI_COMMON_SIGNON (AP_UTILITY_NAME)); + AcpiLogError (ACPI_COMMON_SIGNON (AP_UTILITY_NAME)); continue; /* @@ -427,7 +427,6 @@ acpi_main ( ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); Gbl_OutputFile = ACPI_FILE_OUT; - AcpiGbl_IntegerByteWidth = 8; /* Process command line options */ @@ -470,7 +469,7 @@ acpi_main ( default: - fprintf (stderr, "Internal error, invalid action: 0x%X\n", + AcpiLogError ("Internal error, invalid action: 0x%X\n", Action->ToBeDone); return (-1); } @@ -488,11 +487,11 @@ acpi_main ( /* Summary for the output file */ FileSize = CmGetFileSize (Gbl_OutputFile); - fprintf (stderr, "Output file %s contains 0x%X (%u) bytes\n\n", + AcpiLogError ("Output file %s contains 0x%X (%u) bytes\n\n", Gbl_OutputFilename, FileSize, FileSize); } - fclose (Gbl_OutputFile); + AcpiOsCloseFile (Gbl_OutputFile); } return (Status); diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index aaa7f9099..12199b04c 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -131,6 +131,11 @@ #include "amlresrc.h" #include "acapps.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <signal.h> + /* * Debug Regions @@ -168,11 +173,9 @@ extern ACPI_CONNECTION_INFO AeMyContext; #define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\ AcpiOsPrintf PARAM_LIST(fp);} -#ifndef _GNU_EFI void ACPI_SYSTEM_XFACE AeCtrlCHandler ( int Sig); -#endif ACPI_STATUS AeBuildLocalTables ( diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index c3d0a7db8..f08ffbe8e 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -192,12 +192,10 @@ static char *TableEvents[] = #endif /* !ACPI_REDUCED_HARDWARE */ +static UINT32 SigintCount = 0; static AE_DEBUG_REGIONS AeRegions; -#ifndef _GNU_EFI -static UINT32 SigintCount = 0; - /****************************************************************************** * * FUNCTION: AeCtrlCHandler @@ -234,7 +232,6 @@ AeCtrlCHandler ( (void) AcpiOsTerminate (); exit (0); } -#endif /****************************************************************************** diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index 996cc8e9c..57c20dce0 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -122,8 +122,6 @@ /* Local prototypes */ -#ifndef ACPI_DISABLE_OBJECT_OVERRIDE - static void AeDoOneOverride ( char *Pathname, @@ -160,8 +158,7 @@ AeOpenInitializationFile ( InitFile = fopen (Filename, "r"); if (!InitFile) { - fprintf (stderr, - "Could not open initialization file: %s\n", Filename); + perror ("Could not open initialization file"); return (-1); } @@ -306,5 +303,3 @@ AeDoOneOverride ( AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Value)); } - -#endif diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index b153121fe..a645ffa27 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -114,6 +114,7 @@ *****************************************************************************/ #include "aecommon.h" +#include "errno.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aemain") @@ -130,6 +131,7 @@ * Windows: The setargv.obj module must be linked in to automatically * expand wildcards. */ +extern BOOLEAN AcpiGbl_DebugTimeout; /* Local prototypes */ @@ -396,12 +398,10 @@ AeDoOptions ( return (-1); } -#ifndef ACPI_DISABLE_OBJECT_OVERRIDE if (AeOpenInitializationFile (AcpiGbl_Optarg)) { return (-1); } -#endif break; default: @@ -519,17 +519,10 @@ AeDoOptions ( * *****************************************************************************/ -#ifndef _GNU_EFI int ACPI_SYSTEM_XFACE main ( int argc, - char *argv[]) -#else -int ACPI_SYSTEM_XFACE -acpi_main ( - int argc, - char *argv[]) -#endif + char **argv) { ACPI_NEW_TABLE_DESC *ListHead = NULL; ACPI_STATUS Status; @@ -538,9 +531,7 @@ acpi_main ( ACPI_DEBUG_INITIALIZE (); /* For debug version only */ -#ifndef _GNU_EFI signal (SIGINT, AeCtrlCHandler); -#endif /* Init debug globals */ |