diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/acpiexec/Makefile | 8 | ||||
-rw-r--r-- | tools/acpiexec/aecommon.h | 14 | ||||
-rw-r--r-- | tools/acpiexec/aeexec.c | 241 | ||||
-rw-r--r-- | tools/acpiexec/aehandlers.c | 84 | ||||
-rw-r--r-- | tools/acpiexec/aemain.c | 54 | ||||
-rw-r--r-- | tools/acpiexec/aetables.c | 66 | ||||
-rw-r--r-- | tools/acpisrc/asfile.c | 5 | ||||
-rw-r--r-- | tools/acpisrc/astable.c | 1 | ||||
-rw-r--r-- | tools/acpixtract/acpixtract.c | 50 |
9 files changed, 321 insertions, 202 deletions
diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile index 5fbe79504be00..102c33d5b51c6 100644 --- a/tools/acpiexec/Makefile +++ b/tools/acpiexec/Makefile @@ -89,6 +89,7 @@ OBJS = \ getopt.o \ hwacpi.o \ hwgpe.o \ + hwpci.o \ hwregs.o \ hwsleep.o \ hwvalid.o \ @@ -158,6 +159,7 @@ OBJS = \ utstate.o \ uttrack.o \ utosi.o \ + utxferror.o \ utxface.o @@ -396,6 +398,9 @@ hwacpi.o : $(ACPICA_CORE)/hardware/hwacpi.c hwgpe.o : $(ACPICA_CORE)/hardware/hwgpe.c $(COMPILE) +hwpci.o : $(ACPICA_CORE)/hardware/hwpci.c + $(COMPILE) + hwregs.o : $(ACPICA_CORE)/hardware/hwregs.c $(COMPILE) @@ -600,6 +605,9 @@ uttrack.o : $(ACPICA_CORE)/utilities/uttrack.c utosi.o : $(ACPICA_CORE)/utilities/utosi.c $(COMPILE) +utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c + $(COMPILE) + utxface.o : $(ACPICA_CORE)/utilities/utxface.c $(COMPILE) diff --git a/tools/acpiexec/aecommon.h b/tools/acpiexec/aecommon.h index 7608c5de4887e..3b7d36d9912ec 100644 --- a/tools/acpiexec/aecommon.h +++ b/tools/acpiexec/aecommon.h @@ -139,6 +139,18 @@ extern FILE *AcpiGbl_DebugFile; extern BOOLEAN AcpiGbl_IgnoreErrors; extern UINT8 AcpiGbl_RegionFillValue; +/* Check for unexpected exceptions */ + +#define AE_CHECK_STATUS(Name, Status, Expected) \ + if (Status != Expected) \ + { \ + AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \ + AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \ + } + +/* Check for unexpected non-AE_OK errors */ + +#define AE_CHECK_OK(Name, Status) AE_CHECK_STATUS (Name, Status, AE_OK); typedef struct ae_table_desc { @@ -173,7 +185,7 @@ typedef struct ae_debug_regions #define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\ AcpiOsPrintf PARAM_LIST(fp);} -void __cdecl +void ACPI_SYSTEM_XFACE AeCtrlCHandler ( int Sig); diff --git a/tools/acpiexec/aeexec.c b/tools/acpiexec/aeexec.c index 948b22754694c..baf1aeb75b15f 100644 --- a/tools/acpiexec/aeexec.c +++ b/tools/acpiexec/aeexec.c @@ -120,39 +120,39 @@ /* Local prototypes */ -ACPI_STATUS +static ACPI_STATUS AeSetupConfiguration ( void *RegionAddr); -void +static void AfInstallGpeBlock ( void); -void +static void AeTestBufferArgument ( void); -void +static void AeTestPackageArgument ( void); -ACPI_STATUS +static ACPI_STATUS AeGetDevices ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue); -ACPI_STATUS +static ACPI_STATUS ExecuteOSI ( char *OsiString, UINT32 ExpectedResult); -void +static void AeHardwareInterfaces ( void); -void +static void AeGenericRegisters ( void); @@ -172,11 +172,10 @@ extern unsigned char Ssdt3Code[]; * *****************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AeSetupConfiguration ( void *RegionAddr) { - ACPI_STATUS Status; ACPI_OBJECT_LIST ArgList; ACPI_OBJECT Arg[3]; @@ -190,8 +189,7 @@ AeSetupConfiguration ( Arg[0].Type = ACPI_TYPE_INTEGER; Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr); - Status = AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL); - + (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL); return (AE_OK); } @@ -209,7 +207,7 @@ AeSetupConfiguration ( * *****************************************************************************/ -void +static void AfInstallGpeBlock ( void) { @@ -235,33 +233,46 @@ AfInstallGpeBlock ( if (ACPI_SUCCESS (Status)) { Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8); + AE_CHECK_OK (AcpiInstallGpeBlock, Status); - AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (Handle2, 8); + Status = AcpiInstallGpeHandler (Handle2, 8, + ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiEnableGpe (Handle2, 8); + AE_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiGetGpeDevice (0x30, &GpeDevice); + AE_CHECK_OK (AcpiGetGpeDevice, Status); + Status = AcpiGetGpeDevice (0x42, &GpeDevice); + AE_CHECK_OK (AcpiGetGpeDevice, Status); + Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice); + AE_CHECK_OK (AcpiGetGpeDevice, Status); + Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice); + AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST); - AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler); + Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler); + AE_CHECK_OK (AcpiRemoveGpeHandler, Status); } Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3); if (ACPI_SUCCESS (Status)) { Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11); + AE_CHECK_OK (AcpiInstallGpeBlock, Status); } } /* Test using a Buffer object as a method argument */ -void +static void AeTestBufferArgument ( void) { - ACPI_STATUS Status; ACPI_OBJECT_LIST Params; ACPI_OBJECT BufArg; UINT8 Buffer[] = { @@ -277,26 +288,23 @@ AeTestBufferArgument ( Params.Count = 1; Params.Pointer = &BufArg; - - Status = AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL); + (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL); } -ACPI_OBJECT PkgArg; -ACPI_OBJECT PkgElements[5]; -ACPI_OBJECT Pkg2Elements[5]; -ACPI_OBJECT_LIST Params; +static ACPI_OBJECT PkgArg; +static ACPI_OBJECT PkgElements[5]; +static ACPI_OBJECT Pkg2Elements[5]; +static ACPI_OBJECT_LIST Params; /* * Test using a Package object as an method argument */ -void +static void AeTestPackageArgument ( void) { - ACPI_STATUS Status; - /* Main package */ @@ -335,11 +343,11 @@ AeTestPackageArgument ( Params.Count = 1; Params.Pointer = &PkgArg; - Status = AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL); + (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL); } -ACPI_STATUS +static ACPI_STATUS AeGetDevices ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, @@ -364,7 +372,7 @@ AeGetDevices ( * *****************************************************************************/ -ACPI_STATUS +static ACPI_STATUS ExecuteOSI ( char *OsiString, UINT32 ExpectedResult) @@ -434,9 +442,9 @@ ExecuteOSI ( * *****************************************************************************/ -ACPI_GENERIC_ADDRESS GenericRegister; +static ACPI_GENERIC_ADDRESS GenericRegister; -void +static void AeGenericRegisters ( void) { @@ -450,14 +458,20 @@ AeGenericRegisters ( GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; Status = AcpiRead (&Value, &GenericRegister); + AE_CHECK_OK (AcpiRead, Status); + Status = AcpiWrite (Value, &GenericRegister); + AE_CHECK_OK (AcpiWrite, Status); GenericRegister.Address = 0x12345678; GenericRegister.BitOffset = 0; GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; Status = AcpiRead (&Value, &GenericRegister); + AE_CHECK_OK (AcpiRead, Status); + Status = AcpiWrite (Value, &GenericRegister); + AE_CHECK_OK (AcpiWrite, Status); } @@ -469,7 +483,7 @@ AeGenericRegisters ( * *****************************************************************************/ -void +static void AeHardwareInterfaces ( void) { @@ -478,14 +492,29 @@ AeHardwareInterfaces ( Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1); + AE_CHECK_OK (AcpiWriteBitRegister, Status); + Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1); + AE_CHECK_OK (AcpiWriteBitRegister, Status); + Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1); + AE_CHECK_OK (AcpiWriteBitRegister, Status); + Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1); + AE_CHECK_OK (AcpiWriteBitRegister, Status); + Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value); + AE_CHECK_OK (AcpiReadBitRegister, Status); + Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value); + AE_CHECK_OK (AcpiReadBitRegister, Status); + Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value); + AE_CHECK_OK (AcpiReadBitRegister, Status); + Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value); + AE_CHECK_OK (AcpiReadBitRegister, Status); } @@ -519,52 +548,108 @@ AeMiscellaneousTests ( AeTestPackageArgument (); - AcpiInstallInterface (""); - AcpiInstallInterface ("TestString"); - AcpiInstallInterface ("TestString"); - AcpiRemoveInterface ("Windows 2006"); - AcpiRemoveInterface ("TestString"); - AcpiRemoveInterface ("XXXXXX"); - AcpiInstallInterface ("AnotherTestString"); + Status = AcpiInstallInterface (""); + AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER); + + Status = AcpiInstallInterface ("TestString"); + AE_CHECK_OK (AcpiInstallInterface, Status); + + Status = AcpiInstallInterface ("TestString"); + AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS); + + Status = AcpiRemoveInterface ("Windows 2006"); + AE_CHECK_OK (AcpiRemoveInterface, Status); + + Status = AcpiRemoveInterface ("TestString"); + AE_CHECK_OK (AcpiRemoveInterface, Status); + + Status = AcpiRemoveInterface ("XXXXXX"); + AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST); + + Status = AcpiInstallInterface ("AnotherTestString"); + AE_CHECK_OK (AcpiInstallInterface, Status); + + + Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF); + AE_CHECK_OK (ExecuteOSI, Status); - ExecuteOSI ("Windows 2001", 0xFFFFFFFF); - ExecuteOSI ("MichiganTerminalSystem", 0); + Status = ExecuteOSI ("MichiganTerminalSystem", 0); + AE_CHECK_OK (ExecuteOSI, Status); ReturnBuf.Length = 32; ReturnBuf.Pointer = Buffer; - AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf); - AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); + Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf); + AE_CHECK_OK (AcpiGetName, Status); + + Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); + AE_CHECK_OK (AcpiEnableEvent, Status); /* * GPEs: Handlers, enable/disable, etc. */ - AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (NULL, 0); - AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler); + Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiEnableGpe (NULL, 0); + AE_CHECK_OK (AcpiEnableGpe, Status); + + Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler); + AE_CHECK_OK (AcpiRemoveGpeHandler, Status); + + Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiEnableGpe (NULL, 0); + AE_CHECK_OK (AcpiEnableGpe, Status); + + Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE); + AE_CHECK_OK (AcpiSetGpe, Status); + + Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE); + AE_CHECK_OK (AcpiSetGpe, Status); + + + Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiEnableGpe (NULL, 1); + AE_CHECK_OK (AcpiEnableGpe, Status); + + + Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiEnableGpe (NULL, 2); + AE_CHECK_OK (AcpiEnableGpe, Status); + + + Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + + Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); + - AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (NULL, 0); - AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE); - AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE); + Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); - AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (NULL, 1); + Status = AcpiEnableGpe (NULL, 0x19); + AE_CHECK_OK (AcpiEnableGpe, Status); - AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (NULL, 2); - AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); - AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AE_CHECK_OK (AcpiInstallGpeHandler, Status); - AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (NULL, 0x19); + Status = AcpiEnableGpe (NULL, 0x62); + AE_CHECK_OK (AcpiEnableGpe, Status); - AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); - AcpiEnableGpe (NULL, 0x62); - AcpiDisableGpe (NULL, 0x62); + Status = AcpiDisableGpe (NULL, 0x62); + AE_CHECK_OK (AcpiDisableGpe, Status); AfInstallGpeBlock (); @@ -584,41 +669,23 @@ AeMiscellaneousTests ( /* Test global lock */ Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status); - } + AE_CHECK_OK (AcpiAcquireGlobalLock, Status); Status = AcpiAcquireGlobalLock (0x5, &LockHandle2); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status); - } + AE_CHECK_OK (AcpiAcquireGlobalLock, Status); Status = AcpiReleaseGlobalLock (LockHandle1); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status); - } + AE_CHECK_OK (AcpiReleaseGlobalLock, Status); Status = AcpiReleaseGlobalLock (LockHandle2); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status); - } + AE_CHECK_OK (AcpiReleaseGlobalLock, Status); /* Get Devices */ Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not AcpiGetDevices, %X\n", Status); - } + AE_CHECK_OK (AcpiGetDevices, Status); Status = AcpiGetStatistics (&Stats); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not AcpiGetStatistics, %X\n", Status); - } + AE_CHECK_OK (AcpiGetStatistics, Status); } diff --git a/tools/acpiexec/aehandlers.c b/tools/acpiexec/aehandlers.c index d4749c9afc2fc..1f9b1f6ec125e 100644 --- a/tools/acpiexec/aehandlers.c +++ b/tools/acpiexec/aehandlers.c @@ -120,19 +120,19 @@ /* Local prototypes */ -void +static void AeNotifyHandler ( ACPI_HANDLE Device, UINT32 Value, void *Context); -void +static void AeDeviceNotifyHandler ( ACPI_HANDLE Device, UINT32 Value, void *Context); -ACPI_STATUS +static ACPI_STATUS AeExceptionHandler ( ACPI_STATUS AmlStatus, ACPI_NAME Name, @@ -140,31 +140,31 @@ AeExceptionHandler ( UINT32 AmlOffset, void *Context); -ACPI_STATUS +static ACPI_STATUS AeTableHandler ( UINT32 Event, void *Table, void *Context); -ACPI_STATUS +static ACPI_STATUS AeRegionInit ( ACPI_HANDLE RegionHandle, UINT32 Function, void *HandlerContext, void **RegionContext); -void +static void AeAttachedDataHandler ( ACPI_HANDLE Object, void *Data); -UINT32 +static UINT32 AeInterfaceHandler ( ACPI_STRING InterfaceName, UINT32 Supported); -UINT32 SigintCount = 0; -AE_DEBUG_REGIONS AeRegions; +static UINT32 SigintCount = 0; +static AE_DEBUG_REGIONS AeRegions; /****************************************************************************** @@ -179,7 +179,7 @@ AE_DEBUG_REGIONS AeRegions; * *****************************************************************************/ -void __cdecl +void ACPI_SYSTEM_XFACE AeCtrlCHandler ( int Sig) { @@ -218,7 +218,7 @@ AeCtrlCHandler ( * *****************************************************************************/ -void +static void AeNotifyHandler ( ACPI_HANDLE Device, UINT32 Value, @@ -268,7 +268,6 @@ AeNotifyHandler ( (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); break; } - } @@ -286,7 +285,7 @@ AeNotifyHandler ( * *****************************************************************************/ -void +static void AeDeviceNotifyHandler ( ACPI_HANDLE Device, UINT32 Value, @@ -317,7 +316,7 @@ AeDeviceNotifyHandler ( * *****************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AeExceptionHandler ( ACPI_STATUS AmlStatus, ACPI_NAME Name, @@ -361,7 +360,7 @@ AeExceptionHandler ( Arg[1].String.Length = ACPI_STRLEN (Exception); Arg[2].Type = ACPI_TYPE_INTEGER; - Arg[2].Integer.Value = ACPI_TO_INTEGER (AcpiOsGetThreadId()); + Arg[2].Integer.Value = AcpiOsGetThreadId(); /* Setup return buffer */ @@ -416,14 +415,14 @@ AeExceptionHandler ( * *****************************************************************************/ -char *TableEvents[] = +static char *TableEvents[] = { "LOAD", "UNLOAD", "UNKNOWN" }; -ACPI_STATUS +static ACPI_STATUS AeTableHandler ( UINT32 Event, void *Table, @@ -469,7 +468,7 @@ AeGpeHandler ( * *****************************************************************************/ -void +static void AeAttachedDataHandler ( ACPI_HANDLE Object, void *Data) @@ -490,7 +489,7 @@ AeAttachedDataHandler ( * *****************************************************************************/ -UINT32 +static UINT32 AeInterfaceHandler ( ACPI_STRING InterfaceName, UINT32 Supported) @@ -518,7 +517,7 @@ AeInterfaceHandler ( * *****************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AeRegionInit ( ACPI_HANDLE RegionHandle, UINT32 Function, @@ -530,7 +529,7 @@ AeRegionInit ( */ *RegionContext = RegionHandle; - return AE_OK; + return (AE_OK); } @@ -544,10 +543,13 @@ AeRegionInit ( * * DESCRIPTION: Install handlers for the AcpiExec utility. * + * Notes: Don't install handler for PCI_Config, we want to use the + * default handler to exercise that code. + * *****************************************************************************/ -ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 5, 6, 7, 0x80}; -#define AEXEC_NUM_REGIONS 9 +static ACPI_ADR_SPACE_TYPE SpaceIdList[] = {0, 1, 3, 4, 5, 6, 7, 0x80}; +#define AEXEC_NUM_REGIONS 8 ACPI_STATUS AeInstallHandlers (void) @@ -620,8 +622,12 @@ AeInstallHandlers (void) Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler, NULL); + AE_CHECK_OK (AcpiInstallNotifyHandler, Status); + Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler); + AE_CHECK_OK (AcpiRemoveNotifyHandler, Status); + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler, NULL); if (ACPI_FAILURE (Status)) @@ -631,8 +637,13 @@ AeInstallHandlers (void) } Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); + AE_CHECK_OK (AcpiAttachData, Status); + Status = AcpiDetachData (Handle, AeAttachedDataHandler); + AE_CHECK_OK (AcpiDetachData, Status); + Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); + AE_CHECK_OK (AcpiAttachData, Status); } else { @@ -643,19 +654,21 @@ AeInstallHandlers (void) for (i = 0; i < AEXEC_NUM_REGIONS; i++) { - Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode, - SpaceId[i], AeRegionHandler); + /* Remove any existing handler */ + + (void) AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode, + SpaceIdList[i], AeRegionHandler); /* Install handler at the root object. * TBD: all default handlers should be installed here! */ Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, - SpaceId[i], AeRegionHandler, AeRegionInit, NULL); + SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not install an OpRegion handler for %s space(%u)", - AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i])); + AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i])); return (Status); } } @@ -667,7 +680,7 @@ AeInstallHandlers (void) AeRegions.NumberOfRegions = 0; AeRegions.RegionList = NULL; - return Status; + return (Status); } @@ -714,7 +727,7 @@ AeRegionHandler ( */ if (RegionObject->Region.Type != ACPI_TYPE_REGION) { - return AE_OK; + return (AE_OK); } /* @@ -756,10 +769,12 @@ AeRegionHandler ( { case ACPI_READ: Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth); + AE_CHECK_OK (AcpiHwReadPort, Status); break; case ACPI_WRITE: Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth); + AE_CHECK_OK (AcpiHwWritePort, Status); break; default: @@ -903,14 +918,14 @@ AeRegionHandler ( RegionElement = AcpiOsAllocate (sizeof (AE_REGION)); if (!RegionElement) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } RegionElement->Buffer = AcpiOsAllocate (Length); if (!RegionElement->Buffer) { AcpiOsFree (RegionElement); - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } /* Initialize the region with the default fill value */ @@ -963,7 +978,7 @@ AeRegionHandler ( ByteWidth, (UINT32)(RegionElement->Address), RegionElement->Length)); - return AE_AML_REGION_LIMIT; + return (AE_AML_REGION_LIMIT); } /* @@ -994,9 +1009,10 @@ DoFunction: break; default: - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - return AE_OK; + + return (AE_OK); } diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c index 050ba281025b1..5773a6917e033 100644 --- a/tools/acpiexec/aemain.c +++ b/tools/acpiexec/aemain.c @@ -122,17 +122,18 @@ #define _COMPONENT PARSER ACPI_MODULE_NAME ("aemain") -UINT8 AcpiGbl_BatchMode = 0; -UINT8 AcpiGbl_RegionFillValue = 0; -BOOLEAN AcpiGbl_IgnoreErrors = FALSE; -BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; -BOOLEAN AcpiGbl_DebugTimeout = FALSE; -char BatchBuffer[128]; -AE_TABLE_DESC *AeTableListHead = NULL; + +UINT8 AcpiGbl_RegionFillValue = 0; +BOOLEAN AcpiGbl_IgnoreErrors = FALSE; +BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; +BOOLEAN AcpiGbl_DebugTimeout = FALSE; + +static UINT8 AcpiGbl_BatchMode = 0; +static char BatchBuffer[128]; +static AE_TABLE_DESC *AeTableListHead = NULL; #define ASL_MAX_FILES 256 -char *FileList[ASL_MAX_FILES]; -int FileCount; +static char *FileList[ASL_MAX_FILES]; #define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:" @@ -203,6 +204,7 @@ AcpiDbRunBatchMode ( char *Cmd = Ptr; UINT8 Run = 0; + AcpiGbl_MethodExecuting = FALSE; AcpiGbl_StepToNextCall = FALSE; @@ -360,6 +362,7 @@ AsDoWildcard ( #ifdef WIN32 void *DirInfo; char *Filename; + int FileCount; FileCount = 0; @@ -441,7 +444,7 @@ main ( ACPI_TABLE_HEADER *Table = NULL; UINT32 TableCount; AE_TABLE_DESC *TableDesc; - char **FileList; + char **WildcardList; char *Filename; char *Directory; char *FullPathname; @@ -459,7 +462,7 @@ main ( if (argc < 2) { usage (); - return 0; + return (0); } signal (SIGINT, AeCtrlCHandler); @@ -471,7 +474,8 @@ main ( /* Init ACPI and start debugger thread */ - AcpiInitializeSubsystem (); + Status = AcpiInitializeSubsystem (); + AE_CHECK_OK (AcpiInitializeSubsystem, Status); /* Get the command line options */ @@ -482,7 +486,7 @@ main ( { printf ("**** The length of command line (%u) exceeded maximum (127)\n", (UINT32) strlen (AcpiGbl_Optarg)); - return -1; + return (-1); } AcpiGbl_BatchMode = 1; strcpy (BatchBuffer, AcpiGbl_Optarg); @@ -586,7 +590,7 @@ main ( case 'h': default: usage(); - return -1; + return (-1); } @@ -617,21 +621,21 @@ main ( /* Expand wildcards (Windows only) */ - FileList = AsDoWildcard (Directory, Filename); - if (!FileList) + WildcardList = AsDoWildcard (Directory, Filename); + if (!WildcardList) { - return -1; + return (-1); } - while (*FileList) + while (*WildcardList) { FullPathname = AcpiOsAllocate ( - strlen (Directory) + strlen (*FileList) + 1); + strlen (Directory) + strlen (*WildcardList) + 1); /* Construct a full path to the file */ strcpy (FullPathname, Directory); - strcat (FullPathname, *FileList); + strcat (FullPathname, *WildcardList); /* Get one table */ @@ -644,9 +648,9 @@ main ( } AcpiOsFree (FullPathname); - AcpiOsFree (*FileList); - *FileList = NULL; - FileList++; + AcpiOsFree (*WildcardList); + *WildcardList = NULL; + WildcardList++; /* * Ignore an FACS or RSDT, we can't use them. @@ -676,7 +680,7 @@ main ( Status = AeBuildLocalTables (TableCount, AeTableListHead); if (ACPI_FAILURE (Status)) { - return -1; + return (-1); } Status = AeInstallTables (); @@ -730,6 +734,6 @@ enterloop: AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL); } - return 0; + return (0); } diff --git a/tools/acpiexec/aetables.c b/tools/acpiexec/aetables.c index e1f61c6e61a54..a2ccdab02ea3a 100644 --- a/tools/acpiexec/aetables.c +++ b/tools/acpiexec/aetables.c @@ -135,7 +135,7 @@ AeLocalGetRootPointer ( /* Default DSDT. This will be replaced with the input DSDT */ -unsigned char DsdtCode[] = +static unsigned char DsdtCode[] = { 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ 0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".oIntel." */ @@ -144,7 +144,7 @@ unsigned char DsdtCode[] = 0x04,0x12,0x08,0x20, }; -unsigned char LocalDsdtCode[] = +static unsigned char LocalDsdtCode[] = { 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ 0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".,Intel." */ @@ -155,7 +155,7 @@ unsigned char LocalDsdtCode[] = /* Several example SSDTs */ -unsigned char Ssdt1Code[] = /* Has method _T98 */ +static unsigned char Ssdt1Code[] = /* Has method _T98 */ { 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ @@ -165,7 +165,7 @@ unsigned char Ssdt1Code[] = /* Has method _T98 */ 0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "98.p..`." */ }; -unsigned char Ssdt2Code[] = /* Has method _T99 */ +static unsigned char Ssdt2Code[] = /* Has method _T99 */ { 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ 0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ @@ -175,7 +175,7 @@ unsigned char Ssdt2Code[] = /* Has method _T99 */ 0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "99.p..`." */ }; -unsigned char Ssdt3Code[] = /* Has method _T97 */ +unsigned char Ssdt3Code[] = /* Has method _T97 */ { 0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "TSDT0..." */ 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ @@ -187,7 +187,7 @@ unsigned char Ssdt3Code[] = /* Has method _T97 */ /* Example OEM table */ -unsigned char Oem1Code[] = +static unsigned char Oem1Code[] = { 0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00, /* 00000000 "OEM18..." */ 0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".KIntel." */ @@ -200,7 +200,7 @@ unsigned char Oem1Code[] = /* ASL source for this table is at the end of this file */ -unsigned char OemxCode[] = +static unsigned char OemxCode[] = { 0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */ 0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */ @@ -241,7 +241,7 @@ unsigned char OemxCode[] = * * Compiled byte code below. */ -unsigned char MethodCode[] = +static unsigned char MethodCode[] = { 0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00, /* 00000000 "DSDTS..." */ 0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ @@ -262,19 +262,19 @@ unsigned char MethodCode[] = * even though the underlying OSD HW access functions don't do * anything. */ -ACPI_TABLE_HEADER *DsdtToInstallOverride; -ACPI_TABLE_RSDP LocalRSDP; -ACPI_TABLE_FADT LocalFADT; -ACPI_TABLE_FACS LocalFACS; -ACPI_TABLE_HEADER LocalTEST; -ACPI_TABLE_HEADER LocalBADTABLE; -ACPI_TABLE_RSDT *LocalRSDT; +static ACPI_TABLE_HEADER *DsdtToInstallOverride; +static ACPI_TABLE_RSDP LocalRSDP; +static ACPI_TABLE_FADT LocalFADT; +static ACPI_TABLE_FACS LocalFACS; +static ACPI_TABLE_HEADER LocalTEST; +static ACPI_TABLE_HEADER LocalBADTABLE; +static ACPI_TABLE_RSDT *LocalRSDT; -#define BASE_RSDT_TABLES 7 -#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32))) +#define BASE_RSDT_TABLES 7 +#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32))) -#define ACPI_MAX_INIT_TABLES (32) -static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES]; +#define ACPI_MAX_INIT_TABLES (32) +static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES]; /****************************************************************************** @@ -357,7 +357,7 @@ AeBuildLocalTables ( LocalRSDT = AcpiOsAllocate (RsdtSize); if (!LocalRSDT) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } ACPI_MEMSET (LocalRSDT, 0, RsdtSize); @@ -398,7 +398,7 @@ AeBuildLocalTables ( if (DsdtAddress) { printf ("Already found a DSDT, only one allowed\n"); - return AE_ALREADY_EXISTS; + return (AE_ALREADY_EXISTS); } /* The incoming user table is a DSDT */ @@ -488,21 +488,25 @@ AeBuildLocalTables ( /* Miscellaneous FADT fields */ LocalFADT.Gpe0BlockLength = 16; + LocalFADT.Gpe0Block = 0x00001234; + LocalFADT.Gpe1BlockLength = 6; + LocalFADT.Gpe1Block = 0x00005678; LocalFADT.Gpe1Base = 96; LocalFADT.Pm1EventLength = 4; - LocalFADT.Pm1ControlLength = 2; - LocalFADT.PmTimerLength = 4; - - LocalFADT.Gpe0Block = 0x00001234; - LocalFADT.Gpe1Block = 0x00005678; - LocalFADT.Pm1aEventBlock = 0x00001aaa; LocalFADT.Pm1bEventBlock = 0x00001bbb; - LocalFADT.PmTimerBlock = 0xA0; + + LocalFADT.Pm1ControlLength = 2; LocalFADT.Pm1aControlBlock = 0xB0; + LocalFADT.PmTimerLength = 4; + LocalFADT.PmTimerBlock = 0xA0; + + LocalFADT.Pm2ControlBlock = 0xC0; + LocalFADT.Pm2ControlLength = 1; + /* Setup one example X-64 field */ LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; @@ -566,9 +570,15 @@ AeInstallTables ( { ACPI_STATUS Status; + Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE); + AE_CHECK_OK (AcpiInitializeTables, Status); + Status = AcpiReallocateRootTable (); + AE_CHECK_OK (AcpiReallocateRootTable, Status); + Status = AcpiLoadTables (); + AE_CHECK_OK (AcpiLoadTables, Status); /* * Test run-time control method installation. Do it twice to test code diff --git a/tools/acpisrc/asfile.c b/tools/acpisrc/asfile.c index dd249410772ff..c82a98b30cc55 100644 --- a/tools/acpisrc/asfile.c +++ b/tools/acpisrc/asfile.c @@ -132,7 +132,7 @@ AsDetectLoneLineFeeds ( char *Filename, char *Buffer); -static inline int +static ACPI_INLINE int AsMaxInt (int a, int b) { return (a > b ? a : b); @@ -409,7 +409,8 @@ AsConvertFile ( Gbl_StructDefs = strstr (FileBuffer, "/* acpisrc:StructDefs"); Gbl_Files++; - VERBOSE_PRINT (("Processing %u bytes\n", strlen (FileBuffer))); + VERBOSE_PRINT (("Processing %u bytes\n", + (unsigned int) strlen (FileBuffer))); if (ConversionTable->LowerCaseTable) { diff --git a/tools/acpisrc/astable.c b/tools/acpisrc/astable.c index 058d5a2b545b7..c850891095a0d 100644 --- a/tools/acpisrc/astable.c +++ b/tools/acpisrc/astable.c @@ -378,6 +378,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_PARSE_STATE", SRC_TYPE_STRUCT}, {"ACPI_PARSE_UPWARDS", SRC_TYPE_SIMPLE}, {"ACPI_PARSE_VALUE", SRC_TYPE_UNION}, + {"ACPI_PCI_DEVICE", SRC_TYPE_STRUCT}, {"ACPI_PCI_ID", SRC_TYPE_STRUCT}, {"ACPI_PCI_ROUTING_TABLE", SRC_TYPE_STRUCT}, {"ACPI_PHYSICAL_ADDRESS", SRC_TYPE_SIMPLE}, diff --git a/tools/acpixtract/acpixtract.c b/tools/acpixtract/acpixtract.c index e3d6b7529edcc..543d0bd8ad24b 100644 --- a/tools/acpixtract/acpixtract.c +++ b/tools/acpixtract/acpixtract.c @@ -130,46 +130,46 @@ /* Local prototypes */ -void +static void CheckAscii ( char *Name, int Count); -void +static void NormalizeSignature ( char *Signature); -unsigned int +static unsigned int GetNextInstance ( char *InputPathname, char *Signature); -int +static int ExtractTables ( char *InputPathname, char *Signature, unsigned int MinimumInstances); -size_t +static size_t GetTableHeader ( FILE *InputFile, unsigned char *OutputData); -unsigned int +static unsigned int CountTableInstances ( char *InputPathname, char *Signature); -int +static int ListTables ( char *InputPathname); -size_t +static size_t ConvertLine ( char *InputLine, unsigned char *OutputData); -void +static void DisplayUsage ( void); @@ -196,9 +196,9 @@ struct TableInfo struct TableInfo *Next; }; -struct TableInfo *ListHead = NULL; -char Filename[16]; -unsigned char Data[16]; +static struct TableInfo *ListHead = NULL; +static char Filename[16]; +static unsigned char Data[16]; /****************************************************************************** @@ -209,7 +209,7 @@ unsigned char Data[16]; * ******************************************************************************/ -void +static void DisplayUsage ( void) { @@ -240,7 +240,7 @@ DisplayUsage ( * ******************************************************************************/ -void +static void CheckAscii ( char *Name, int Count) @@ -270,7 +270,7 @@ CheckAscii ( * ******************************************************************************/ -void +static void NormalizeSignature ( char *Signature) { @@ -295,7 +295,7 @@ NormalizeSignature ( * ******************************************************************************/ -size_t +static size_t ConvertLine ( char *InputLine, unsigned char *OutputData) @@ -353,7 +353,7 @@ ConvertLine ( * ******************************************************************************/ -size_t +static size_t GetTableHeader ( FILE *InputFile, unsigned char *OutputData) @@ -401,7 +401,7 @@ GetTableHeader ( * ******************************************************************************/ -unsigned int +static unsigned int CountTableInstances ( char *InputPathname, char *Signature) @@ -459,7 +459,7 @@ CountTableInstances ( * ******************************************************************************/ -unsigned int +static unsigned int GetNextInstance ( char *InputPathname, char *Signature) @@ -520,7 +520,7 @@ GetNextInstance ( * ******************************************************************************/ -int +static int ExtractTables ( char *InputPathname, char *Signature, @@ -639,8 +639,8 @@ ExtractTables ( OutputFile = NULL; State = FIND_HEADER; - printf ("Acpi table [%4.4s] - % 7d bytes written to %s\n", - ThisSignature, TotalBytesWritten, Filename); + printf ("Acpi table [%4.4s] - %u bytes written to %s\n", + ThisSignature, (unsigned int) TotalBytesWritten, Filename); continue; } @@ -684,8 +684,8 @@ CleanupAndExit: { /* Received an EOF while extracting data */ - printf ("Acpi table [%4.4s] - % 7d bytes written to %s\n", - ThisSignature, TotalBytesWritten, Filename); + printf ("Acpi table [%4.4s] - %u bytes written to %s\n", + ThisSignature, (unsigned int) TotalBytesWritten, Filename); } } @@ -707,7 +707,7 @@ CleanupAndExit: * ******************************************************************************/ -int +static int ListTables ( char *InputPathname) { |