Index: drivers/bus/acpi/acpica/dispatcher/dsargs.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsargs.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsargs.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __DSARGS_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dscontrol.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dscontrol.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dscontrol.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __DSCONTROL_C__ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" Index: drivers/bus/acpi/acpica/dispatcher/dsfield.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsfield.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsfield.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSFIELD_C__ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" @@ -463,6 +461,7 @@ */ Info->ResourceBuffer = NULL; Info->ConnectionNode = NULL; + Info->PinNumberIndex = 0; /* * A Connection() is either an actual resource descriptor (buffer) @@ -538,6 +537,7 @@ } Info->FieldBitPosition += Info->FieldBitLength; + Info->PinNumberIndex++; /* Index relative to previous Connection() */ break; default: Index: drivers/bus/acpi/acpica/dispatcher/dsinit.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsinit.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsinit.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSINIT_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" Index: drivers/bus/acpi/acpica/dispatcher/dsmethod.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsmethod.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsmethod.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSMETHOD_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" Index: drivers/bus/acpi/acpica/dispatcher/dsmthdat.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsmthdat.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsmthdat.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSMTHDAT_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" Index: drivers/bus/acpi/acpica/dispatcher/dsobject.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsobject.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsobject.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSOBJECT_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dsopcode.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsopcode.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsopcode.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSOPCODE_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dsutils.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dsutils.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dsutils.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSUTILS_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dswexec.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dswexec.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dswexec.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __DSWEXEC_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dswload.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dswload.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dswload.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSWLOAD_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dswload2.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dswload2.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dswload2.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSWLOAD2_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/dispatcher/dswscope.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dswscope.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dswscope.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __DSWSCOPE_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" Index: drivers/bus/acpi/acpica/dispatcher/dswstate.c =================================================================== --- drivers/bus/acpi/acpica/dispatcher/dswstate.c (revision 69845) +++ drivers/bus/acpi/acpica/dispatcher/dswstate.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __DSWSTATE_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/events/evglock.c =================================================================== --- drivers/bus/acpi/acpica/events/evglock.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evglock.c (working copy) @@ -120,7 +120,9 @@ #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evglock") - +#if ACPI_REDUCED_HARDWARE +#error +#endif #if (!ACPI_REDUCED_HARDWARE) /* Entire module */ /* Local prototypes */ Index: drivers/bus/acpi/acpica/events/evgpe.c =================================================================== --- drivers/bus/acpi/acpica/events/evgpe.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evgpe.c (working copy) @@ -504,7 +504,7 @@ GpeRegisterInfo->EnableForWake)) { ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Ignore disabled registers for GPE%02X-GPE%02X: " + "Ignore disabled registers for GPE %02X-%02X: " "RunEnable=%02X, WakeEnable=%02X\n", GpeRegisterInfo->BaseGpeNumber, GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), @@ -530,7 +530,7 @@ } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " + "Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, " "RunEnable=%02X, WakeEnable=%02X\n", GpeRegisterInfo->BaseGpeNumber, GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), @@ -833,22 +833,6 @@ } /* - * If edge-triggered, clear the GPE status bit now. Note that - * level-triggered events are cleared after the GPE is serviced. - */ - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) - { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE%02X", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } - } - - /* * Always disable the GPE so that it does not keep firing before * any asynchronous activity completes (either from the execution * of a GPE method or an asynchronous GPE handler.) @@ -861,11 +845,29 @@ if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE%02X", GpeNumber)); + "Unable to disable GPE %02X", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } /* + * If edge-triggered, clear the GPE status bit now. Note that + * level-triggered events are cleared after the GPE is serviced. + */ + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == + ACPI_GPE_EDGE_TRIGGERED) + { + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Unable to clear GPE %02X", GpeNumber)); + (void) AcpiHwLowSetGpe (GpeEventInfo, + ACPI_GPE_CONDITIONAL_ENABLE); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); + } + } + + /* * Dispatch the GPE to either an installed handler or the control * method associated with this GPE (_Lxx or _Exx). If a handler * exists, we invoke it and do not attempt to run the method. @@ -901,7 +903,7 @@ if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to queue handler for GPE%02X - event disabled", + "Unable to queue handler for GPE %02X - event disabled", GpeNumber)); } break; @@ -913,7 +915,7 @@ * a GPE to be enabled if it has no handler or method. */ ACPI_ERROR ((AE_INFO, - "No handler or method for GPE%02X, disabling event", + "No handler or method for GPE %02X, disabling event", GpeNumber)); break; } Index: drivers/bus/acpi/acpica/events/evgpeblk.c =================================================================== --- drivers/bus/acpi/acpica/events/evgpeblk.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evgpeblk.c (working copy) @@ -354,17 +354,17 @@ { /* Init the RegisterInfo for this GPE register (8 GPEs) */ - ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber + - (i * ACPI_GPE_REGISTER_WIDTH)); + ThisRegister->BaseGpeNumber = (UINT16) + (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH)); ThisRegister->StatusAddress.Address = - GpeBlock->BlockAddress.Address + i; + GpeBlock->Address + i; ThisRegister->EnableAddress.Address = - GpeBlock->BlockAddress.Address + i + GpeBlock->RegisterCount; + GpeBlock->Address + i + GpeBlock->RegisterCount; - ThisRegister->StatusAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; - ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; + ThisRegister->StatusAddress.SpaceId = GpeBlock->SpaceId; + ThisRegister->EnableAddress.SpaceId = GpeBlock->SpaceId; ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->StatusAddress.BitOffset = 0; @@ -437,9 +437,10 @@ ACPI_STATUS AcpiEvCreateGpeBlock ( ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT64 Address, + UINT8 SpaceId, UINT32 RegisterCount, - UINT8 GpeBlockBaseNumber, + UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock) { @@ -466,6 +467,8 @@ /* Initialize the new GPE block */ + GpeBlock->Address = Address; + GpeBlock->SpaceId = SpaceId; GpeBlock->Node = GpeDevice; GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); GpeBlock->Initialized = FALSE; @@ -472,9 +475,6 @@ GpeBlock->RegisterCount = RegisterCount; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; - ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress, - sizeof (ACPI_GENERIC_ADDRESS)); - /* * Create the RegisterInfo and EventInfo sub-structures * Note: disables and clears all GPEs in the block @@ -517,11 +517,11 @@ } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n", + " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n", (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)), - GpeDevice->Name.Ascii, GpeBlock->RegisterCount, - InterruptNumber)); + GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber, + InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : "")); /* Update global count of currently available GPEs */ Index: drivers/bus/acpi/acpica/events/evgpeinit.c =================================================================== --- drivers/bus/acpi/acpica/events/evgpeinit.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evgpeinit.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acevents.h" @@ -211,7 +210,9 @@ /* Install GPE Block 0 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - &AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0, + AcpiGbl_FADT.XGpe0Block.Address, + AcpiGbl_FADT.XGpe0Block.SpaceId, + RegisterCount0, 0, AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]); if (ACPI_FAILURE (Status)) @@ -249,7 +250,9 @@ /* Install GPE Block 1 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - &AcpiGbl_FADT.XGpe1Block, RegisterCount1, + AcpiGbl_FADT.XGpe1Block.Address, + AcpiGbl_FADT.XGpe1Block.SpaceId, + RegisterCount1, AcpiGbl_FADT.Gpe1Base, AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]); @@ -512,6 +515,10 @@ return_ACPI_STATUS (AE_OK); } + /* Disable the GPE in case it's been enabled already. */ + + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + /* * Add the GPE information from above to the GpeEventInfo block for * use during dispatch of this GPE. Index: drivers/bus/acpi/acpica/events/evhandler.c =================================================================== --- drivers/bus/acpi/acpica/events/evhandler.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evhandler.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EVHANDLER_C__ - #include "acpi.h" #include "accommon.h" #include "acevents.h" Index: drivers/bus/acpi/acpica/events/evregion.c =================================================================== --- drivers/bus/acpi/acpica/events/evregion.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evregion.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EVREGION_C__ - #include "acpi.h" #include "accommon.h" #include "acevents.h" @@ -231,6 +228,7 @@ ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; ACPI_CONNECTION_INFO *Context; + ACPI_PHYSICAL_ADDRESS Address; ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); @@ -320,23 +318,23 @@ /* We have everything we need, we can invoke the address space handler */ Handler = HandlerDesc->AddressSpace.Handler; + Address = (RegionObj->Region.Address + RegionOffset); - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - &RegionObj->Region.Handler->AddressSpace, Handler, - ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset), - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - /* * Special handling for GenericSerialBus and GeneralPurposeIo: * There are three extra parameters that must be passed to the * handler via the context: - * 1) Connection buffer, a resource template from Connection() op. - * 2) Length of the above buffer. - * 3) Actual access length from the AccessAs() op. + * 1) Connection buffer, a resource template from Connection() op + * 2) Length of the above buffer + * 3) Actual access length from the AccessAs() op + * + * In addition, for GeneralPurposeIo, the Address and BitWidth fields + * are defined as follows: + * 1) Address is the pin number index of the field (bit offset from + * the previous Connection) + * 2) BitWidth is the actual bit length of the field (number of pins) */ - if (((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) || - (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) && + if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) && Context && FieldObj) { @@ -346,7 +344,25 @@ Context->Length = FieldObj->Field.ResourceLength; Context->AccessLength = FieldObj->Field.AccessLength; } + if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO) && + Context && + FieldObj) + { + /* Get the Connection (ResourceTemplate) buffer */ + Context->Connection = FieldObj->Field.ResourceBuffer; + Context->Length = FieldObj->Field.ResourceLength; + Context->AccessLength = FieldObj->Field.AccessLength; + Address = FieldObj->Field.PinNumberIndex; + BitWidth = FieldObj->Field.BitLength; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, + "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", + &RegionObj->Region.Handler->AddressSpace, Handler, + ACPI_FORMAT_NATIVE_UINT (Address), + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + if (!(HandlerDesc->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { @@ -360,9 +376,8 @@ /* Call the handler */ - Status = Handler (Function, - (RegionObj->Region.Address + RegionOffset), BitWidth, Value, - Context, RegionObj2->Extra.RegionContext); + Status = Handler (Function, Address, BitWidth, Value, Context, + RegionObj2->Extra.RegionContext); if (ACPI_FAILURE (Status)) { Index: drivers/bus/acpi/acpica/events/evrgnini.c =================================================================== --- drivers/bus/acpi/acpica/events/evrgnini.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evrgnini.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EVRGNINI_C__ - #include "acpi.h" #include "accommon.h" #include "acevents.h" Index: drivers/bus/acpi/acpica/events/evxface.c =================================================================== --- drivers/bus/acpi/acpica/events/evxface.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evxface.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __EVXFACE_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -1109,7 +1107,8 @@ * enabled, it should be enabled at this point to restore the * post-initialization configuration. */ - if ((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) && + if (((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) || + (Handler->OriginalFlags & ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { (void) AcpiEvAddGpeReference (GpeEventInfo); Index: drivers/bus/acpi/acpica/events/evxfevnt.c =================================================================== --- drivers/bus/acpi/acpica/events/evxfevnt.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evxfevnt.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __EVXFEVNT_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -437,7 +435,9 @@ UINT32 Event, ACPI_EVENT_STATUS *EventStatus) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; + ACPI_EVENT_STATUS LocalEventStatus = 0; + UINT32 InByte; ACPI_FUNCTION_TRACE (AcpiGetEventStatus); @@ -455,12 +455,43 @@ return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get the status of the requested fixed event */ + /* Fixed event currently can be dispatched? */ + if (AcpiGbl_FixedEventHandlers[Event].Handler) + { + LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; + } + + /* Fixed event currently enabled? */ + Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &InByte); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - return_ACPI_STATUS (Status); + if (InByte) + { + LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED; + } + + /* Fixed event currently active? */ + + Status = AcpiReadBitRegister ( + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, &InByte); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (InByte) + { + LocalEventStatus |= ACPI_EVENT_FLAG_SET; + } + + (*EventStatus) = LocalEventStatus; + return_ACPI_STATUS (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) Index: drivers/bus/acpi/acpica/events/evxfgpe.c =================================================================== --- drivers/bus/acpi/acpica/events/evxfgpe.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evxfgpe.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __EVXFGPE_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -213,12 +211,23 @@ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - /* Ensure that we have a valid GPE number */ - + /* + * Ensure that we have a valid GPE number and that there is some way + * of handling the GPE (handler or a GPE method). In other words, we + * won't allow a valid GPE to be enabled if there is no way to handle it. + */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (GpeEventInfo) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_NONE) + { + Status = AcpiEvAddGpeReference (GpeEventInfo); + } + else + { + Status = AE_NO_HANDLER; + } } AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); @@ -348,6 +357,60 @@ /******************************************************************************* * + * FUNCTION: AcpiMarkGpeForWake + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply + * sets the ACPI_GPE_CAN_WAKE flag. + * + * Some potential callers of AcpiSetupGpeForWake may know in advance that + * there won't be any notify handlers installed for device wake notifications + * from the given GPE (one example is a button GPE in Linux). For these cases, + * AcpiMarkGpeForWake should be used instead of AcpiSetupGpeForWake. + * This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to + * setup implicit wake notification for it (since there's no handler method). + * + ******************************************************************************/ + +ACPI_STATUS +AcpiMarkGpeForWake ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiMarkGpeForWake); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + /* Mark the GPE as a possible wake event */ + + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; + Status = AE_OK; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiMarkGpeForWake) + + +/******************************************************************************* + * * FUNCTION: AcpiSetupGpeForWake * * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW) @@ -881,7 +944,8 @@ * For user-installed GPE Block Devices, the GpeBlockBaseNumber * is always zero */ - Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, + Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress->Address, + GpeBlockAddress->SpaceId, RegisterCount, 0, InterruptNumber, &GpeBlock); if (ACPI_FAILURE (Status)) { Index: drivers/bus/acpi/acpica/events/evxfregn.c =================================================================== --- drivers/bus/acpi/acpica/events/evxfregn.c (revision 69845) +++ drivers/bus/acpi/acpica/events/evxfregn.c (working copy) @@ -114,7 +114,6 @@ * *****************************************************************************/ -#define __EVXFREGN_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/executer/exconfig.c =================================================================== --- drivers/bus/acpi/acpica/executer/exconfig.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exconfig.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __EXCONFIG_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exconvrt.c =================================================================== --- drivers/bus/acpi/acpica/executer/exconvrt.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exconvrt.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EXCONVRT_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/excreate.c =================================================================== --- drivers/bus/acpi/acpica/executer/excreate.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/excreate.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __EXCREATE_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exdebug.c =================================================================== --- drivers/bus/acpi/acpica/executer/exdebug.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exdebug.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXDEBUG_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" @@ -154,6 +152,7 @@ UINT32 Index) { UINT32 i; + UINT32 Timer; ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); @@ -168,12 +167,20 @@ } /* + * We will emit the current timer value (in microseconds) with each + * debug output. Only need the lower 26 bits. This allows for 67 + * million microseconds or 67 seconds before rollover. + */ + Timer = ((UINT32) AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */ + Timer &= 0x03FFFFFF; + + /* * Print line header as long as we are not in the middle of an * object display */ if (!((Level > 0) && Index == 0)) { - AcpiOsPrintf ("[ACPI Debug] %*s", Level, " "); + AcpiOsPrintf ("[ACPI Debug %.8u] %*s", Timer, Level, " "); } /* Display the index for package output only */ Index: drivers/bus/acpi/acpica/executer/exdump.c =================================================================== --- drivers/bus/acpi/acpica/executer/exdump.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exdump.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXDUMP_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" @@ -580,7 +578,7 @@ } } - AcpiOsPrintf ("\n", Next); + AcpiOsPrintf ("\n"); break; case ACPI_EXD_HDLR_LIST: @@ -614,7 +612,7 @@ } } - AcpiOsPrintf ("\n", Next); + AcpiOsPrintf ("\n"); break; case ACPI_EXD_RGN_LIST: @@ -648,7 +646,7 @@ } } - AcpiOsPrintf ("\n", Next); + AcpiOsPrintf ("\n"); break; case ACPI_EXD_NODE: Index: drivers/bus/acpi/acpica/executer/exfield.c =================================================================== --- drivers/bus/acpi/acpica/executer/exfield.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exfield.c (working copy) @@ -113,21 +113,87 @@ * *****************************************************************************/ - -#define __EXFIELD_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" #include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exfield") +/* Local prototypes */ +static UINT32 +AcpiExGetSerialAccessLength ( + UINT32 AccessorType, + UINT32 AccessLength); + + /******************************************************************************* * + * FUNCTION: AcpiExGetSerialAccessLength + * + * PARAMETERS: AccessorType - The type of the protocol indicated by region + * field access attributes + * AccessLength - The access length of the region field + * + * RETURN: Decoded access length + * + * DESCRIPTION: This routine returns the length of the GenericSerialBus + * protocol bytes + * + ******************************************************************************/ + +static UINT32 +AcpiExGetSerialAccessLength ( + UINT32 AccessorType, + UINT32 AccessLength) +{ + UINT32 Length; + + + switch (AccessorType) + { + case AML_FIELD_ATTRIB_QUICK: + + Length = 0; + break; + + case AML_FIELD_ATTRIB_SEND_RCV: + case AML_FIELD_ATTRIB_BYTE: + + Length = 1; + break; + + case AML_FIELD_ATTRIB_WORD: + case AML_FIELD_ATTRIB_WORD_CALL: + + Length = 2; + break; + + case AML_FIELD_ATTRIB_MULTIBYTE: + case AML_FIELD_ATTRIB_RAW_BYTES: + case AML_FIELD_ATTRIB_RAW_PROCESS: + + Length = AccessLength; + break; + + case AML_FIELD_ATTRIB_BLOCK: + case AML_FIELD_ATTRIB_BLOCK_CALL: + default: + + Length = ACPI_GSBUS_BUFFER_SIZE - 2; + break; + } + + return (Length); +} + + +/******************************************************************************* + * * FUNCTION: AcpiExReadDataFromField * * PARAMETERS: WalkState - Current execution state @@ -152,6 +218,7 @@ ACPI_SIZE Length; void *Buffer; UINT32 Function; + UINT16 AccessorType; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -201,8 +268,19 @@ } else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) { - Length = ACPI_GSBUS_BUFFER_SIZE; - Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + AccessorType = ObjDesc->Field.Attribute; + Length = AcpiExGetSerialAccessLength (AccessorType, + ObjDesc->Field.AccessLength); + + /* + * Add additional 2 bytes for the GenericSerialBus data buffer: + * + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + */ + Length += 2; + Function = ACPI_READ | (AccessorType << 16); } else /* IPMI */ { @@ -265,6 +343,39 @@ Buffer = &BufferDesc->Integer.Value; } + if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) + { + /* + * For GPIO (GeneralPurposeIo), the Address will be the bit offset + * from the previous Connection() operator, making it effectively a + * pin number index. The BitLength is the length of the field, which + * is thus the number of pins. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "GPIO FieldRead [FROM]: Pin %u Bits %u\n", + ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Perform the write */ + + Status = AcpiExAccessRegion (ObjDesc, 0, + (UINT64 *) Buffer, ACPI_READ); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference (BufferDesc); + } + else + { + *RetBufferDesc = BufferDesc; + } + return_ACPI_STATUS (Status); + } + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length)); @@ -323,6 +434,7 @@ void *Buffer; ACPI_OPERAND_OBJECT *BufferDesc; UINT32 Function; + UINT16 AccessorType; ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); @@ -382,8 +494,19 @@ } else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) { - Length = ACPI_GSBUS_BUFFER_SIZE; - Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + AccessorType = ObjDesc->Field.Attribute; + Length = AcpiExGetSerialAccessLength (AccessorType, + ObjDesc->Field.AccessLength); + + /* + * Add additional 2 bytes for the GenericSerialBus data buffer: + * + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + */ + Length += 2; + Function = ACPI_WRITE | (AccessorType << 16); } else /* IPMI */ { @@ -426,7 +549,42 @@ *ResultDesc = BufferDesc; return_ACPI_STATUS (Status); } + else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) + { + /* + * For GPIO (GeneralPurposeIo), we will bypass the entire field + * mechanism and handoff the bit address and bit width directly to + * the handler. The Address will be the bit offset + * from the previous Connection() operator, making it effectively a + * pin number index. The BitLength is the length of the field, which + * is thus the number of pins. + */ + if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) + { + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", + AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc->Common.Type, (UINT32) SourceDesc->Integer.Value, + ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + + Buffer = &SourceDesc->Integer.Value; + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Perform the write */ + + Status = AcpiExAccessRegion (ObjDesc, 0, + (UINT64 *) Buffer, ACPI_WRITE); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + return_ACPI_STATUS (Status); + } + /* Get a pointer to the data to be written */ switch (SourceDesc->Common.Type) Index: drivers/bus/acpi/acpica/executer/exfldio.c =================================================================== --- drivers/bus/acpi/acpica/executer/exfldio.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exfldio.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EXFLDIO_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exmisc.c =================================================================== --- drivers/bus/acpi/acpica/executer/exmisc.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exmisc.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __EXMISC_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exmutex.c =================================================================== --- drivers/bus/acpi/acpica/executer/exmutex.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exmutex.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXMUTEX_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exnames.c =================================================================== --- drivers/bus/acpi/acpica/executer/exnames.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exnames.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXNAMES_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exoparg1.c =================================================================== --- drivers/bus/acpi/acpica/executer/exoparg1.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exoparg1.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXOPARG1_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/executer/exoparg2.c =================================================================== --- drivers/bus/acpi/acpica/executer/exoparg2.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exoparg2.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EXOPARG2_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/executer/exoparg3.c =================================================================== --- drivers/bus/acpi/acpica/executer/exoparg3.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exoparg3.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __EXOPARG3_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exoparg6.c =================================================================== --- drivers/bus/acpi/acpica/executer/exoparg6.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exoparg6.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __EXOPARG6_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exprep.c =================================================================== --- drivers/bus/acpi/acpica/executer/exprep.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exprep.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXPREP_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" @@ -587,6 +585,8 @@ ObjDesc->Field.ResourceLength = Info->ResourceLength; } + ObjDesc->Field.PinNumberIndex = Info->PinNumberIndex; + /* Allow full data read from EC address space */ if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && Index: drivers/bus/acpi/acpica/executer/exregion.c =================================================================== --- drivers/bus/acpi/acpica/executer/exregion.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exregion.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __EXREGION_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exresnte.c =================================================================== --- drivers/bus/acpi/acpica/executer/exresnte.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exresnte.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXRESNTE_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" Index: drivers/bus/acpi/acpica/executer/exresolv.c =================================================================== --- drivers/bus/acpi/acpica/executer/exresolv.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exresolv.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXRESOLV_C__ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" Index: drivers/bus/acpi/acpica/executer/exresop.c =================================================================== --- drivers/bus/acpi/acpica/executer/exresop.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exresop.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXRESOP_C__ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" Index: drivers/bus/acpi/acpica/executer/exstore.c =================================================================== --- drivers/bus/acpi/acpica/executer/exstore.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exstore.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXSTORE_C__ - #include "acpi.h" #include "accommon.h" #include "acdispat.h" Index: drivers/bus/acpi/acpica/executer/exstoren.c =================================================================== --- drivers/bus/acpi/acpica/executer/exstoren.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exstoren.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __EXSTOREN_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exstorob.c =================================================================== --- drivers/bus/acpi/acpica/executer/exstorob.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exstorob.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXSTOROB_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exsystem.c =================================================================== --- drivers/bus/acpi/acpica/executer/exsystem.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exsystem.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXSYSTEM_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/executer/exutils.c =================================================================== --- drivers/bus/acpi/acpica/executer/exutils.c (revision 69845) +++ drivers/bus/acpi/acpica/executer/exutils.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __EXUTILS_C__ - /* * DEFINE_AML_GLOBALS is tested in amlcode.h * to determine whether certain global names should be "defined" or only Index: drivers/bus/acpi/acpica/hardware/hwacpi.c =================================================================== --- drivers/bus/acpi/acpica/hardware/hwacpi.c (revision 69845) +++ drivers/bus/acpi/acpica/hardware/hwacpi.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __HWACPI_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/hardware/hwgpe.c =================================================================== --- drivers/bus/acpi/acpica/hardware/hwgpe.c (revision 69845) +++ drivers/bus/acpi/acpica/hardware/hwgpe.c (working copy) @@ -313,6 +313,14 @@ return (AE_BAD_PARAMETER); } + /* GPE currently handled? */ + + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_NONE) + { + LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; + } + /* Get the info block for the entire GPE register */ GpeRegisterInfo = GpeEventInfo->RegisterInfo; Index: drivers/bus/acpi/acpica/hardware/hwpci.c =================================================================== --- drivers/bus/acpi/acpica/hardware/hwpci.c (revision 69845) +++ drivers/bus/acpi/acpica/hardware/hwpci.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __HWPCI_C__ - #include "acpi.h" #include "accommon.h" @@ -233,11 +231,12 @@ /* Walk the list, updating the PCI device/function/bus numbers */ Status = AcpiHwProcessPciList (PciId, ListHead); + + /* Delete the list */ + + AcpiHwDeletePciList (ListHead); } - /* Always delete the list */ - - AcpiHwDeletePciList (ListHead); return_ACPI_STATUS (Status); } @@ -285,6 +284,9 @@ Status = AcpiGetParent (CurrentDevice, &ParentDevice); if (ACPI_FAILURE (Status)) { + /* Must delete the list before exit */ + + AcpiHwDeletePciList (*ReturnListHead); return (Status); } @@ -299,6 +301,9 @@ ListElement = ACPI_ALLOCATE (sizeof (ACPI_PCI_DEVICE)); if (!ListElement) { + /* Must delete the list before exit */ + + AcpiHwDeletePciList (*ReturnListHead); return (AE_NO_MEMORY); } Index: drivers/bus/acpi/acpica/hardware/hwregs.c =================================================================== --- drivers/bus/acpi/acpica/hardware/hwregs.c (revision 69845) +++ drivers/bus/acpi/acpica/hardware/hwregs.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __HWREGS_C__ - #include "acpi.h" #include "accommon.h" #include "acevents.h" @@ -382,9 +380,12 @@ Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, ACPI_BITMASK_ALL_FIXED_STATUS); + + AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); + if (ACPI_FAILURE (Status)) { - goto UnlockAndExit; + goto Exit; } /* Clear the GPE Bits in all GPE registers in all GPE blocks */ @@ -391,8 +392,7 @@ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL); -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); +Exit: return_ACPI_STATUS (Status); } Index: drivers/bus/acpi/acpica/hardware/hwvalid.c =================================================================== --- drivers/bus/acpi/acpica/hardware/hwvalid.c (revision 69845) +++ drivers/bus/acpi/acpica/hardware/hwvalid.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __HWVALID_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/include/acapps.h =================================================================== --- drivers/bus/acpi/acpica/include/acapps.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acapps.h (working copy) @@ -156,10 +156,13 @@ /* Macros for usage messages */ #define ACPI_USAGE_HEADER(Usage) \ - printf ("Usage: %s\nOptions:\n", Usage); + AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage); +#define ACPI_USAGE_TEXT(Description) \ + AcpiOsPrintf (Description); + #define ACPI_OPTION(Name, Description) \ - printf (" %-18s%s\n", Name, Description); + AcpiOsPrintf (" %-18s%s\n", Name, Description); #define FILE_SUFFIX_DISASSEMBLY "dsl" @@ -191,7 +194,7 @@ */ UINT32 CmGetFileSize ( - FILE *File); + ACPI_FILE File); #ifndef ACPI_DUMP_APP Index: drivers/bus/acpi/acpica/include/acbuffer.h =================================================================== --- drivers/bus/acpi/acpica/include/acbuffer.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acbuffer.h (working copy) @@ -191,7 +191,9 @@ { UINT8 Revision; UINT8 IgnoreColor; - UINT32 Color; + UINT8 Red; + UINT8 Green; + UINT8 Blue; UINT16 Width; UINT16 Height; UINT8 UserVisible; @@ -237,9 +239,15 @@ #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ -#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) -#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ +#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */ +#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */ + +#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */ + /* Second 32-bit dword, bits 33:63 */ #define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) Index: drivers/bus/acpi/acpica/include/acconfig.h =================================================================== --- drivers/bus/acpi/acpica/include/acconfig.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acconfig.h (working copy) @@ -295,6 +295,25 @@ /****************************************************************************** * + * Miscellaneous constants + * + *****************************************************************************/ + +/* UUID constants */ + +#define UUID_BUFFER_LENGTH 16 /* Length of UUID in memory */ +#define UUID_STRING_LENGTH 36 /* Total length of a UUID string */ + +/* Positions for required hyphens (dashes) in UUID strings */ + +#define UUID_HYPHEN1_OFFSET 8 +#define UUID_HYPHEN2_OFFSET 13 +#define UUID_HYPHEN3_OFFSET 18 +#define UUID_HYPHEN4_OFFSET 23 + + +/****************************************************************************** + * * ACPI AML Debugger * *****************************************************************************/ Index: drivers/bus/acpi/acpica/include/acdebug.h =================================================================== --- drivers/bus/acpi/acpica/include/acdebug.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acdebug.h (working copy) @@ -449,12 +449,7 @@ char *Filename, ACPI_TABLE_HEADER **Table); -ACPI_STATUS -AcpiDbReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table); - /* * dbhistry - debugger HISTORY command */ Index: drivers/bus/acpi/acpica/include/acdisasm.h =================================================================== --- drivers/bus/acpi/acpica/include/acdisasm.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acdisasm.h (working copy) @@ -209,15 +209,18 @@ ACPI_DMT_ASF, ACPI_DMT_DMAR, + ACPI_DMT_DMAR_SCOPE, ACPI_DMT_EINJACT, ACPI_DMT_EINJINST, ACPI_DMT_ERSTACT, ACPI_DMT_ERSTINST, ACPI_DMT_FADTPM, + ACPI_DMT_GTDT, ACPI_DMT_HEST, ACPI_DMT_HESTNTFY, ACPI_DMT_HESTNTYP, ACPI_DMT_IVRS, + ACPI_DMT_LPIT, ACPI_DMT_MADT, ACPI_DMT_PCCT, ACPI_DMT_PMTT, @@ -259,6 +262,7 @@ UINT32 BitOffset; UINT32 Flags; ACPI_WALK_STATE *WalkState; + ACPI_PARSE_OBJECT *MappingOp; } ACPI_OP_WALK_INFO; @@ -276,6 +280,7 @@ typedef void (*ACPI_RESOURCE_HANDLER) ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -326,6 +331,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; @@ -343,6 +349,10 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[]; @@ -355,6 +365,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[]; @@ -377,6 +390,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt13[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; @@ -400,6 +415,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; @@ -418,6 +434,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; @@ -513,6 +530,10 @@ ACPI_TABLE_HEADER *Table); void +AcpiDmDumpGtdt ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); @@ -521,6 +542,10 @@ ACPI_TABLE_HEADER *Table); void +AcpiDmDumpLpit ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table); @@ -719,6 +744,10 @@ UINT32 EncodedId); BOOLEAN +AcpiDmIsUuidBuffer ( + ACPI_PARSE_OBJECT *Op); + +BOOLEAN AcpiDmIsUnicodeBuffer ( ACPI_PARSE_OBJECT *Op); @@ -838,6 +867,7 @@ */ void AcpiDmWordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -844,6 +874,7 @@ void AcpiDmDwordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -850,6 +881,7 @@ void AcpiDmExtendedDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -856,6 +888,7 @@ void AcpiDmQwordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -862,6 +895,7 @@ void AcpiDmMemory24Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -868,6 +902,7 @@ void AcpiDmMemory32Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -874,6 +909,7 @@ void AcpiDmFixedMemory32Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -880,6 +916,7 @@ void AcpiDmGenericRegisterDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -886,6 +923,7 @@ void AcpiDmInterruptDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -892,6 +930,7 @@ void AcpiDmVendorLargeDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -898,6 +937,7 @@ void AcpiDmGpioDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -904,6 +944,7 @@ void AcpiDmSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -921,6 +962,7 @@ */ void AcpiDmIrqDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -927,6 +969,7 @@ void AcpiDmDmaDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -933,6 +976,7 @@ void AcpiDmFixedDmaDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -939,6 +983,7 @@ void AcpiDmIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -945,6 +990,7 @@ void AcpiDmFixedIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -951,6 +997,7 @@ void AcpiDmStartDependentDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -957,6 +1004,7 @@ void AcpiDmEndDependentDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -963,6 +1011,7 @@ void AcpiDmVendorSmallDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -1002,6 +1051,19 @@ /* + * dmcstyle + */ +BOOLEAN +AcpiDmCheckForSymbolicOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_OP_WALK_INFO *Info); + +void +AcpiDmCloseOperator ( + ACPI_PARSE_OBJECT *Op); + + +/* * acdisasm */ void @@ -1008,5 +1070,4 @@ AdDisassemblerHeader ( char *Filename); - #endif /* __ACDISASM_H__ */ Index: drivers/bus/acpi/acpica/include/acdispat.h =================================================================== --- drivers/bus/acpi/acpica/include/acdispat.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acdispat.h (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #ifndef _ACDISPAT_H_ #define _ACDISPAT_H_ Index: drivers/bus/acpi/acpica/include/acevents.h =================================================================== --- drivers/bus/acpi/acpica/include/acevents.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acevents.h (working copy) @@ -216,9 +216,10 @@ ACPI_STATUS AcpiEvCreateGpeBlock ( ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT64 Address, + UINT8 SpaceId, UINT32 RegisterCount, - UINT8 GpeBlockBaseNumber, + UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock); Index: drivers/bus/acpi/acpica/include/acglobal.h =================================================================== --- drivers/bus/acpi/acpica/include/acglobal.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acglobal.h (working copy) @@ -117,146 +117,14 @@ #define __ACGLOBAL_H__ -/* - * Ensure that the globals are actually defined and initialized only once. - * - * The use of these macros allows a single list of globals (here) in order - * to simplify maintenance of the code. - */ -#ifdef DEFINE_ACPI_GLOBALS -#define ACPI_GLOBAL(type,name) \ - extern type name; \ - type name - -#define ACPI_INIT_GLOBAL(type,name,value) \ - type name=value - -#else -#define ACPI_GLOBAL(type,name) \ - extern type name - -#define ACPI_INIT_GLOBAL(type,name,value) \ - extern type name -#endif - - -#ifdef DEFINE_ACPI_GLOBALS - -/* Public globals, available from outside ACPICA subsystem */ - /***************************************************************************** * - * Runtime configuration (static defaults that can be overriden at runtime) + * Globals related to the ACPI tables * ****************************************************************************/ -/* - * Enable "slack" in the AML interpreter? Default is FALSE, and the - * interpreter strictly follows the ACPI specification. Setting to TRUE - * allows the interpreter to ignore certain errors and/or bad AML constructs. - * - * Currently, these features are enabled by this flag: - * - * 1) Allow "implicit return" of last value in a control method - * 2) Allow access beyond the end of an operation region - * 3) Allow access to uninitialized locals/args (auto-init to integer 0) - * 4) Allow ANY object type to be a source operand for the Store() operator - * 5) Allow unresolved references (invalid target name) in package objects - * 6) Enable warning messages for behavior that is not ACPI spec compliant - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableInterpreterSlack, FALSE); +/* Master list of all ACPI tables that were found in the RSDT/XSDT */ -/* - * Automatically serialize all methods that create named objects? Default - * is TRUE, meaning that all NonSerialized methods are scanned once at - * table load time to determine those that create named objects. Methods - * that create named objects are marked Serialized in order to prevent - * possible run-time problems if they are entered by more than one thread. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE); - -/* - * Create the predefined _OSI method in the namespace? Default is TRUE - * because ACPICA is fully compatible with other ACPI implementations. - * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE); - -/* - * Optionally use default values for the ACPI register widths. Set this to - * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE); - -/* - * Optionally enable output from the AML Debug Object. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE); - -/* - * Optionally copy the entire DSDT to local memory (instead of simply - * mapping it.) There are some BIOSs that corrupt or replace the original - * DSDT, creating the need for this option. Default is FALSE, do not copy - * the DSDT. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CopyDsdtLocally, FALSE); - -/* - * Optionally ignore an XSDT if present and use the RSDT instead. - * Although the ACPI specification requires that an XSDT be used instead - * of the RSDT, the XSDT has been found to be corrupt or ill-formed on - * some machines. Default behavior is to use the XSDT if present. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); - -/* - * Optionally use 32-bit FADT addresses if and when there is a conflict - * (address mismatch) between the 32-bit and 64-bit versions of the - * address. Although ACPICA adheres to the ACPI specification which - * requires the use of the corresponding 64-bit address if it is non-zero, - * some machines have been found to have a corrupted non-zero 64-bit - * address. Default is FALSE, do not favor the 32-bit addresses. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); - -/* - * Optionally truncate I/O addresses to 16 bits. Provides compatibility - * with other ACPI implementations. NOTE: During ACPICA initialization, - * this value is set to TRUE if any Windows OSI strings have been - * requested by the BIOS. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE); - -/* - * Disable runtime checking and repair of values returned by control methods. - * Use only if the repair is causing a problem on a particular machine. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); - -/* - * Optionally do not install any SSDTs from the RSDT/XSDT during initialization. - * This can be useful for debugging ACPI problems on some machines. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE); - -/* - * We keep track of the latest version of Windows that has been requested by - * the BIOS. - */ -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); - -#endif /* DEFINE_ACPI_GLOBALS */ - - -/***************************************************************************** - * - * ACPI Table globals - * - ****************************************************************************/ - -/* - * Master list of all ACPI tables that were found in the RSDT/XSDT. - */ ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList); /* DSDT information. Used to check for DSDT corruption */ @@ -356,7 +224,6 @@ ACPI_GLOBAL (ACPI_INIT_HANDLER, AcpiGbl_InitHandler); ACPI_GLOBAL (ACPI_TABLE_HANDLER, AcpiGbl_TableHandler); ACPI_GLOBAL (void *, AcpiGbl_TableHandlerContext); -ACPI_GLOBAL (ACPI_WALK_STATE *, AcpiGbl_BreakpointWalk); ACPI_GLOBAL (ACPI_INTERFACE_HANDLER, AcpiGbl_InterfaceHandler); ACPI_GLOBAL (ACPI_SCI_HANDLER_INFO *, AcpiGbl_SciHandlerList); @@ -373,7 +240,6 @@ /* Misc */ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); -ACPI_GLOBAL (UINT32, AcpiGbl_RsdpOriginalLocation); ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); ACPI_GLOBAL (UINT32, AcpiGbl_PsFindCount); ACPI_GLOBAL (UINT16, AcpiGbl_Pm1EnableRegisterSave); @@ -507,7 +373,7 @@ * ****************************************************************************/ -ACPI_GLOBAL (UINT8, AcpiGbl_DbOutputFlags); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT); #ifdef ACPI_DISASSEMBLER @@ -515,6 +381,7 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_verbose); @@ -561,11 +428,6 @@ ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); -ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfParseTree); -ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfMethodTrees); -ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfNodeEntries); -ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfAcpiObjects); - #endif /* ACPI_DEBUGGER */ @@ -578,7 +440,13 @@ #ifdef ACPI_APPLICATION ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); +/* Print buffer */ + +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */ +ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]); + #endif /* ACPI_APPLICATION */ Index: drivers/bus/acpi/acpica/include/aclocal.h =================================================================== --- drivers/bus/acpi/acpica/include/aclocal.h (revision 69845) +++ drivers/bus/acpi/acpica/include/aclocal.h (working copy) @@ -363,6 +363,7 @@ UINT32 FieldBitPosition; UINT32 FieldBitLength; UINT16 ResourceLength; + UINT16 PinNumberIndex; UINT8 FieldFlags; UINT8 Attribute; UINT8 FieldType; @@ -588,9 +589,9 @@ { ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ + UINT16 BaseGpeNumber; /* Base GPE number for this register */ UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */ UINT8 EnableForRun; /* GPEs to keep enabled when running */ - UINT8 BaseGpeNumber; /* Base GPE number for this register */ } ACPI_GPE_REGISTER_INFO; @@ -606,10 +607,11 @@ struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */ ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */ ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */ - ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */ + UINT64 Address; /* Base address of the block */ UINT32 RegisterCount; /* Number of register pairs in block */ UINT16 GpeCount; /* Number of individual GPEs in block */ - UINT8 BlockBaseNumber;/* Base GPE number for this block */ + UINT16 BlockBaseNumber;/* Base GPE number for this block */ + UINT8 SpaceId; BOOLEAN Initialized; /* TRUE if this block is initialized */ } ACPI_GPE_BLOCK_INFO; @@ -939,6 +941,7 @@ ACPI_DISASM_ONLY_MEMBERS (\ UINT8 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ + char *OperatorSymbol;/* Used for C-style operator name strings */\ char AmlOpName[16]) /* Op name (debug only) */ @@ -949,12 +952,13 @@ #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ -#define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ -#define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ -#define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a LNotEqual (etc.) pair of opcodes */ -#define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a LNotEqual (etc.) pair of opcodes */ -#define ACPI_DASM_HID_STRING 0x09 /* String is a _HID or _CID */ -#define ACPI_DASM_IGNORE 0x0A /* Not used at this time */ +#define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */ +#define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */ +#define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */ +#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */ +#define ACPI_DASM_IGNORE 0x0B /* Not used at this time */ /* * Generic operation (for example: If, While, Store) @@ -1060,6 +1064,8 @@ #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 #define ACPI_PARSEOP_PREDEF_CHECKED 0x08 #define ACPI_PARSEOP_SPECIAL 0x10 +#define ACPI_PARSEOP_COMPOUND 0x20 +#define ACPI_PARSEOP_ASSIGNMENT 0x40 /***************************************************************************** @@ -1429,4 +1435,11 @@ } AH_DEVICE_ID; +typedef struct ah_uuid +{ + char *Description; + char *String; + +} AH_UUID; + #endif /* __ACLOCAL_H__ */ Index: drivers/bus/acpi/acpica/include/acnames.h =================================================================== --- drivers/bus/acpi/acpica/include/acnames.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acnames.h (working copy) @@ -124,12 +124,18 @@ #define METHOD_NAME__CBA "_CBA" #define METHOD_NAME__CID "_CID" #define METHOD_NAME__CRS "_CRS" +#define METHOD_NAME__DDN "_DDN" #define METHOD_NAME__HID "_HID" #define METHOD_NAME__INI "_INI" #define METHOD_NAME__PLD "_PLD" +#define METHOD_NAME__DSD "_DSD" #define METHOD_NAME__PRS "_PRS" #define METHOD_NAME__PRT "_PRT" #define METHOD_NAME__PRW "_PRW" +#define METHOD_NAME__PS0 "_PS0" +#define METHOD_NAME__PS1 "_PS1" +#define METHOD_NAME__PS2 "_PS2" +#define METHOD_NAME__PS3 "_PS3" #define METHOD_NAME__REG "_REG" #define METHOD_NAME__SB_ "_SB_" #define METHOD_NAME__SEG "_SEG" Index: drivers/bus/acpi/acpica/include/acobject.h =================================================================== --- drivers/bus/acpi/acpica/include/acobject.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acobject.h (working copy) @@ -410,6 +410,7 @@ UINT16 ResourceLength; union acpi_operand_object *RegionObj; /* Containing OpRegion object */ UINT8 *ResourceBuffer; /* ResourceTemplate for serial regions/fields */ + UINT16 PinNumberIndex; /* Index relative to previous Connection/Template */ } ACPI_OBJECT_REGION_FIELD; Index: drivers/bus/acpi/acpica/include/acparser.h =================================================================== --- drivers/bus/acpi/acpica/include/acparser.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acparser.h (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #ifndef __ACPARSER_H__ #define __ACPARSER_H__ Index: drivers/bus/acpi/acpica/include/acpi.h =================================================================== --- drivers/bus/acpi/acpica/include/acpi.h (revision 69860) +++ drivers/bus/acpi/acpica/include/acpi.h (working copy) @@ -122,6 +122,7 @@ */ #include #undef ACPI_BIOS_ERROR // ACPI_BIOS_ERROR is redefined in acoutput.h +#define ACPI_USE_SYSTEM_INTTYPES #endif /* __REACTOS__ */ /* @@ -142,8 +143,6 @@ #include "acrestyp.h" /* Resource Descriptor structs */ #include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ #include "acpixf.h" /* ACPI core subsystem external interfaces */ -#ifdef ACPI_NATIVE_INTERFACE_HEADER -#include ACPI_NATIVE_INTERFACE_HEADER -#endif +#include "platform/acenvex.h" /* Extra environment-specific items */ #endif /* __ACPI_H__ */ Index: drivers/bus/acpi/acpica/include/acpiosxf.h =================================================================== --- drivers/bus/acpi/acpica/include/acpiosxf.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acpiosxf.h (working copy) @@ -623,4 +623,53 @@ #endif +/* + * File I/O and related support + */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenFile +ACPI_FILE +AcpiOsOpenFile ( + const char *Path, + UINT8 Modes); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseFile +void +AcpiOsCloseFile ( + ACPI_FILE File); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadFile +int +AcpiOsReadFile ( + ACPI_FILE File, + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteFile +int +AcpiOsWriteFile ( + ACPI_FILE File, + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetFileOffset +long +AcpiOsGetFileOffset ( + ACPI_FILE File); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSetFileOffset +ACPI_STATUS +AcpiOsSetFileOffset ( + ACPI_FILE File, + long Offset, + UINT8 From); +#endif + + #endif /* __ACPIOSXF_H__ */ Index: drivers/bus/acpi/acpica/include/acpixf.h =================================================================== --- drivers/bus/acpi/acpica/include/acpixf.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acpixf.h (working copy) @@ -113,13 +113,12 @@ * *****************************************************************************/ - #ifndef __ACXFACE_H__ #define __ACXFACE_H__ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20140325 +#define ACPI_CA_VERSION 0x20141107 #include "acconfig.h" #include "actypes.h" @@ -126,51 +125,246 @@ #include "actbl.h" #include "acbuffer.h" + +/***************************************************************************** + * + * Macros used for ACPICA globals and configuration + * + ****************************************************************************/ + /* - * Globals that are publically available + * Ensure that global variables are defined and initialized only once. + * + * The use of these macros allows for a single list of globals (here) + * in order to simplify maintenance of the code. */ -extern UINT32 AcpiCurrentGpeCount; -extern ACPI_TABLE_FADT AcpiGbl_FADT; -extern BOOLEAN AcpiGbl_SystemAwakeAndRunning; -extern BOOLEAN AcpiGbl_ReducedHardware; /* ACPI 5.0 */ -extern UINT8 AcpiGbl_OsiData; +#ifdef DEFINE_ACPI_GLOBALS +#define ACPI_GLOBAL(type,name) \ + extern type name; \ + type name -/* Runtime configuration of debug print levels */ +#define ACPI_INIT_GLOBAL(type,name,value) \ + type name=value -extern UINT32 AcpiDbgLevel; -extern UINT32 AcpiDbgLayer; +#else +#ifndef ACPI_GLOBAL +#define ACPI_GLOBAL(type,name) \ + extern type name +#endif -/* ACPICA runtime options */ +#ifndef ACPI_INIT_GLOBAL +#define ACPI_INIT_GLOBAL(type,name,value) \ + extern type name +#endif +#endif -extern UINT8 AcpiGbl_AutoSerializeMethods; -extern UINT8 AcpiGbl_CopyDsdtLocally; -extern UINT8 AcpiGbl_CreateOsiMethod; -extern UINT8 AcpiGbl_DisableAutoRepair; -extern UINT8 AcpiGbl_DisableSsdtTableInstall; -extern UINT8 AcpiGbl_DoNotUseXsdt; -extern UINT8 AcpiGbl_EnableAmlDebugObject; -extern UINT8 AcpiGbl_EnableInterpreterSlack; -extern UINT32 AcpiGbl_TraceFlags; -extern ACPI_NAME AcpiGbl_TraceMethodName; -extern UINT8 AcpiGbl_TruncateIoAddresses; -extern UINT8 AcpiGbl_Use32BitFadtAddresses; -extern UINT8 AcpiGbl_UseDefaultRegisterWidths; +/* + * These macros configure the various ACPICA interfaces. They are + * useful for generating stub inline functions for features that are + * configured out of the current kernel or ACPICA application. + */ +#ifndef ACPI_EXTERNAL_RETURN_STATUS +#define ACPI_EXTERNAL_RETURN_STATUS(Prototype) \ + Prototype; +#endif +#ifndef ACPI_EXTERNAL_RETURN_OK +#define ACPI_EXTERNAL_RETURN_OK(Prototype) \ + Prototype; +#endif +#ifndef ACPI_EXTERNAL_RETURN_VOID +#define ACPI_EXTERNAL_RETURN_VOID(Prototype) \ + Prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_UINT32 +#define ACPI_EXTERNAL_RETURN_UINT32(Prototype) \ + Prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_PTR +#define ACPI_EXTERNAL_RETURN_PTR(Prototype) \ + Prototype; +#endif + + +/***************************************************************************** + * + * Public globals and runtime configuration options + * + ****************************************************************************/ + /* - * Hardware-reduced prototypes. All interfaces that use these macros will - * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag + * Enable "slack mode" of the AML interpreter? Default is FALSE, and the + * interpreter strictly follows the ACPI specification. Setting to TRUE + * allows the interpreter to ignore certain errors and/or bad AML constructs. + * + * Currently, these features are enabled by this flag: + * + * 1) Allow "implicit return" of last value in a control method + * 2) Allow access beyond the end of an operation region + * 3) Allow access to uninitialized locals/args (auto-init to integer 0) + * 4) Allow ANY object type to be a source operand for the Store() operator + * 5) Allow unresolved references (invalid target name) in package objects + * 6) Enable warning messages for behavior that is not ACPI spec compliant + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableInterpreterSlack, FALSE); + +/* + * Automatically serialize all methods that create named objects? Default + * is TRUE, meaning that all NonSerialized methods are scanned once at + * table load time to determine those that create named objects. Methods + * that create named objects are marked Serialized in order to prevent + * possible run-time problems if they are entered by more than one thread. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE); + +/* + * Create the predefined _OSI method in the namespace? Default is TRUE + * because ACPICA is fully compatible with other ACPI implementations. + * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE); + +/* + * Optionally use default values for the ACPI register widths. Set this to + * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE); + +/* + * Whether or not to verify the table checksum before installation. Set + * this to TRUE to verify the table checksum before install it to the table + * manager. Note that enabling this option causes errors to happen in some + * OSPMs during early initialization stages. Default behavior is to do such + * verification. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_VerifyTableChecksum, TRUE); + +/* + * Optionally enable output from the AML Debug Object. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE); + +/* + * Optionally copy the entire DSDT to local memory (instead of simply + * mapping it.) There are some BIOSs that corrupt or replace the original + * DSDT, creating the need for this option. Default is FALSE, do not copy + * the DSDT. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CopyDsdtLocally, FALSE); + +/* + * Optionally ignore an XSDT if present and use the RSDT instead. + * Although the ACPI specification requires that an XSDT be used instead + * of the RSDT, the XSDT has been found to be corrupt or ill-formed on + * some machines. Default behavior is to use the XSDT if present. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); + +/* + * Optionally use 32-bit FADT addresses if and when there is a conflict + * (address mismatch) between the 32-bit and 64-bit versions of the + * address. Although ACPICA adheres to the ACPI specification which + * requires the use of the corresponding 64-bit address if it is non-zero, + * some machines have been found to have a corrupted non-zero 64-bit + * address. Default is FALSE, do not favor the 32-bit addresses. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); + +/* + * Optionally truncate I/O addresses to 16 bits. Provides compatibility + * with other ACPI implementations. NOTE: During ACPICA initialization, + * this value is set to TRUE if any Windows OSI strings have been + * requested by the BIOS. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE); + +/* + * Disable runtime checking and repair of values returned by control methods. + * Use only if the repair is causing a problem on a particular machine. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); + +/* + * Optionally do not install any SSDTs from the RSDT/XSDT during initialization. + * This can be useful for debugging ACPI problems on some machines. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE); + +/* + * We keep track of the latest version of Windows that has been requested by + * the BIOS. ACPI 5.0. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); + +/* + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. + */ +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); + +/* + * This mechanism is used to trace a specified AML method. The method is + * traced each time it is executed. + */ +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceFlags, 0); +ACPI_INIT_GLOBAL (ACPI_NAME, AcpiGbl_TraceMethodName, 0); + +/* + * Runtime configuration of debug output control masks. We want the debug + * switches statically initialized so they are already set when the debugger + * is entered. + */ +#ifdef ACPI_DEBUG_OUTPUT +ACPI_INIT_GLOBAL (UINT32, AcpiDbgLevel, ACPI_DEBUG_DEFAULT); +#else +ACPI_INIT_GLOBAL (UINT32, AcpiDbgLevel, ACPI_NORMAL_DEFAULT); +#endif +ACPI_INIT_GLOBAL (UINT32, AcpiDbgLayer, ACPI_COMPONENT_DEFAULT); + +/* + * Other miscellaneous globals + */ +ACPI_GLOBAL (ACPI_TABLE_FADT, AcpiGbl_FADT); +ACPI_GLOBAL (UINT32, AcpiCurrentGpeCount); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning); + + +/***************************************************************************** + * + * ACPICA public interface configuration. + * + * Interfaces that are configured out of the ACPICA build are replaced + * by inlined stubs by default. + * + ****************************************************************************/ + +/* + * Hardware-reduced prototypes (default: Not hardware reduced). + * + * All ACPICA hardware-related interfaces that use these macros will be + * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag * is set to TRUE. + * + * Note: This static build option for reduced hardware is intended to + * reduce ACPICA code size if desired or necessary. However, even if this + * option is not specified, the runtime behavior of ACPICA is dependent + * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, + * the flag will enable similar behavior -- ACPICA will not attempt + * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) */ #if (!ACPI_REDUCED_HARDWARE) #define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \ - Prototype; + ACPI_EXTERNAL_RETURN_STATUS(Prototype) #define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \ - Prototype; + ACPI_EXTERNAL_RETURN_OK(Prototype) #define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \ - Prototype; + ACPI_EXTERNAL_RETURN_VOID(Prototype) #else #define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \ @@ -186,29 +380,94 @@ /* + * Error message prototypes (default: error messages enabled). + * + * All interfaces related to error and warning messages + * will be configured out of the ACPICA build if the + * ACPI_NO_ERROR_MESSAGE flag is defined. + */ +#ifndef ACPI_NO_ERROR_MESSAGES +#define ACPI_MSG_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_MSG_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_NO_ERROR_MESSAGES */ + + +/* + * Debugging output prototypes (default: no debug output). + * + * All interfaces related to debug output messages + * will be configured out of the ACPICA build unless the + * ACPI_DEBUG_OUTPUT flag is defined. + */ +#ifdef ACPI_DEBUG_OUTPUT +#define ACPI_DBG_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_DBG_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_DEBUG_OUTPUT */ + + +/* + * Application prototypes + * + * All interfaces used by application will be configured + * out of the ACPICA build unless the ACPI_APPLICATION + * flag is defined. + */ +#ifdef ACPI_APPLICATION +#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_APPLICATION */ + + +/***************************************************************************** + * + * ACPICA public interface prototypes + * + ****************************************************************************/ + +/* * Initialization */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInitializeTables ( ACPI_TABLE_DESC *InitialStorage, UINT32 InitialTableCount, - BOOLEAN AllowResize); + BOOLEAN AllowResize)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInitializeSubsystem ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEnableSubsystem ( - UINT32 Flags); + UINT32 Flags)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInitializeObjects ( - UINT32 Flags); + UINT32 Flags)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiTerminate ( - void); + void)) /* @@ -224,114 +483,136 @@ AcpiDisable ( void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiSubsystemStatus ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetSystemInfo ( - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetStatistics ( - ACPI_STATISTICS *Stats); + ACPI_STATISTICS *Stats)) +ACPI_EXTERNAL_RETURN_PTR ( const char * AcpiFormatException ( - ACPI_STATUS Exception); + ACPI_STATUS Exception)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiPurgeCachedObjects ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallInterface ( - ACPI_STRING InterfaceName); + ACPI_STRING InterfaceName)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveInterface ( - ACPI_STRING InterfaceName); + ACPI_STRING InterfaceName)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiUpdateInterfaces ( - UINT8 Action); + UINT8 Action)) +ACPI_EXTERNAL_RETURN_UINT32 ( UINT32 AcpiCheckAddressRange ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, ACPI_SIZE Length, - BOOLEAN Warn); + BOOLEAN Warn)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDecodePldBuffer ( UINT8 *InBuffer, ACPI_SIZE Length, - ACPI_PLD_INFO **ReturnBuffer); + ACPI_PLD_INFO **ReturnBuffer)) /* * ACPI table load/unload interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallTable ( ACPI_PHYSICAL_ADDRESS Address, - BOOLEAN Physical); + BOOLEAN Physical)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLoadTable ( - ACPI_TABLE_HEADER *Table); + ACPI_TABLE_HEADER *Table)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiUnloadParentTable ( - ACPI_HANDLE Object); + ACPI_HANDLE Object)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLoadTables ( - void); + void)) /* * ACPI table manipulation interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiReallocateRootTable ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiFindRootPointer ( - ACPI_SIZE *RsdpAddress); + ACPI_SIZE *RsdpAddress)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetTableHeader ( ACPI_STRING Signature, UINT32 Instance, - ACPI_TABLE_HEADER *OutTableHeader); + ACPI_TABLE_HEADER *OutTableHeader)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetTable ( ACPI_STRING Signature, UINT32 Instance, - ACPI_TABLE_HEADER **OutTable); + ACPI_TABLE_HEADER **OutTable)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetTableByIndex ( UINT32 TableIndex, - ACPI_TABLE_HEADER **OutTable); + ACPI_TABLE_HEADER **OutTable)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallTableHandler ( ACPI_TABLE_HANDLER Handler, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveTableHandler ( - ACPI_TABLE_HANDLER Handler); + ACPI_TABLE_HANDLER Handler)) /* * Namespace and name interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, @@ -340,62 +621,71 @@ ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, - void **ReturnValue); + void **ReturnValue)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetDevices ( char *HID, ACPI_WALK_CALLBACK UserFunction, void *Context, - void **ReturnValue); + void **ReturnValue)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetName ( ACPI_HANDLE Object, UINT32 NameType, - ACPI_BUFFER *RetPathPtr); + ACPI_BUFFER *RetPathPtr)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetHandle ( ACPI_HANDLE Parent, ACPI_STRING Pathname, - ACPI_HANDLE *RetHandle); + ACPI_HANDLE *RetHandle)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiAttachData ( ACPI_HANDLE Object, ACPI_OBJECT_HANDLER Handler, - void *Data); + void *Data)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDetachData ( ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler); + ACPI_OBJECT_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetData ( ACPI_HANDLE Object, ACPI_OBJECT_HANDLER Handler, - void **Data); + void **Data)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDebugTrace ( char *Name, UINT32 DebugLevel, UINT32 DebugLayer, - UINT32 Flags); + UINT32 Flags)) /* * Object manipulation and enumeration */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEvaluateObject ( ACPI_HANDLE Object, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ParameterObjects, - ACPI_BUFFER *ReturnObjectBuffer); + ACPI_BUFFER *ReturnObjectBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEvaluateObjectTyped ( ACPI_HANDLE Object, @@ -402,42 +692,48 @@ ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer, - ACPI_OBJECT_TYPE ReturnType); + ACPI_OBJECT_TYPE ReturnType)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Object, - ACPI_DEVICE_INFO **ReturnBuffer); + ACPI_DEVICE_INFO **ReturnBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallMethod ( - UINT8 *Buffer); + UINT8 *Buffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetNextObject ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE Parent, ACPI_HANDLE Child, - ACPI_HANDLE *OutHandle); + ACPI_HANDLE *OutHandle)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetType ( ACPI_HANDLE Object, - ACPI_OBJECT_TYPE *OutType); + ACPI_OBJECT_TYPE *OutType)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetParent ( ACPI_HANDLE Object, - ACPI_HANDLE *OutHandle); + ACPI_HANDLE *OutHandle)) /* * Handler interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallInitializationHandler ( ACPI_INIT_HANDLER Handler, - UINT32 Function); + UINT32 Function)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -485,19 +781,22 @@ UINT32 GpeNumber, ACPI_GPE_HANDLER Address)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, - ACPI_NOTIFY_HANDLER Handler); + ACPI_NOTIFY_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallAddressSpaceHandler ( ACPI_HANDLE Device, @@ -504,21 +803,24 @@ ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler, ACPI_ADR_SPACE_SETUP Setup, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveAddressSpaceHandler ( ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler); + ACPI_ADR_SPACE_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallExceptionHandler ( - ACPI_EXCEPTION_HANDLER Handler); + ACPI_EXCEPTION_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallInterfaceHandler ( - ACPI_INTERFACE_HANDLER Handler); + ACPI_INTERFACE_HANDLER Handler)) /* @@ -539,16 +841,18 @@ /* * Interfaces to AML mutex objects */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiAcquireMutex ( ACPI_HANDLE Handle, ACPI_STRING Pathname, - UINT16 Timeout); + UINT16 Timeout)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiReleaseMutex ( ACPI_HANDLE Handle, - ACPI_STRING Pathname); + ACPI_STRING Pathname)) /* @@ -619,6 +923,12 @@ ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS +AcpiMarkGpeForWake ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber)) + +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS AcpiSetupGpeForWake ( ACPI_HANDLE ParentDevice, ACPI_HANDLE GpeDevice, @@ -676,79 +986,92 @@ ACPI_RESOURCE *Resource, void *Context); +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetVendorResource ( ACPI_HANDLE Device, char *Name, ACPI_VENDOR_UUID *Uuid, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetCurrentResources ( ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetPossibleResources ( ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetEventResources ( ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWalkResourceBuffer ( ACPI_BUFFER *Buffer, ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWalkResources ( ACPI_HANDLE Device, char *Name, ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiSetCurrentResources ( ACPI_HANDLE Device, - ACPI_BUFFER *InBuffer); + ACPI_BUFFER *InBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetIrqRoutingTable ( ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiResourceToAddress64 ( ACPI_RESOURCE *Resource, - ACPI_RESOURCE_ADDRESS64 *Out); + ACPI_RESOURCE_ADDRESS64 *Out)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiBufferToResource ( UINT8 *AmlBuffer, UINT16 AmlBufferLength, - ACPI_RESOURCE **ResourcePtr); + ACPI_RESOURCE **ResourcePtr)) /* * Hardware (ACPI device) interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiReset ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRead ( UINT64 *Value, - ACPI_GENERIC_ADDRESS *Reg); + ACPI_GENERIC_ADDRESS *Reg)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWrite ( UINT64 Value, - ACPI_GENERIC_ADDRESS *Reg); + ACPI_GENERIC_ADDRESS *Reg)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -766,19 +1089,22 @@ /* * Sleep/Wake interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetSleepTypeData ( UINT8 SleepState, UINT8 *Slp_TypA, - UINT8 *Slp_TypB); + UINT8 *Slp_TypB)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEnterSleepStatePrep ( - UINT8 SleepState); + UINT8 SleepState)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEnterSleepState ( - UINT8 SleepState); + UINT8 SleepState)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -785,13 +1111,15 @@ AcpiEnterSleepStateS4bios ( void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLeaveSleepStatePrep ( - UINT8 SleepState); + UINT8 SleepState)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLeaveSleepState ( - UINT8 SleepState); + UINT8 SleepState)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -830,6 +1158,7 @@ /* * Error/Warning output */ +ACPI_MSG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiError ( @@ -836,8 +1165,9 @@ const char *ModuleName, UINT32 LineNumber, const char *Format, - ...); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(4) void ACPI_INTERNAL_VAR_XFACE AcpiException ( @@ -845,8 +1175,9 @@ UINT32 LineNumber, ACPI_STATUS Status, const char *Format, - ...); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiWarning ( @@ -853,8 +1184,9 @@ const char *ModuleName, UINT32 LineNumber, const char *Format, - ...); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiInfo ( @@ -861,8 +1193,9 @@ const char *ModuleName, UINT32 LineNumber, const char *Format, - ...); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiBiosError ( @@ -869,8 +1202,9 @@ const char *ModuleName, UINT32 LineNumber, const char *Format, - ...); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiBiosWarning ( @@ -877,14 +1211,13 @@ const char *ModuleName, UINT32 LineNumber, const char *Format, - ...); + ...)) /* * Debug output */ -#ifdef ACPI_DEBUG_OUTPUT - +ACPI_DBG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(6) void ACPI_INTERNAL_VAR_XFACE AcpiDebugPrint ( @@ -894,8 +1227,9 @@ const char *ModuleName, UINT32 ComponentId, const char *Format, - ...); + ...)) +ACPI_DBG_DEPENDENT_RETURN_VOID ( ACPI_PRINTF_LIKE(6) void ACPI_INTERNAL_VAR_XFACE AcpiDebugPrintRaw ( @@ -905,7 +1239,13 @@ const char *ModuleName, UINT32 ComponentId, const char *Format, - ...); -#endif + ...)) +ACPI_APP_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(1) +void ACPI_INTERNAL_VAR_XFACE +AcpiLogError ( + const char *Format, + ...)) + #endif /* __ACXFACE_H__ */ Index: drivers/bus/acpi/acpica/include/acpredef.h =================================================================== --- drivers/bus/acpi/acpica/include/acpredef.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acpredef.h (working copy) @@ -178,6 +178,11 @@ * count = 0 (optional) * (Used for _DLM) * + * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID + * defines the format of the package. Zero-length parent package is + * allowed. + * (Used for _DSD) + * *****************************************************************************/ enum AcpiReturnPackageTypes @@ -191,7 +196,8 @@ ACPI_PTYPE2_FIXED = 7, ACPI_PTYPE2_MIN = 8, ACPI_PTYPE2_REV_FIXED = 9, - ACPI_PTYPE2_FIX_VAR = 10 + ACPI_PTYPE2_FIX_VAR = 10, + ACPI_PTYPE2_UUID_PAIR = 11 }; @@ -438,6 +444,9 @@ {{"_CBA", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */ + {{"_CCA", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 5.1 */ + {{"_CDM", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -506,6 +515,10 @@ {{"_DOS", METHOD_1ARGS (ACPI_TYPE_INTEGER), METHOD_NO_RETURN_VALUE}}, + {{"_DSD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */ + PACKAGE_INFO (ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_PACKAGE, 1,0), + {{"_DSM", METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_PACKAGE), METHOD_RETURNS (ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */ @@ -652,6 +665,10 @@ {{"_LID", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_LPD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */ + PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), + {{"_MAT", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, @@ -756,12 +773,6 @@ METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), - {{"_PRP", METHOD_0ARGS, - METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Str, 1 Int/Str/Pkg */ - PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, - ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | - ACPI_RTYPE_PACKAGE | ACPI_RTYPE_REFERENCE, 1,0), - {{"_PRS", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, Index: drivers/bus/acpi/acpica/include/actables.h =================================================================== --- drivers/bus/acpi/acpica/include/actables.h (revision 69845) +++ drivers/bus/acpi/acpica/include/actables.h (working copy) @@ -124,6 +124,10 @@ /* * tbxfroot - Root pointer utilities */ +UINT32 +AcpiTbGetRsdpLength ( + ACPI_TABLE_RSDP *Rsdp); + ACPI_STATUS AcpiTbValidateRsdp ( ACPI_TABLE_RSDP *Rsdp); @@ -158,6 +162,15 @@ AcpiTbReleaseTempTable ( ACPI_TABLE_DESC *TableDesc); +ACPI_STATUS +AcpiTbValidateTempTable ( + ACPI_TABLE_DESC *TableDesc); + +ACPI_STATUS +AcpiTbVerifyTempTable ( + ACPI_TABLE_DESC *TableDesc, + char *Signature); + BOOLEAN AcpiTbIsTableLoaded ( UINT32 TableIndex); @@ -207,11 +220,6 @@ AcpiTbInvalidateTable ( ACPI_TABLE_DESC *TableDesc); -ACPI_STATUS -AcpiTbVerifyTable ( - ACPI_TABLE_DESC *TableDesc, - char *Signature); - void AcpiTbOverrideTable ( ACPI_TABLE_DESC *OldTableDesc); Index: drivers/bus/acpi/acpica/include/actbl.h =================================================================== --- drivers/bus/acpi/acpica/include/actbl.h (revision 69845) +++ drivers/bus/acpi/acpica/include/actbl.h (working copy) @@ -368,7 +368,8 @@ UINT32 Flags; /* Miscellaneous flag bits (see below for individual flags) */ ACPI_GENERIC_ADDRESS ResetRegister; /* 64-bit address of the Reset register */ UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */ - UINT8 Reserved4[3]; /* Reserved, must be zero */ + UINT16 ArmBootFlags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ + UINT8 MinorRevision; /* FADT Minor Revision (ACPI 5.1) */ UINT64 XFacs; /* 64-bit physical address of FACS */ UINT64 XDsdt; /* 64-bit physical address of DSDT */ ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ @@ -385,7 +386,7 @@ } ACPI_TABLE_FADT; -/* Masks for FADT Boot Architecture Flags (BootFlags) [Vx]=Introduced in this FADT revision */ +/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ @@ -394,6 +395,11 @@ #define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ #define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */ +/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ + +#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */ +#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */ + /* Masks for FADT flags */ #define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ @@ -507,7 +513,7 @@ * FADT V5 size: 0x10C */ #define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) -#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3) +#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1) #define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) #define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) Index: drivers/bus/acpi/acpica/include/actbl1.h =================================================================== --- drivers/bus/acpi/acpica/include/actbl1.h (revision 69845) +++ drivers/bus/acpi/acpica/include/actbl1.h (working copy) @@ -834,25 +834,27 @@ enum AcpiMadtType { - ACPI_MADT_TYPE_LOCAL_APIC = 0, - ACPI_MADT_TYPE_IO_APIC = 1, - ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, - ACPI_MADT_TYPE_NMI_SOURCE = 3, - ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, - ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, - ACPI_MADT_TYPE_IO_SAPIC = 6, - ACPI_MADT_TYPE_LOCAL_SAPIC = 7, - ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, - ACPI_MADT_TYPE_LOCAL_X2APIC = 9, - ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, - ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, - ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, - ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */ + ACPI_MADT_TYPE_LOCAL_APIC = 0, + ACPI_MADT_TYPE_IO_APIC = 1, + ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, + ACPI_MADT_TYPE_NMI_SOURCE = 3, + ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, + ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, + ACPI_MADT_TYPE_IO_SAPIC = 6, + ACPI_MADT_TYPE_LOCAL_SAPIC = 7, + ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, + ACPI_MADT_TYPE_LOCAL_X2APIC = 9, + ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, + ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, + ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, + ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, + ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, + ACPI_MADT_TYPE_RESERVED = 15 /* 15 and greater are reserved */ }; /* - * MADT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER + * MADT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER */ /* 0: Processor Local APIC */ @@ -1008,7 +1010,7 @@ { ACPI_SUBTABLE_HEADER Header; UINT16 Reserved; /* Reserved - must be zero */ - UINT32 GicId; + UINT32 CpuInterfaceNumber; UINT32 Uid; UINT32 Flags; UINT32 ParkingVersion; @@ -1015,10 +1017,21 @@ UINT32 PerformanceInterrupt; UINT64 ParkedAddress; UINT64 BaseAddress; + UINT64 GicvBaseAddress; + UINT64 GichBaseAddress; + UINT32 VgicInterrupt; + UINT64 GicrBaseAddress; + UINT64 ArmMpidr; } ACPI_MADT_GENERIC_INTERRUPT; +/* Masks for Flags field above */ +/* ACPI_MADT_ENABLED (1) Processor is usable if set */ +#define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */ +#define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */ + + /* 12: Generic Distributor (ACPI 5.0) */ typedef struct acpi_madt_generic_distributor @@ -1033,11 +1046,42 @@ } ACPI_MADT_GENERIC_DISTRIBUTOR; +/* 13: Generic MSI Frame (ACPI 5.1) */ + +typedef struct acpi_madt_generic_msi_frame +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* Reserved - must be zero */ + UINT32 MsiFrameId; + UINT64 BaseAddress; + UINT32 Flags; + UINT16 SpiCount; + UINT16 SpiBase; + +} ACPI_MADT_GENERIC_MSI_FRAME; + +/* Masks for Flags field above */ + +#define ACPI_MADT_OVERRIDE_SPI_VALUES (1) + + +/* 14: Generic Redistributor (ACPI 5.1) */ + +typedef struct acpi_madt_generic_redistributor +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* reserved - must be zero */ + UINT64 BaseAddress; + UINT32 Length; + +} ACPI_MADT_GENERIC_REDISTRIBUTOR; + + /* * Common flags fields for MADT subtables */ -/* MADT Local APIC flags (LapicFlags) and GIC flags */ +/* MADT Local APIC flags */ #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ @@ -1146,11 +1190,12 @@ ACPI_SRAT_TYPE_CPU_AFFINITY = 0, ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, - ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ + ACPI_SRAT_TYPE_GICC_AFFINITY = 3, + ACPI_SRAT_TYPE_RESERVED = 4 /* 4 and greater are reserved */ }; /* - * SRAT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER + * SRAT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER */ /* 0: Processor Local APIC/SAPIC Affinity */ @@ -1163,7 +1208,7 @@ UINT32 Flags; UINT8 LocalSapicEid; UINT8 ProximityDomainHi[3]; - UINT32 Reserved; /* Reserved, must be zero */ + UINT32 ClockDomain; } ACPI_SRAT_CPU_AFFINITY; @@ -1213,6 +1258,22 @@ #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ +/* 3: GICC Affinity (ACPI 5.1) */ + +typedef struct acpi_srat_gicc_affinity +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 ProximityDomain; + UINT32 AcpiProcessorUid; + UINT32 Flags; + UINT32 ClockDomain; + +} ACPI_SRAT_GICC_AFFINITY; + +/* Flags for ACPI_SRAT_GICC_AFFINITY */ + +#define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */ + /* Reset to default packing */ #pragma pack() Index: drivers/bus/acpi/acpica/include/actbl2.h =================================================================== --- drivers/bus/acpi/acpica/include/actbl2.h (revision 69845) +++ drivers/bus/acpi/acpica/include/actbl2.h (working copy) @@ -144,6 +144,7 @@ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ +#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ @@ -521,7 +522,7 @@ * Version 1 * * Conforms to "Intel Virtualization Technology for Directed I/O", - * Version 1.2, Sept. 2008 + * Version 2.2, Sept. 2013 * ******************************************************************************/ @@ -554,9 +555,10 @@ { ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, - ACPI_DMAR_TYPE_ATSR = 2, - ACPI_DMAR_HARDWARE_AFFINITY = 3, - ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */ + ACPI_DMAR_TYPE_ROOT_ATS = 2, + ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, + ACPI_DMAR_TYPE_NAMESPACE = 4, + ACPI_DMAR_TYPE_RESERVED = 5 /* 5 and greater are reserved */ }; @@ -572,7 +574,7 @@ } ACPI_DMAR_DEVICE_SCOPE; -/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE */ +/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE - device types */ enum AcpiDmarScopeType { @@ -581,7 +583,8 @@ ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, ACPI_DMAR_SCOPE_TYPE_HPET = 4, - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ + ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, + ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ }; typedef struct acpi_dmar_pci_path @@ -593,7 +596,7 @@ /* - * DMAR Sub-tables, correspond to Type in ACPI_DMAR_HEADER + * DMAR Subtables, correspond to Type in ACPI_DMAR_HEADER */ /* 0: Hardware Unit Definition */ @@ -658,6 +661,18 @@ } ACPI_DMAR_RHSA; +/* 4: ACPI Namespace Device Declaration Structure */ + +typedef struct acpi_dmar_andd +{ + ACPI_DMAR_HEADER Header; + UINT8 Reserved[3]; + UINT8 DeviceNumber; + char DeviceName[1]; + +} ACPI_DMAR_ANDD; + + /******************************************************************************* * * HPET - High Precision Event Timer table @@ -1006,7 +1021,83 @@ /******************************************************************************* * - * MCFG - PCI Memory Mapped Configuration table and sub-table + * LPIT - Low Power Idle Table + * + * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)" + * + ******************************************************************************/ + +typedef struct acpi_table_lpit +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_LPIT; + + +/* LPIT subtable header */ + +typedef struct acpi_lpit_header +{ + UINT32 Type; /* Subtable type */ + UINT32 Length; /* Subtable length */ + UINT16 UniqueId; + UINT16 Reserved; + UINT32 Flags; + +} ACPI_LPIT_HEADER; + +/* Values for subtable Type above */ + +enum AcpiLpitType +{ + ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, + ACPI_LPIT_TYPE_SIMPLE_IO = 0x01 +}; + +/* Masks for Flags field above */ + +#define ACPI_LPIT_STATE_DISABLED (1) +#define ACPI_LPIT_NO_COUNTER (1<<1) + +/* + * LPIT subtables, correspond to Type in ACPI_LPIT_HEADER + */ + +/* 0x00: Native C-state instruction based LPI structure */ + +typedef struct acpi_lpit_native +{ + ACPI_LPIT_HEADER Header; + ACPI_GENERIC_ADDRESS EntryTrigger; + UINT32 Residency; + UINT32 Latency; + ACPI_GENERIC_ADDRESS ResidencyCounter; + UINT64 CounterFrequency; + +} ACPI_LPIT_NATIVE; + + +/* 0x01: Simple I/O based LPI structure */ + +typedef struct acpi_lpit_io +{ + ACPI_LPIT_HEADER Header; + ACPI_GENERIC_ADDRESS EntryTrigger; + UINT32 TriggerAction; + UINT64 TriggerValue; + UINT64 TriggerMask; + ACPI_GENERIC_ADDRESS MinimumIdleState; + UINT32 Residency; + UINT32 Latency; + ACPI_GENERIC_ADDRESS ResidencyCounter; + UINT64 CounterFrequency; + +} ACPI_LPIT_IO; + + +/******************************************************************************* + * + * MCFG - PCI Memory Mapped Configuration table and subtable * Version 1 * * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 @@ -1130,7 +1221,7 @@ /* - * SLIC Sub-tables, correspond to Type in ACPI_SLIC_HEADER + * SLIC Subtables, correspond to Type in ACPI_SLIC_HEADER */ /* 0: Public Key Structure */ Index: drivers/bus/acpi/acpica/include/actbl3.h =================================================================== --- drivers/bus/acpi/acpica/include/actbl3.h (revision 69845) +++ drivers/bus/acpi/acpica/include/actbl3.h (working copy) @@ -352,8 +352,8 @@ /******************************************************************************* * - * GTDT - Generic Timer Description Table (ACPI 5.0) - * Version 1 + * GTDT - Generic Timer Description Table (ACPI 5.1) + * Version 2 * ******************************************************************************/ @@ -360,29 +360,109 @@ typedef struct acpi_table_gtdt { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 Address; - UINT32 Flags; - UINT32 SecurePl1Interrupt; - UINT32 SecurePl1Flags; - UINT32 NonSecurePl1Interrupt; - UINT32 NonSecurePl1Flags; + UINT64 CounterBlockAddresss; + UINT32 Reserved; + UINT32 SecureEl1Interrupt; + UINT32 SecureEl1Flags; + UINT32 NonSecureEl1Interrupt; + UINT32 NonSecureEl1Flags; UINT32 VirtualTimerInterrupt; UINT32 VirtualTimerFlags; - UINT32 NonSecurePl2Interrupt; - UINT32 NonSecurePl2Flags; + UINT32 NonSecureEl2Interrupt; + UINT32 NonSecureEl2Flags; + UINT64 CounterReadBlockAddress; + UINT32 PlatformTimerCount; + UINT32 PlatformTimerOffset; } ACPI_TABLE_GTDT; -/* Values for Flags field above */ +/* Flag Definitions: Timer Block Physical Timers and Virtual timers */ -#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1 +#define ACPI_GTDT_INTERRUPT_MODE (1) +#define ACPI_GTDT_INTERRUPT_POLARITY (1<<1) +#define ACPI_GTDT_ALWAYS_ON (1<<2) -/* Values for all "TimerFlags" fields above */ -#define ACPI_GTDT_INTERRUPT_MODE 1 -#define ACPI_GTDT_INTERRUPT_POLARITY 2 +/* Common GTDT subtable header */ +typedef struct acpi_gtdt_header +{ + UINT8 Type; + UINT16 Length; +} ACPI_GTDT_HEADER; + +/* Values for GTDT subtable type above */ + +enum AcpiGtdtType +{ + ACPI_GTDT_TYPE_TIMER_BLOCK = 0, + ACPI_GTDT_TYPE_WATCHDOG = 1, + ACPI_GTDT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + + +/* GTDT Subtables, correspond to Type in acpi_gtdt_header */ + +/* 0: Generic Timer Block */ + +typedef struct acpi_gtdt_timer_block +{ + ACPI_GTDT_HEADER Header; + UINT8 Reserved; + UINT64 BlockAddress; + UINT32 TimerCount; + UINT32 TimerOffset; + +} ACPI_GTDT_TIMER_BLOCK; + +/* Timer Sub-Structure, one per timer */ + +typedef struct acpi_gtdt_timer_entry +{ + UINT8 FrameNumber; + UINT8 Reserved[3]; + UINT64 BaseAddress; + UINT64 El0BaseAddress; + UINT32 TimerInterrupt; + UINT32 TimerFlags; + UINT32 VirtualTimerInterrupt; + UINT32 VirtualTimerFlags; + UINT32 CommonFlags; + +} ACPI_GTDT_TIMER_ENTRY; + +/* Flag Definitions: TimerFlags and VirtualTimerFlags above */ + +#define ACPI_GTDT_GT_IRQ_MODE (1) +#define ACPI_GTDT_GT_IRQ_POLARITY (1<<1) + +/* Flag Definitions: CommonFlags above */ + +#define ACPI_GTDT_GT_IS_SECURE_TIMER (1) +#define ACPI_GTDT_GT_ALWAYS_ON (1<<1) + + +/* 1: SBSA Generic Watchdog Structure */ + +typedef struct acpi_gtdt_watchdog +{ + ACPI_GTDT_HEADER Header; + UINT8 Reserved; + UINT64 RefreshFrameAddress; + UINT64 ControlFrameAddress; + UINT32 TimerInterrupt; + UINT32 TimerFlags; + +} ACPI_GTDT_WATCHDOG; + +/* Flag Definitions: TimerFlags above */ + +#define ACPI_GTDT_WATCHDOG_IRQ_MODE (1) +#define ACPI_GTDT_WATCHDOG_IRQ_POLARITY (1<<1) +#define ACPI_GTDT_WATCHDOG_SECURE (1<<2) + + /******************************************************************************* * * MPST - Memory Power State Table (ACPI 5.0) @@ -525,7 +605,8 @@ enum AcpiPcctType { ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, - ACPI_PCCT_TYPE_RESERVED = 1 /* 1 and greater are reserved */ + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, + ACPI_PCCT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ }; /* @@ -550,6 +631,31 @@ } ACPI_PCCT_SUBSPACE; +/* 1: HW-reduced Communications Subspace (ACPI 5.1) */ + +typedef struct acpi_pcct_hw_reduced +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 DoorbellInterrupt; + UINT8 Flags; + UINT8 Reserved; + UINT64 BaseAddress; + UINT64 Length; + ACPI_GENERIC_ADDRESS DoorbellRegister; + UINT64 PreserveMask; + UINT64 WriteMask; + UINT32 Latency; + UINT32 MaxAccessRate; + UINT16 MinTurnaroundTime; + +} ACPI_PCCT_HW_REDUCED; + +/* Values for doorbell flags above */ + +#define ACPI_PCCT_INTERRUPT_POLARITY (1) +#define ACPI_PCCT_INTERRUPT_MODE (1<<1) + + /* * PCC memory structures (not part of the ACPI table) */ Index: drivers/bus/acpi/acpica/include/actypes.h =================================================================== --- drivers/bus/acpi/acpica/include/actypes.h (revision 69860) +++ drivers/bus/acpi/acpica/include/actypes.h (working copy) @@ -127,8 +127,6 @@ #error ACPI_MACHINE_WIDTH not defined #endif -/*! [Begin] no source code translation */ - /* * Data type ranges * Note: These macros are designed to be compiler independent as well as @@ -196,15 +194,16 @@ * ******************************************************************************/ -#ifndef __REACTOS__ +#ifndef ACPI_USE_SYSTEM_INTTYPES + typedef unsigned char BOOLEAN; typedef unsigned char UINT8; typedef unsigned short UINT16; +typedef short INT16; typedef COMPILER_DEPENDENT_UINT64 UINT64; typedef COMPILER_DEPENDENT_INT64 INT64; -#endif /* __REACTOS__ */ -/*! [End] no source code translation !*/ +#endif /* ACPI_USE_SYSTEM_INTTYPES */ /* * Value returned by AcpiOsGetThreadId. There is no standard "thread_id" @@ -225,16 +224,15 @@ #if ACPI_MACHINE_WIDTH == 64 -/*! [Begin] no source code translation (keep the typedefs as-is) */ +#ifndef ACPI_USE_SYSTEM_INTTYPES -#ifndef __REACTOS__ typedef unsigned int UINT32; typedef int INT32; -#endif /* __REACTOS__ */ -/*! [End] no source code translation !*/ +#endif /* ACPI_USE_SYSTEM_INTTYPES */ + typedef INT64 ACPI_NATIVE_INT; typedef UINT64 ACPI_SIZE; typedef UINT64 ACPI_IO_ADDRESS; @@ -266,16 +264,15 @@ #elif ACPI_MACHINE_WIDTH == 32 -/*! [Begin] no source code translation (keep the typedefs as-is) */ +#ifndef ACPI_USE_SYSTEM_INTTYPES -#ifndef __REACTOS__ typedef unsigned int UINT32; typedef int INT32; -#endif /* __REACTOS__ */ -/*! [End] no source code translation !*/ +#endif /* ACPI_USE_SYSTEM_INTTYPES */ + typedef INT32 ACPI_NATIVE_INT; typedef UINT32 ACPI_SIZE; typedef UINT32 ACPI_IO_ADDRESS; @@ -412,6 +409,15 @@ * ******************************************************************************/ +#ifdef ACPI_NO_MEM_ALLOCATIONS + +#define ACPI_ALLOCATE(a) NULL +#define ACPI_ALLOCATE_ZEROED(a) NULL +#define ACPI_FREE(a) +#define ACPI_MEM_TRACKING(a) + +#else /* ACPI_NO_MEM_ALLOCATIONS */ + #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* * Memory allocation tracking (used by AcpiExec to detect memory leaks) @@ -433,7 +439,9 @@ #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ +#endif /* ACPI_NO_MEM_ALLOCATIONS */ + /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) @@ -590,7 +598,7 @@ #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i) #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) -#define ACPI_OFFSET(d, f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) +#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL) #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) @@ -684,8 +692,9 @@ #define ACPI_NOTIFY_RESERVED (UINT8) 0x0A #define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B #define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C +#define ACPI_NOTIFY_AFFINITY_UPDATE (UINT8) 0x0D -#define ACPI_NOTIFY_MAX 0x0C +#define ACPI_NOTIFY_MAX 0x0D /* * Types associated with ACPI names and objects. The first group of @@ -785,14 +794,15 @@ * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+ - * | Bits 31:3 |2|1|0| - * +-------------+-+-+-+ - * | | | | - * | | | +- Enabled? - * | | +--- Enabled for wake? - * | +----- Set? - * +----------- + * +-------------+-+-+-+-+ + * | Bits 31:4 |3|2|1|0| + * +-------------+-+-+-+-+ + * | | | | | + * | | | | +- Enabled? + * | | | +--- Enabled for wake? + * | | +----- Set? + * | +------- Has a handler? + * +------------- */ typedef UINT32 ACPI_EVENT_STATUS; @@ -800,6 +810,7 @@ #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 +#define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x08 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ @@ -1032,9 +1043,19 @@ * Miscellaneous common Data Structures used by the interfaces */ #define ACPI_NO_BUFFER 0 + +#ifdef ACPI_NO_MEM_ALLOCATIONS + +#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (0) +#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (0) + +#else /* ACPI_NO_MEM_ALLOCATIONS */ + #define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) /* Let ACPICA allocate buffer */ #define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) /* For internal use only (enables tracking) */ +#endif /* ACPI_NO_MEM_ALLOCATIONS */ + typedef struct acpi_buffer { ACPI_SIZE Length; /* Length in bytes of the buffer */ @@ -1393,4 +1414,19 @@ #define ACPI_OSI_WIN_8 0x0C +/* Definitions of file IO */ + +#define ACPI_FILE_READING 0x01 +#define ACPI_FILE_WRITING 0x02 +#define ACPI_FILE_BINARY 0x04 + +#define ACPI_FILE_BEGIN 0x01 +#define ACPI_FILE_END 0x02 + + +/* Definitions of getopt */ + +#define ACPI_OPT_END -1 + + #endif /* __ACTYPES_H__ */ Index: drivers/bus/acpi/acpica/include/acutils.h =================================================================== --- drivers/bus/acpi/acpica/include/acutils.h (revision 69845) +++ drivers/bus/acpi/acpica/include/acutils.h (working copy) @@ -168,7 +168,6 @@ #ifdef ACPI_ASL_COMPILER #include -extern FILE *AcpiGbl_OutputFile; #define ACPI_MSG_REDIRECT_BEGIN \ FILE *OutputFile = AcpiGbl_OutputFile; \ @@ -298,6 +297,10 @@ UINT64 Integer, UINT32 Position); +UINT8 +AcpiUtAsciiCharToHex ( + int HexChar); + BOOLEAN AcpiUtValidObjectType ( ACPI_OBJECT_TYPE Type); @@ -325,6 +328,11 @@ const char *String); char * +AcpiUtStrchr ( + const char *String, + int ch); + +char * AcpiUtStrcpy ( char *DstString, const char *SrcString); @@ -412,7 +420,7 @@ #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) -#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) +#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ @@ -554,7 +562,17 @@ UINT32 Display, UINT32 Offset); +#ifdef ACPI_APPLICATION void +AcpiUtDumpBufferToFile ( + ACPI_FILE File, + UINT8 *Buffer, + UINT32 Count, + UINT32 Display, + UINT32 BaseOffset); +#endif + +void AcpiUtReportError ( char *ModuleName, UINT32 LineNumber); @@ -623,6 +641,17 @@ /* + * utfileio - file operations + */ +#ifdef ACPI_APPLICATION +ACPI_STATUS +AcpiUtReadTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table); +#endif + + +/* * utids - device ID support */ ACPI_STATUS @@ -1182,4 +1211,57 @@ AcpiAhMatchHardwareId ( char *Hid); +const char * +AcpiAhMatchUuid ( + UINT8 *Data); + +/* + * utprint - printf/vprintf output functions + */ +const char * +AcpiUtScanNumber ( + const char *String, + UINT64 *NumberPtr); + +const char * +AcpiUtPrintNumber ( + char *String, + UINT64 Number); + +int +AcpiUtVsnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + va_list Args); + +int +AcpiUtSnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + ...); + +#ifdef ACPI_APPLICATION +int +AcpiUtFileVprintf ( + ACPI_FILE File, + const char *Format, + va_list Args); + +int +AcpiUtFilePrintf ( + ACPI_FILE File, + const char *Format, + ...); +#endif + +/* + * utuuid -- UUID support functions + */ +void +AcpiUtConvertStringToUuid ( + char *InString, + UINT8 *UuidBuffer); + #endif /* _ACUTILS_H */ Index: drivers/bus/acpi/acpica/include/amlresrc.h =================================================================== --- drivers/bus/acpi/acpica/include/amlresrc.h (revision 69845) +++ drivers/bus/acpi/acpica/include/amlresrc.h (working copy) @@ -194,7 +194,15 @@ } ASL_RESOURCE_NODE; +typedef struct asl_resource_info +{ + ACPI_PARSE_OBJECT *DescriptorTypeOp; /* Resource descriptor parse node */ + ACPI_PARSE_OBJECT *MappingOp; /* Used for mapfile support */ + UINT32 CurrentByteOffset; /* Offset in resource template */ +} ASL_RESOURCE_INFO; + + /* Macros used to generate AML resource length fields */ #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER)) @@ -646,4 +654,50 @@ } AML_RESOURCE; + +/* Interfaces used by both the disassembler and compiler */ + +void +MpSaveGpioInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + UINT32 PinCount, + UINT16 *PinList, + char *DeviceName); + +void +MpSaveSerialInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + char *DeviceName); + +char * +MpGetHidFromParseTree ( + ACPI_NAMESPACE_NODE *HidNode); + +char * +MpGetHidViaNamestring ( + char *DeviceName); + +char * +MpGetConnectionInfo ( + ACPI_PARSE_OBJECT *Op, + UINT32 PinIndex, + ACPI_NAMESPACE_NODE **TargetNode, + char **TargetName); + +char * +MpGetParentDeviceHid ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE **TargetNode, + char **ParentDeviceName); + +char * +MpGetDdnValue ( + char *DeviceName); + +char * +MpGetHidValue ( + ACPI_NAMESPACE_NODE *DeviceNode); + #endif Index: drivers/bus/acpi/acpica/include/platform/accygwin.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/accygwin.h (revision 69845) +++ drivers/bus/acpi/acpica/include/platform/accygwin.h (working copy) @@ -164,11 +164,14 @@ /* - * The vsnprintf function is defined by c99, but cygwin/gcc does not - * enable this prototype when the -ansi flag is set. Also related to - * __STRICT_ANSI__. So, we just declare the prototype here. + * The vsnprintf/snprintf functions are defined by c99, but cygwin/gcc + * does not enable this prototype when the -ansi flag is set. Also related + * to __STRICT_ANSI__. So, we just declare the prototype here. */ int vsnprintf (char *s, size_t n, const char *format, va_list ap); +int +snprintf (char *s, size_t n, const char *format, ...); + #endif /* __ACCYGWIN_H__ */ Index: drivers/bus/acpi/acpica/include/platform/acefi.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/acefi.h (revision 69845) +++ drivers/bus/acpi/acpica/include/platform/acefi.h (working copy) @@ -116,11 +116,20 @@ #ifndef __ACEFI_H__ #define __ACEFI_H__ +#include +#if defined(_GNU_EFI) +#include +#include +#endif #include #include #include +/* AED EFI definitions */ + +#if defined(_AED_EFI) + /* _int64 works for both IA32 and IA64 */ #define COMPILER_DEPENDENT_INT64 __int64 @@ -143,5 +152,57 @@ #pragma warning(disable:4142) +#endif + +/* GNU EFI definitions */ + +#if defined(_GNU_EFI) + +/* Using GCC for GNU EFI */ + +#include "acgcc.h" + +#undef ACPI_USE_SYSTEM_CLIBRARY +#undef ACPI_USE_STANDARD_HEADERS +#undef ACPI_USE_NATIVE_DIVIDE +#define ACPI_USE_SYSTEM_INTTYPES + +#define ACPI_FILE SIMPLE_TEXT_OUTPUT_INTERFACE * +#define ACPI_FILE_OUT ST->ConOut +#define ACPI_FILE_ERR ST->ConOut + +/* + * Math helpers + */ +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ + do { \ + UINT64 __n = ((UINT64) n_hi) << 32 | (n_lo); \ + (q32) = DivU64x32 ((__n), (d32), &(r32)); \ + } while (0) + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ + do { \ + (n_lo) >>= 1; \ + (n_lo) |= (((n_hi) & 1) << 31); \ + (n_hi) >>= 1; \ + } while (0) + +/* + * EFI specific prototypes + */ +EFI_STATUS +efi_main ( + EFI_HANDLE Image, + EFI_SYSTEM_TABLE *SystemTab); + +int +acpi_main ( + int argc, + char *argv[]); + + +#endif + + #endif /* __ACEFI_H__ */ Index: drivers/bus/acpi/acpica/include/platform/acenv.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/acenv.h (revision 69860) +++ drivers/bus/acpi/acpica/include/platform/acenv.h (working copy) @@ -160,20 +160,14 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif -/* AcpiNames configuration. Single threaded with debugger output enabled. */ - -#ifdef ACPI_NAMES_APP -#define ACPI_DEBUGGER -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED -#endif - /* - * AcpiBin/AcpiDump/AcpiSrc/AcpiXtract/Example configuration. All single - * threaded, with no debug output. + * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example configuration. + * All single threaded. */ #if (defined ACPI_BIN_APP) || \ (defined ACPI_DUMP_APP) || \ + (defined ACPI_HELP_APP) || \ + (defined ACPI_NAMES_APP) || \ (defined ACPI_SRC_APP) || \ (defined ACPI_XTRACT_APP) || \ (defined ACPI_EXAMPLE_APP) @@ -181,12 +175,40 @@ #define ACPI_SINGLE_THREADED #endif +/* AcpiHelp configuration. Error messages disabled. */ + #ifdef ACPI_HELP_APP -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED #define ACPI_NO_ERROR_MESSAGES #endif +/* AcpiNames configuration. Debug output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUG_OUTPUT +#endif + +/* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */ + +#if (defined ACPI_EXEC_APP) || \ + (defined ACPI_EXAMPLE_APP) || \ + (defined ACPI_NAMES_APP) +#define ACPI_USE_NATIVE_RSDP_POINTER +#endif + +/* AcpiDump configuration. Native mapping used if provied by OSPMs */ + +#ifdef ACPI_DUMP_APP +#define ACPI_USE_NATIVE_MEMORY_MAPPING +#define USE_NATIVE_ALLOCATE_ZEROED +#endif + +/* AcpiNames/Example configuration. Hardware disabled */ + +#if (defined ACPI_EXAMPLE_APP) || \ + (defined ACPI_NAMES_APP) +#define ACPI_REDUCED_HARDWARE 1 +#endif + /* Linkable ACPICA library */ #ifdef ACPI_LIBRARY @@ -257,6 +279,9 @@ #elif defined(_AED_EFI) #include "acefi.h" +#elif defined(_GNU_EFI) +#include "acefi.h" + #elif defined(__HAIKU__) #include "achaiku.h" @@ -477,8 +502,12 @@ #ifdef ACPI_APPLICATION #include #define ACPI_FILE FILE * +#define ACPI_FILE_OUT stdout +#define ACPI_FILE_ERR stderr #else #define ACPI_FILE void * +#define ACPI_FILE_OUT NULL +#define ACPI_FILE_ERR NULL #endif /* ACPI_APPLICATION */ #endif /* ACPI_FILE */ Index: drivers/bus/acpi/acpica/include/platform/acenvex.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/acenvex.h (revision 0) +++ drivers/bus/acpi/acpica/include/platform/acenvex.h (working copy) @@ -0,0 +1,135 @@ +/****************************************************************************** + * + * Name: acenvex.h - Extra host and compiler configuration + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACENVEX_H__ +#define __ACENVEX_H__ + +/*! [Begin] no source code translation */ + +/****************************************************************************** + * + * Extra host configuration files. All ACPICA headers are included before + * including these files. + * + *****************************************************************************/ + +#if defined(_LINUX) || defined(__linux__) +#include "aclinuxex.h" + +#endif + +/*! [End] no source code translation !*/ + +#endif /* __ACENVEX_H__ */ Property changes on: drivers/bus/acpi/acpica/include/platform/acenvex.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: drivers/bus/acpi/acpica/include/platform/achaiku.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/achaiku.h (revision 69845) +++ drivers/bus/acpi/acpica/include/platform/achaiku.h (working copy) @@ -132,7 +132,8 @@ #define ACPI_USE_NATIVE_DIVIDE -// #define ACPI_THREAD_ID thread_id +/* #define ACPI_THREAD_ID thread_id */ + #define ACPI_SEMAPHORE sem_id #define ACPI_SPINLOCK spinlock * #define ACPI_CPU_FLAGS cpu_status Index: drivers/bus/acpi/acpica/include/platform/aclinux.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/aclinux.h (revision 69845) +++ drivers/bus/acpi/acpica/include/platform/aclinux.h (working copy) @@ -116,15 +116,32 @@ #ifndef __ACLINUX_H__ #define __ACLINUX_H__ +#ifdef __KERNEL__ + +/* ACPICA external files should not include ACPICA headers directly. */ + +#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H) +#error "Please don't include directly, include instead." +#endif + +#endif + /* Common (in-kernel/user-space) ACPICA configuration */ #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_DO_WHILE_0 -#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE #ifdef __KERNEL__ +#define ACPI_USE_SYSTEM_INTTYPES + +/* Compile for reduced hardware mode only with this kernel config */ + +#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY +#define ACPI_REDUCED_HARDWARE 1 +#endif + #include #include #include @@ -136,8 +153,41 @@ #ifdef EXPORT_ACPI_INTERFACES #include #endif -#include +#ifdef CONFIG_ACPI +#include +#endif +#ifndef CONFIG_ACPI + +/* External globals for __KERNEL__, stubs is needed */ + +#define ACPI_GLOBAL(t,a) +#define ACPI_INIT_GLOBAL(t,a,b) + +/* Generating stubs for configurable ACPICA macros */ + +#define ACPI_NO_MEM_ALLOCATIONS + +/* Generating stubs for configurable ACPICA functions */ + +#define ACPI_NO_ERROR_MESSAGES +#undef ACPI_DEBUG_OUTPUT + +/* External interface for __KERNEL__, stub is needed */ + +#define ACPI_EXTERNAL_RETURN_STATUS(Prototype) \ + static ACPI_INLINE Prototype {return(AE_NOT_CONFIGURED);} +#define ACPI_EXTERNAL_RETURN_OK(Prototype) \ + static ACPI_INLINE Prototype {return(AE_OK);} +#define ACPI_EXTERNAL_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} +#define ACPI_EXTERNAL_RETURN_UINT32(Prototype) \ + static ACPI_INLINE Prototype {return(0);} +#define ACPI_EXTERNAL_RETURN_PTR(Prototype) \ + static ACPI_INLINE Prototype {return(NULL);} + +#endif /* CONFIG_ACPI */ + /* Host-dependent types and defines for in-kernel ACPICA */ #define ACPI_MACHINE_WIDTH BITS_PER_LONG @@ -148,6 +198,40 @@ #define ACPI_SPINLOCK spinlock_t * #define ACPI_CPU_FLAGS unsigned long +/* Use native linux version of AcpiOsAllocateZeroed */ + +#define USE_NATIVE_ALLOCATE_ZEROED + +/* + * Overrides for in-kernel ACPICA + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock + +/* + * OSL interfaces used by debugger/disassembler + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable + +/* + * OSL interfaces used by utilities + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory + #else /* !__KERNEL__ */ #include @@ -162,10 +246,6 @@ #define __init #endif -#ifndef __iomem -#define __iomem -#endif - /* Host-dependent types and defines for user-space ACPICA */ #define ACPI_FLUSH_CPU_CACHE() @@ -193,153 +273,4 @@ #include "acgcc.h" - -#ifdef __KERNEL__ - -/* - * FIXME: Inclusion of actypes.h - * Linux kernel need this before defining inline OSL interfaces as - * actypes.h need to be included to find ACPICA type definitions. - * Since from ACPICA's perspective, the actypes.h should be included after - * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue. - */ -#include - -/* - * Overrides for in-kernel ACPICA - */ -ACPI_STATUS __init AcpiOsInitialize ( - void); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize - -ACPI_STATUS AcpiOsTerminate ( - void); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate - -/* - * Memory allocation/deallocation - */ - -/* - * The irqs_disabled() check is for resume from RAM. - * Interrupts are off during resume, just like they are for boot. - * However, boot has (system_state != SYSTEM_RUNNING) - * to quiet __might_sleep() in kmalloc() and resume does not. - */ -static inline void * -AcpiOsAllocate ( - ACPI_SIZE Size) -{ - return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate - -/* Use native linux version of AcpiOsAllocateZeroed */ - -static inline void * -AcpiOsAllocateZeroed ( - ACPI_SIZE Size) -{ - return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed -#define USE_NATIVE_ALLOCATE_ZEROED - -static inline void -AcpiOsFree ( - void *Memory) -{ - kfree (Memory); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree - -static inline void * -AcpiOsAcquireObject ( - ACPI_CACHE_T *Cache) -{ - return kmem_cache_zalloc (Cache, - irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject - -static inline ACPI_THREAD_ID -AcpiOsGetThreadId ( - void) -{ - return (ACPI_THREAD_ID) (unsigned long) current; -} -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId - -#ifndef CONFIG_PREEMPT - -/* - * Used within ACPICA to show where it is safe to preempt execution - * when CONFIG_PREEMPT=n - */ -#define ACPI_PREEMPTION_POINT() \ - do { \ - if (!irqs_disabled()) \ - cond_resched(); \ - } while (0) - -#endif - -/* - * When lockdep is enabled, the spin_lock_init() macro stringifies it's - * argument and uses that as a name for the lock in debugging. - * By executing spin_lock_init() in a macro the key changes from "lock" for - * all locks to the name of the argument of acpi_os_create_lock(), which - * prevents lockdep from reporting false positives for ACPICA locks. - */ -#define AcpiOsCreateLock(__Handle) \ - ({ \ - spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \ - if (Lock) { \ - *(__Handle) = Lock; \ - spin_lock_init(*(__Handle)); \ - } \ - Lock ? AE_OK : AE_NO_MEMORY; \ - }) -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock - -void __iomem * -AcpiOsMapMemory ( - ACPI_PHYSICAL_ADDRESS Where, - ACPI_SIZE Length); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory - -void -AcpiOsUnmapMemory ( - void __iomem *LogicalAddress, - ACPI_SIZE Size); -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory - -/* - * OSL interfaces used by debugger/disassembler - */ -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable - -/* - * OSL interfaces used by utilities - */ -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename -#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory - -/* - * OSL interfaces added by Linux - */ -void -EarlyAcpiOsUnmapMemory ( - void __iomem *Virt, - ACPI_SIZE Size); - -#endif /* __KERNEL__ */ - #endif /* __ACLINUX_H__ */ Index: drivers/bus/acpi/acpica/include/platform/aclinuxex.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/aclinuxex.h (revision 0) +++ drivers/bus/acpi/acpica/include/platform/aclinuxex.h (working copy) @@ -0,0 +1,221 @@ +/****************************************************************************** + * + * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACLINUXEX_H__ +#define __ACLINUXEX_H__ + +#ifdef __KERNEL__ + +#ifndef ACPI_USE_NATIVE_DIVIDE + +#ifndef ACPI_DIV_64_BY_32 +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ + do { \ + UINT64 (__n) = ((UINT64) n_hi) << 32 | (n_lo); \ + (r32) = do_div ((__n), (d32)); \ + (q32) = (UINT32) (__n); \ + } while (0) +#endif + +#ifndef ACPI_SHIFT_RIGHT_64 +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ + do { \ + (n_lo) >>= 1; \ + (n_lo) |= (((n_hi) & 1) << 31); \ + (n_hi) >>= 1; \ + } while (0) +#endif + +#endif + +/* + * Overrides for in-kernel ACPICA + */ +ACPI_STATUS __init AcpiOsInitialize ( + void); + +ACPI_STATUS AcpiOsTerminate ( + void); + +/* + * The irqs_disabled() check is for resume from RAM. + * Interrupts are off during resume, just like they are for boot. + * However, boot has (system_state != SYSTEM_RUNNING) + * to quiet __might_sleep() in kmalloc() and resume does not. + */ +static inline void * +AcpiOsAllocate ( + ACPI_SIZE Size) +{ + return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline void * +AcpiOsAllocateZeroed ( + ACPI_SIZE Size) +{ + return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline void +AcpiOsFree ( + void *Memory) +{ + kfree (Memory); +} + +static inline void * +AcpiOsAcquireObject ( + ACPI_CACHE_T *Cache) +{ + return kmem_cache_zalloc (Cache, + irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline ACPI_THREAD_ID +AcpiOsGetThreadId ( + void) +{ + return (ACPI_THREAD_ID) (unsigned long) current; +} + +/* + * When lockdep is enabled, the spin_lock_init() macro stringifies it's + * argument and uses that as a name for the lock in debugging. + * By executing spin_lock_init() in a macro the key changes from "lock" for + * all locks to the name of the argument of acpi_os_create_lock(), which + * prevents lockdep from reporting false positives for ACPICA locks. + */ +#define AcpiOsCreateLock(__Handle) \ + ({ \ + spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \ + if (Lock) { \ + *(__Handle) = Lock; \ + spin_lock_init(*(__Handle)); \ + } \ + Lock ? AE_OK : AE_NO_MEMORY; \ + }) + +/* + * OSL interfaces added by Linux + */ +void +EarlyAcpiOsUnmapMemory ( + void __iomem *Virt, + ACPI_SIZE Size); + +#endif /* __KERNEL__ */ + +#endif /* __ACLINUXEX_H__ */ Property changes on: drivers/bus/acpi/acpica/include/platform/aclinuxex.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: drivers/bus/acpi/acpica/include/platform/acmsvc.h =================================================================== --- drivers/bus/acpi/acpica/include/platform/acmsvc.h (revision 69860) +++ drivers/bus/acpi/acpica/include/platform/acmsvc.h (working copy) @@ -285,6 +285,10 @@ /* Debug support. Must be last in this file, do not move. */ #ifdef _DEBUG +#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */ + +#include +#include #include /* @@ -294,9 +298,26 @@ * This can quickly localize the memory corruption. */ #define ACPI_DEBUG_INITIALIZE() \ - _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | \ - _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | \ - _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) + _CrtSetDbgFlag (\ + _CRTDBG_CHECK_ALWAYS_DF | \ + _CRTDBG_ALLOC_MEM_DF | \ + _CRTDBG_DELAY_FREE_MEM_DF | \ + _CRTDBG_LEAK_CHECK_DF | \ + _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); + +#if 0 +/* + * _CrtSetBreakAlloc can be used to set a breakpoint at a particular + * memory leak, add to the macro above. + */ +Detected memory leaks! +Dumping objects -> +..\..\source\os_specific\service_layers\oswinxf.c(701) : {937} normal block at 0x002E9190, 40 bytes long. + Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +_CrtSetBreakAlloc (937); #endif +#endif + #endif /* __ACMSVC_H__ */ Index: drivers/bus/acpi/acpica/namespace/nsaccess.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsaccess.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsaccess.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __NSACCESS_C__ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" Index: drivers/bus/acpi/acpica/namespace/nsalloc.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsalloc.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsalloc.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __NSALLOC_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsconvert.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsconvert.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsconvert.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __NSCONVERT_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsdump.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsdump.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsdump.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __NSDUMP_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsdumpdv.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsdumpdv.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsdumpdv.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __NSDUMPDV_C__ - #include "acpi.h" Index: drivers/bus/acpi/acpica/namespace/nseval.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nseval.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nseval.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __NSEVAL_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/namespace/nsinit.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsinit.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsinit.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __NSXFINIT_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsload.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsload.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsload.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __NSLOAD_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsnames.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsnames.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsnames.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __NSNAMES_C__ - #include "acpi.h" #include "accommon.h" #include "amlcode.h" Index: drivers/bus/acpi/acpica/namespace/nsobject.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsobject.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsobject.c (working copy) @@ -114,9 +114,6 @@ * *****************************************************************************/ - -#define __NSOBJECT_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -335,6 +332,16 @@ { Node->Object = Node->Object->Common.NextObject; } + + /* + * Detach the object from any data objects (which are still held by + * the namespace node) + */ + if (ObjDesc->Common.NextObject && + ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) + { + ObjDesc->Common.NextObject = NULL; + } } /* Reset the node type to untyped */ Index: drivers/bus/acpi/acpica/namespace/nsparse.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsparse.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsparse.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __NSPARSE_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsprepkg.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsprepkg.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsprepkg.c (working copy) @@ -393,6 +393,46 @@ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; + case ACPI_PTYPE2_UUID_PAIR: + + /* The package must contain pairs of (UUID + type) */ + + if (Count & 1) + { + ExpectedCount = Count + 1; + goto PackageTooSmall; + } + + while (Count > 0) + { + Status = AcpiNsCheckObjectType(Info, Elements, + Package->RetInfo.ObjectType1, 0); + if (ACPI_FAILURE(Status)) + { + return (Status); + } + + /* Validate length of the UUID buffer */ + + if ((*Elements)->Buffer.Length != 16) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, + Info->NodeFlags, "Invalid length for UUID Buffer")); + return (AE_AML_OPERAND_VALUE); + } + + Status = AcpiNsCheckObjectType(Info, Elements + 1, + Package->RetInfo.ObjectType2, 0); + if (ACPI_FAILURE(Status)) + { + return (Status); + } + + Elements += 2; + Count -= 2; + } + break; + default: /* Should not get here if predefined info table is correct */ Index: drivers/bus/acpi/acpica/namespace/nsrepair.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsrepair.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsrepair.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __NSREPAIR_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsrepair2.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsrepair2.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsrepair2.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __NSREPAIR2_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nssearch.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nssearch.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nssearch.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __NSSEARCH_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsutils.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsutils.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsutils.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ -#define __NSUTILS_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nswalk.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nswalk.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nswalk.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __NSWALK_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/namespace/nsxfeval.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsxfeval.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsxfeval.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ - -#define __NSXFEVAL_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/namespace/nsxfname.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsxfname.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsxfname.c (working copy) @@ -114,7 +114,6 @@ * *****************************************************************************/ -#define __NSXFNAME_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/namespace/nsxfobj.c =================================================================== --- drivers/bus/acpi/acpica/namespace/nsxfobj.c (revision 69845) +++ drivers/bus/acpi/acpica/namespace/nsxfobj.c (working copy) @@ -114,8 +114,6 @@ * *****************************************************************************/ - -#define __NSXFOBJ_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/parser/psargs.c =================================================================== --- drivers/bus/acpi/acpica/parser/psargs.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psargs.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __PSARGS_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/psloop.c =================================================================== --- drivers/bus/acpi/acpica/parser/psloop.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psloop.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - /* * Parse the AML and build an operation tree as most interpreters, (such as * Perl) do. Parsing is done by hand rather than with a YACC generated parser Index: drivers/bus/acpi/acpica/parser/psobject.c =================================================================== --- drivers/bus/acpi/acpica/parser/psobject.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psobject.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/psopcode.c =================================================================== --- drivers/bus/acpi/acpica/parser/psopcode.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psopcode.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acopcode.h" Index: drivers/bus/acpi/acpica/parser/psopinfo.c =================================================================== --- drivers/bus/acpi/acpica/parser/psopinfo.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psopinfo.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/psparse.c =================================================================== --- drivers/bus/acpi/acpica/parser/psparse.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psparse.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - /* * Parse the AML and build an operation tree as most interpreters, * like Perl, do. Parsing is done by hand rather than with a YACC Index: drivers/bus/acpi/acpica/parser/psscope.c =================================================================== --- drivers/bus/acpi/acpica/parser/psscope.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psscope.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/pstree.c =================================================================== --- drivers/bus/acpi/acpica/parser/pstree.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/pstree.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __PSTREE_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/psutils.c =================================================================== --- drivers/bus/acpi/acpica/parser/psutils.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psutils.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/pswalk.c =================================================================== --- drivers/bus/acpi/acpica/parser/pswalk.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/pswalk.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/parser/psxface.c =================================================================== --- drivers/bus/acpi/acpica/parser/psxface.c (revision 69845) +++ drivers/bus/acpi/acpica/parser/psxface.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __PSXFACE_C__ - #include "acpi.h" #include "accommon.h" #include "acparser.h" Index: drivers/bus/acpi/acpica/resources/rsaddr.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsaddr.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsaddr.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSADDR_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rscalc.c =================================================================== --- drivers/bus/acpi/acpica/resources/rscalc.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rscalc.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSCALC_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rscreate.c =================================================================== --- drivers/bus/acpi/acpica/resources/rscreate.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rscreate.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSCREATE_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" @@ -149,6 +147,10 @@ void *Resource; void *CurrentResourcePtr; + + ACPI_FUNCTION_TRACE (AcpiBufferToResource); + + /* * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag * is not required here. @@ -164,7 +166,7 @@ } if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Allocate a buffer for the converted resource */ @@ -173,7 +175,7 @@ CurrentResourcePtr = Resource; if (!Resource) { - return (AE_NO_MEMORY); + return_ACPI_STATUS (AE_NO_MEMORY); } /* Perform the AML-to-Resource conversion */ @@ -193,10 +195,12 @@ *ResourcePtr = Resource; } - return (Status); + return_ACPI_STATUS (Status); } +ACPI_EXPORT_SYMBOL (AcpiBufferToResource) + /******************************************************************************* * * FUNCTION: AcpiRsCreateResourceList Index: drivers/bus/acpi/acpica/resources/rsdump.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsdump.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsdump.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __RSDUMP_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsdumpinfo.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsdumpinfo.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsdumpinfo.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __RSDUMPINFO_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsinfo.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsinfo.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsinfo.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSINFO_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsio.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsio.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsio.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSIO_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsirq.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsirq.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsirq.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSIRQ_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rslist.c =================================================================== --- drivers/bus/acpi/acpica/resources/rslist.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rslist.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSLIST_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsmemory.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsmemory.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsmemory.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSMEMORY_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsmisc.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsmisc.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsmisc.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSMISC_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsserial.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsserial.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsserial.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __RSIRQ_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" Index: drivers/bus/acpi/acpica/resources/rsutils.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsutils.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsutils.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __RSUTILS_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/resources/rsxface.c =================================================================== --- drivers/bus/acpi/acpica/resources/rsxface.c (revision 69845) +++ drivers/bus/acpi/acpica/resources/rsxface.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __RSXFACE_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/tables/tbdata.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbdata.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbdata.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBDATA_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -424,9 +422,45 @@ /****************************************************************************** * - * FUNCTION: AcpiTbVerifyTable + * FUNCTION: AcpiTbValidateTempTable * * PARAMETERS: TableDesc - Table descriptor + * + * RETURN: Status + * + * DESCRIPTION: This function is called to validate the table, the returned + * table descriptor is in "VALIDATED" state. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiTbValidateTempTable ( + ACPI_TABLE_DESC *TableDesc) +{ + + if (!TableDesc->Pointer && !AcpiGbl_VerifyTableChecksum) + { + /* + * Only validates the header of the table. + * Note that Length contains the size of the mapping after invoking + * this work around, this value is required by + * AcpiTbReleaseTempTable(). + * We can do this because in AcpiInitTableDescriptor(), the Length + * field of the installed descriptor is filled with the actual + * table length obtaining from the table header. + */ + TableDesc->Length = sizeof (ACPI_TABLE_HEADER); + } + + return (AcpiTbValidateTable (TableDesc)); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiTbVerifyTempTable + * + * PARAMETERS: TableDesc - Table descriptor * Signature - Table signature to verify * * RETURN: Status @@ -437,7 +471,7 @@ *****************************************************************************/ ACPI_STATUS -AcpiTbVerifyTable ( +AcpiTbVerifyTempTable ( ACPI_TABLE_DESC *TableDesc, char *Signature) { @@ -444,12 +478,12 @@ ACPI_STATUS Status = AE_OK; - ACPI_FUNCTION_TRACE (TbVerifyTable); + ACPI_FUNCTION_TRACE (TbVerifyTempTable); /* Validate the table */ - Status = AcpiTbValidateTable (TableDesc); + Status = AcpiTbValidateTempTable (TableDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -469,16 +503,19 @@ /* Verify the checksum */ - Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); - if (ACPI_FAILURE (Status)) + if (AcpiGbl_VerifyTableChecksum) { - ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, - "%4.4s " ACPI_PRINTF_UINT - " Attempted table install failed", - AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? - TableDesc->Signature.Ascii : "????", - ACPI_FORMAT_TO_UINT (TableDesc->Address))); - goto InvalidateAndExit; + Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, + "%4.4s " ACPI_PRINTF_UINT + " Attempted table install failed", + AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? + TableDesc->Signature.Ascii : "????", + ACPI_FORMAT_TO_UINT (TableDesc->Address))); + goto InvalidateAndExit; + } } return_ACPI_STATUS (AE_OK); Index: drivers/bus/acpi/acpica/tables/tbfadt.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbfadt.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbfadt.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBFADT_C__ - #include "acpi.h" #include "accommon.h" #include "actables.h" @@ -130,7 +128,8 @@ UINT8 SpaceId, UINT8 ByteWidth, UINT64 Address, - char *RegisterName); + char *RegisterName, + UINT8 Flags); static void AcpiTbConvertFadt ( @@ -156,7 +155,7 @@ UINT16 Address32; UINT16 Length; UINT8 DefaultLength; - UINT8 Type; + UINT8 Flags; } ACPI_FADT_INFO; @@ -163,6 +162,7 @@ #define ACPI_FADT_OPTIONAL 0 #define ACPI_FADT_REQUIRED 1 #define ACPI_FADT_SEPARATE_LENGTH 2 +#define ACPI_FADT_GPE_REGISTER 4 static ACPI_FADT_INFO FadtInfoTable[] = { @@ -213,7 +213,7 @@ ACPI_FADT_OFFSET (Gpe0Block), ACPI_FADT_OFFSET (Gpe0BlockLength), 0, - ACPI_FADT_SEPARATE_LENGTH}, + ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}, {"Gpe1Block", ACPI_FADT_OFFSET (XGpe1Block), @@ -220,7 +220,7 @@ ACPI_FADT_OFFSET (Gpe1Block), ACPI_FADT_OFFSET (Gpe1BlockLength), 0, - ACPI_FADT_SEPARATE_LENGTH} + ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; #define ACPI_FADT_INFO_ENTRIES \ @@ -284,21 +284,31 @@ UINT8 SpaceId, UINT8 ByteWidth, UINT64 Address, - char *RegisterName) + char *RegisterName, + UINT8 Flags) { UINT8 BitWidth; - /* Bit width field in the GAS is only one byte long, 255 max */ - + /* + * Bit width field in the GAS is only one byte long, 255 max. + * Check for BitWidth overflow in GAS. + */ BitWidth = (UINT8) (ByteWidth * 8); - - if (ByteWidth > 31) /* (31*8)=248 */ + if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */ { - ACPI_ERROR ((AE_INFO, - "%s - 32-bit FADT register is too long (%u bytes, %u bits) " - "to convert to GAS struct - 255 bits max, truncating", - RegisterName, ByteWidth, (ByteWidth * 8))); + /* + * No error for GPE blocks, because we do not use the BitWidth + * for GPEs, the legacy length (ByteWidth) is used instead to + * allow for a large number of GPEs. + */ + if (!(Flags & ACPI_FADT_GPE_REGISTER)) + { + ACPI_ERROR ((AE_INFO, + "%s - 32-bit FADT register is too long (%u bytes, %u bits) " + "to convert to GAS struct - 255 bits max, truncating", + RegisterName, ByteWidth, (ByteWidth * 8))); + } BitWidth = 255; } @@ -564,6 +574,7 @@ ACPI_GENERIC_ADDRESS *Address64; UINT32 Address32; UINT8 Length; + UINT8 Flags; UINT32 i; @@ -628,6 +639,7 @@ &AcpiGbl_FADT, FadtInfoTable[i].Length); Name = FadtInfoTable[i].Name; + Flags = FadtInfoTable[i].Flags; /* * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" @@ -664,7 +676,7 @@ ACPI_ADR_SPACE_SYSTEM_IO, *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), - (UINT64) Address32, Name); + (UINT64) Address32, Name, Flags); } else if (Address64->Address != (UINT64) Address32) { @@ -685,7 +697,7 @@ ACPI_ADR_SPACE_SYSTEM_IO, *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), - (UINT64) Address32, Name); + (UINT64) Address32, Name, Flags); } } } @@ -706,7 +718,7 @@ Name, ACPI_MUL_8 (Length), Address64->BitWidth)); } - if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED) + if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED) { /* * Field is required (PM1aEvent, PM1aControl). @@ -720,7 +732,7 @@ Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); } } - else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH) + else if (FadtInfoTable[i].Flags & ACPI_FADT_SEPARATE_LENGTH) { /* * Field is optional (PM2Control, GPE0, GPE1) AND has its own @@ -827,7 +839,7 @@ Source64->SpaceId, Pm1RegisterByteWidth, Source64->Address + (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth), - "PmRegisters"); + "PmRegisters", 0); } } } Index: drivers/bus/acpi/acpica/tables/tbfind.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbfind.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbfind.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBFIND_C__ - #include "acpi.h" #include "accommon.h" #include "actables.h" Index: drivers/bus/acpi/acpica/tables/tbinstal.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbinstal.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbinstal.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBINSTAL_C__ - #include "acpi.h" #include "accommon.h" #include "actables.h" @@ -282,7 +280,7 @@ /* Validate and verify a table before installation */ - Status = AcpiTbVerifyTable (&NewTableDesc, Signature); + Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature); if (ACPI_FAILURE (Status)) { goto ReleaseAndExit; @@ -362,7 +360,7 @@ /* Validate and verify a table before installation */ - Status = AcpiTbVerifyTable (&NewTableDesc, NULL); + Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); if (ACPI_FAILURE (Status)) { goto ReleaseAndExit; @@ -527,7 +525,7 @@ /* Validate and verify a table before overriding */ - Status = AcpiTbVerifyTable (&NewTableDesc, NULL); + Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); if (ACPI_FAILURE (Status)) { return; @@ -549,7 +547,7 @@ */ AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address, NewTableDesc.Flags, NewTableDesc.Pointer); - AcpiTbValidateTable (OldTableDesc); + AcpiTbValidateTempTable (OldTableDesc); /* Release the temporary table descriptor */ Index: drivers/bus/acpi/acpica/tables/tbprint.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbprint.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbprint.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBPRINT_C__ - #include "acpi.h" #include "accommon.h" #include "actables.h" Index: drivers/bus/acpi/acpica/tables/tbutils.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbutils.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbutils.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBUTILS_C__ - #include "acpi.h" #include "accommon.h" #include "actables.h" @@ -125,10 +123,6 @@ /* Local prototypes */ -static ACPI_STATUS -AcpiTbValidateXsdt ( - ACPI_PHYSICAL_ADDRESS Address); - static ACPI_PHYSICAL_ADDRESS AcpiTbGetRootTableEntry ( UINT8 *TableEntry, @@ -348,92 +342,6 @@ /******************************************************************************* * - * FUNCTION: AcpiTbValidateXsdt - * - * PARAMETERS: Address - Physical address of the XSDT (from RSDP) - * - * RETURN: Status. AE_OK if the table appears to be valid. - * - * DESCRIPTION: Validate an XSDT to ensure that it is of minimum size and does - * not contain any NULL entries. A problem that is seen in the - * field is that the XSDT exists, but is actually useless because - * of one or more (or all) NULL entries. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiTbValidateXsdt ( - ACPI_PHYSICAL_ADDRESS XsdtAddress) -{ - ACPI_TABLE_HEADER *Table; - UINT8 *NextEntry; - ACPI_PHYSICAL_ADDRESS Address; - UINT32 Length; - UINT32 EntryCount; - ACPI_STATUS Status; - UINT32 i; - - - /* Get the XSDT length */ - - Table = AcpiOsMapMemory (XsdtAddress, sizeof (ACPI_TABLE_HEADER)); - if (!Table) - { - return (AE_NO_MEMORY); - } - - Length = Table->Length; - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); - - /* - * Minimum XSDT length is the size of the standard ACPI header - * plus one physical address entry - */ - if (Length < (sizeof (ACPI_TABLE_HEADER) + ACPI_XSDT_ENTRY_SIZE)) - { - return (AE_INVALID_TABLE_LENGTH); - } - - /* Map the entire XSDT */ - - Table = AcpiOsMapMemory (XsdtAddress, Length); - if (!Table) - { - return (AE_NO_MEMORY); - } - - /* Get the number of entries and pointer to first entry */ - - Status = AE_OK; - NextEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); - EntryCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / - ACPI_XSDT_ENTRY_SIZE); - - /* Validate each entry (physical address) within the XSDT */ - - for (i = 0; i < EntryCount; i++) - { - Address = AcpiTbGetRootTableEntry (NextEntry, ACPI_XSDT_ENTRY_SIZE); - if (!Address) - { - /* Detected a NULL entry, XSDT is invalid */ - - Status = AE_NULL_ENTRY; - break; - } - - NextEntry += ACPI_XSDT_ENTRY_SIZE; - } - - /* Unmap table */ - - AcpiOsUnmapMemory (Table, Length); - return (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiTbParseRootTable * * PARAMETERS: Rsdp - Pointer to the RSDP @@ -507,25 +415,6 @@ */ AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP)); - /* - * If it is present and used, validate the XSDT for access/size - * and ensure that all table entries are at least non-NULL - */ - if (TableEntrySize == ACPI_XSDT_ENTRY_SIZE) - { - Status = AcpiTbValidateXsdt (Address); - if (ACPI_FAILURE (Status)) - { - ACPI_BIOS_WARNING ((AE_INFO, "XSDT is invalid (%s), using RSDT", - AcpiFormatException (Status))); - - /* Fall back to the RSDT */ - - Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress; - TableEntrySize = ACPI_RSDT_ENTRY_SIZE; - } - } - /* Map the RSDT/XSDT table header to get the full table length */ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); @@ -584,8 +473,16 @@ { /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ - Status = AcpiTbInstallStandardTable ( - AcpiTbGetRootTableEntry (TableEntry, TableEntrySize), + Address = AcpiTbGetRootTableEntry (TableEntry, TableEntrySize); + + /* Skip NULL entries in RSDT/XSDT */ + + if (!Address) + { + goto NextTable; + } + + Status = AcpiTbInstallStandardTable (Address, ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex); if (ACPI_SUCCESS (Status) && @@ -595,13 +492,11 @@ AcpiTbParseFadt (TableIndex); } +NextTable: + TableEntry += TableEntrySize; } - /* - * It is not possible to map more than one entry in some environments, - * so unmap the root table here before mapping other tables - */ AcpiOsUnmapMemory (Table, Length); return_ACPI_STATUS (AE_OK); Index: drivers/bus/acpi/acpica/tables/tbxface.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbxface.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbxface.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ -#define __TBXFACE_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/tables/tbxfload.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbxfload.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbxfload.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ -#define __TBXFLOAD_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" Index: drivers/bus/acpi/acpica/tables/tbxfroot.c =================================================================== --- drivers/bus/acpi/acpica/tables/tbxfroot.c (revision 69845) +++ drivers/bus/acpi/acpica/tables/tbxfroot.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __TBXFROOT_C__ - #include "acpi.h" #include "accommon.h" #include "actables.h" @@ -126,6 +124,43 @@ /******************************************************************************* * + * FUNCTION: AcpiTbGetRsdpLength + * + * PARAMETERS: Rsdp - Pointer to RSDP + * + * RETURN: Table length + * + * DESCRIPTION: Get the length of the RSDP + * + ******************************************************************************/ + +UINT32 +AcpiTbGetRsdpLength ( + ACPI_TABLE_RSDP *Rsdp) +{ + + if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature)) + { + /* BAD Signature */ + + return (0); + } + + /* "Length" field is available if table version >= 2 */ + + if (Rsdp->Revision >= 2) + { + return (Rsdp->Length); + } + else + { + return (ACPI_RSDP_CHECKSUM_LENGTH); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbValidateRsdp * * PARAMETERS: Rsdp - Pointer to unvalidated RSDP Index: drivers/bus/acpi/acpica/utilities/utaddress.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utaddress.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utaddress.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTADDRESS_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/utilities/utalloc.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utalloc.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utalloc.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTALLOC_C__ - #include "acpi.h" #include "accommon.h" #include "acdebug.h" Index: drivers/bus/acpi/acpica/utilities/utbuffer.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utbuffer.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utbuffer.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTBUFFER_C__ - #include "acpi.h" #include "accommon.h" @@ -290,3 +288,138 @@ AcpiUtDumpBuffer (Buffer, Count, Display, 0); } + + +#ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiUtDumpBufferToFile + * + * PARAMETERS: File - File descriptor + * Buffer - Buffer to dump + * Count - Amount to dump, in bytes + * Display - BYTE, WORD, DWORD, or QWORD display: + * DB_BYTE_DISPLAY + * DB_WORD_DISPLAY + * DB_DWORD_DISPLAY + * DB_QWORD_DISPLAY + * BaseOffset - Beginning buffer offset (display only) + * + * RETURN: None + * + * DESCRIPTION: Generic dump buffer in both hex and ascii to a file. + * + ******************************************************************************/ + +void +AcpiUtDumpBufferToFile ( + ACPI_FILE File, + UINT8 *Buffer, + UINT32 Count, + UINT32 Display, + UINT32 BaseOffset) +{ + UINT32 i = 0; + UINT32 j; + UINT32 Temp32; + UINT8 BufChar; + + + if (!Buffer) + { + AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n"); + return; + } + + if ((Count < 4) || (Count & 0x01)) + { + Display = DB_BYTE_DISPLAY; + } + + /* Nasty little dump buffer routine! */ + + while (i < Count) + { + /* Print current offset */ + + AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i)); + + /* Print 16 hex chars */ + + for (j = 0; j < 16;) + { + if (i + j >= Count) + { + /* Dump fill spaces */ + + AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " "); + j += Display; + continue; + } + + switch (Display) + { + case DB_BYTE_DISPLAY: + default: /* Default is BYTE display */ + + AcpiUtFilePrintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]); + break; + + case DB_WORD_DISPLAY: + + ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); + AcpiUtFilePrintf (File, "%04X ", Temp32); + break; + + case DB_DWORD_DISPLAY: + + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); + AcpiUtFilePrintf (File, "%08X ", Temp32); + break; + + case DB_QWORD_DISPLAY: + + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); + AcpiUtFilePrintf (File, "%08X", Temp32); + + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); + AcpiUtFilePrintf (File, "%08X ", Temp32); + break; + } + + j += Display; + } + + /* + * Print the ASCII equivalent characters but watch out for the bad + * unprintable ones (printable chars are 0x20 through 0x7E) + */ + AcpiUtFilePrintf (File, " "); + for (j = 0; j < 16; j++) + { + if (i + j >= Count) + { + AcpiUtFilePrintf (File, "\n"); + return; + } + + BufChar = Buffer[(ACPI_SIZE) i + j]; + if (ACPI_IS_PRINT (BufChar)) + { + AcpiUtFilePrintf (File, "%c", BufChar); + } + else + { + AcpiUtFilePrintf (File, "."); + } + } + + /* Done with that line. */ + + AcpiUtFilePrintf (File, "\n"); + i += 16; + } + + return; +} +#endif Index: drivers/bus/acpi/acpica/utilities/utcache.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utcache.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utcache.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTCACHE_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utclib.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utclib.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utclib.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __CMCLIB_C__ - #include "acpi.h" #include "accommon.h" @@ -380,8 +377,6 @@ } -#ifdef ACPI_FUTURE_IMPLEMENTATION -/* Not used at this time */ /******************************************************************************* * * FUNCTION: AcpiUtStrchr (strchr) @@ -412,8 +407,8 @@ return (NULL); } -#endif + /******************************************************************************* * * FUNCTION: AcpiUtStrncmp (strncmp) Index: drivers/bus/acpi/acpica/utilities/utcopy.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utcopy.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utcopy.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTCOPY_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -1135,5 +1133,12 @@ Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc); } + /* Delete the allocated object if copy failed */ + + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference(*DestDesc); + } + return_ACPI_STATUS (Status); } Index: drivers/bus/acpi/acpica/utilities/utdebug.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utdebug.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utdebug.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ -#define __UTDEBUG_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -708,3 +707,33 @@ } #endif + + +#ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiLogError + * + * PARAMETERS: Format - Printf format field + * ... - Optional printf arguments + * + * RETURN: None + * + * DESCRIPTION: Print error message to the console, used by applications. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiLogError ( + const char *Format, + ...) +{ + va_list Args; + + va_start (Args, Format); + (void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args); + va_end (Args); +} + +ACPI_EXPORT_SYMBOL (AcpiLogError) +#endif Index: drivers/bus/acpi/acpica/utilities/utdecode.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utdecode.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utdecode.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTDECODE_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -165,38 +163,6 @@ /******************************************************************************* * - * FUNCTION: AcpiUtHexToAsciiChar - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -/* Hex to ASCII conversion table */ - -static const char AcpiGbl_HexToAscii[] = -{ - '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' -}; - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position) -{ - - return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtGetRegionName * * PARAMETERS: Space ID - ID for the region @@ -613,7 +579,8 @@ /* 09 */ "Device PLD Check", /* 0A */ "Reserved", /* 0B */ "System Locality Update", - /* 0C */ "Shutdown Request" + /* 0C */ "Shutdown Request", + /* 0D */ "System Resource Affinity Update" }; static const char *AcpiGbl_DeviceNotify[4] = @@ -647,7 +614,7 @@ ACPI_OBJECT_TYPE Type) { - /* 00 - 0C are common to all object types */ + /* 00 - 0D are common to all object types */ if (NotifyValue <= ACPI_NOTIFY_MAX) { Index: drivers/bus/acpi/acpica/utilities/utdelete.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utdelete.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utdelete.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTDELETE_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/utilities/uterror.c =================================================================== --- drivers/bus/acpi/acpica/utilities/uterror.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/uterror.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTERROR_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/utilities/uteval.c =================================================================== --- drivers/bus/acpi/acpica/utilities/uteval.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/uteval.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTEVAL_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/utilities/utexcep.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utexcep.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utexcep.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __UTEXCEP_C__ #define EXPORT_ACPI_INTERFACES #define ACPI_DEFINE_EXCEPTION_TABLE Index: drivers/bus/acpi/acpica/utilities/utfileio.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utfileio.c (revision 0) +++ drivers/bus/acpi/acpica/utilities/utfileio.c (working copy) @@ -0,0 +1,433 @@ +/******************************************************************************* + * + * Module Name: utfileio - simple file I/O routines + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "actables.h" +#include "acapps.h" + +#ifdef ACPI_ASL_COMPILER +#include "aslcompiler.h" +#endif + + +#define _COMPONENT ACPI_CA_DEBUGGER + ACPI_MODULE_NAME ("utfileio") + + +#ifdef ACPI_APPLICATION + +/* Local prototypes */ + +static ACPI_STATUS +AcpiUtCheckTextModeCorruption ( + UINT8 *Table, + UINT32 TableLength, + UINT32 FileLength); + +static ACPI_STATUS +AcpiUtReadTable ( + FILE *fp, + ACPI_TABLE_HEADER **Table, + UINT32 *TableLength); + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCheckTextModeCorruption + * + * PARAMETERS: Table - Table buffer + * TableLength - Length of table from the table header + * FileLength - Length of the file that contains the table + * + * RETURN: Status + * + * DESCRIPTION: Check table for text mode file corruption where all linefeed + * characters (LF) have been replaced by carriage return linefeed + * pairs (CR/LF). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtCheckTextModeCorruption ( + UINT8 *Table, + UINT32 TableLength, + UINT32 FileLength) +{ + UINT32 i; + UINT32 Pairs = 0; + + + if (TableLength != FileLength) + { + ACPI_WARNING ((AE_INFO, + "File length (0x%X) is not the same as the table length (0x%X)", + FileLength, TableLength)); + } + + /* Scan entire table to determine if each LF has been prefixed with a CR */ + + for (i = 1; i < FileLength; i++) + { + if (Table[i] == 0x0A) + { + if (Table[i - 1] != 0x0D) + { + /* The LF does not have a preceding CR, table not corrupted */ + + return (AE_OK); + } + else + { + /* Found a CR/LF pair */ + + Pairs++; + } + i++; + } + } + + if (!Pairs) + { + return (AE_OK); + } + + /* + * Entire table scanned, each CR is part of a CR/LF pair -- + * meaning that the table was treated as a text file somewhere. + * + * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the + * original table are left untouched by the text conversion process -- + * meaning that we cannot simply replace CR/LF pairs with LFs. + */ + AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); + AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs); + AcpiOsPrintf ("Table cannot be repaired!\n"); + return (AE_BAD_VALUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadTable + * + * PARAMETERS: fp - File that contains table + * Table - Return value, buffer with table + * TableLength - Return value, length of table + * + * RETURN: Status + * + * DESCRIPTION: Load the DSDT from the file pointer + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtReadTable ( + FILE *fp, + ACPI_TABLE_HEADER **Table, + UINT32 *TableLength) +{ + ACPI_TABLE_HEADER TableHeader; + UINT32 Actual; + ACPI_STATUS Status; + UINT32 FileSize; + BOOLEAN StandardHeader = TRUE; + INT32 Count; + + /* Get the file size */ + + FileSize = CmGetFileSize (fp); + if (FileSize == ACPI_UINT32_MAX) + { + return (AE_ERROR); + } + + if (FileSize < 4) + { + return (AE_BAD_HEADER); + } + + /* Read the signature */ + + fseek (fp, 0, SEEK_SET); + + Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp); + if (Count != sizeof (ACPI_TABLE_HEADER)) + { + AcpiOsPrintf ("Could not read the table header\n"); + return (AE_BAD_HEADER); + } + + /* The RSDP table does not have standard ACPI header */ + + if (ACPI_VALIDATE_RSDP_SIG (TableHeader.Signature)) + { + *TableLength = FileSize; + StandardHeader = FALSE; + } + else + { + +#if 0 + /* Validate the table header/length */ + + Status = AcpiTbValidateTableHeader (&TableHeader); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Table header is invalid!\n"); + return (Status); + } +#endif + + /* File size must be at least as long as the Header-specified length */ + + if (TableHeader.Length > FileSize) + { + AcpiOsPrintf ( + "TableHeader length [0x%X] greater than the input file size [0x%X]\n", + TableHeader.Length, FileSize); + +#ifdef ACPI_ASL_COMPILER + Status = FlCheckForAscii (fp, NULL, FALSE); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("File appears to be ASCII only, must be binary\n"); + } +#endif + return (AE_BAD_HEADER); + } + +#ifdef ACPI_OBSOLETE_CODE + /* We only support a limited number of table types */ + + if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && + !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) + { + AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", + (char *) TableHeader.Signature); + ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); + return (AE_ERROR); + } +#endif + + *TableLength = TableHeader.Length; + } + + /* Allocate a buffer for the table */ + + *Table = AcpiOsAllocate ((size_t) FileSize); + if (!*Table) + { + AcpiOsPrintf ( + "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", + TableHeader.Signature, *TableLength); + return (AE_NO_MEMORY); + } + + /* Get the rest of the table */ + + fseek (fp, 0, SEEK_SET); + Actual = fread (*Table, 1, (size_t) FileSize, fp); + if (Actual == FileSize) + { + if (StandardHeader) + { + /* Now validate the checksum */ + + Status = AcpiTbVerifyChecksum ((void *) *Table, + ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length); + + if (Status == AE_BAD_CHECKSUM) + { + Status = AcpiUtCheckTextModeCorruption ((UINT8 *) *Table, + FileSize, (*Table)->Length); + return (Status); + } + } + return (AE_OK); + } + + if (Actual > 0) + { + AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", + FileSize, Actual); + return (AE_OK); + } + + AcpiOsPrintf ("Error - could not read the table file\n"); + AcpiOsFree (*Table); + *Table = NULL; + *TableLength = 0; + return (AE_ERROR); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadTableFromFile + * + * PARAMETERS: Filename - File where table is located + * Table - Where a pointer to the table is returned + * + * RETURN: Status + * + * DESCRIPTION: Get an ACPI table from a file + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtReadTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table) +{ + FILE *File; + UINT32 FileSize; + UINT32 TableLength; + ACPI_STATUS Status = AE_ERROR; + + + /* Open the file, get current size */ + + File = fopen (Filename, "rb"); + if (!File) + { + perror ("Could not open input file"); + return (Status); + } + + FileSize = CmGetFileSize (File); + if (FileSize == ACPI_UINT32_MAX) + { + goto Exit; + } + + /* Get the entire file */ + + fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n", + Filename, FileSize, FileSize); + + Status = AcpiUtReadTable (File, Table, &TableLength); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not get table from the file\n"); + } + +Exit: + fclose(File); + return (Status); +} + +#endif Property changes on: drivers/bus/acpi/acpica/utilities/utfileio.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: drivers/bus/acpi/acpica/utilities/utglobal.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utglobal.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utglobal.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ -#define __UTGLOBAL_C__ #define EXPORT_ACPI_INTERFACES #define DEFINE_ACPI_GLOBALS @@ -130,31 +129,6 @@ * ******************************************************************************/ -/* Debug output control masks */ - -#ifdef ACPI_DEBUG_OUTPUT -UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT; -#else -UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT; -#endif - -UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; - -/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ - -ACPI_TABLE_FADT AcpiGbl_FADT; -UINT32 AcpiGbl_TraceFlags; -ACPI_NAME AcpiGbl_TraceMethodName; -BOOLEAN AcpiGbl_SystemAwakeAndRunning; -UINT32 AcpiCurrentGpeCount; - -/* - * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning - * that the ACPI hardware is no longer required. A flag in the FADT indicates - * a reduced HW machine, and that flag is duplicated here for convenience. - */ -BOOLEAN AcpiGbl_ReducedHardware; - /* Various state name strings */ const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = @@ -270,166 +244,6 @@ }; #endif /* !ACPI_REDUCED_HARDWARE */ - -/******************************************************************************* - * - * FUNCTION: AcpiUtInitGlobals - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize ACPICA globals. All globals that require specific - * initialization should be initialized here. This allows for - * a warm restart. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInitGlobals ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtInitGlobals); - - - /* Create all memory caches */ - - Status = AcpiUtCreateCaches (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Address Range lists */ - - for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) - { - AcpiGbl_AddressRangeList[i] = NULL; - } - - /* Mutex locked flags */ - - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - AcpiGbl_MutexInfo[i].Mutex = NULL; - AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - AcpiGbl_MutexInfo[i].UseCount = 0; - } - - for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) - { - AcpiGbl_OwnerIdMask[i] = 0; - } - - /* Last OwnerID is never valid */ - - AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; - - /* Event counters */ - - AcpiMethodCount = 0; - AcpiSciCount = 0; - AcpiGpeCount = 0; - - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - AcpiFixedEventCount[i] = 0; - } - -#if (!ACPI_REDUCED_HARDWARE) - - /* GPE/SCI support */ - - AcpiGbl_AllGpesInitialized = FALSE; - AcpiGbl_GpeXruptListHead = NULL; - AcpiGbl_GpeFadtBlocks[0] = NULL; - AcpiGbl_GpeFadtBlocks[1] = NULL; - AcpiCurrentGpeCount = 0; - - AcpiGbl_GlobalEventHandler = NULL; - AcpiGbl_SciHandlerList = NULL; - -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* Global handlers */ - - AcpiGbl_GlobalNotify[0].Handler = NULL; - AcpiGbl_GlobalNotify[1].Handler = NULL; - AcpiGbl_ExceptionHandler = NULL; - AcpiGbl_InitHandler = NULL; - AcpiGbl_TableHandler = NULL; - AcpiGbl_InterfaceHandler = NULL; - - /* Global Lock support */ - - AcpiGbl_GlobalLockSemaphore = NULL; - AcpiGbl_GlobalLockMutex = NULL; - AcpiGbl_GlobalLockAcquired = FALSE; - AcpiGbl_GlobalLockHandle = 0; - AcpiGbl_GlobalLockPresent = FALSE; - - /* Miscellaneous variables */ - - AcpiGbl_DSDT = NULL; - AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_Shutdown = FALSE; - AcpiGbl_NsLookupCount = 0; - AcpiGbl_PsFindCount = 0; - AcpiGbl_AcpiHardwarePresent = TRUE; - AcpiGbl_LastOwnerIdIndex = 0; - AcpiGbl_NextOwnerIdOffset = 0; - AcpiGbl_TraceMethodName = 0; - AcpiGbl_TraceDbgLevel = 0; - AcpiGbl_TraceDbgLayer = 0; - AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; - AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; - AcpiGbl_OsiMutex = NULL; - AcpiGbl_RegMethodsExecuted = FALSE; - - /* Hardware oriented */ - - AcpiGbl_EventsInitialized = FALSE; - AcpiGbl_SystemAwakeAndRunning = TRUE; - - /* Namespace */ - - AcpiGbl_ModuleCodeList = NULL; - AcpiGbl_RootNode = NULL; - AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; - AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; - AcpiGbl_RootNodeStruct.Parent = NULL; - AcpiGbl_RootNodeStruct.Child = NULL; - AcpiGbl_RootNodeStruct.Peer = NULL; - AcpiGbl_RootNodeStruct.Object = NULL; - - -#ifdef ACPI_DISASSEMBLER - AcpiGbl_ExternalList = NULL; - AcpiGbl_NumExternalMethods = 0; - AcpiGbl_ResolvedExternalMethods = 0; -#endif - -#ifdef ACPI_DEBUG_OUTPUT - AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); -#endif - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiGbl_DisplayFinalMemStats = FALSE; - AcpiGbl_DisableMemTracking = FALSE; -#endif - -#ifdef ACPI_DEBUGGER - AcpiGbl_DbTerminateThreads = FALSE; -#endif - - return_ACPI_STATUS (AE_OK); -} - /* Public globals */ ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) Index: drivers/bus/acpi/acpica/utilities/uthex.c =================================================================== --- drivers/bus/acpi/acpica/utilities/uthex.c (revision 0) +++ drivers/bus/acpi/acpica/utilities/uthex.c (working copy) @@ -0,0 +1,183 @@ +/****************************************************************************** + * + * Module Name: uthex -- Hex/ASCII support functions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("uthex") + + +/* Hex to ASCII conversion table */ + +static char AcpiGbl_HexToAscii[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexToAsciiChar + * + * PARAMETERS: Integer - Contains the hex digit + * Position - bit position of the digit within the + * integer (multiple of 4) + * + * RETURN: The converted Ascii character + * + * DESCRIPTION: Convert a hex digit to an Ascii character + * + ******************************************************************************/ + +char +AcpiUtHexToAsciiChar ( + UINT64 Integer, + UINT32 Position) +{ + + return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexCharToValue + * + * PARAMETERS: AsciiChar - Hex character in Ascii + * + * RETURN: The binary value of the ascii/hex character + * + * DESCRIPTION: Perform ascii-to-hex translation + * + ******************************************************************************/ + +UINT8 +AcpiUtAsciiCharToHex ( + int HexChar) +{ + + if (HexChar <= 0x39) + { + return ((UINT8) (HexChar - 0x30)); + } + + if (HexChar <= 0x46) + { + return ((UINT8) (HexChar - 0x37)); + } + + return ((UINT8) (HexChar - 0x57)); +} Property changes on: drivers/bus/acpi/acpica/utilities/uthex.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: drivers/bus/acpi/acpica/utilities/utids.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utids.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utids.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTIDS_C__ - #include "acpi.h" #include "accommon.h" #include "acinterp.h" Index: drivers/bus/acpi/acpica/utilities/utinit.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utinit.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utinit.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTINIT_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -188,6 +185,162 @@ #endif /* !ACPI_REDUCED_HARDWARE */ +/******************************************************************************* + * + * FUNCTION: AcpiUtInitGlobals + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Initialize ACPICA globals. All globals that require specific + * initialization should be initialized here. This allows for + * a warm restart. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtInitGlobals ( + void) +{ + ACPI_STATUS Status; + UINT32 i; + + + ACPI_FUNCTION_TRACE (UtInitGlobals); + + + /* Create all memory caches */ + + Status = AcpiUtCreateCaches (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Address Range lists */ + + for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) + { + AcpiGbl_AddressRangeList[i] = NULL; + } + + /* Mutex locked flags */ + + for (i = 0; i < ACPI_NUM_MUTEX; i++) + { + AcpiGbl_MutexInfo[i].Mutex = NULL; + AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[i].UseCount = 0; + } + + for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) + { + AcpiGbl_OwnerIdMask[i] = 0; + } + + /* Last OwnerID is never valid */ + + AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; + + /* Event counters */ + + AcpiMethodCount = 0; + AcpiSciCount = 0; + AcpiGpeCount = 0; + + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) + { + AcpiFixedEventCount[i] = 0; + } + +#if (!ACPI_REDUCED_HARDWARE) + + /* GPE/SCI support */ + + AcpiGbl_AllGpesInitialized = FALSE; + AcpiGbl_GpeXruptListHead = NULL; + AcpiGbl_GpeFadtBlocks[0] = NULL; + AcpiGbl_GpeFadtBlocks[1] = NULL; + AcpiCurrentGpeCount = 0; + + AcpiGbl_GlobalEventHandler = NULL; + AcpiGbl_SciHandlerList = NULL; + +#endif /* !ACPI_REDUCED_HARDWARE */ + + /* Global handlers */ + + AcpiGbl_GlobalNotify[0].Handler = NULL; + AcpiGbl_GlobalNotify[1].Handler = NULL; + AcpiGbl_ExceptionHandler = NULL; + AcpiGbl_InitHandler = NULL; + AcpiGbl_TableHandler = NULL; + AcpiGbl_InterfaceHandler = NULL; + + /* Global Lock support */ + + AcpiGbl_GlobalLockSemaphore = NULL; + AcpiGbl_GlobalLockMutex = NULL; + AcpiGbl_GlobalLockAcquired = FALSE; + AcpiGbl_GlobalLockHandle = 0; + AcpiGbl_GlobalLockPresent = FALSE; + + /* Miscellaneous variables */ + + AcpiGbl_DSDT = NULL; + AcpiGbl_CmSingleStep = FALSE; + AcpiGbl_Shutdown = FALSE; + AcpiGbl_NsLookupCount = 0; + AcpiGbl_PsFindCount = 0; + AcpiGbl_AcpiHardwarePresent = TRUE; + AcpiGbl_LastOwnerIdIndex = 0; + AcpiGbl_NextOwnerIdOffset = 0; + AcpiGbl_TraceDbgLevel = 0; + AcpiGbl_TraceDbgLayer = 0; + AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; + AcpiGbl_OsiMutex = NULL; + AcpiGbl_RegMethodsExecuted = FALSE; + + /* Hardware oriented */ + + AcpiGbl_EventsInitialized = FALSE; + AcpiGbl_SystemAwakeAndRunning = TRUE; + + /* Namespace */ + + AcpiGbl_ModuleCodeList = NULL; + AcpiGbl_RootNode = NULL; + AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; + AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; + AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; + AcpiGbl_RootNodeStruct.Parent = NULL; + AcpiGbl_RootNodeStruct.Child = NULL; + AcpiGbl_RootNodeStruct.Peer = NULL; + AcpiGbl_RootNodeStruct.Object = NULL; + + +#ifdef ACPI_DISASSEMBLER + AcpiGbl_ExternalList = NULL; + AcpiGbl_NumExternalMethods = 0; + AcpiGbl_ResolvedExternalMethods = 0; +#endif + +#ifdef ACPI_DEBUG_OUTPUT + AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); +#endif + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + AcpiGbl_DisplayFinalMemStats = FALSE; + AcpiGbl_DisableMemTracking = FALSE; +#endif + + ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE); + + return_ACPI_STATUS (AE_OK); +} + + /****************************************************************************** * * FUNCTION: AcpiUtTerminate Index: drivers/bus/acpi/acpica/utilities/utlock.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utlock.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utlock.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTLOCK_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utmath.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utmath.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utmath.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTMATH_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utmisc.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utmisc.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utmisc.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTMISC_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/utilities/utmutex.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utmutex.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utmutex.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTMUTEX_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utobject.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utobject.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utobject.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTOBJECT_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -472,7 +470,7 @@ default: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not not an ACPI operand obj [%s]\n", + "%p is not an ACPI operand obj [%s]\n", Object, AcpiUtGetDescriptorName (Object))); break; } Index: drivers/bus/acpi/acpica/utilities/utosi.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utosi.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utosi.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTOSI_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utownerid.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utownerid.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utownerid.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTOWNERID_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/utilities/utpredef.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utpredef.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utpredef.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTPREDEF_C__ - #include "acpi.h" #include "accommon.h" #include "acpredef.h" Index: drivers/bus/acpi/acpica/utilities/utprint.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utprint.c (revision 0) +++ drivers/bus/acpi/acpica/utilities/utprint.c (working copy) @@ -0,0 +1,883 @@ +/****************************************************************************** + * + * Module Name: utprint - Formatted printing routines + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utprint") + + +#define ACPI_FORMAT_SIGN 0x01 +#define ACPI_FORMAT_SIGN_PLUS 0x02 +#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04 +#define ACPI_FORMAT_ZERO 0x08 +#define ACPI_FORMAT_LEFT 0x10 +#define ACPI_FORMAT_UPPER 0x20 +#define ACPI_FORMAT_PREFIX 0x40 + + +/* Local prototypes */ + +static ACPI_SIZE +AcpiUtBoundStringLength ( + const char *String, + ACPI_SIZE Count); + +static char * +AcpiUtBoundStringOutput ( + char *String, + const char *End, + char c); + +static char * +AcpiUtFormatNumber ( + char *String, + char *End, + UINT64 Number, + UINT8 Base, + INT32 Width, + INT32 Precision, + UINT8 Type); + +static char * +AcpiUtPutNumber ( + char *String, + UINT64 Number, + UINT8 Base, + BOOLEAN Upper); + + +/* Module globals */ + +static const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef"; +static const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF"; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtBoundStringLength + * + * PARAMETERS: String - String with boundary + * Count - Boundary of the string + * + * RETURN: Length of the string. Less than or equal to Count. + * + * DESCRIPTION: Calculate the length of a string with boundary. + * + ******************************************************************************/ + +static ACPI_SIZE +AcpiUtBoundStringLength ( + const char *String, + ACPI_SIZE Count) +{ + UINT32 Length = 0; + + + while (*String && Count) + { + Length++; + String++; + Count--; + } + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtBoundStringOutput + * + * PARAMETERS: String - String with boundary + * End - Boundary of the string + * c - Character to be output to the string + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Output a character into a string with boundary check. + * + ******************************************************************************/ + +static char * +AcpiUtBoundStringOutput ( + char *String, + const char *End, + char c) +{ + + if (String < End) + { + *String = c; + } + + ++String; + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtPutNumber + * + * PARAMETERS: String - Buffer to hold reverse-ordered string + * Number - Integer to be converted + * Base - Base of the integer + * Upper - Whether or not using upper cased digits + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Convert an integer into a string, note that, the string holds a + * reversed ordered number without the trailing zero. + * + ******************************************************************************/ + +static char * +AcpiUtPutNumber ( + char *String, + UINT64 Number, + UINT8 Base, + BOOLEAN Upper) +{ + const char *Digits; + UINT64 DigitIndex; + char *Pos; + + + Pos = String; + Digits = Upper ? AcpiGbl_UpperHexDigits : AcpiGbl_LowerHexDigits; + + if (Number == 0) + { + *(Pos++) = '0'; + } + else + { + while (Number) + { + (void) AcpiUtDivide (Number, Base, &Number, &DigitIndex); + *(Pos++) = Digits[DigitIndex]; + } + } + + /* *(Pos++) = '0'; */ + return (Pos); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtScanNumber + * + * PARAMETERS: String - String buffer + * NumberPtr - Where the number is returned + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Scan a string for a decimal integer. + * + ******************************************************************************/ + +const char * +AcpiUtScanNumber ( + const char *String, + UINT64 *NumberPtr) +{ + UINT64 Number = 0; + + + while (ACPI_IS_DIGIT (*String)) + { + Number *= 10; + Number += *(String++) - '0'; + } + + *NumberPtr = Number; + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtPrintNumber + * + * PARAMETERS: String - String buffer + * Number - The number to be converted + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Print a decimal integer into a string. + * + ******************************************************************************/ + +const char * +AcpiUtPrintNumber ( + char *String, + UINT64 Number) +{ + char AsciiString[20]; + const char *Pos1; + char *Pos2; + + + Pos1 = AcpiUtPutNumber (AsciiString, Number, 10, FALSE); + Pos2 = String; + + while (Pos1 != AsciiString) + { + *(Pos2++) = *(--Pos1); + } + + *Pos2 = 0; + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtFormatNumber + * + * PARAMETERS: String - String buffer with boundary + * End - Boundary of the string + * Number - The number to be converted + * Base - Base of the integer + * Width - Field width + * Precision - Precision of the integer + * Type - Special printing flags + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Print an integer into a string with any base and any precision. + * + ******************************************************************************/ + +static char * +AcpiUtFormatNumber ( + char *String, + char *End, + UINT64 Number, + UINT8 Base, + INT32 Width, + INT32 Precision, + UINT8 Type) +{ + char *Pos; + char Sign; + char Zero; + BOOLEAN NeedPrefix; + BOOLEAN Upper; + INT32 i; + char ReversedString[66]; + + + /* Parameter validation */ + + if (Base < 2 || Base > 16) + { + return (NULL); + } + + if (Type & ACPI_FORMAT_LEFT) + { + Type &= ~ACPI_FORMAT_ZERO; + } + + NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE; + Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE; + Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' '; + + /* Calculate size according to sign and prefix */ + + Sign = '\0'; + if (Type & ACPI_FORMAT_SIGN) + { + if ((INT64) Number < 0) + { + Sign = '-'; + Number = - (INT64) Number; + Width--; + } + else if (Type & ACPI_FORMAT_SIGN_PLUS) + { + Sign = '+'; + Width--; + } + else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE) + { + Sign = ' '; + Width--; + } + } + if (NeedPrefix) + { + Width--; + if (Base == 16) + { + Width--; + } + } + + /* Generate full string in reverse order */ + + Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper); + i = ACPI_PTR_DIFF (Pos, ReversedString); + + /* Printing 100 using %2d gives "100", not "00" */ + + if (i > Precision) + { + Precision = i; + } + + Width -= Precision; + + /* Output the string */ + + if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT))) + { + while (--Width >= 0) + { + String = AcpiUtBoundStringOutput (String, End, ' '); + } + } + if (Sign) + { + String = AcpiUtBoundStringOutput (String, End, Sign); + } + if (NeedPrefix) + { + String = AcpiUtBoundStringOutput (String, End, '0'); + if (Base == 16) + { + String = AcpiUtBoundStringOutput (String, End, + Upper ? 'X' : 'x'); + } + } + if (!(Type & ACPI_FORMAT_LEFT)) + { + while (--Width >= 0) + { + String = AcpiUtBoundStringOutput (String, End, Zero); + } + } + + while (i <= --Precision) + { + String = AcpiUtBoundStringOutput (String, End, '0'); + } + while (--i >= 0) + { + String = AcpiUtBoundStringOutput (String, End, + ReversedString[i]); + } + while (--Width >= 0) + { + String = AcpiUtBoundStringOutput (String, End, ' '); + } + + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtVsnprintf + * + * PARAMETERS: String - String with boundary + * Size - Boundary of the string + * Format - Standard printf format + * Args - Argument list + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a string using argument list pointer. + * + ******************************************************************************/ + +int +AcpiUtVsnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + va_list Args) +{ + UINT8 Base = 10; + UINT8 Type = 0; + INT32 Width = -1; + INT32 Precision = -1; + char Qualifier = 0; + UINT64 Number; + char *Pos; + char *End; + char c; + const char *s; + const void *p; + INT32 Length; + int i; + + + Pos = String; + End = String + Size; + + for (; *Format; ++Format) + { + if (*Format != '%') + { + Pos = AcpiUtBoundStringOutput (Pos, End, *Format); + continue; + } + + /* Process sign */ + + do + { + ++Format; + if (*Format == '#') + { + Type |= ACPI_FORMAT_PREFIX; + } + else if (*Format == '0') + { + Type |= ACPI_FORMAT_ZERO; + } + else if (*Format == '+') + { + Type |= ACPI_FORMAT_SIGN_PLUS; + } + else if (*Format == ' ') + { + Type |= ACPI_FORMAT_SIGN_PLUS_SPACE; + } + else if (*Format == '-') + { + Type |= ACPI_FORMAT_LEFT; + } + else + { + break; + } + } while (1); + + /* Process width */ + + Width = -1; + if (ACPI_IS_DIGIT (*Format)) + { + Format = AcpiUtScanNumber (Format, &Number); + Width = (INT32) Number; + } + else if (*Format == '*') + { + ++Format; + Width = va_arg (Args, int); + if (Width < 0) + { + Width = -Width; + Type |= ACPI_FORMAT_LEFT; + } + } + + /* Process precision */ + + Precision = -1; + if (*Format == '.') + { + ++Format; + if (ACPI_IS_DIGIT(*Format)) + { + Format = AcpiUtScanNumber (Format, &Number); + Precision = (INT32) Number; + } + else if (*Format == '*') + { + ++Format; + Precision = va_arg (Args, int); + } + if (Precision < 0) + { + Precision = 0; + } + } + + /* Process qualifier */ + + Qualifier = -1; + if (*Format == 'h' || *Format == 'l' || *Format == 'L') + { + Qualifier = *Format; + ++Format; + + if (Qualifier == 'l' && *Format == 'l') + { + Qualifier = 'L'; + ++Format; + } + } + + switch (*Format) + { + case '%': + + Pos = AcpiUtBoundStringOutput (Pos, End, '%'); + continue; + + case 'c': + + if (!(Type & ACPI_FORMAT_LEFT)) + { + while (--Width > 0) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + } + + c = (char) va_arg (Args, int); + Pos = AcpiUtBoundStringOutput (Pos, End, c); + + while (--Width > 0) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + continue; + + case 's': + + s = va_arg (Args, char *); + if (!s) + { + s = ""; + } + Length = AcpiUtBoundStringLength (s, Precision); + if (!(Type & ACPI_FORMAT_LEFT)) + { + while (Length < Width--) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + } + for (i = 0; i < Length; ++i) + { + Pos = AcpiUtBoundStringOutput (Pos, End, *s); + ++s; + } + while (Length < Width--) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + continue; + + case 'o': + + Base = 8; + break; + + case 'X': + + Type |= ACPI_FORMAT_UPPER; + + case 'x': + + Base = 16; + break; + + case 'd': + case 'i': + + Type |= ACPI_FORMAT_SIGN; + + case 'u': + + break; + + case 'p': + + if (Width == -1) + { + Width = 2 * sizeof (void *); + Type |= ACPI_FORMAT_ZERO; + } + + p = va_arg (Args, void *); + Pos = AcpiUtFormatNumber (Pos, End, + ACPI_TO_INTEGER (p), 16, Width, Precision, Type); + continue; + + default: + + Pos = AcpiUtBoundStringOutput (Pos, End, '%'); + if (*Format) + { + Pos = AcpiUtBoundStringOutput (Pos, End, *Format); + } + else + { + --Format; + } + continue; + } + + if (Qualifier == 'L') + { + Number = va_arg (Args, UINT64); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (INT64) Number; + } + } + else if (Qualifier == 'l') + { + Number = va_arg (Args, unsigned long); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (INT32) Number; + } + } + else if (Qualifier == 'h') + { + Number = (UINT16) va_arg (Args, int); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (INT16) Number; + } + } + else + { + Number = va_arg (Args, unsigned int); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (signed int) Number; + } + } + + Pos = AcpiUtFormatNumber (Pos, End, Number, Base, + Width, Precision, Type); + } + + if (Size > 0) + { + if (Pos < End) + { + *Pos = '\0'; + } + else + { + End[-1] = '\0'; + } + } + + return (ACPI_PTR_DIFF (Pos, String)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtSnprintf + * + * PARAMETERS: String - String with boundary + * Size - Boundary of the string + * Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a string. + * + ******************************************************************************/ + +int +AcpiUtSnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = AcpiUtVsnprintf (String, Size, Format, Args); + va_end (Args); + + return (Length); +} + + +#ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiUtFileVprintf + * + * PARAMETERS: File - File descriptor + * Format - Standard printf format + * Args - Argument list + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a file using argument list pointer. + * + ******************************************************************************/ + +int +AcpiUtFileVprintf ( + ACPI_FILE File, + const char *Format, + va_list Args) +{ + ACPI_CPU_FLAGS Flags; + int Length; + + + Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); + Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, + sizeof (AcpiGbl_PrintBuffer), Format, Args); + + (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); + AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtFilePrintf + * + * PARAMETERS: File - File descriptor + * Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a file. + * + ******************************************************************************/ + +int +AcpiUtFilePrintf ( + ACPI_FILE File, + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = AcpiUtFileVprintf (File, Format, Args); + va_end (Args); + + return (Length); +} +#endif Property changes on: drivers/bus/acpi/acpica/utilities/utprint.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: drivers/bus/acpi/acpica/utilities/utresrc.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utresrc.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utresrc.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTRESRC_C__ - #include "acpi.h" #include "accommon.h" #include "acresrc.h" @@ -172,7 +169,9 @@ const char *AcpiGbl_LlDecode[] = { "ActiveHigh", - "ActiveLow" + "ActiveLow", + "ActiveBoth", + "Reserved" }; const char *AcpiGbl_MaxDecode[] = @@ -371,7 +370,7 @@ const char *AcpiGbl_SbDecode[] = { - "StopBitsNone", + "StopBitsZero", "StopBitsOne", "StopBitsOnePlusHalf", "StopBitsTwo" Index: drivers/bus/acpi/acpica/utilities/utstate.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utstate.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utstate.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTSTATE_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utstring.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utstring.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utstring.c (working copy) @@ -113,9 +113,6 @@ * *****************************************************************************/ - -#define __UTSTRING_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/acpica/utilities/uttrack.c =================================================================== --- drivers/bus/acpi/acpica/utilities/uttrack.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/uttrack.c (working copy) @@ -124,8 +124,6 @@ * occurs in the body of AcpiUtFree. */ -#define __UTTRACK_C__ - #include "acpi.h" #include "accommon.h" Index: drivers/bus/acpi/acpica/utilities/utuuid.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utuuid.c (revision 0) +++ drivers/bus/acpi/acpica/utilities/utuuid.c (working copy) @@ -0,0 +1,173 @@ +/****************************************************************************** + * + * Module Name: utuuid -- UUID support functions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("utuuid") + + +/* + * UUID support functions. + * + * This table is used to convert an input UUID ascii string to a 16 byte + * buffer and the reverse. The table maps a UUID buffer index 0-15 to + * the index within the 36-byte UUID string where the associated 2-byte + * hex value can be found. + * + * 36-byte UUID strings are of the form: + * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp + * Where aa-pp are one byte hex numbers, made up of two hex digits + * + * Note: This table is basically the inverse of the string-to-offset table + * found in the ACPI spec in the description of the ToUUID macro. + */ +const UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH] = +{ + 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtConvertStringToUuid + * + * PARAMETERS: InString - 36-byte formatted UUID string + * UuidBuffer - Where the 16-byte UUID buffer is returned + * + * RETURN: None. Output data is returned in the UuidBuffer + * + * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer + * + ******************************************************************************/ + +void +AcpiUtConvertStringToUuid ( + char *InString, + UINT8 *UuidBuffer) +{ + UINT32 i; + + + for (i = 0; i < UUID_BUFFER_LENGTH; i++) + { + UuidBuffer[i] = + (AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i]]) << 4); + + UuidBuffer[i] |= + AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]); + } +} Property changes on: drivers/bus/acpi/acpica/utilities/utuuid.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: drivers/bus/acpi/acpica/utilities/utxface.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utxface.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utxface.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __UTXFACE_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -694,7 +692,9 @@ ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]); PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword); PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword); - PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword); + PldInfo->Red = ACPI_PLD_GET_RED (&Dword); + PldInfo->Green = ACPI_PLD_GET_GREEN (&Dword); + PldInfo->Blue = ACPI_PLD_GET_BLUE (&Dword); /* Second 32-bit DWord */ Index: drivers/bus/acpi/acpica/utilities/utxferror.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utxferror.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utxferror.c (working copy) @@ -113,7 +113,6 @@ * *****************************************************************************/ -#define __UTXFERROR_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -128,6 +127,8 @@ * tools/applications. */ +#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */ + /******************************************************************************* * * FUNCTION: AcpiError @@ -362,3 +363,5 @@ } ACPI_EXPORT_SYMBOL (AcpiBiosWarning) + +#endif /* ACPI_NO_ERROR_MESSAGES */ Index: drivers/bus/acpi/acpica/utilities/utxfinit.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utxfinit.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utxfinit.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ - -#define __UTXFINIT_C__ #define EXPORT_ACPI_INTERFACES #include "acpi.h" @@ -127,7 +125,12 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxfinit") +/* For AcpiExec only */ +void +AeDoObjectOverrides ( + void); + /******************************************************************************* * * FUNCTION: AcpiInitializeSubsystem @@ -382,7 +385,15 @@ } } +#ifdef ACPI_EXEC_APP /* + * This call implements the "initialization file" option for AcpiExec. + * This is the precise point that we want to perform the overrides. + */ + AeDoObjectOverrides (); +#endif + + /* * Execute any module-level code that was detected during the table load * phase. Although illegal since ACPI 2.0, there are many machines that * contain this type of code. Each block of detected executable AML code Index: drivers/bus/acpi/acpica/utilities/utxfmutex.c =================================================================== --- drivers/bus/acpi/acpica/utilities/utxfmutex.c (revision 69845) +++ drivers/bus/acpi/acpica/utilities/utxfmutex.c (working copy) @@ -113,8 +113,6 @@ * *****************************************************************************/ -#define __UTXFMUTEX_C__ - #include "acpi.h" #include "accommon.h" #include "acnamesp.h" Index: drivers/bus/acpi/CMakeLists.txt =================================================================== --- drivers/bus/acpi/CMakeLists.txt (revision 69845) +++ drivers/bus/acpi/CMakeLists.txt (working copy) @@ -133,11 +133,13 @@ acpica/utilities/utcache.c acpica/utilities/utclib.c acpica/utilities/utcopy.c - acpica/utilities/utdebug.c + # acpica/utilities/utdebug.c acpica/utilities/utdecode.c acpica/utilities/utdelete.c acpica/utilities/uterror.c acpica/utilities/uteval.c + # acpica/utilities/utfileio.c + acpica/utilities/uthex.c acpica/utilities/utids.c acpica/utilities/utinit.c acpica/utilities/utlock.c @@ -148,9 +150,11 @@ acpica/utilities/utosi.c acpica/utilities/utownerid.c acpica/utilities/utpredef.c + # acpica/utilities/utprint.c acpica/utilities/utresrc.c acpica/utilities/utstate.c acpica/utilities/utstring.c + # acpica/utilities/utuuid.c acpica/utilities/uttrack.c acpica/utilities/utxface.c acpica/utilities/utxferror.c