This commit was generated by cvs2svn to compensate for changes in r129684,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
Nate Lawson 2004-05-25 02:34:44 +00:00
commit d57f8354ca
49 changed files with 2098 additions and 1170 deletions

View File

@ -1,3 +1,174 @@
----------------------------------------
14 May 2004. Summary of changes for version 20040514:
1) ACPI CA Core Subsystem:
Fixed a problem where hardware GPE enable bits sometimes not set
properly during and after GPE method execution. Result of 04/27
changes.
Removed extra "clear all GPEs" when sleeping/waking.
Removed AcpiHwEnableGpe and AcpiHwDisableGpe, replaced by the
single AcpiHwWriteGpeEnableReg. Changed a couple of calls to the
functions above to the new AcpiEv* calls as appropriate.
ACPI_OS_NAME was removed from the OS-specific headers. The
default name is now "Microsoft Windows NT" for maximum
compatibility. However this can be changed by modifying the
acconfig.h file.
Allow a single invocation of AcpiInstallNotifyHandler for a
handler that traps both types of notifies (System, Device). Use
ACPI_ALL_NOTIFY flag.
Run _INI methods on ThermalZone objects. This is against the
ACPI specification, but there is apparently ASL code in the field
that has these _INI methods, and apparently "other" AML
interpreters execute them.
Performed a full 16/32/64 bit lint that resulted in some small
changes.
Added a sleep simulation command to the AML debugger to test
sleep code.
Code and Data Size: Current and previous core subsystem library
sizes are shown below. These are the code and data sizes for the
acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
these values do not include any ACPI driver or OSPM code. The
debug version of the code includes the debug output trace
mechanism and has a much larger code and data size. Note that
these values will vary depending on the efficiency of the
compiler and the compiler options used during generation.
Previous Release:
Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total
Debug Version: 162.9K Code, 67.0K Data, 229.9K Total
Current Release:
Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total
Debug Version: 163.2K Code, 67.2K Data, 230.4K Total
----------------------------------------
27 April 2004. Summary of changes for version 20040427:
1) ACPI CA Core Subsystem:
Completed a major overhaul of the GPE handling within ACPI CA.
There are now three types of GPEs: wake-only, runtime-only, and
combination wake/run. The only GPEs allowed to be combination
wake/run are for button-style devices such as a control-method
power button, control-method sleep button, or a notebook lid
switch. GPEs that have an _Lxx or _Exx method and are not
referenced by any _PRW methods are marked for "runtime" and
hardware enabled. Any GPE that is referenced by a _PRW method is
marked for "wake" (and disabled at runtime). However, at sleep
time, only those GPEs that have been specifically enabled for
wake via the AcpiEnableGpe interface will actually be hardware
enabled.
A new external interface has been added, AcpiSetGpeType(), that
is meant to be used by device drivers to force a GPE to a
particular type. It will be especially useful for the drivers
for the button devices mentioned above.
Completed restructuring of the ACPI CA initialization sequence so
that default operation region handlers are installed before GPEs
are initialized and the _PRW methods are executed. This will
prevent errors when the _PRW methods attempt to access system
memory or I/O space.
GPE enable/disable no longer reads the GPE enable register. We
now keep the enable info for runtime and wake separate and in the
GPE_EVENT_INFO. We thus no longer depend on the hardware to
maintain these bits.
Always clear the wake status and fixed/GPE status bits before
sleep, even for state S5.
Improved the AML debugger output for displaying the GPE blocks
and their current status.
Added new strings for the _OSI method, of the form "Windows 2001
SPx" where x = 0,1,2,3,4.
Fixed a problem where the physical address was incorrectly
calculated when the Load() operator was used to directly load
from an Operation Region (vs. loading from a Field object.) Also
added check for minimum table length for this case.
Fix for multiple mutex acquisition. Restore original thread
SyncLevel on mutex release.
Added ACPI_VALID_SXDS flag to the AcpiGetObjectInfo interface for
consistency with the other fields returned.
Shrunk the ACPI_GPE_EVENT_INFO structure by 40%. There is one
such structure for each GPE in the system, so the size of this
structure is important.
CPU stack requirement reduction: Cleaned up the method execution
and object evaluation paths so that now a parameter structure is
passed, instead of copying the various method parameters over and
over again.
In evregion.c: Correctly exit and reenter the interpreter region
if and only if dispatching an operation region request to a user-
installed handler. Do not exit/reenter when dispatching to a
default handler (e.g., default system memory or I/O handlers)
Notes for updating drivers for the new GPE support. The
following changes must be made to ACPI-related device drivers
that are attached to one or more GPEs: (This information will be
added to the ACPI CA Programmer Reference.)
1) AcpiInstallGpeHandler no longer automatically enables the GPE,
you must explicitly call AcpiEnableGpe.
2) There is a new interface called AcpiSetGpeType. This should be
called before enabling the GPE. Also, this interface will
automatically disable the GPE if it is currently enabled.
3) AcpiEnableGpe no longer supports a GPE type flag.
Specific drivers that must be changed:
1) EC driver:
AcpiInstallGpeHandler (NULL, GpeNum, ACPI_GPE_EDGE_TRIGGERED,
AeGpeHandler, NULL);
AcpiSetGpeType (NULL, GpeNum, ACPI_GPE_TYPE_RUNTIME);
AcpiEnableGpe (NULL, GpeNum, ACPI_NOT_ISR);
2) Button Drivers (Power, Lid, Sleep):
Run _PRW method under parent device
If _PRW exists: /* This is a control-method button */
Extract GPE number and possibly GpeDevice
AcpiSetGpeType (GpeDevice, GpeNum, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (GpeDevice, GpeNum, ACPI_NOT_ISR);
For all other devices that have _PRWs, we automatically set the
GPE type to ACPI_GPE_TYPE_WAKE, but the GPE is NOT automatically
(wake) enabled. This must be done on a selective basis, usually
requiring some kind of user app to allow the user to pick the
wake devices.
Code and Data Size: Current and previous core subsystem library
sizes are shown below. These are the code and data sizes for the
acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
these values do not include any ACPI driver or OSPM code. The
debug version of the code includes the debug output trace
mechanism and has a much larger code and data size. Note that
these values will vary depending on the efficiency of the
compiler and the compiler options used during generation.
Previous Release:
Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total
Debug Version: 161.0K Code, 66.3K Data, 227.3K Total
Current Release:
Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total
Debug Version: 162.9K Code, 67.0K Data, 229.9K Total
---------------------------------------- ----------------------------------------
02 April 2004. Summary of changes for version 20040402: 02 April 2004. Summary of changes for version 20040402:

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acdebug.h - ACPI/AML debugger * Name: acdebug.h - ACPI/AML debugger
* $Revision: 73 $ * $Revision: 74 $
* *
*****************************************************************************/ *****************************************************************************/
@ -239,6 +239,10 @@ void
AcpiDbSetScope ( AcpiDbSetScope (
char *Name); char *Name);
ACPI_STATUS
AcpiDbSleep (
char *ObjectArg);
void void
AcpiDbFindReferences ( AcpiDbFindReferences (
char *ObjectArg); char *ObjectArg);

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acdispat.h - dispatcher (parser to interpreter interface) * Name: acdispat.h - dispatcher (parser to interpreter interface)
* $Revision: 57 $ * $Revision: 58 $
* *
*****************************************************************************/ *****************************************************************************/
@ -510,8 +510,7 @@ AcpiDsInitAmlWalk (
ACPI_NAMESPACE_NODE *MethodNode, ACPI_NAMESPACE_NODE *MethodNode,
UINT8 *AmlStart, UINT8 *AmlStart,
UINT32 AmlLength, UINT32 AmlLength,
ACPI_OPERAND_OBJECT **Params, ACPI_PARAMETER_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjDesc,
UINT32 PassNumber); UINT32 PassNumber);
ACPI_STATUS ACPI_STATUS

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acefi.h - OS specific defines, etc. * Name: acefi.h - OS specific defines, etc.
* $Revision: 14 $ * $Revision: 15 $
* *
*****************************************************************************/ *****************************************************************************/
@ -117,8 +117,6 @@
#ifndef __ACEFI_H__ #ifndef __ACEFI_H__
#define __ACEFI_H__ #define __ACEFI_H__
#define ACPI_OS_NAME "AED EFI"
#include <efi.h> #include <efi.h>
#include <efistdarg.h> #include <efistdarg.h>
#include <efilib.h> #include <efilib.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acevents.h - Event subcomponent prototypes and defines * Name: acevents.h - Event subcomponent prototypes and defines
* $Revision: 93 $ * $Revision: 95 $
* *
*****************************************************************************/ *****************************************************************************/
@ -119,11 +119,11 @@
ACPI_STATUS ACPI_STATUS
AcpiEvInitialize ( AcpiEvInitializeEvents (
void); void);
ACPI_STATUS ACPI_STATUS
AcpiEvHandlerInitialize ( AcpiEvInstallXruptHandlers (
void); void);
@ -190,6 +190,20 @@ BOOLEAN
AcpiEvValidGpeEvent ( AcpiEvValidGpeEvent (
ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiEvUpdateGpeEnableMasks (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type);
ACPI_STATUS
AcpiEvEnableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
BOOLEAN WriteToHardware);
ACPI_STATUS
AcpiEvDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_GPE_EVENT_INFO * ACPI_GPE_EVENT_INFO *
AcpiEvGetGpeEventInfo ( AcpiEvGetGpeEventInfo (
ACPI_HANDLE GpeDevice, ACPI_HANDLE GpeDevice,
@ -212,6 +226,11 @@ ACPI_STATUS
AcpiEvDeleteGpeBlock ( AcpiEvDeleteGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock); ACPI_GPE_BLOCK_INFO *GpeBlock);
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock);
UINT32 UINT32
AcpiEvGpeDispatch ( AcpiEvGpeDispatch (
ACPI_GPE_EVENT_INFO *GpeEventInfo, ACPI_GPE_EVENT_INFO *GpeEventInfo,
@ -221,12 +240,25 @@ UINT32
AcpiEvGpeDetect ( AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList); ACPI_GPE_XRUPT_INFO *GpeXruptList);
ACPI_STATUS
AcpiEvSetGpeType (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type);
ACPI_STATUS
AcpiEvCheckForWakeOnlyGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
/* /*
* Evregion - Address Space handling * Evregion - Address Space handling
*/ */
ACPI_STATUS ACPI_STATUS
AcpiEvInitAddressSpaces ( AcpiEvInstallRegionHandlers (
void);
ACPI_STATUS
AcpiEvInitializeOpRegions (
void); void);
ACPI_STATUS ACPI_STATUS
@ -255,6 +287,19 @@ AcpiEvDetachRegion (
ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *RegionObj,
BOOLEAN AcpiNsIsLocked); BOOLEAN AcpiNsIsLocked);
ACPI_STATUS
AcpiEvInstallSpaceHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId,
ACPI_ADR_SPACE_HANDLER Handler,
ACPI_ADR_SPACE_SETUP Setup,
void *Context);
ACPI_STATUS
AcpiEvExecuteRegMethods (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId);
ACPI_STATUS ACPI_STATUS
AcpiEvExecuteRegMethod ( AcpiEvExecuteRegMethod (
ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *RegionObj,

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acexcep.h - Exception codes returned by the ACPI subsystem * Name: acexcep.h - Exception codes returned by the ACPI subsystem
* $Revision: 70 $ * $Revision: 71 $
* *
*****************************************************************************/ *****************************************************************************/
@ -168,8 +168,9 @@
#define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) #define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL) #define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL) #define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL)
#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001E | AE_CODE_ENVIRONMENTAL)
#define AE_CODE_ENV_MAX 0x001D #define AE_CODE_ENV_MAX 0x001E
/* /*
* Programmer exceptions * Programmer exceptions
@ -295,7 +296,8 @@ char const *AcpiGbl_ExceptionNames_Env[] =
"AE_NO_GLOBAL_LOCK", "AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS", "AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD", "AE_ABORT_METHOD",
"AE_SAME_HANDLER" "AE_SAME_HANDLER",
"AE_WAKE_ONLY_GPE"
}; };
char const *AcpiGbl_ExceptionNames_Pgm[] = char const *AcpiGbl_ExceptionNames_Pgm[] =

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acglobal.h - Declarations for global variables * Name: acglobal.h - Declarations for global variables
* $Revision: 152 $ * $Revision: 154 $
* *
*****************************************************************************/ *****************************************************************************/
@ -132,7 +132,7 @@
#define ACPI_INIT_GLOBAL(a,b) a #define ACPI_INIT_GLOBAL(a,b) a
#endif #endif
/* /*
* Keep local copies of these FADT-based registers. NOTE: These globals * Keep local copies of these FADT-based registers. NOTE: These globals
* are first in this file for alignment reasons on 64-bit systems. * are first in this file for alignment reasons on 64-bit systems.
*/ */
@ -265,6 +265,7 @@ ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning;
extern BOOLEAN AcpiGbl_Shutdown; extern BOOLEAN AcpiGbl_Shutdown;
extern UINT32 AcpiGbl_StartupFlags; extern UINT32 AcpiGbl_StartupFlags;

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: achware.h -- hardware specific interfaces * Name: achware.h -- hardware specific interfaces
* $Revision: 69 $ * $Revision: 72 $
* *
*****************************************************************************/ *****************************************************************************/
@ -187,15 +187,7 @@ AcpiHwClearAcpiStatus (
/* GPE support */ /* GPE support */
ACPI_STATUS ACPI_STATUS
AcpiHwEnableGpe ( AcpiHwWriteGpeEnableReg (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
void
AcpiHwEnableGpeForWakeup (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiHwDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS ACPI_STATUS
@ -203,10 +195,6 @@ AcpiHwDisableGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock); ACPI_GPE_BLOCK_INFO *GpeBlock);
void
AcpiHwDisableGpeForWakeup (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS ACPI_STATUS
AcpiHwClearGpe ( AcpiHwClearGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_GPE_EVENT_INFO *GpeEventInfo);
@ -222,13 +210,27 @@ AcpiHwGetGpeStatus (
ACPI_EVENT_STATUS *EventStatus); ACPI_EVENT_STATUS *EventStatus);
ACPI_STATUS ACPI_STATUS
AcpiHwPrepareGpesForSleep ( AcpiHwDisableAllGpes (
void); void);
ACPI_STATUS ACPI_STATUS
AcpiHwRestoreGpesOnWake ( AcpiHwEnableAllRuntimeGpes (
void); void);
ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
void);
ACPI_STATUS
AcpiHwEnableRuntimeGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock);
ACPI_STATUS
AcpiHwEnableWakeupGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock);
/* ACPI Timer prototypes */ /* ACPI Timer prototypes */

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: aclocal.h - Internal data types used across the ACPI subsystem * Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 199 $ * $Revision: 201 $
* *
*****************************************************************************/ *****************************************************************************/
@ -264,8 +264,6 @@ typedef struct acpi_namespace_node
UINT8 Type; /* Type associated with this name */ UINT8 Type; /* Type associated with this name */
UINT16 OwnerId; UINT16 OwnerId;
ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */ ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */ union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */
struct acpi_namespace_node *Child; /* First child */ struct acpi_namespace_node *Child; /* First child */
struct acpi_namespace_node *Peer; /* Next peer*/ struct acpi_namespace_node *Peer; /* Next peer*/
@ -287,10 +285,8 @@ typedef struct acpi_namespace_node
#define ANOBJ_METHOD_LOCAL 0x10 #define ANOBJ_METHOD_LOCAL 0x10
#define ANOBJ_METHOD_NO_RETVAL 0x20 #define ANOBJ_METHOD_NO_RETVAL 0x20
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
#define ANOBJ_IS_BIT_OFFSET 0x80 #define ANOBJ_IS_BIT_OFFSET 0x80
/* /*
* ACPI Table Descriptor. One per ACPI table * ACPI Table Descriptor. One per ACPI table
*/ */
@ -392,16 +388,33 @@ typedef struct acpi_create_field_info
* *
****************************************************************************/ ****************************************************************************/
/* Information about a GPE, one per each GPE in an array */ /* Dispatch info for each GPE -- either a method or handler, cannot be both */
typedef struct acpi_gpe_event_info typedef struct acpi_handler_info
{
ACPI_EVENT_HANDLER Address; /* Address of handler, if any */
void *Context; /* Context to be passed to handler */
ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */
} ACPI_HANDLER_INFO;
typedef union acpi_gpe_dispatch_info
{ {
ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
ACPI_GPE_HANDLER Handler; /* Address of handler, if any */ struct acpi_handler_info *Handler;
void *Context; /* Context to be passed to handler */
} ACPI_GPE_DISPATCH_INFO;
/*
* Information about a GPE, one per each GPE in an array.
* NOTE: Important to keep this struct as small as possible.
*/
typedef struct acpi_gpe_event_info
{
union acpi_gpe_dispatch_info Dispatch; /* Either Method or Handler */
struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
UINT8 Flags; /* Level or Edge */ UINT8 Flags; /* Misc info about this GPE */
UINT8 BitMask; /* This GPE within the register */ UINT8 RegisterBit; /* This GPE bit within the register */
} ACPI_GPE_EVENT_INFO; } ACPI_GPE_EVENT_INFO;
@ -411,9 +424,8 @@ typedef struct acpi_gpe_register_info
{ {
ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */
ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */
UINT8 Status; /* Current value of status reg */ UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */
UINT8 Enable; /* Current value of enable reg */ UINT8 EnableForRun; /* GPEs to keep enabled when running */
UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */
UINT8 BaseGpeNumber; /* Base GPE number for this register */ UINT8 BaseGpeNumber; /* Base GPE number for this register */
} ACPI_GPE_REGISTER_INFO; } ACPI_GPE_REGISTER_INFO;
@ -424,6 +436,7 @@ typedef struct acpi_gpe_register_info
*/ */
typedef struct acpi_gpe_block_info typedef struct acpi_gpe_block_info
{ {
ACPI_NAMESPACE_NODE *Node;
struct acpi_gpe_block_info *Previous; struct acpi_gpe_block_info *Previous;
struct acpi_gpe_block_info *Next; struct acpi_gpe_block_info *Next;
struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */ struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
@ -598,7 +611,7 @@ typedef struct acpi_thread_state
struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */ struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */ union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
UINT32 ThreadId; /* Running thread ID */ UINT32 ThreadId; /* Running thread ID */
UINT16 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
} ACPI_THREAD_STATE; } ACPI_THREAD_STATE;

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acmacros.h - C macros for the entire subsystem. * Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 149 $ * $Revision: 150 $
* *
*****************************************************************************/ *****************************************************************************/
@ -170,7 +170,7 @@
* printf() format helpers * printf() format helpers
*/ */
/* Split 64-bit integer into two 32-bit values. Use with %8,8X%8.8X */ /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */
#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acnamesp.h - Namespace subcomponent prototypes and defines * Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 135 $ * $Revision: 136 $
* *
*****************************************************************************/ *****************************************************************************/
@ -351,33 +351,25 @@ AcpiNsDumpObjects (
ACPI_STATUS ACPI_STATUS
AcpiNsEvaluateByHandle ( AcpiNsEvaluateByHandle (
ACPI_NAMESPACE_NODE *PrefixNode, ACPI_PARAMETER_INFO *Info);
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObject);
ACPI_STATUS ACPI_STATUS
AcpiNsEvaluateByName ( AcpiNsEvaluateByName (
char *Pathname, char *Pathname,
ACPI_OPERAND_OBJECT **Params, ACPI_PARAMETER_INFO *Info);
ACPI_OPERAND_OBJECT **ReturnObject);
ACPI_STATUS ACPI_STATUS
AcpiNsEvaluateRelative ( AcpiNsEvaluateRelative (
ACPI_NAMESPACE_NODE *PrefixNode,
char *Pathname, char *Pathname,
ACPI_OPERAND_OBJECT **Params, ACPI_PARAMETER_INFO *Info);
ACPI_OPERAND_OBJECT **ReturnObject);
ACPI_STATUS ACPI_STATUS
AcpiNsExecuteControlMethod ( AcpiNsExecuteControlMethod (
ACPI_NAMESPACE_NODE *MethodNode, ACPI_PARAMETER_INFO *Info);
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObjDesc);
ACPI_STATUS ACPI_STATUS
AcpiNsGetObjectValue ( AcpiNsGetObjectValue (
ACPI_NAMESPACE_NODE *ObjectNode, ACPI_PARAMETER_INFO *Info);
ACPI_OPERAND_OBJECT **ReturnObjDesc);
/* /*

View File

@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
* $Revision: 124 $ * $Revision: 125 $
* *
*****************************************************************************/ *****************************************************************************/
@ -284,13 +284,14 @@ typedef struct acpi_object_method
typedef struct acpi_object_mutex typedef struct acpi_object_mutex
{ {
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_COMMON_HEADER
UINT16 SyncLevel; UINT8 SyncLevel; /* 0-15, specified in Mutex() call */
UINT16 AcquisitionDepth; UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */
struct acpi_thread_state *OwnerThread; struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */
void *Semaphore; void *Semaphore; /* Actual OS synchronization object */
union acpi_operand_object *Prev; /* Link for list of acquired mutexes */ union acpi_operand_object *Prev; /* Link for list of acquired mutexes */
union acpi_operand_object *Next; /* Link for list of acquired mutexes */ union acpi_operand_object *Next; /* Link for list of acquired mutexes */
ACPI_NAMESPACE_NODE *Node; /* containing object */ ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
UINT8 OriginalSyncLevel; /* Owner's original sync level (0-15) */
} ACPI_OBJECT_MUTEX; } ACPI_OBJECT_MUTEX;
@ -301,7 +302,7 @@ typedef struct acpi_object_region
UINT8 SpaceId; UINT8 SpaceId;
union acpi_operand_object *Handler; /* Handler for region access */ union acpi_operand_object *Handler; /* Handler for region access */
ACPI_NAMESPACE_NODE *Node; /* containing object */ ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
union acpi_operand_object *Next; union acpi_operand_object *Next;
UINT32 Length; UINT32 Length;
ACPI_PHYSICAL_ADDRESS Address; ACPI_PHYSICAL_ADDRESS Address;

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
* $Revision: 66 $ * $Revision: 67 $
* *
*****************************************************************************/ *****************************************************************************/
@ -146,9 +146,7 @@ AcpiPsxLoadTable (
ACPI_STATUS ACPI_STATUS
AcpiPsxExecute ( AcpiPsxExecute (
ACPI_NAMESPACE_NODE *MethodNode, ACPI_PARAMETER_INFO *Info);
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObjDesc);
/****************************************************************************** /******************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acstruct.h - Internal structs * Name: acstruct.h - Internal structs
* $Revision: 27 $ * $Revision: 28 $
* *
*****************************************************************************/ *****************************************************************************/
@ -142,13 +142,14 @@
typedef struct acpi_walk_state typedef struct acpi_walk_state
{ {
UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\ UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\
UINT8 WalkType;
ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
BOOLEAN LastPredicate; /* Result of last predicate */ BOOLEAN LastPredicate; /* Result of last predicate */
UINT8 Reserved; /* For alignment */
UINT8 CurrentResult; /* */ UINT8 CurrentResult; /* */
UINT8 NextOpInfo; /* Info about NextOp */ UINT8 NextOpInfo; /* Info about NextOp */
UINT8 NumOperands; /* Stack pointer for Operands[] array */ UINT8 NumOperands; /* Stack pointer for Operands[] array */
UINT8 ReturnUsed; UINT8 ReturnUsed;
UINT8 WalkType;
UINT16 Opcode; /* Current AML opcode */ UINT16 Opcode; /* Current AML opcode */
UINT8 ScopeDepth; UINT8 ScopeDepth;
UINT8 Reserved1; UINT8 Reserved1;
@ -164,7 +165,8 @@ typedef struct acpi_walk_state
struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
union acpi_operand_object **CallerReturnDesc; union acpi_operand_object **CallerReturnDesc;
ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */ struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
struct acpi_gpe_event_info *GpeEventInfo; /* Info for GPE (_Lxx/_Exx methods only */
struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
struct acpi_namespace_node *MethodCallNode; /* Called method Node*/ struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
@ -279,4 +281,22 @@ typedef union acpi_aml_operands
} ACPI_AML_OPERANDS; } ACPI_AML_OPERANDS;
/* Internal method parameter list */
typedef struct acpi_parameter_info
{
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT **Parameters;
ACPI_OPERAND_OBJECT *ReturnObject;
UINT8 ParameterType;
UINT8 ReturnObjectType;
} ACPI_PARAMETER_INFO;
/* Types for ParameterType above */
#define ACPI_PARAM_ARGS 0
#define ACPI_PARAM_GPE 1
#endif #endif

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: actbl.h - Table data structures defined in ACPI specification * Name: actbl.h - Table data structures defined in ACPI specification
* $Revision: 64 $ * $Revision: 66 $
* *
*****************************************************************************/ *****************************************************************************/
@ -375,20 +375,6 @@ typedef struct smart_battery_table
} SMART_BATTERY_TABLE; } SMART_BATTERY_TABLE;
/*
* High performance timer
*/
typedef struct hpet_table
{
ACPI_TABLE_HEADER_DEF
UINT32 HardwareId;
UINT32 BaseAddress [3];
UINT8 HpetNumber;
UINT16 ClockTick;
UINT8 Attributes;
} HPET_TABLE;
#pragma pack() #pragma pack()
@ -433,4 +419,21 @@ typedef struct acpi_table_support
#include "actbl2.h" /* Acpi 2.0 table definitions */ #include "actbl2.h" /* Acpi 2.0 table definitions */
#pragma pack(1)
/*
* High performance timer
*/
typedef struct hpet_table
{
ACPI_TABLE_HEADER_DEF
UINT32 HardwareId;
ACPI_GENERIC_ADDRESS BaseAddress;
UINT8 HpetNumber;
UINT16 ClockTick;
UINT8 Attributes;
} HPET_TABLE;
#pragma pack()
#endif /* __ACTBL_H__ */ #endif /* __ACTBL_H__ */

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: actypes.h - Common data types for the entire ACPI subsystem * Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 266 $ * $Revision: 270 $
* *
*****************************************************************************/ *****************************************************************************/
@ -636,34 +636,56 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_GPE_MAX 0xFF #define ACPI_GPE_MAX 0xFF
#define ACPI_NUM_GPE 256 #define ACPI_NUM_GPE 256
#define ACPI_GPE_ENABLE 0
#define ACPI_GPE_DISABLE 1
/* /*
* GPE info flags - Per GPE * GPE info flags - Per GPE
* +---------+-+-+-+ * +-+-+-+---+---+-+
* |Bits 8:3 |2|1|0| * |7|6|5|4:3|2:1|0|
* +---------+-+-+-+ * +-+-+-+---+---+-+
* | | | | * | | | | | |
* | | | +- Edge or Level Triggered * | | | | | +--- Interrupt type: Edge or Level Triggered
* | | +--- Type: Wake or Runtime * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
* | +----- Enabled for wake? * | | | +--- Type of dispatch -- to method, handler, or none
* +--------<Reserved> * | | +--- Enabled for runtime?
* | +--- Enabled for wake?
* +--- System state when GPE ocurred (running/waking)
*/ */
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 1 #define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01
#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 1 #define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01
#define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00
#define ACPI_GPE_TYPE_MASK (UINT8) 2 #define ACPI_GPE_TYPE_MASK (UINT8) 0x06
#define ACPI_GPE_TYPE_WAKE (UINT8) 2 #define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x06
#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0 /* Default */ #define ACPI_GPE_TYPE_WAKE (UINT8) 0x02
#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x04 /* Default */
#define ACPI_GPE_ENABLE_MASK (UINT8) 4 #define ACPI_GPE_DISPATCH_MASK (UINT8) 0x18
#define ACPI_GPE_ENABLED (UINT8) 4 #define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x08
#define ACPI_GPE_DISABLED (UINT8) 0 /* Default */ #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x10
#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* Default */
#define ACPI_GPE_RUN_ENABLE_MASK (UINT8) 0x20
#define ACPI_GPE_RUN_ENABLED (UINT8) 0x20
#define ACPI_GPE_RUN_DISABLED (UINT8) 0x00 /* Default */
#define ACPI_GPE_WAKE_ENABLE_MASK (UINT8) 0x40
#define ACPI_GPE_WAKE_ENABLED (UINT8) 0x40
#define ACPI_GPE_WAKE_DISABLED (UINT8) 0x00 /* Default */
#define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */
#define ACPI_GPE_SYSTEM_MASK (UINT8) 0x80
#define ACPI_GPE_SYSTEM_RUNNING (UINT8) 0x80
#define ACPI_GPE_SYSTEM_WAKING (UINT8) 0x00
/* /*
* Flags for GPE and Lock interfaces * Flags for GPE and Lock interfaces
*/ */
#define ACPI_EVENT_WAKE_ENABLE 0x2 #define ACPI_EVENT_WAKE_ENABLE 0x2 /* AcpiGpeEnable */
#define ACPI_EVENT_WAKE_DISABLE 0x2 #define ACPI_EVENT_WAKE_DISABLE 0x2 /* AcpiGpeDisable */
#define ACPI_NOT_ISR 0x1 #define ACPI_NOT_ISR 0x1
#define ACPI_ISR 0x0 #define ACPI_ISR 0x0
@ -671,9 +693,10 @@ typedef UINT32 ACPI_EVENT_STATUS;
/* Notify types */ /* Notify types */
#define ACPI_SYSTEM_NOTIFY 0 #define ACPI_SYSTEM_NOTIFY 0x1
#define ACPI_DEVICE_NOTIFY 1 #define ACPI_DEVICE_NOTIFY 0x2
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 1 #define ACPI_ALL_NOTIFY 0x3
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
#define ACPI_MAX_SYS_NOTIFY 0x7f #define ACPI_MAX_SYS_NOTIFY 0x7f
@ -873,10 +896,6 @@ typedef
UINT32 (*ACPI_EVENT_HANDLER) ( UINT32 (*ACPI_EVENT_HANDLER) (
void *Context); void *Context);
typedef
void (*ACPI_GPE_HANDLER) (
void *Context);
typedef typedef
void (*ACPI_NOTIFY_HANDLER) ( void (*ACPI_NOTIFY_HANDLER) (
ACPI_HANDLE Device, ACPI_HANDLE Device,
@ -967,6 +986,7 @@ typedef struct acpi_compatible_id_list
#define ACPI_VALID_HID 0x0004 #define ACPI_VALID_HID 0x0004
#define ACPI_VALID_UID 0x0008 #define ACPI_VALID_UID 0x0008
#define ACPI_VALID_CID 0x0010 #define ACPI_VALID_CID 0x0010
#define ACPI_VALID_SXDS 0x0020
#define ACPI_COMMON_OBJ_INFO \ #define ACPI_COMMON_OBJ_INFO \
@ -987,12 +1007,12 @@ typedef struct acpi_device_info
{ {
ACPI_COMMON_OBJ_INFO; ACPI_COMMON_OBJ_INFO;
UINT8 HighestDstates[4]; /* _SxD values 0xFF indicates not valid */
UINT32 Valid; /* Indicates which fields below are valid */ UINT32 Valid; /* Indicates which fields below are valid */
UINT32 CurrentStatus; /* _STA value */ UINT32 CurrentStatus; /* _STA value */
ACPI_INTEGER Address; /* _ADR value if any */ ACPI_INTEGER Address; /* _ADR value if any */
ACPI_DEVICE_ID HardwareId; /* _HID value if any */ ACPI_DEVICE_ID HardwareId; /* _HID value if any */
ACPI_DEVICE_ID UniqueId; /* _UID value if any */ ACPI_DEVICE_ID UniqueId; /* _UID value if any */
UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */ ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
} ACPI_DEVICE_INFO; } ACPI_DEVICE_INFO;

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: adisasm - Application-level disassembler routines * Module Name: adisasm - Application-level disassembler routines
* $Revision: 65 $ * $Revision: 67 $
* *
*****************************************************************************/ *****************************************************************************/
@ -548,9 +548,9 @@ AdAmlDisassemble (
} }
/* /*
* TBD: We want to cross reference the namespace here, in order to * TBD: We want to cross reference the namespace here, in order to
* generate External() statements. The problem is that the parse * generate External() statements. The problem is that the parse
* tree is in run-time (interpreter) format, not compiler format, * tree is in run-time (interpreter) format, not compiler format,
* so we cannot directly use the function below: * so we cannot directly use the function below:
* *
* Status = LkCrossReferenceNamespace (); * Status = LkCrossReferenceNamespace ();
@ -709,7 +709,7 @@ AdDeferredParse (
} }
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml, Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
AmlLength, NULL, NULL, 1); AmlLength, NULL, 1);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
@ -1026,7 +1026,7 @@ AdParseTable (
} }
Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot, Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot,
NULL, AmlStart, AmlLength, NULL, NULL, 1); NULL, AmlStart, AmlLength, NULL, 1);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return (Status); return (Status);

View File

@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: aslstubs - Stubs used to link to Aml interpreter * Module Name: aslstubs - Stubs used to link to Aml interpreter
* $Revision: 12 $ * $Revision: 13 $
* *
*****************************************************************************/ *****************************************************************************/
@ -211,6 +211,13 @@ AcpiEvInitializeRegion (
return (AE_OK); return (AE_OK);
} }
ACPI_STATUS
AcpiEvCheckForWakeOnlyGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
return (AE_OK);
}
ACPI_STATUS ACPI_STATUS
AcpiExReadDataFromField ( AcpiExReadDataFromField (
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbdisply - debug display commands * Module Name: dbdisply - debug display commands
* $Revision: 101 $ * $Revision: 105 $
* *
******************************************************************************/ ******************************************************************************/
@ -783,26 +783,150 @@ AcpiDbDisplayGpes (void)
{ {
ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo; ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
UINT32 i = 0; ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 GpeIndex;
UINT32 Block = 0;
UINT32 i;
UINT32 j;
char Buffer[80];
ACPI_BUFFER RetBuf;
ACPI_STATUS Status;
RetBuf.Length = sizeof (Buffer);
RetBuf.Pointer = Buffer;
Block = 0;
/* Walk the GPE lists */
GpeXruptInfo = AcpiGbl_GpeXruptListHead; GpeXruptInfo = AcpiGbl_GpeXruptListHead;
while (GpeXruptInfo) while (GpeXruptInfo)
{ {
GpeBlock = GpeXruptInfo->GpeBlockListHead; GpeBlock = GpeXruptInfo->GpeBlockListHead;
while (GpeBlock) while (GpeBlock)
{ {
AcpiOsPrintf ("Block %d - %p\n", i, GpeBlock); Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
AcpiOsPrintf (" Registers: %d\n", GpeBlock->RegisterCount); if (ACPI_FAILURE (Status))
AcpiOsPrintf (" GPE range: %d to %d\n", GpeBlock->BlockBaseNumber, {
GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8) -1); AcpiOsPrintf ("Could not convert name to pathname\n");
AcpiOsPrintf (" RegisterInfo: %p\n", GpeBlock->RegisterInfo); }
AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
i++;
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
Block, GpeBlock, GpeBlock->Node, Buffer);
AcpiOsPrintf (" Registers: %u (%u GPEs) \n",
GpeBlock->RegisterCount,
ACPI_MUL_8 (GpeBlock->RegisterCount));
AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n",
GpeBlock->BlockBaseNumber,
GpeBlock->BlockBaseNumber +
(GpeBlock->RegisterCount * 8) -1);
AcpiOsPrintf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
GpeBlock->RegisterInfo,
ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address),
ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address));
AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
/* Examine each GPE Register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
AcpiOsPrintf (
" Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
i, GpeRegisterInfo->EnableForWake,
GpeRegisterInfo->EnableForRun,
ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
{
/* This GPE is not used (no method or handler) */
continue;
}
AcpiOsPrintf (
" GPE %.3X: %p Bit %2.2X Flags %2.2X: ",
GpeBlock->BlockBaseNumber + GpeIndex,
GpeEventInfo, GpeEventInfo->RegisterBit,
GpeEventInfo->Flags);
if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
{
AcpiOsPrintf ("Level, ");
}
else
{
AcpiOsPrintf ("Edge, ");
}
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
AcpiOsPrintf ("WakeOnly: ");
break;
case ACPI_GPE_TYPE_RUNTIME:
AcpiOsPrintf (" RunOnly: ");
break;
case ACPI_GPE_TYPE_WAKE_RUN:
AcpiOsPrintf (" WakeRun: ");
break;
default:
AcpiOsPrintf (" NotUsed: ");
break;
}
if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED)
{
AcpiOsPrintf ("[Wake 1 ");
}
else
{
AcpiOsPrintf ("[Wake 0 ");
}
if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED)
{
AcpiOsPrintf ("Run 1], ");
}
else
{
AcpiOsPrintf ("Run 0], ");
}
switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
{
case ACPI_GPE_DISPATCH_NOT_USED:
AcpiOsPrintf ("NotUsed");
break;
case ACPI_GPE_DISPATCH_HANDLER:
AcpiOsPrintf ("Handler");
break;
case ACPI_GPE_DISPATCH_METHOD:
AcpiOsPrintf ("Method");
break;
default:
AcpiOsPrintf ("UNKNOWN: %X",
GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK);
break;
}
AcpiOsPrintf ("\n");
}
}
Block++;
GpeBlock = GpeBlock->Next; GpeBlock = GpeBlock->Next;
} }
GpeXruptInfo = GpeXruptInfo->Next; GpeXruptInfo = GpeXruptInfo->Next;
} }
} }

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbinput - user front-end to the AML debugger * Module Name: dbinput - user front-end to the AML debugger
* $Revision: 98 $ * $Revision: 100 $
* *
******************************************************************************/ ******************************************************************************/
@ -175,6 +175,7 @@ enum AcpiExDebuggerCommands
CMD_RESOURCES, CMD_RESOURCES,
CMD_RESULTS, CMD_RESULTS,
CMD_SET, CMD_SET,
CMD_SLEEP,
CMD_STATS, CMD_STATS,
CMD_STOP, CMD_STOP,
CMD_TABLES, CMD_TABLES,
@ -233,6 +234,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"RESOURCES", 1}, {"RESOURCES", 1},
{"RESULTS", 0}, {"RESULTS", 0},
{"SET", 3}, {"SET", 3},
{"SLEEP", 1},
{"STATS", 0}, {"STATS", 0},
{"STOP", 0}, {"STOP", 0},
{"TABLES", 0}, {"TABLES", 0},
@ -621,7 +623,7 @@ AcpiDbCommandDispatch (
break; break;
case CMD_FIND: case CMD_FIND:
AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
break; break;
case CMD_GO: case CMD_GO:
@ -730,7 +732,7 @@ AcpiDbCommandDispatch (
break; break;
case CMD_METHODS: case CMD_METHODS:
AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
break; break;
case CMD_NAMESPACE: case CMD_NAMESPACE:
@ -744,7 +746,7 @@ AcpiDbCommandDispatch (
case CMD_OBJECT: case CMD_OBJECT:
ACPI_STRUPR (AcpiGbl_DbArgs[1]); ACPI_STRUPR (AcpiGbl_DbArgs[1]);
AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break; break;
case CMD_OPEN: case CMD_OPEN:
@ -775,8 +777,12 @@ AcpiDbCommandDispatch (
AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
break; break;
case CMD_SLEEP:
Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
break;
case CMD_STATS: case CMD_STATS:
AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
break; break;
case CMD_STOP: case CMD_STOP:

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dmwalk - AML disassembly tree walk * Module Name: dmwalk - AML disassembly tree walk
* $Revision: 12 $ * $Revision: 13 $
* *
******************************************************************************/ ******************************************************************************/
@ -474,7 +474,7 @@ AcpiDmDescendingOp (
NextExternal = AcpiGbl_ExternalList->Next; NextExternal = AcpiGbl_ExternalList->Next;
ACPI_MEM_FREE (AcpiGbl_ExternalList->Path); ACPI_MEM_FREE (AcpiGbl_ExternalList->Path);
ACPI_MEM_FREE (AcpiGbl_ExternalList); ACPI_MEM_FREE (AcpiGbl_ExternalList);
AcpiGbl_ExternalList = NextExternal; AcpiGbl_ExternalList = NextExternal;
} }
AcpiOsPrintf ("\n"); AcpiOsPrintf ("\n");
} }

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 94 $ * $Revision: 97 $
* *
*****************************************************************************/ *****************************************************************************/
@ -225,8 +225,9 @@ AcpiDsParseMethod (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
ObjDesc->Method.AmlLength, NULL, NULL, 1); ObjDesc->Method.AmlStart,
ObjDesc->Method.AmlLength, NULL, 1);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
AcpiDsDeleteWalkState (WalkState); AcpiDsDeleteWalkState (WalkState);
@ -353,8 +354,9 @@ AcpiDsCallControlMethod (
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *MethodNode; ACPI_NAMESPACE_NODE *MethodNode;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_WALK_STATE *NextWalkState; ACPI_WALK_STATE *NextWalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARAMETER_INFO Info;
UINT32 i; UINT32 i;
@ -400,7 +402,6 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* Create and init a Root Node */ /* Create and init a Root Node */
Op = AcpiPsCreateScopeOp (); Op = AcpiPsCreateScopeOp ();
@ -412,7 +413,7 @@ AcpiDsCallControlMethod (
Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode, Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode,
ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
NULL, NULL, 1); NULL, 1);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
AcpiDsDeleteWalkState (NextWalkState); AcpiDsDeleteWalkState (NextWalkState);
@ -442,9 +443,12 @@ AcpiDsCallControlMethod (
*/ */
ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL; ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
Info.Parameters = &ThisWalkState->Operands[0];
Info.ParameterType = ACPI_PARAM_ARGS;
Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
&ThisWalkState->Operands[0], NULL, 3); &Info, 3);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
@ -479,7 +483,7 @@ AcpiDsCallControlMethod (
/* On error, we must delete the new walk state */ /* On error, we must delete the new walk state */
Cleanup: Cleanup:
if (NextWalkState->MethodDesc) if (NextWalkState && (NextWalkState->MethodDesc))
{ {
/* Decrement the thread count on the method parse tree */ /* Decrement the thread count on the method parse tree */

View File

@ -2,7 +2,7 @@
* *
* Module Name: dsopcode - Dispatcher Op Region support and handling of * Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes * "control" opcodes
* $Revision: 93 $ * $Revision: 94 $
* *
*****************************************************************************/ *****************************************************************************/
@ -181,7 +181,7 @@ AcpiDsExecuteArguments (
} }
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
AmlLength, NULL, NULL, 1); AmlLength, NULL, 1);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
AcpiDsDeleteWalkState (WalkState); AcpiDsDeleteWalkState (WalkState);
@ -230,7 +230,7 @@ AcpiDsExecuteArguments (
/* Execute the opcode and arguments */ /* Execute the opcode and arguments */
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
AmlLength, NULL, NULL, 3); AmlLength, NULL, 3);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
AcpiDsDeleteWalkState (WalkState); AcpiDsDeleteWalkState (WalkState);

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswstate - Dispatcher parse tree walk management routines * Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 78 $ * $Revision: 80 $
* *
*****************************************************************************/ *****************************************************************************/
@ -1017,8 +1017,7 @@ AcpiDsInitAmlWalk (
ACPI_NAMESPACE_NODE *MethodNode, ACPI_NAMESPACE_NODE *MethodNode,
UINT8 *AmlStart, UINT8 *AmlStart,
UINT32 AmlLength, UINT32 AmlLength,
ACPI_OPERAND_OBJECT **Params, ACPI_PARAMETER_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjDesc,
UINT32 PassNumber) UINT32 PassNumber)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
@ -1037,8 +1036,20 @@ AcpiDsInitAmlWalk (
/* The NextOp of the NextWalk will be the beginning of the method */ /* The NextOp of the NextWalk will be the beginning of the method */
WalkState->NextOp = NULL; WalkState->NextOp = NULL;
WalkState->Params = Params;
WalkState->CallerReturnDesc = ReturnObjDesc; if (Info)
{
if (Info->ParameterType == ACPI_PARAM_GPE)
{
WalkState->GpeEventInfo = ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO,
Info->Parameters);
}
else
{
WalkState->Params = Info->Parameters;
WalkState->CallerReturnDesc = &Info->ReturnObject;
}
}
Status = AcpiPsInitScope (&WalkState->ParserState, Op); Status = AcpiPsInitScope (&WalkState->ParserState, Op);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -1063,7 +1074,7 @@ AcpiDsInitAmlWalk (
/* Init the method arguments */ /* Init the method arguments */
Status = AcpiDsMethodDataInitArgs (Params, ACPI_METHOD_NUM_ARGS, WalkState); Status = AcpiDsMethodDataInitArgs (WalkState->Params, ACPI_METHOD_NUM_ARGS, WalkState);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evevent - Fixed Event handling and dispatch * Module Name: evevent - Fixed Event handling and dispatch
* $Revision: 112 $ * $Revision: 113 $
* *
*****************************************************************************/ *****************************************************************************/
@ -123,7 +123,7 @@
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvInitialize * FUNCTION: AcpiEvInitializeEvents
* *
* PARAMETERS: None * PARAMETERS: None
* *
@ -134,13 +134,13 @@
******************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiEvInitialize ( AcpiEvInitializeEvents (
void) void)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvInitialize"); ACPI_FUNCTION_TRACE ("EvInitializeEvents");
/* Make sure we have ACPI tables */ /* Make sure we have ACPI tables */
@ -180,7 +180,7 @@ AcpiEvInitialize (
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvHandlerInitialize * FUNCTION: AcpiEvInstallXruptHandlers
* *
* PARAMETERS: None * PARAMETERS: None
* *
@ -191,13 +191,13 @@ AcpiEvInitialize (
******************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiEvHandlerInitialize ( AcpiEvInstallXruptHandlers (
void) void)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvHandlerInitialize"); ACPI_FUNCTION_TRACE ("EvInstallXruptHandlers");
/* Install the SCI handler */ /* Install the SCI handler */

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evgpe - General Purpose Event handling and dispatch * Module Name: evgpe - General Purpose Event handling and dispatch
* $Revision: 35 $ * $Revision: 40 $
* *
*****************************************************************************/ *****************************************************************************/
@ -122,6 +122,258 @@
ACPI_MODULE_NAME ("evgpe") ACPI_MODULE_NAME ("evgpe")
/*******************************************************************************
*
* FUNCTION: AcpiEvSetGpeType
*
* PARAMETERS: GpeEventInfo - GPE to set
* Type - New type
*
* RETURN: Status
*
* DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
*
******************************************************************************/
ACPI_STATUS
AcpiEvSetGpeType (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvSetGpeType");
/* Validate type and update register enable masks */
switch (Type)
{
case ACPI_GPE_TYPE_WAKE:
case ACPI_GPE_TYPE_RUNTIME:
case ACPI_GPE_TYPE_WAKE_RUN:
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Disable the GPE if currently enabled */
Status = AcpiEvDisableGpe (GpeEventInfo);
/* Type was validated above */
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
GpeEventInfo->Flags |= Type; /* Insert type */
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvUpdateGpeEnableMasks
*
* PARAMETERS: GpeEventInfo - GPE to update
*
* RETURN: Status
*
* DESCRIPTION: Updates GPE register enable masks based on the GPE type
*
******************************************************************************/
ACPI_STATUS
AcpiEvUpdateGpeEnableMasks (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT8 RegisterBit;
ACPI_FUNCTION_TRACE ("EvUpdateGpeEnableMasks");
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
RegisterBit = GpeEventInfo->RegisterBit;
/* 1) Disable case. Simply clear all enable bits */
if (Type == ACPI_GPE_DISABLE)
{
GpeRegisterInfo->EnableForWake &= ~RegisterBit;
GpeRegisterInfo->EnableForRun &= ~RegisterBit;
return_ACPI_STATUS (AE_OK);
}
/* 2) Enable case. Set the appropriate enable bits */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
GpeRegisterInfo->EnableForWake |= RegisterBit;
GpeRegisterInfo->EnableForRun &= ~RegisterBit;
break;
case ACPI_GPE_TYPE_RUNTIME:
GpeRegisterInfo->EnableForWake &= ~RegisterBit;
GpeRegisterInfo->EnableForRun |= RegisterBit;
break;
case ACPI_GPE_TYPE_WAKE_RUN:
GpeRegisterInfo->EnableForWake |= RegisterBit;
GpeRegisterInfo->EnableForRun |= RegisterBit;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvEnableGpe
*
* PARAMETERS: GpeEventInfo - GPE to enable
*
* RETURN: Status
*
* DESCRIPTION: Enable a GPE based on the GPE type
*
******************************************************************************/
ACPI_STATUS
AcpiEvEnableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
BOOLEAN WriteToHardware)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvEnableGpe");
/* Make sure HW enable masks are updated */
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_ENABLE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Mark wake-enabled or HW enable, or both */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED;
break;
case ACPI_GPE_TYPE_WAKE_RUN:
GpeEventInfo->Flags |= ACPI_GPE_WAKE_ENABLED;
/*lint -fallthrough */
case ACPI_GPE_TYPE_RUNTIME:
GpeEventInfo->Flags |= ACPI_GPE_RUN_ENABLED;
if (WriteToHardware)
{
/* Clear the GPE (of stale events), then enable it */
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Enable the requested runtime GPE */
Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
}
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDisableGpe
*
* PARAMETERS: GpeEventInfo - GPE to disable
*
* RETURN: Status
*
* DESCRIPTION: Disable a GPE based on the GPE type
*
******************************************************************************/
ACPI_STATUS
AcpiEvDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvDisableGpe");
if (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK))
{
return_ACPI_STATUS (AE_OK);
}
/* Make sure HW enable masks are updated */
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Mark wake-disabled or HW disable, or both */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED;
break;
case ACPI_GPE_TYPE_WAKE_RUN:
GpeEventInfo->Flags &= ~ACPI_GPE_WAKE_ENABLED;
/*lint -fallthrough */
case ACPI_GPE_TYPE_RUNTIME:
/* Disable the requested runtime GPE */
GpeEventInfo->Flags &= ~ACPI_GPE_RUN_ENABLED;
Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvGetGpeEventInfo * FUNCTION: AcpiEvGetGpeEventInfo
@ -218,11 +470,12 @@ AcpiEvGpeDetect (
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
UINT8 EnabledStatusByte; UINT8 EnabledStatusByte;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 InValue; UINT32 StatusReg;
UINT32 EnableReg;
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_BLOCK_INFO *GpeBlock;
UINT32 i; ACPI_NATIVE_UINT i;
UINT32 j; ACPI_NATIVE_UINT j;
ACPI_FUNCTION_NAME ("EvGpeDetect"); ACPI_FUNCTION_NAME ("EvGpeDetect");
@ -253,9 +506,8 @@ AcpiEvGpeDetect (
/* Read the Status Register */ /* Read the Status Register */
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &InValue, Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &StatusReg,
&GpeRegisterInfo->StatusAddress); &GpeRegisterInfo->StatusAddress);
GpeRegisterInfo->Status = (UINT8) InValue;
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto UnlockAndExit; goto UnlockAndExit;
@ -263,9 +515,8 @@ AcpiEvGpeDetect (
/* Read the Enable Register */ /* Read the Enable Register */
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &InValue, Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableReg,
&GpeRegisterInfo->EnableAddress); &GpeRegisterInfo->EnableAddress);
GpeRegisterInfo->Enable = (UINT8) InValue;
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto UnlockAndExit; goto UnlockAndExit;
@ -273,15 +524,16 @@ AcpiEvGpeDetect (
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n", "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n",
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
GpeRegisterInfo->Status, GpeRegisterInfo->StatusAddress.Address)),
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), StatusReg,
GpeRegisterInfo->Enable)); ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
GpeRegisterInfo->EnableAddress.Address)),
EnableReg));
/* First check if there is anything active at all in this register */ /* First check if there is anything active at all in this register */
EnabledStatusByte = (UINT8) (GpeRegisterInfo->Status & EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
GpeRegisterInfo->Enable);
if (!EnabledStatusByte) if (!EnabledStatusByte)
{ {
/* No active GPEs in this register, move on */ /* No active GPEs in this register, move on */
@ -303,7 +555,7 @@ AcpiEvGpeDetect (
*/ */
IntStatus |= AcpiEvGpeDispatch ( IntStatus |= AcpiEvGpeDispatch (
&GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j], &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j],
j + GpeRegisterInfo->BaseGpeNumber); (UINT32) j + GpeRegisterInfo->BaseGpeNumber);
} }
} }
} }
@ -342,6 +594,7 @@ AcpiEvAsynchExecuteGpeMethod (
UINT32 GpeNumber = 0; UINT32 GpeNumber = 0;
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO LocalGpeEventInfo; ACPI_GPE_EVENT_INFO LocalGpeEventInfo;
ACPI_PARAMETER_INFO Info;
ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod"); ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
@ -361,6 +614,10 @@ AcpiEvAsynchExecuteGpeMethod (
return_VOID; return_VOID;
} }
/* Set the GPE flags for return to enabled state */
(void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
/* /*
* Take a snapshot of the GPE info for this level - we copy the * Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with RemoveHandler/RemoveBlock. * info to prevent a race condition with RemoveHandler/RemoveBlock.
@ -373,26 +630,36 @@ AcpiEvAsynchExecuteGpeMethod (
return_VOID; return_VOID;
} }
if (LocalGpeEventInfo.MethodNode) /*
* Must check for control method type dispatch one more
* time to avoid race with EvGpeInstallHandler
*/
if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD)
{ {
/* /*
* Invoke the GPE Method (_Lxx, _Exx): * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.) * control method that corresponds to this GPE
*/ */
Status = AcpiNsEvaluateByHandle (LocalGpeEventInfo.MethodNode, NULL, NULL); Info.Node = LocalGpeEventInfo.Dispatch.MethodNode;
Info.Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo);
Info.ParameterType = ACPI_PARAM_GPE;
Status = AcpiNsEvaluateByHandle (&Info);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2X]\n", ACPI_REPORT_ERROR ((
"%s while evaluating method [%4.4s] for GPE[%2X]\n",
AcpiFormatException (Status), AcpiFormatException (Status),
AcpiUtGetNodeName (LocalGpeEventInfo.MethodNode), GpeNumber)); AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode),
GpeNumber));
} }
} }
if ((LocalGpeEventInfo.Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) if ((LocalGpeEventInfo.Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED)
{ {
/* /*
* GPE is level-triggered, we clear the GPE status bit after handling * GPE is level-triggered, we clear the GPE status bit after
* the event. * handling the event.
*/ */
Status = AcpiHwClearGpe (&LocalGpeEventInfo); Status = AcpiHwClearGpe (&LocalGpeEventInfo);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -403,7 +670,7 @@ AcpiEvAsynchExecuteGpeMethod (
/* Enable this GPE */ /* Enable this GPE */
(void) AcpiHwEnableGpe (&LocalGpeEventInfo); (void) AcpiHwWriteGpeEnableReg (&LocalGpeEventInfo);
return_VOID; return_VOID;
} }
@ -450,6 +717,17 @@ AcpiEvGpeDispatch (
} }
} }
/* Save current system state */
if (AcpiGbl_SystemAwakeAndRunning)
{
GpeEventInfo->Flags |= ACPI_GPE_SYSTEM_RUNNING;
}
else
{
GpeEventInfo->Flags &= ~ACPI_GPE_SYSTEM_RUNNING;
}
/* /*
* Dispatch the GPE to either an installed handler, or the control * Dispatch the GPE to either an installed handler, or the control
* method associated with this GPE (_Lxx or _Exx). * method associated with this GPE (_Lxx or _Exx).
@ -457,11 +735,14 @@ AcpiEvGpeDispatch (
* If there is neither a handler nor a method, we disable the level to * If there is neither a handler nor a method, we disable the level to
* prevent further events from coming in here. * prevent further events from coming in here.
*/ */
if (GpeEventInfo->Handler) switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
{ {
case ACPI_GPE_DISPATCH_HANDLER:
/* Invoke the installed handler (at interrupt level) */ /* Invoke the installed handler (at interrupt level) */
GpeEventInfo->Handler (GpeEventInfo->Context); GpeEventInfo->Dispatch.Handler->Address ((void *)
GpeEventInfo->Dispatch.Handler->Context);
/* It is now safe to clear level-triggered events. */ /* It is now safe to clear level-triggered events. */
@ -476,14 +757,15 @@ AcpiEvGpeDispatch (
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
} break;
else if (GpeEventInfo->MethodNode)
{ case ACPI_GPE_DISPATCH_METHOD:
/* /*
* Disable GPE, so it doesn't keep firing before the method has a * Disable GPE, so it doesn't keep firing before the method has a
* chance to run. * chance to run.
*/ */
Status = AcpiHwDisableGpe (GpeEventInfo); Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
@ -504,9 +786,10 @@ AcpiEvGpeDispatch (
"AcpiEvGpeDispatch: Unable to queue handler for GPE[%2X], event is disabled\n", "AcpiEvGpeDispatch: Unable to queue handler for GPE[%2X], event is disabled\n",
GpeNumber)); GpeNumber));
} }
} break;
else
{ default:
/* No handler or method to run! */ /* No handler or method to run! */
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
@ -517,7 +800,7 @@ AcpiEvGpeDispatch (
* Disable the GPE. The GPE will remain disabled until the ACPI * Disable the GPE. The GPE will remain disabled until the ACPI
* Core Subsystem is restarted, or a handler is installed. * Core Subsystem is restarted, or a handler is installed.
*/ */
Status = AcpiHwDisableGpe (GpeEventInfo); Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
@ -525,8 +808,62 @@ AcpiEvGpeDispatch (
GpeNumber)); GpeNumber));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
break;
} }
return_VALUE (ACPI_INTERRUPT_HANDLED); return_VALUE (ACPI_INTERRUPT_HANDLED);
} }
#ifdef ACPI_GPE_NOTIFY_CHECK
/*******************************************************************************
* NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
*
* FUNCTION: AcpiEvCheckForWakeOnlyGpe
*
* PARAMETERS: GpeEventInfo - info for this GPE
*
* RETURN: Status
*
* DESCRIPTION: Determine if a a GPE is "wake-only".
*
* Called from Notify() code in interpreter when a "DeviceWake"
* Notify comes in.
*
******************************************************************************/
ACPI_STATUS
AcpiEvCheckForWakeOnlyGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvCheckForWakeOnlyGpe");
if ((GpeEventInfo) && /* Only >0 for _Lxx/_Exx */
((GpeEventInfo->Flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */
{
/* This must be a wake-only GPE, disable it */
Status = AcpiEvDisableGpe (GpeEventInfo);
/* Set GPE to wake-only. Do not change wake disabled/enabled status */
AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
GpeEventInfo));
/* This was a wake-only GPE */
return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
}
return_ACPI_STATUS (AE_OK);
}
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evgpeblk - GPE block creation and initialization. * Module Name: evgpeblk - GPE block creation and initialization.
* $Revision: 29 $ * $Revision: 34 $
* *
*****************************************************************************/ *****************************************************************************/
@ -126,7 +126,7 @@
* *
* FUNCTION: AcpiEvValidGpeEvent * FUNCTION: AcpiEvValidGpeEvent
* *
* PARAMETERS: GpeEventInfo - Info for this GPE * PARAMETERS: GpeEventInfo - Info for this GPE
* *
* RETURN: TRUE if the GpeEvent is valid * RETURN: TRUE if the GpeEvent is valid
* *
@ -233,6 +233,56 @@ AcpiEvWalkGpeList (
} }
/******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeHandlers
*
* PARAMETERS: GpeXruptInfo - GPE Interrupt info
* GpeBlock - Gpe Block info
*
* RETURN: Status
*
* DESCRIPTION: Delete all Handler objects found in the GPE data structs.
* Used only prior to termination.
*
******************************************************************************/
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
ACPI_FUNCTION_TRACE ("EvDeleteGpeHandlers");
/* Examine each GPE Register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER)
{
ACPI_MEM_FREE (GpeEventInfo->Dispatch.Handler);
GpeEventInfo->Dispatch.Handler = NULL;
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
}
}
}
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvSaveMethodInfo * FUNCTION: AcpiEvSaveMethodInfo
@ -267,12 +317,13 @@ AcpiEvSaveMethodInfo (
UINT32 GpeNumber; UINT32 GpeNumber;
char Name[ACPI_NAME_SIZE + 1]; char Name[ACPI_NAME_SIZE + 1];
UINT8 Type; UINT8 Type;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvSaveMethodInfo"); ACPI_FUNCTION_TRACE ("EvSaveMethodInfo");
/* /*
* _Lxx and _Exx GPE method support * _Lxx and _Exx GPE method support
* *
* 1) Extract the name from the object and convert to a string * 1) Extract the name from the object and convert to a string
@ -285,17 +336,17 @@ AcpiEvSaveMethodInfo (
* 2) Edge/Level determination is based on the 2nd character * 2) Edge/Level determination is based on the 2nd character
* of the method name * of the method name
* *
* NOTE: Default GPE type is RUNTIME. May be changed later to WAKE if a * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
* _PRW object is found that points to this GPE. * if a _PRW object is found that points to this GPE.
*/ */
switch (Name[1]) switch (Name[1])
{ {
case 'L': case 'L':
Type = ACPI_GPE_LEVEL_TRIGGERED | ACPI_GPE_TYPE_RUNTIME; Type = ACPI_GPE_LEVEL_TRIGGERED;
break; break;
case 'E': case 'E':
Type = ACPI_GPE_EDGE_TRIGGERED | ACPI_GPE_TYPE_RUNTIME; Type = ACPI_GPE_EDGE_TRIGGERED;
break; break;
default: default:
@ -335,23 +386,30 @@ AcpiEvSaveMethodInfo (
/* /*
* Now we can add this information to the GpeEventInfo block * Now we can add this information to the GpeEventInfo block
* for use during dispatch of this GPE. * for use during dispatch of this GPE. Default type is RUNTIME, although
* this may change when the _PRW methods are executed later.
*/ */
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]; GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
GpeEventInfo->Flags = Type; GpeEventInfo->Flags = (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD |
GpeEventInfo->MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_GPE_TYPE_RUNTIME);
GpeEventInfo->Dispatch.MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
/* Update enable mask, but don't enable the HW GPE as of yet */
Status = AcpiEvEnableGpe (GpeEventInfo, FALSE);
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Registered GPE method %s as GPE number 0x%.2X\n", "Registered GPE method %s as GPE number 0x%.2X\n",
Name, GpeNumber)); Name, GpeNumber));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (Status);
} }
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvGetGpeType * FUNCTION: AcpiEvMatchPrwAndGpe
* *
* PARAMETERS: Callback from WalkNamespace * PARAMETERS: Callback from WalkNamespace
* *
@ -364,7 +422,7 @@ AcpiEvSaveMethodInfo (
******************************************************************************/ ******************************************************************************/
static ACPI_STATUS static ACPI_STATUS
AcpiEvGetGpeType ( AcpiEvMatchPrwAndGpe (
ACPI_HANDLE ObjHandle, ACPI_HANDLE ObjHandle,
UINT32 Level, UINT32 Level,
void *Info, void *Info,
@ -381,7 +439,7 @@ AcpiEvGetGpeType (
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvGetGpeType"); ACPI_FUNCTION_TRACE ("EvMatchPrwAndGpe");
/* Check for a _PRW method under this device */ /* Check for a _PRW method under this device */
@ -458,10 +516,17 @@ AcpiEvGetGpeType (
(GpeNumber >= GpeBlock->BlockBaseNumber) && (GpeNumber >= GpeBlock->BlockBaseNumber) &&
(GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))) (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
{ {
/* Mark GPE for WAKE but DISABLED (even for wake) */
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]; GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
GpeEventInfo->Flags |= ACPI_GPE_TYPE_WAKE;
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
GpeEventInfo->Flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
Status = AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
} }
Cleanup: Cleanup:
@ -857,7 +922,7 @@ AcpiEvCreateGpeInfoBlocks (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{ {
ThisEvent->BitMask = AcpiGbl_DecodeTo8bit[j]; ThisEvent->RegisterBit = AcpiGbl_DecodeTo8bit[j];
ThisEvent->RegisterInfo = ThisRegister; ThisEvent->RegisterInfo = ThisRegister;
ThisEvent++; ThisEvent++;
} }
@ -936,6 +1001,7 @@ AcpiEvCreateGpeBlock (
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_GPE_WALK_INFO GpeInfo; ACPI_GPE_WALK_INFO GpeInfo;
ACPI_FUNCTION_TRACE ("EvCreateGpeBlock"); ACPI_FUNCTION_TRACE ("EvCreateGpeBlock");
@ -956,6 +1022,7 @@ AcpiEvCreateGpeBlock (
GpeBlock->RegisterCount = RegisterCount; GpeBlock->RegisterCount = RegisterCount;
GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
GpeBlock->Node = GpeDevice;
ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress, sizeof (ACPI_GENERIC_ADDRESS)); ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress, sizeof (ACPI_GENERIC_ADDRESS));
@ -977,6 +1044,61 @@ AcpiEvCreateGpeBlock (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
/* Find all GPE methods (_Lxx, _Exx) for this block */
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo,
GpeBlock, NULL);
/*
* Runtime option: Should Wake GPEs be enabled at runtime? The default
* is No,they should only be enabled just as the machine goes to sleep.
*/
if (AcpiGbl_LeaveWakeGpesDisabled)
{
/*
* Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods.
* (Each GPE that has one or more _PRWs that reference it is by
* definition a WAKE GPE and will not be enabled while the machine
* is running.)
*/
GpeInfo.GpeBlock = GpeBlock;
GpeInfo.GpeDevice = GpeDevice;
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvMatchPrwAndGpe,
&GpeInfo, NULL);
}
/*
* Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs,
* and 2) have a corresponding _Lxx or _Exx method. All other GPEs must
* be enabled via the AcpiEnableGpe() external interface.
*/
WakeGpeCount = 0;
GpeEnabledCount = 0;
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
for (j = 0; j < 8; j++)
{
/* Get the info block for this particular GPE */
GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
(GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME))
{
GpeEnabledCount++;
}
if (GpeEventInfo->Flags & ACPI_GPE_TYPE_WAKE)
{
WakeGpeCount++;
}
}
}
/* Dump info about this GPE block */ /* Dump info about this GPE block */
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
@ -989,68 +1111,13 @@ AcpiEvCreateGpeBlock (
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)), ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)),
InterruptLevel)); InterruptLevel));
/* Find all GPE methods (_Lxx, _Exx) for this block */
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, /* Enable all valid GPEs found above */
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo,
GpeBlock, NULL);
/* Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
* Runtime option: Should Wake GPEs be enabled at runtime? The default is
* No,they should only be enabled just as the machine goes to sleep.
*/
if (AcpiGbl_LeaveWakeGpesDisabled)
{
/*
* Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. (Each
* GPE that has one or more _PRWs that reference it is by definition a
* WAKE GPE and will not be enabled while the machine is running.)
*/
GpeInfo.GpeBlock = GpeBlock;
GpeInfo.GpeDevice = GpeDevice;
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvGetGpeType, "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
&GpeInfo, NULL);
}
/*
* Enable all GPEs in this block that are 1) "runtime" GPEs, and 2) have
* a corresponding _Lxx or _Exx method. All other GPEs must be enabled via
* the AcpiEnableGpe() external interface.
*/
WakeGpeCount = 0;
GpeEnabledCount = 0;
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
for (j = 0; j < 8; j++)
{
/* Get the info block for this particular GPE */
GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if ((GpeEventInfo->MethodNode) &&
((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == ACPI_GPE_TYPE_RUNTIME))
{
/* Enable this GPE, it is 1) RUNTIME and 2) has an _Lxx or _Exx method */
Status = AcpiHwEnableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
GpeEnabledCount++;
}
if ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == ACPI_GPE_TYPE_WAKE)
{
WakeGpeCount++;
}
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Found %u Wake, Enabled %u Runtime GPEs in this block\n",
WakeGpeCount, GpeEnabledCount)); WakeGpeCount, GpeEnabledCount));
/* Return the new block */ /* Return the new block */
@ -1194,7 +1261,8 @@ AcpiEvGpeInitialize (
{ {
/* GPEs are not required by ACPI, this is OK */ /* GPEs are not required by ACPI, this is OK */
ACPI_REPORT_INFO (("There are no GPE blocks defined in the FADT\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"There are no GPE blocks defined in the FADT\n"));
Status = AE_OK; Status = AE_OK;
goto Cleanup; goto Cleanup;
} }

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evmisc - Miscellaneous event manager support functions * Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 72 $ * $Revision: 75 $
* *
*****************************************************************************/ *****************************************************************************/
@ -210,7 +210,7 @@ AcpiEvQueueNotifyRequest (
if (NotifyValue <= 7) if (NotifyValue <= 7)
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
AcpiNotifyValueNames[NotifyValue])); AcpiNotifyValueNames[NotifyValue]));
} }
else else
@ -280,8 +280,8 @@ AcpiEvQueueNotifyRequest (
/* There is no per-device notify handler for this device */ /* There is no per-device notify handler for this device */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"No notify handler for [%4.4s] node %p\n", "No notify handler for Notify(%4.4s, %X) node %p\n",
AcpiUtGetNodeName (Node), Node)); AcpiUtGetNodeName (Node), NotifyValue, Node));
} }
return (Status); return (Status);
@ -662,6 +662,10 @@ AcpiEvTerminate (void)
} }
} }
/* Deallocate all handler objects installed within GPE info structs */
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
/* Return to original mode if necessary */ /* Return to original mode if necessary */
if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY) if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY)

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* $Revision: 149 $ * $Revision: 151 $
* *
*****************************************************************************/ *****************************************************************************/
@ -136,7 +136,7 @@ static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = {
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvInitAddressSpaces * FUNCTION: AcpiEvInstallRegionHandlers
* *
* PARAMETERS: None * PARAMETERS: None
* *
@ -147,16 +147,22 @@ static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = {
******************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiEvInitAddressSpaces ( AcpiEvInstallRegionHandlers (
void) void)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_NATIVE_UINT i; ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("EvInitAddressSpaces"); ACPI_FUNCTION_TRACE ("EvInstallRegionHandlers");
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* /*
* All address spaces (PCI Config, EC, SMBus) are scope dependent * All address spaces (PCI Config, EC, SMBus) are scope dependent
* and registration must occur for a specific device. * and registration must occur for a specific device.
@ -175,10 +181,9 @@ AcpiEvInitAddressSpaces (
* has already been installed (via AcpiInstallAddressSpaceHandler). * has already been installed (via AcpiInstallAddressSpaceHandler).
* Similar for AE_SAME_HANDLER. * Similar for AE_SAME_HANDLER.
*/ */
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{ {
Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode, Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode,
AcpiGbl_DefaultAddressSpaces[i], AcpiGbl_DefaultAddressSpaces[i],
ACPI_DEFAULT_HANDLER, NULL, NULL); ACPI_DEFAULT_HANDLER, NULL, NULL);
switch (Status) switch (Status)
@ -189,15 +194,65 @@ AcpiEvInitAddressSpaces (
/* These exceptions are all OK */ /* These exceptions are all OK */
Status = AE_OK;
break; break;
default: default:
return_ACPI_STATUS (Status); goto UnlockAndExit;
} }
} }
return_ACPI_STATUS (AE_OK); UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvInitializeOpRegions
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Execute _REG methods for all Operation Regions that have
* an installed default region handler.
*
******************************************************************************/
ACPI_STATUS
AcpiEvInitializeOpRegions (
void)
{
ACPI_STATUS Status;
ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("EvInitializeOpRegions");
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Run the _REG methods for OpRegions in each default address space
*/
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
/* TBD: Make sure handler is the DEFAULT handler, otherwise
* _REG will have already been run.
*/
Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
AcpiGbl_DefaultAddressSpaces[i]);
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
} }
@ -216,11 +271,12 @@ AcpiEvInitAddressSpaces (
ACPI_STATUS ACPI_STATUS
AcpiEvExecuteRegMethod ( AcpiEvExecuteRegMethod (
ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function) UINT32 Function)
{ {
ACPI_OPERAND_OBJECT *Params[3]; ACPI_PARAMETER_INFO Info;
ACPI_OPERAND_OBJECT *RegionObj2; ACPI_OPERAND_OBJECT *Params[3];
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_STATUS Status; ACPI_STATUS Status;
@ -239,10 +295,11 @@ AcpiEvExecuteRegMethod (
} }
/* /*
* _REG method has two arguments * The _REG method has two arguments:
* Arg0: Integer: Operation region space ID *
* Arg0, Integer: Operation region space ID
* Same value as RegionObj->Region.SpaceId * Same value as RegionObj->Region.SpaceId
* Arg1: Integer: connection status * Arg1, Integer: connection status
* 1 for connecting the handler, * 1 for connecting the handler,
* 0 for disconnecting the handler * 0 for disconnecting the handler
* Passed as a parameter * Passed as a parameter
@ -266,10 +323,15 @@ AcpiEvExecuteRegMethod (
Params[1]->Integer.Value = Function; Params[1]->Integer.Value = Function;
Params[2] = NULL; Params[2] = NULL;
Info.Node = RegionObj2->Extra.Method_REG;
Info.Parameters = Params;
Info.ParameterType = ACPI_PARAM_ARGS;
/* Execute the method, no return value */ /* Execute the method, no return value */
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, RegionObj2->Extra.Method_REG, NULL)); ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
Status = AcpiNsEvaluateByHandle (RegionObj2->Extra.Method_REG, Params, NULL); ACPI_TYPE_METHOD, Info.Node, NULL));
Status = AcpiNsEvaluateByHandle (&Info);
AcpiUtRemoveReference (Params[1]); AcpiUtRemoveReference (Params[1]);
@ -417,7 +479,7 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (RegionObj->Region.SpaceId))); AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) if (!(HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{ {
/* /*
* For handlers other than the default (supplied) handlers, we must * For handlers other than the default (supplied) handlers, we must
@ -440,7 +502,7 @@ AcpiEvAddressSpaceDispatch (
AcpiFormatException (Status))); AcpiFormatException (Status)));
} }
if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) if (!(HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{ {
/* /*
* We just returned from a non-default handler, we must re-enter the * We just returned from a non-default handler, we must re-enter the
@ -790,6 +852,288 @@ AcpiEvInstallHandler (
return (Status); return (Status);
} }
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallSpaceHandler
*
* PARAMETERS: Node - Namespace node for the device
* SpaceId - The address space ID
* Handler - Address of the handler
* Setup - Address of the setup function
* Context - Value passed to the handler on each access
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for all OpRegions of a given SpaceId.
* Assumes namespace is locked
*
******************************************************************************/
ACPI_STATUS
AcpiEvInstallSpaceHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId,
ACPI_ADR_SPACE_HANDLER Handler,
ACPI_ADR_SPACE_SETUP Setup,
void *Context)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
UINT16 Flags = 0;
ACPI_FUNCTION_TRACE ("EvInstallSpaceHandler");
/*
* This registration is valid for only the types below
* and the root. This is where the default handlers
* get placed.
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR) &&
(Node->Type != ACPI_TYPE_THERMAL) &&
(Node != AcpiGbl_RootNode))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if (Handler == ACPI_DEFAULT_HANDLER)
{
Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
switch (SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Handler = AcpiExSystemMemorySpaceHandler;
Setup = AcpiEvSystemMemoryRegionSetup;
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
Handler = AcpiExSystemIoSpaceHandler;
Setup = AcpiEvIoSpaceRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_CONFIG:
Handler = AcpiExPciConfigSpaceHandler;
Setup = AcpiEvPciConfigRegionSetup;
break;
case ACPI_ADR_SPACE_CMOS:
Handler = AcpiExCmosSpaceHandler;
Setup = AcpiEvCmosRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_BAR_TARGET:
Handler = AcpiExPciBarSpaceHandler;
Setup = AcpiEvPciBarRegionSetup;
break;
case ACPI_ADR_SPACE_DATA_TABLE:
Handler = AcpiExDataTableSpaceHandler;
Setup = NULL;
break;
default:
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* If the caller hasn't specified a setup routine, use the default */
if (!Setup)
{
Setup = AcpiEvDefaultRegionSetup;
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
/*
* The attached device object already exists.
* Make sure the handler is not already installed.
*/
HandlerObj = ObjDesc->Device.Handler;
/* Walk the handler list for this device */
while (HandlerObj)
{
/* Same SpaceId indicates a handler already installed */
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
if (HandlerObj->AddressSpace.Handler == Handler)
{
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
}
else
{
/* A handler is already installed */
Status = AE_ALREADY_EXISTS;
}
goto UnlockAndExit;
}
/* Walk the linked list of handlers */
HandlerObj = HandlerObj->AddressSpace.Next;
}
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Creating object on Device %p while installing handler\n", Node));
/* ObjDesc does not exist, create one */
if (Node->Type == ACPI_TYPE_ANY)
{
Type = ACPI_TYPE_DEVICE;
}
else
{
Type = Node->Type;
}
ObjDesc = AcpiUtCreateInternalObject (Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init new descriptor */
ObjDesc->Common.Type = (UINT8) Type;
/* Attach the new object to the Node */
Status = AcpiNsAttachObject (Node, ObjDesc, Type);
/* Remove local reference to the object */
AcpiUtRemoveReference (ObjDesc);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
AcpiUtGetRegionName (SpaceId), SpaceId,
AcpiUtGetNodeName (Node), Node, ObjDesc));
/*
* Install the handler
*
* At this point there is no existing handler.
* Just allocate the object for the handler and link it
* into the list.
*/
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!HandlerObj)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init handler obj */
HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
HandlerObj->AddressSpace.Hflags = Flags;
HandlerObj->AddressSpace.RegionList = NULL;
HandlerObj->AddressSpace.Node = Node;
HandlerObj->AddressSpace.Handler = Handler;
HandlerObj->AddressSpace.Context = Context;
HandlerObj->AddressSpace.Setup = Setup;
/* Install at head of Device.AddressSpace list */
HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
/*
* The Device object is the first reference on the HandlerObj.
* Each region that uses the handler adds a reference.
*/
ObjDesc->Device.Handler = HandlerObj;
/*
* Walk the namespace finding all of the regions this
* handler will manage.
*
* Start at the device and search the branch toward
* the leaf nodes until either the leaf is encountered or
* a device is detected that has an address handler of the
* same type.
*
* In either case, back up and search down the remainder
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
HandlerObj, NULL);
UnlockAndExit:
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvExecuteRegMethods
*
* PARAMETERS: Node - Namespace node for the device
* SpaceId - The address space ID
*
* RETURN: Status
*
* DESCRIPTION: Run _REG methods for the Space ID;
* Note: assumes namespace is locked, or system init time.
*
******************************************************************************/
ACPI_STATUS
AcpiEvExecuteRegMethods (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvExecuteRegMethods");
/*
* Run all _REG methods for all Operation Regions for this
* space ID. This is a separate walk in order to handle any
* interdependencies between regions and _REG methods. (i.e. handlers
* must be installed for all regions of this Space ID before we
* can run any _REG methods)
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
&SpaceId, NULL);
return_ACPI_STATUS (Status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEvRegRun * FUNCTION: AcpiEvRegRun
@ -807,20 +1151,13 @@ AcpiEvRegRun (
void *Context, void *Context,
void **ReturnValue) void **ReturnValue)
{ {
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node; ACPI_NAMESPACE_NODE *Node;
ACPI_ADR_SPACE_TYPE SpaceId;
ACPI_STATUS Status; ACPI_STATUS Status;
HandlerObj = (ACPI_OPERAND_OBJECT *) Context; SpaceId = *ACPI_CAST_PTR (ACPI_ADR_SPACE_TYPE, Context);
/* Parameter validation */
if (!HandlerObj)
{
return (AE_OK);
}
/* Convert and validate the device handle */ /* Convert and validate the device handle */
@ -850,10 +1187,9 @@ AcpiEvRegRun (
return (AE_OK); return (AE_OK);
} }
/* Object is a Region */ /* Object is a Region */
if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId) if (ObjDesc->Region.SpaceId != SpaceId)
{ {
/* /*
* This region is for a different address space * This region is for a different address space

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evxface - External interfaces for ACPI events * Module Name: evxface - External interfaces for ACPI events
* $Revision: 142 $ * $Revision: 145 $
* *
*****************************************************************************/ *****************************************************************************/
@ -272,6 +272,7 @@ AcpiRemoveFixedEventHandler (
* HandlerType - The type of handler: * HandlerType - The type of handler:
* ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f) * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
* ACPI_DEVICE_NOTIFY: DriverHandler (80-ff) * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
* ACPI_ALL_NOTIFY: both system and device
* Handler - Address of the handler * Handler - Address of the handler
* Context - Value passed to the handler on each GPE * Context - Value passed to the handler on each GPE
* *
@ -331,22 +332,23 @@ AcpiInstallNotifyHandler (
{ {
/* Make sure the handler is not already installed */ /* Make sure the handler is not already installed */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) && if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
AcpiGbl_SystemNotify.Handler) || AcpiGbl_SystemNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) && ((HandlerType & ACPI_DEVICE_NOTIFY) &&
AcpiGbl_DeviceNotify.Handler)) AcpiGbl_DeviceNotify.Handler))
{ {
Status = AE_ALREADY_EXISTS; Status = AE_ALREADY_EXISTS;
goto UnlockAndExit; goto UnlockAndExit;
} }
if (HandlerType == ACPI_SYSTEM_NOTIFY) if (HandlerType & ACPI_SYSTEM_NOTIFY)
{ {
AcpiGbl_SystemNotify.Node = Node; AcpiGbl_SystemNotify.Node = Node;
AcpiGbl_SystemNotify.Handler = Handler; AcpiGbl_SystemNotify.Handler = Handler;
AcpiGbl_SystemNotify.Context = Context; AcpiGbl_SystemNotify.Context = Context;
} }
else /* ACPI_DEVICE_NOTIFY */
if (HandlerType & ACPI_DEVICE_NOTIFY)
{ {
AcpiGbl_DeviceNotify.Node = Node; AcpiGbl_DeviceNotify.Node = Node;
AcpiGbl_DeviceNotify.Handler = Handler; AcpiGbl_DeviceNotify.Handler = Handler;
@ -378,9 +380,9 @@ AcpiInstallNotifyHandler (
{ {
/* Object exists - make sure there's no handler */ /* Object exists - make sure there's no handler */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) && if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
ObjDesc->CommonNotify.SystemNotify) || ObjDesc->CommonNotify.SystemNotify) ||
((HandlerType == ACPI_DEVICE_NOTIFY) && ((HandlerType & ACPI_DEVICE_NOTIFY) &&
ObjDesc->CommonNotify.DeviceNotify)) ObjDesc->CommonNotify.DeviceNotify))
{ {
Status = AE_ALREADY_EXISTS; Status = AE_ALREADY_EXISTS;
@ -405,7 +407,6 @@ AcpiInstallNotifyHandler (
/* Remove local reference to the object */ /* Remove local reference to the object */
AcpiUtRemoveReference (ObjDesc); AcpiUtRemoveReference (ObjDesc);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto UnlockAndExit; goto UnlockAndExit;
@ -425,14 +426,22 @@ AcpiInstallNotifyHandler (
NotifyObj->Notify.Handler = Handler; NotifyObj->Notify.Handler = Handler;
NotifyObj->Notify.Context = Context; NotifyObj->Notify.Context = Context;
if (HandlerType == ACPI_SYSTEM_NOTIFY) if (HandlerType & ACPI_SYSTEM_NOTIFY)
{ {
ObjDesc->CommonNotify.SystemNotify = NotifyObj; ObjDesc->CommonNotify.SystemNotify = NotifyObj;
} }
else /* ACPI_DEVICE_NOTIFY */
if (HandlerType & ACPI_DEVICE_NOTIFY)
{ {
ObjDesc->CommonNotify.DeviceNotify = NotifyObj; ObjDesc->CommonNotify.DeviceNotify = NotifyObj;
} }
if (HandlerType == ACPI_ALL_NOTIFY)
{
/* Extra ref if installed in both */
AcpiUtAddReference (NotifyObj);
}
} }
@ -450,6 +459,7 @@ AcpiInstallNotifyHandler (
* HandlerType - The type of handler: * HandlerType - The type of handler:
* ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f) * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
* ACPI_DEVICE_NOTIFY: DriverHandler (80-ff) * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
* ACPI_ALL_NOTIFY: both system and device
* Handler - Address of the handler * Handler - Address of the handler
* RETURN: Status * RETURN: Status
* *
@ -503,22 +513,23 @@ AcpiRemoveNotifyHandler (
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
if (((HandlerType == ACPI_SYSTEM_NOTIFY) && if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
!AcpiGbl_SystemNotify.Handler) || !AcpiGbl_SystemNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) && ((HandlerType & ACPI_DEVICE_NOTIFY) &&
!AcpiGbl_DeviceNotify.Handler)) !AcpiGbl_DeviceNotify.Handler))
{ {
Status = AE_NOT_EXIST; Status = AE_NOT_EXIST;
goto UnlockAndExit; goto UnlockAndExit;
} }
if (HandlerType == ACPI_SYSTEM_NOTIFY) if (HandlerType & ACPI_SYSTEM_NOTIFY)
{ {
AcpiGbl_SystemNotify.Node = NULL; AcpiGbl_SystemNotify.Node = NULL;
AcpiGbl_SystemNotify.Handler = NULL; AcpiGbl_SystemNotify.Handler = NULL;
AcpiGbl_SystemNotify.Context = NULL; AcpiGbl_SystemNotify.Context = NULL;
} }
else
if (HandlerType & ACPI_DEVICE_NOTIFY)
{ {
AcpiGbl_DeviceNotify.Node = NULL; AcpiGbl_DeviceNotify.Node = NULL;
AcpiGbl_DeviceNotify.Handler = NULL; AcpiGbl_DeviceNotify.Handler = NULL;
@ -550,34 +561,37 @@ AcpiRemoveNotifyHandler (
/* Object exists - make sure there's an existing handler */ /* Object exists - make sure there's an existing handler */
if (HandlerType == ACPI_SYSTEM_NOTIFY) if (HandlerType & ACPI_SYSTEM_NOTIFY)
{ {
NotifyObj = ObjDesc->CommonNotify.SystemNotify; NotifyObj = ObjDesc->CommonNotify.SystemNotify;
if ((!NotifyObj) ||
(NotifyObj->Notify.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Remove the handler */
ObjDesc->CommonNotify.SystemNotify = NULL;
AcpiUtRemoveReference (NotifyObj);
} }
else
if (HandlerType & ACPI_DEVICE_NOTIFY)
{ {
NotifyObj = ObjDesc->CommonNotify.DeviceNotify; NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
} if ((!NotifyObj) ||
(NotifyObj->Notify.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if ((!NotifyObj) || /* Remove the handler */
(NotifyObj->Notify.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Remove the handler */
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
ObjDesc->CommonNotify.SystemNotify = NULL;
}
else
{
ObjDesc->CommonNotify.DeviceNotify = NULL; ObjDesc->CommonNotify.DeviceNotify = NULL;
AcpiUtRemoveReference (NotifyObj);
} }
AcpiUtRemoveReference (NotifyObj);
} }
@ -595,7 +609,7 @@ AcpiRemoveNotifyHandler (
* GpeBlock - GPE block (NULL == FADT GPEs) * GpeBlock - GPE block (NULL == FADT GPEs)
* Type - Whether this GPE should be treated as an * Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt. * edge- or level-triggered interrupt.
* Handler - Address of the handler * Address - Address of the handler
* Context - Value passed to the handler on each GPE * Context - Value passed to the handler on each GPE
* *
* RETURN: Status * RETURN: Status
@ -609,11 +623,12 @@ AcpiInstallGpeHandler (
ACPI_HANDLE GpeDevice, ACPI_HANDLE GpeDevice,
UINT32 GpeNumber, UINT32 GpeNumber,
UINT32 Type, UINT32 Type,
ACPI_GPE_HANDLER Handler, ACPI_EVENT_HANDLER Address,
void *Context) void *Context)
{ {
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler"); ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler");
@ -621,7 +636,7 @@ AcpiInstallGpeHandler (
/* Parameter validation */ /* Parameter validation */
if (!Handler) if ((!Address) || (Type > ACPI_GPE_XRUPT_TYPE_MASK))
{ {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
@ -643,30 +658,45 @@ AcpiInstallGpeHandler (
/* Make sure that there isn't a handler there already */ /* Make sure that there isn't a handler there already */
if (GpeEventInfo->Handler) if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER)
{ {
Status = AE_ALREADY_EXISTS; Status = AE_ALREADY_EXISTS;
goto UnlockAndExit; goto UnlockAndExit;
} }
/* Allocate and init handler object */
Handler = ACPI_MEM_CALLOCATE (sizeof (ACPI_HANDLER_INFO));
if (!Handler)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
Handler->Address = Address;
Handler->Context = Context;
Handler->MethodNode = GpeEventInfo->Dispatch.MethodNode;
/* Disable the GPE before installing the handler */
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Install the handler */ /* Install the handler */
AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR); AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
GpeEventInfo->Handler = Handler; GpeEventInfo->Dispatch.Handler = Handler;
GpeEventInfo->Context = Context;
GpeEventInfo->Flags = (UINT8) Type; /* Setup up dispatch flags to indicate handler (vs. method) */
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER);
AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR); AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
/* Clear the GPE (of stale events), the enable it */
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
Status = AcpiHwEnableGpe (GpeEventInfo);
UnlockAndExit: UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
@ -680,7 +710,7 @@ AcpiInstallGpeHandler (
* *
* PARAMETERS: GpeNumber - The event to remove a handler * PARAMETERS: GpeNumber - The event to remove a handler
* GpeBlock - GPE block (NULL == FADT GPEs) * GpeBlock - GPE block (NULL == FADT GPEs)
* Handler - Address of the handler * Address - Address of the handler
* *
* RETURN: Status * RETURN: Status
* *
@ -692,10 +722,11 @@ ACPI_STATUS
AcpiRemoveGpeHandler ( AcpiRemoveGpeHandler (
ACPI_HANDLE GpeDevice, ACPI_HANDLE GpeDevice,
UINT32 GpeNumber, UINT32 GpeNumber,
ACPI_GPE_HANDLER Handler) ACPI_EVENT_HANDLER Address)
{ {
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler"); ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler");
@ -703,7 +734,7 @@ AcpiRemoveGpeHandler (
/* Parameter validation */ /* Parameter validation */
if (!Handler) if (!Address)
{ {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
@ -723,30 +754,49 @@ AcpiRemoveGpeHandler (
goto UnlockAndExit; goto UnlockAndExit;
} }
/* Disable the GPE before removing the handler */ /* Make sure that a handler is indeed installed */
Status = AcpiHwDisableGpe (GpeEventInfo); if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER)
if (ACPI_FAILURE (Status))
{ {
Status = AE_NOT_EXIST;
goto UnlockAndExit; goto UnlockAndExit;
} }
/* Make sure that the installed handler is the same */ /* Make sure that the installed handler is the same */
if (GpeEventInfo->Handler != Handler) if (GpeEventInfo->Dispatch.Handler->Address != Address)
{ {
(void) AcpiHwEnableGpe (GpeEventInfo);
Status = AE_BAD_PARAMETER; Status = AE_BAD_PARAMETER;
goto UnlockAndExit; goto UnlockAndExit;
} }
/* Disable the GPE before removing the handler */
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Remove the handler */ /* Remove the handler */
AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR); AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
GpeEventInfo->Handler = NULL; Handler = GpeEventInfo->Dispatch.Handler;
GpeEventInfo->Context = NULL;
/* Restore Method node (if any), set dispatch flags */
GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode;
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
if (Handler->MethodNode)
{
GpeEventInfo->Flags |= ACPI_GPE_DISPATCH_METHOD;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR); AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
/* Now we can free the handler object */
ACPI_MEM_FREE (Handler);
UnlockAndExit: UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 75 $ * $Revision: 79 $
* *
*****************************************************************************/ *****************************************************************************/
@ -289,6 +289,56 @@ AcpiEnableEvent (
} }
/*******************************************************************************
*
* FUNCTION: AcpiSetGpeType
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Type - New GPE type
*
* RETURN: Status
*
* DESCRIPTION: Enable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiSetGpeType (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 Type)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiSetGpeType");
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == Type)
{
return_ACPI_STATUS (AE_OK);
}
/* Set the new type (will disable GPE if currently enabled) */
Status = AcpiEvSetGpeType (GpeEventInfo, Type);
UnlockAndExit:
return_ACPI_STATUS (Status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiEnableGpe * FUNCTION: AcpiEnableGpe
@ -337,33 +387,68 @@ AcpiEnableGpe (
goto UnlockAndExit; goto UnlockAndExit;
} }
/* Check for Wake vs Runtime GPE */ /* Perform the enable */
if (Flags & ACPI_EVENT_WAKE_ENABLE) Status = AcpiEvEnableGpe (GpeEventInfo, TRUE);
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{ {
/* Ensure the requested wake GPE is disabled */ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
Status = AcpiHwDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Defer Enable of Wake GPE until sleep time */
AcpiHwEnableGpeForWakeup (GpeEventInfo);
} }
else return_ACPI_STATUS (Status);
{ }
/* Enable the requested runtime GPE */
Status = AcpiHwEnableGpe (GpeEventInfo);
/*******************************************************************************
*
* FUNCTION: AcpiDisableGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Just disable, or also wake disable?
* Called from ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Disable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto UnlockAndExit; return_ACPI_STATUS (Status);
} }
} }
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
Status = AcpiEvDisableGpe (GpeEventInfo);
UnlockAndExit: UnlockAndExit:
if (Flags & ACPI_NOT_ISR) if (Flags & ACPI_NOT_ISR)
@ -435,76 +520,6 @@ AcpiDisableEvent (
} }
/*******************************************************************************
*
* FUNCTION: AcpiDisableGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Just enable, or also wake enable?
* Called from ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Disable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/*
* Only disable the requested GPE number for wake if specified.
* Otherwise, turn it totally off
*/
if (Flags & ACPI_EVENT_WAKE_DISABLE)
{
AcpiHwDisableGpeForWakeup (GpeEventInfo);
}
else
{
Status = AcpiHwDisableGpe (GpeEventInfo);
}
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: AcpiClearEvent * FUNCTION: AcpiClearEvent

View File

@ -2,7 +2,7 @@
* *
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces. * Address Spaces.
* $Revision: 61 $ * $Revision: 63 $
* *
*****************************************************************************/ *****************************************************************************/
@ -120,7 +120,6 @@
#include "acpi.h" #include "acpi.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acevents.h" #include "acevents.h"
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfregn") ACPI_MODULE_NAME ("evxfregn")
@ -150,12 +149,8 @@ AcpiInstallAddressSpaceHandler (
ACPI_ADR_SPACE_SETUP Setup, ACPI_ADR_SPACE_SETUP Setup,
void *Context) void *Context)
{ {
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_NAMESPACE_NODE *Node; ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
UINT16 Flags = 0;
ACPI_FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler"); ACPI_FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler");
@ -183,217 +178,17 @@ AcpiInstallAddressSpaceHandler (
goto UnlockAndExit; goto UnlockAndExit;
} }
/* /* Install the handler for all Regions for this Space ID */
* This registration is valid for only the types below
* and the root. This is where the default handlers Status = AcpiEvInstallSpaceHandler (Node, SpaceId, Handler, Setup, Context);
* get placed. if (ACPI_FAILURE (Status))
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR) &&
(Node->Type != ACPI_TYPE_THERMAL) &&
(Node != AcpiGbl_RootNode))
{ {
Status = AE_BAD_PARAMETER;
goto UnlockAndExit; goto UnlockAndExit;
} }
if (Handler == ACPI_DEFAULT_HANDLER) /* Run all _REG methods for this address space */
{
Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
switch (SpaceId) Status = AcpiEvExecuteRegMethods (Node, SpaceId);
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Handler = AcpiExSystemMemorySpaceHandler;
Setup = AcpiEvSystemMemoryRegionSetup;
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
Handler = AcpiExSystemIoSpaceHandler;
Setup = AcpiEvIoSpaceRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_CONFIG:
Handler = AcpiExPciConfigSpaceHandler;
Setup = AcpiEvPciConfigRegionSetup;
break;
case ACPI_ADR_SPACE_CMOS:
Handler = AcpiExCmosSpaceHandler;
Setup = AcpiEvCmosRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_BAR_TARGET:
Handler = AcpiExPciBarSpaceHandler;
Setup = AcpiEvPciBarRegionSetup;
break;
case ACPI_ADR_SPACE_DATA_TABLE:
Handler = AcpiExDataTableSpaceHandler;
Setup = NULL;
break;
default:
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* If the caller hasn't specified a setup routine, use the default */
if (!Setup)
{
Setup = AcpiEvDefaultRegionSetup;
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
/*
* The attached device object already exists.
* Make sure the handler is not already installed.
*/
HandlerObj = ObjDesc->Device.Handler;
/* Walk the handler list for this device */
while (HandlerObj)
{
/* Same SpaceId indicates a handler already installed */
if(HandlerObj->AddressSpace.SpaceId == SpaceId)
{
if (HandlerObj->AddressSpace.Handler == Handler)
{
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
}
else
{
/* A handler is already installed */
Status = AE_ALREADY_EXISTS;
}
goto UnlockAndExit;
}
/* Walk the linked list of handlers */
HandlerObj = HandlerObj->AddressSpace.Next;
}
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Creating object on Device %p while installing handler\n", Node));
/* ObjDesc does not exist, create one */
if (Node->Type == ACPI_TYPE_ANY)
{
Type = ACPI_TYPE_DEVICE;
}
else
{
Type = Node->Type;
}
ObjDesc = AcpiUtCreateInternalObject (Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init new descriptor */
ObjDesc->Common.Type = (UINT8) Type;
/* Attach the new object to the Node */
Status = AcpiNsAttachObject (Node, ObjDesc, Type);
/* Remove local reference to the object */
AcpiUtRemoveReference (ObjDesc);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
AcpiUtGetRegionName (SpaceId), SpaceId,
AcpiUtGetNodeName (Node), Node, ObjDesc));
/*
* Install the handler
*
* At this point there is no existing handler.
* Just allocate the object for the handler and link it
* into the list.
*/
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!HandlerObj)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init handler obj */
HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
HandlerObj->AddressSpace.Hflags = Flags;
HandlerObj->AddressSpace.RegionList = NULL;
HandlerObj->AddressSpace.Node = Node;
HandlerObj->AddressSpace.Handler = Handler;
HandlerObj->AddressSpace.Context = Context;
HandlerObj->AddressSpace.Setup = Setup;
/* Install at head of Device.AddressSpace list */
HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
/*
* The Device object is the first reference on the HandlerObj.
* Each region that uses the handler adds a reference.
*/
ObjDesc->Device.Handler = HandlerObj;
/*
* Walk the namespace finding all of the regions this
* handler will manage.
*
* Start at the device and search the branch toward
* the leaf nodes until either the leaf is encountered or
* a device is detected that has an address handler of the
* same type.
*
* In either case, back up and search down the remainder
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
HandlerObj, NULL);
/*
* Now we can run the _REG methods for all Regions for this
* space ID. This is a separate walk in order to handle any
* interdependencies between regions and _REG methods. (i.e. handlers
* must be installed for all regions of this Space ID before we
* can run any _REG methods.
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
HandlerObj, NULL);
UnlockAndExit: UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 75 $ * $Revision: 77 $
* *
*****************************************************************************/ *****************************************************************************/
@ -123,6 +123,7 @@
#include "acnamesp.h" #include "acnamesp.h"
#include "acevents.h" #include "acevents.h"
#include "actables.h" #include "actables.h"
#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
@ -375,7 +376,7 @@ AcpiExLoadOp (
ACPI_OPERAND_OBJECT *DdbHandle; ACPI_OPERAND_OBJECT *DdbHandle;
ACPI_OPERAND_OBJECT *BufferDesc = NULL; ACPI_OPERAND_OBJECT *BufferDesc = NULL;
ACPI_TABLE_HEADER *TablePtr = NULL; ACPI_TABLE_HEADER *TablePtr = NULL;
UINT8 *TableDataPtr; ACPI_PHYSICAL_ADDRESS Address;
ACPI_TABLE_HEADER TableHeader; ACPI_TABLE_HEADER TableHeader;
UINT32 i; UINT32 i;
@ -391,13 +392,30 @@ AcpiExLoadOp (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
/* Get the table header */ /*
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
*/
if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
{
Status = AcpiDsGetRegionArguments (ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Get the base physical address of the region */
Address = ObjDesc->Region.Address;
/* Get the table length from the table header */
TableHeader.Length = 0; TableHeader.Length = 0;
for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) for (i = 0; i < 8; i++)
{ {
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
(ACPI_PHYSICAL_ADDRESS) i, 8, (ACPI_PHYSICAL_ADDRESS) i + Address, 8,
((UINT8 *) &TableHeader) + i); ((UINT8 *) &TableHeader) + i);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
@ -405,6 +423,13 @@ AcpiExLoadOp (
} }
} }
/* Sanity check the table length */
if (TableHeader.Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_BAD_HEADER);
}
/* Allocate a buffer for the entire table */ /* Allocate a buffer for the entire table */
TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length); TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
@ -413,18 +438,13 @@ AcpiExLoadOp (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* Copy the header to the buffer */ /* Get the entire table from the op region */
ACPI_MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
TableDataPtr = ACPI_PTR_ADD (UINT8, TablePtr, sizeof (ACPI_TABLE_HEADER));
/* Get the table from the op region */
for (i = 0; i < TableHeader.Length; i++) for (i = 0; i < TableHeader.Length; i++)
{ {
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
(ACPI_PHYSICAL_ADDRESS) i, 8, (ACPI_PHYSICAL_ADDRESS) i + Address, 8,
((UINT8 *) TableDataPtr + i)); ((UINT8 *) TablePtr + i));
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
@ -452,6 +472,13 @@ AcpiExLoadOp (
} }
TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer); TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer);
/* Sanity check the table length */
if (TablePtr->Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_BAD_HEADER);
}
break; break;

View File

@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exmutex - ASL Mutex Acquire/Release functions * Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 21 $ * $Revision: 24 $
* *
*****************************************************************************/ *****************************************************************************/
@ -128,7 +128,7 @@
* *
* FUNCTION: AcpiExUnlinkMutex * FUNCTION: AcpiExUnlinkMutex
* *
* PARAMETERS: *ObjDesc - The mutex to be unlinked * PARAMETERS: ObjDesc - The mutex to be unlinked
* *
* RETURN: Status * RETURN: Status
* *
@ -148,6 +148,8 @@ AcpiExUnlinkMutex (
return; return;
} }
/* Doubly linked list */
if (ObjDesc->Mutex.Next) if (ObjDesc->Mutex.Next)
{ {
(ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev; (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev;
@ -168,8 +170,8 @@ AcpiExUnlinkMutex (
* *
* FUNCTION: AcpiExLinkMutex * FUNCTION: AcpiExLinkMutex
* *
* PARAMETERS: *ObjDesc - The mutex to be linked * PARAMETERS: ObjDesc - The mutex to be linked
* *ListHead - head of the "AcquiredMutex" list * ListHead - head of the "AcquiredMutex" list
* *
* RETURN: Status * RETURN: Status
* *
@ -209,8 +211,8 @@ AcpiExLinkMutex (
* *
* FUNCTION: AcpiExAcquireMutex * FUNCTION: AcpiExAcquireMutex
* *
* PARAMETERS: *TimeDesc - The 'time to delay' object descriptor * PARAMETERS: TimeDesc - The 'time to delay' object descriptor
* *ObjDesc - The object descriptor for this op * ObjDesc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
* *
@ -255,9 +257,8 @@ AcpiExAcquireMutex (
return_ACPI_STATUS (AE_AML_MUTEX_ORDER); return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
} }
/* /* Support for multiple acquires by the owning thread */
* Support for multiple acquires by the owning thread
*/
if (ObjDesc->Mutex.OwnerThread) if (ObjDesc->Mutex.OwnerThread)
{ {
/* Special case for Global Lock, allow all threads */ /* Special case for Global Lock, allow all threads */
@ -284,10 +285,11 @@ AcpiExAcquireMutex (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
/* Have the mutex, update mutex and walk info */ /* Have the mutex: update mutex and walk info and save the SyncLevel */
ObjDesc->Mutex.OwnerThread = WalkState->Thread; ObjDesc->Mutex.OwnerThread = WalkState->Thread;
ObjDesc->Mutex.AcquisitionDepth = 1; ObjDesc->Mutex.AcquisitionDepth = 1;
ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel;
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
@ -303,7 +305,7 @@ AcpiExAcquireMutex (
* *
* FUNCTION: AcpiExReleaseMutex * FUNCTION: AcpiExReleaseMutex
* *
* PARAMETERS: *ObjDesc - The object descriptor for this op * PARAMETERS: ObjDesc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
* *
@ -345,13 +347,12 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
/* /*
* The Mutex is owned, but this thread must be the owner. * The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release * Special case for Global Lock, any thread can release
*/ */
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) && if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
(ObjDesc->Mutex.Semaphore != AcpiGbl_GlobalLockSemaphore)) (ObjDesc->Mutex.Semaphore != AcpiGbl_GlobalLockSemaphore))
{ {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
@ -372,9 +373,8 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_AML_MUTEX_ORDER); return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
} }
/* /* Match multiple Acquires with multiple Releases */
* Match multiple Acquires with multiple Releases
*/
ObjDesc->Mutex.AcquisitionDepth--; ObjDesc->Mutex.AcquisitionDepth--;
if (ObjDesc->Mutex.AcquisitionDepth != 0) if (ObjDesc->Mutex.AcquisitionDepth != 0)
{ {
@ -391,10 +391,10 @@ AcpiExReleaseMutex (
Status = AcpiExSystemReleaseMutex (ObjDesc); Status = AcpiExSystemReleaseMutex (ObjDesc);
/* Update the mutex and walk state */ /* Update the mutex and walk state, restore SyncLevel before acquire */
ObjDesc->Mutex.OwnerThread = NULL; ObjDesc->Mutex.OwnerThread = NULL;
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
@ -404,7 +404,7 @@ AcpiExReleaseMutex (
* *
* FUNCTION: AcpiExReleaseAllMutexes * FUNCTION: AcpiExReleaseAllMutexes
* *
* PARAMETERS: *MutexList - Head of the mutex list * PARAMETERS: MutexList - Head of the mutex list
* *
* RETURN: Status * RETURN: Status
* *
@ -424,9 +424,8 @@ AcpiExReleaseAllMutexes (
ACPI_FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
/* /* Traverse the list of owned mutexes, releasing each one */
* Traverse the list of owned mutexes, releasing each one.
*/
while (Next) while (Next)
{ {
This = Next; This = Next;
@ -446,7 +445,11 @@ AcpiExReleaseAllMutexes (
/* Mark mutex unowned */ /* Mark mutex unowned */
This->Mutex.OwnerThread = NULL; This->Mutex.OwnerThread = NULL;
/* Update Thread SyncLevel (Last mutex is the important one) */
Thread->CurrentSyncLevel = This->Mutex.OriginalSyncLevel;
} }
} }

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 119 $ * $Revision: 121 $
* *
*****************************************************************************/ *****************************************************************************/
@ -172,6 +172,7 @@ AcpiExOpcode_2A_0T_0R (
{ {
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_NAMESPACE_NODE *Node; ACPI_NAMESPACE_NODE *Node;
UINT32 Value;
ACPI_STATUS Status = AE_OK; ACPI_STATUS Status = AE_OK;
@ -189,17 +190,49 @@ AcpiExOpcode_2A_0T_0R (
Node = (ACPI_NAMESPACE_NODE *) Operand[0]; Node = (ACPI_NAMESPACE_NODE *) Operand[0];
/* Second value is the notify value */
Value = (UINT32) Operand[1]->Integer.Value;
/* Notifies allowed on this object? */ /* Notifies allowed on this object? */
if (!AcpiEvIsNotifyObject (Node)) if (!AcpiEvIsNotifyObject (Node))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unexpected notify object type [%s]\n",
AcpiUtGetTypeName (Node->Type))); AcpiUtGetTypeName (Node->Type)));
Status = AE_AML_OPERAND_TYPE; Status = AE_AML_OPERAND_TYPE;
break; break;
} }
#ifdef ACPI_GPE_NOTIFY_CHECK
/*
* GPE method wake/notify check. Here, we want to ensure that we
* don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
* GPE method during system runtime. If we do, the GPE is marked
* as "wake-only" and disabled.
*
* 1) Is the Notify() value == DeviceWake?
* 2) Is this a GPE deferred method? (An _Lxx or _Exx method)
* 3) Did the original GPE happen at system runtime?
* (versus during wake)
*
* If all three cases are true, this is a wake-only GPE that should
* be disabled at runtime.
*/
if (Value == 2) /* DeviceWake */
{
Status = AcpiEvCheckForWakeOnlyGpe (WalkState->GpeEventInfo);
if (ACPI_FAILURE (Status))
{
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
return_ACPI_STATUS (AE_OK)
}
}
#endif
/* /*
* Dispatch the notify to the appropriate handler * Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method * NOTE: the request is queued for execution after this method
@ -207,8 +240,7 @@ AcpiExOpcode_2A_0T_0R (
* from this thread -- because handlers may in turn run other * from this thread -- because handlers may in turn run other
* control methods. * control methods.
*/ */
Status = AcpiEvQueueNotifyRequest (Node, Status = AcpiEvQueueNotifyRequest (Node, Value);
(UINT32) Operand[1]->Integer.Value);
break; break;

View File

@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exresolv - AML Interpreter object resolution * Module Name: exresolv - AML Interpreter object resolution
* $Revision: 123 $ * $Revision: 124 $
* *
*****************************************************************************/ *****************************************************************************/
@ -269,15 +269,15 @@ AcpiExResolveObjectToValue (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n",
StackDesc->Reference.Offset, ObjDesc));
/* /*
* Now we can delete the original Reference Object and * Now we can delete the original Reference Object and
* replace it with the resolve value * replace it with the resolved value
*/ */
AcpiUtRemoveReference (StackDesc); AcpiUtRemoveReference (StackDesc);
*StackPtr = ObjDesc; *StackPtr = ObjDesc;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %d] ValueObj is %p\n",
StackDesc->Reference.Offset, ObjDesc));
break; break;

View File

@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exstore - AML Interpreter object store support * Module Name: exstore - AML Interpreter object store support
* $Revision: 181 $ * $Revision: 182 $
* *
*****************************************************************************/ *****************************************************************************/
@ -279,14 +279,14 @@ AcpiExStore (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X",
(UINT32) SourceDesc->Buffer.Length)); (UINT32) SourceDesc->Buffer.Length));
ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer, ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
(SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32); (SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X, \"%s\"\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X, \"%s\"\n",
SourceDesc->String.Length, SourceDesc->String.Pointer)); SourceDesc->String.Length, SourceDesc->String.Pointer));
break; break;

View File

@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: hwgpe - Low level GPE enable/disable/clear functions * Module Name: hwgpe - Low level GPE enable/disable/clear functions
* $Revision: 57 $ * $Revision: 62 $
* *
*****************************************************************************/ *****************************************************************************/
@ -124,183 +124,46 @@
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: AcpiHwEnableGpe * FUNCTION: AcpiHwWriteGpeEnableReg
* *
* PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled * PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable a single GPE. * DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must
* already be cleared or set in the parent register
* EnableForRun mask.
* *
******************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiHwEnableGpe ( AcpiHwWriteGpeEnableReg (
ACPI_GPE_EVENT_INFO *GpeEventInfo) ACPI_GPE_EVENT_INFO *GpeEventInfo)
{ {
UINT32 InByte; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
/* /* Get the info block for the entire GPE register */
* Read the current value of the register, set the appropriate bit
* to enable the GPE, and write out the new register. GpeRegisterInfo = GpeEventInfo->RegisterInfo;
*/ if (!GpeRegisterInfo)
Status = AcpiHwLowLevelRead (8, &InByte,
&GpeEventInfo->RegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{ {
return (Status); return (AE_NOT_EXIST);
} }
/* Write with the new GPE bit enabled */ /* Write the entire GPE (runtime) enable register */
Status = AcpiHwLowLevelWrite (8, (InByte | GpeEventInfo->BitMask), Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->EnableForRun,
&GpeEventInfo->RegisterInfo->EnableAddress); &GpeRegisterInfo->EnableAddress);
return (Status); return (Status);
} }
/******************************************************************************
*
* FUNCTION: AcpiHwEnableGpeForWakeup
*
* PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled
*
* RETURN: None
*
* DESCRIPTION: Keep track of which GPEs the OS has requested not be
* disabled when going to sleep.
*
******************************************************************************/
void
AcpiHwEnableGpeForWakeup (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_FUNCTION_ENTRY ();
/* Get the info block for the entire GPE register */
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
return;
}
/*
* Set the bit so we will not enable this GPE when sleeping (and disable
* it upon wake)
*/
GpeRegisterInfo->WakeEnable |= GpeEventInfo->BitMask;
GpeEventInfo->Flags |= (ACPI_GPE_TYPE_WAKE | ACPI_GPE_ENABLED);
}
/******************************************************************************
*
* FUNCTION: AcpiHwDisableGpe
*
* PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled
*
* RETURN: Status
*
* DESCRIPTION: Disable a single GPE.
*
******************************************************************************/
ACPI_STATUS
AcpiHwDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
UINT32 InByte;
ACPI_STATUS Status;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_FUNCTION_ENTRY ();
/* Get the info block for the entire GPE register */
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
return (AE_BAD_PARAMETER);
}
/*
* Read the current value of the register, clear the appropriate bit,
* and write out the new register value to disable the GPE.
*/
Status = AcpiHwLowLevelRead (8, &InByte,
&GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Write the byte with this GPE bit cleared */
Status = AcpiHwLowLevelWrite (8, (InByte & ~(GpeEventInfo->BitMask)),
&GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Make sure this GPE is disabled for wake, also */
AcpiHwDisableGpeForWakeup (GpeEventInfo);
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiHwDisableGpeForWakeup
*
* PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled
*
* RETURN: None
*
* DESCRIPTION: Keep track of which GPEs the OS has requested not be
* disabled when going to sleep.
*
******************************************************************************/
void
AcpiHwDisableGpeForWakeup (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_FUNCTION_ENTRY ();
/* Get the info block for the entire GPE register */
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
return;
}
/* Clear the bit so we will disable this when sleeping */
GpeRegisterInfo->WakeEnable &= ~(GpeEventInfo->BitMask);
}
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: AcpiHwClearGpe * FUNCTION: AcpiHwClearGpe
@ -327,7 +190,7 @@ AcpiHwClearGpe (
* Write a one to the appropriate bit in the status register to * Write a one to the appropriate bit in the status register to
* clear this GPE. * clear this GPE.
*/ */
Status = AcpiHwLowLevelWrite (8, GpeEventInfo->BitMask, Status = AcpiHwLowLevelWrite (8, GpeEventInfo->RegisterBit,
&GpeEventInfo->RegisterInfo->StatusAddress); &GpeEventInfo->RegisterInfo->StatusAddress);
return (Status); return (Status);
@ -353,7 +216,7 @@ AcpiHwGetGpeStatus (
ACPI_EVENT_STATUS *EventStatus) ACPI_EVENT_STATUS *EventStatus)
{ {
UINT32 InByte; UINT32 InByte;
UINT8 BitMask; UINT8 RegisterBit;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_EVENT_STATUS LocalEventStatus = 0; ACPI_EVENT_STATUS LocalEventStatus = 0;
@ -373,29 +236,23 @@ AcpiHwGetGpeStatus (
/* Get the register bitmask for this GPE */ /* Get the register bitmask for this GPE */
BitMask = GpeEventInfo->BitMask; RegisterBit = GpeEventInfo->RegisterBit;
/* GPE Enabled? */ /* GPE currently enabled? (enabled for runtime?) */
Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->EnableAddress); if (RegisterBit & GpeRegisterInfo->EnableForRun)
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
if (BitMask & InByte)
{ {
LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED; LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
} }
/* GPE Enabled for wake? */ /* GPE enabled for wake? */
if (BitMask & GpeRegisterInfo->WakeEnable) if (RegisterBit & GpeRegisterInfo->EnableForWake)
{ {
LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED; LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
} }
/* GPE active (set)? */ /* GPE currently active (status bit == 1)? */
Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress); Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -403,7 +260,7 @@ AcpiHwGetGpeStatus (
goto UnlockAndExit; goto UnlockAndExit;
} }
if (BitMask & InByte) if (RegisterBit & InByte)
{ {
LocalEventStatus |= ACPI_EVENT_FLAG_SET; LocalEventStatus |= ACPI_EVENT_FLAG_SET;
} }
@ -500,67 +357,46 @@ AcpiHwClearGpeBlock (
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: AcpiHwPrepareGpeBlockForSleep * FUNCTION: AcpiHwEnableRuntimeGpeBlock
* *
* PARAMETERS: GpeXruptInfo - GPE Interrupt info * PARAMETERS: GpeXruptInfo - GPE Interrupt info
* GpeBlock - Gpe Block info * GpeBlock - Gpe Block info
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Disable all runtime GPEs and enable all wakeup GPEs -- within * DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes
* a single GPE block * combination wake/run GPEs.)
* *
******************************************************************************/ ******************************************************************************/
static ACPI_STATUS ACPI_STATUS
AcpiHwPrepareGpeBlockForSleep ( AcpiHwEnableRuntimeGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock) ACPI_GPE_BLOCK_INFO *GpeBlock)
{ {
UINT32 i; UINT32 i;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 InValue;
ACPI_STATUS Status; ACPI_STATUS Status;
/* Get the register info for the entire GPE block */ /* NOTE: assumes that all GPEs are currently disabled */
GpeRegisterInfo = GpeBlock->RegisterInfo;
/* Examine each GPE Register within the block */ /* Examine each GPE Register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++) for (i = 0; i < GpeBlock->RegisterCount; i++)
{ {
/* if (!GpeBlock->RegisterInfo[i].EnableForRun)
* Read the enabled/disabled status of all GPEs. We {
* will be using it to restore all the GPEs later. continue;
* }
* NOTE: Wake GPEs are are ALL disabled at this time, so when we wake
* and restore this register, they will be automatically disabled. /* Enable all "runtime" GPEs in this register */
*/
Status = AcpiHwLowLevelRead (8, &InValue, Status = AcpiHwLowLevelWrite (8, GpeBlock->RegisterInfo[i].EnableForRun,
&GpeRegisterInfo->EnableAddress); &GpeBlock->RegisterInfo[i].EnableAddress);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return (Status); return (Status);
} }
GpeRegisterInfo->Enable = (UINT8) InValue;
/*
* 1) Disable all runtime GPEs
* 2) Enable all wakeup GPEs
*/
Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable,
&GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Point to next GPE register */
GpeRegisterInfo++;
} }
return (AE_OK); return (AE_OK);
@ -569,96 +405,44 @@ AcpiHwPrepareGpeBlockForSleep (
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: AcpiHwPrepareGpesForSleep * FUNCTION: AcpiHwEnableWakeupGpeBlock
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Disable all runtime GPEs, enable all wake GPEs.
* Called with interrupts disabled. The interrupt handler also
* modifies GpeRegisterInfo->Enable, so it should not be
* given the chance to run until after the runtime GPEs are
* re-enabled.
*
******************************************************************************/
ACPI_STATUS
AcpiHwPrepareGpesForSleep (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY ();
Status = AcpiEvWalkGpeList (AcpiHwPrepareGpeBlockForSleep);
return (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiHwRestoreGpeBlockOnWake
* *
* PARAMETERS: GpeXruptInfo - GPE Interrupt info * PARAMETERS: GpeXruptInfo - GPE Interrupt info
* GpeBlock - Gpe Block info * GpeBlock - Gpe Block info
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable all runtime GPEs and disable all wake GPEs -- in one * DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes
* GPE block * combination wake/run GPEs.)
* *
******************************************************************************/ ******************************************************************************/
static ACPI_STATUS ACPI_STATUS
AcpiHwRestoreGpeBlockOnWake ( AcpiHwEnableWakeupGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock) ACPI_GPE_BLOCK_INFO *GpeBlock)
{ {
UINT32 i; UINT32 i;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status; ACPI_STATUS Status;
/* This callback processes one entire GPE block */ /* Examine each GPE Register within the block */
/* Get the register info for the entire GPE block */
GpeRegisterInfo = GpeBlock->RegisterInfo;
/* Examine each GPE register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++) for (i = 0; i < GpeBlock->RegisterCount; i++)
{ {
/* Clear the entire status register */ if (!GpeBlock->RegisterInfo[i].EnableForWake)
{
continue;
}
Status = AcpiHwLowLevelWrite (8, 0xFF, /* Enable all "wake" GPEs in this register */
&GpeBlock->RegisterInfo[i].StatusAddress);
Status = AcpiHwLowLevelWrite (8, GpeBlock->RegisterInfo[i].EnableForWake,
&GpeBlock->RegisterInfo[i].EnableAddress);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return (Status); return (Status);
} }
/*
* Restore the GPE Enable register, which will do the following:
*
* 1) Disable all wakeup GPEs
* 2) Enable all runtime GPEs
*
* (On sleep, we saved the enabled status of all GPEs)
*/
Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable,
&GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Point to next GPE register */
GpeRegisterInfo++;
} }
return (AE_OK); return (AE_OK);
@ -667,27 +451,82 @@ AcpiHwRestoreGpeBlockOnWake (
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: AcpiHwRestoreGpesOnWake * FUNCTION: AcpiHwDisableAllGpes
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable all runtime GPEs and disable all wake GPEs -- in all * DESCRIPTION: Disable and clear all GPEs
* GPE blocks
* *
******************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiHwRestoreGpesOnWake ( AcpiHwDisableAllGpes (
void) void)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY (); ACPI_FUNCTION_TRACE ("HwDisableAllGpes");
Status = AcpiEvWalkGpeList (AcpiHwRestoreGpeBlockOnWake); Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
return (Status); Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
return_ACPI_STATUS (Status);
} }
/******************************************************************************
*
* FUNCTION: AcpiHwEnableAllRuntimeGpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Enable all GPEs of the given type
*
******************************************************************************/
ACPI_STATUS
AcpiHwEnableAllRuntimeGpes (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("HwEnableAllRuntimeGpes");
Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiHwEnableAllWakeupGpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Enable all GPEs of the given type
*
******************************************************************************/
ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("HwEnableAllWakeupGpes");
Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 180 $ * $Revision: 182 $
* *
******************************************************************************/ ******************************************************************************/
@ -190,7 +190,7 @@ AcpiNsRootInitialize (void)
} }
Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type, Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type,
ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
NULL, &NewNode); NULL, &NewNode);
if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */ if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */
@ -210,7 +210,7 @@ AcpiNsRootInitialize (void)
Status = AcpiOsPredefinedOverride (InitVal, &Val); Status = AcpiOsPredefinedOverride (InitVal, &Val);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not override predefined %s\n", "Could not override predefined %s\n",
InitVal->Name)); InitVal->Name));
} }
@ -239,7 +239,7 @@ AcpiNsRootInitialize (void)
switch (InitVal->Type) switch (InitVal->Type)
{ {
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
ObjDesc->Method.ParamCount = (UINT8) ACPI_STRTOUL ObjDesc->Method.ParamCount = (UINT8) ACPI_STRTOUL
(Val, NULL, 10); (Val, NULL, 10);
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
@ -277,7 +277,7 @@ AcpiNsRootInitialize (void)
case ACPI_TYPE_MUTEX: case ACPI_TYPE_MUTEX:
ObjDesc->Mutex.Node = NewNode; ObjDesc->Mutex.Node = NewNode;
ObjDesc->Mutex.SyncLevel = (UINT16) ACPI_STRTOUL ObjDesc->Mutex.SyncLevel = (UINT8) ACPI_STRTOUL
(Val, NULL, 10); (Val, NULL, 10);
if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: nsalloc - Namespace allocation and deletion utilities * Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 85 $ * $Revision: 87 $
* *
******************************************************************************/ ******************************************************************************/
@ -355,7 +355,7 @@ AcpiNsInstallNode (
{ {
#ifdef ACPI_ALPHABETIC_NAMESPACE #ifdef ACPI_ALPHABETIC_NAMESPACE
/* /*
* Walk the list whilst searching for the the correct * Walk the list whilst searching for the correct
* alphabetic placement. * alphabetic placement.
*/ */
PreviousChildNode = NULL; PreviousChildNode = NULL;
@ -428,7 +428,7 @@ AcpiNsInstallNode (
Node->OwnerId = OwnerId; Node->OwnerId = OwnerId;
Node->Type = (UINT8) Type; Node->Type = (UINT8) Type;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n", "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), Node, OwnerId, AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), Node, OwnerId,
AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type), AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type),

View File

@ -2,7 +2,7 @@
* *
* Module Name: nseval - Object evaluation interfaces -- includes control * Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution. * method lookup and execution.
* $Revision: 125 $ * $Revision: 127 $
* *
******************************************************************************/ ******************************************************************************/
@ -152,13 +152,10 @@
ACPI_STATUS ACPI_STATUS
AcpiNsEvaluateRelative ( AcpiNsEvaluateRelative (
ACPI_NAMESPACE_NODE *Handle,
char *Pathname, char *Pathname,
ACPI_OPERAND_OBJECT **Params, ACPI_PARAMETER_INFO *Info)
ACPI_OPERAND_OBJECT **ReturnObject)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *PrefixNode;
ACPI_NAMESPACE_NODE *Node = NULL; ACPI_NAMESPACE_NODE *Node = NULL;
ACPI_GENERIC_STATE *ScopeInfo; ACPI_GENERIC_STATE *ScopeInfo;
char *InternalPath = NULL; char *InternalPath = NULL;
@ -170,7 +167,7 @@ AcpiNsEvaluateRelative (
/* /*
* Must have a valid object handle * Must have a valid object handle
*/ */
if (!Handle) if (!Info || !Info->Node)
{ {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
@ -197,8 +194,8 @@ AcpiNsEvaluateRelative (
goto Cleanup; goto Cleanup;
} }
PrefixNode = AcpiNsMapHandleToNode (Handle); Info->Node = AcpiNsMapHandleToNode (Info->Node);
if (!PrefixNode) if (!Info->Node)
{ {
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Status = AE_BAD_PARAMETER; Status = AE_BAD_PARAMETER;
@ -207,7 +204,7 @@ AcpiNsEvaluateRelative (
/* Lookup the name in the namespace */ /* Lookup the name in the namespace */
ScopeInfo->Scope.Node = PrefixNode; ScopeInfo->Scope.Node = Info->Node;
Status = AcpiNsLookup (ScopeInfo, InternalPath, ACPI_TYPE_ANY, Status = AcpiNsLookup (ScopeInfo, InternalPath, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
&Node); &Node);
@ -228,7 +225,8 @@ AcpiNsEvaluateRelative (
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
Pathname, Node, AcpiNsGetAttachedObject (Node))); Pathname, Node, AcpiNsGetAttachedObject (Node)));
Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); Info->Node = Node;
Status = AcpiNsEvaluateByHandle (Info);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
Pathname)); Pathname));
@ -247,6 +245,7 @@ AcpiNsEvaluateRelative (
* FUNCTION: AcpiNsEvaluateByName * FUNCTION: AcpiNsEvaluateByName
* *
* PARAMETERS: Pathname - Fully qualified pathname to the object * PARAMETERS: Pathname - Fully qualified pathname to the object
* Info - Contains:
* ReturnObject - Where to put method's return value (if * ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
@ -265,11 +264,9 @@ AcpiNsEvaluateRelative (
ACPI_STATUS ACPI_STATUS
AcpiNsEvaluateByName ( AcpiNsEvaluateByName (
char *Pathname, char *Pathname,
ACPI_OPERAND_OBJECT **Params, ACPI_PARAMETER_INFO *Info)
ACPI_OPERAND_OBJECT **ReturnObject)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node = NULL;
char *InternalPath = NULL; char *InternalPath = NULL;
@ -294,7 +291,7 @@ AcpiNsEvaluateByName (
Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
&Node); &Info->Node);
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
@ -310,9 +307,9 @@ AcpiNsEvaluateByName (
* to evaluate it. * to evaluate it.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
Pathname, Node, AcpiNsGetAttachedObject (Node))); Pathname, Info->Node, AcpiNsGetAttachedObject (Info->Node)));
Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); Status = AcpiNsEvaluateByHandle (Info);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
Pathname)); Pathname));
@ -339,6 +336,7 @@ AcpiNsEvaluateByName (
* Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* ParamType - Type of Parameter list
* ReturnObject - Where to put method's return value (if * ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* *
@ -352,13 +350,9 @@ AcpiNsEvaluateByName (
ACPI_STATUS ACPI_STATUS
AcpiNsEvaluateByHandle ( AcpiNsEvaluateByHandle (
ACPI_NAMESPACE_NODE *Handle, ACPI_PARAMETER_INFO *Info)
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObject)
{ {
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *LocalReturnObject;
ACPI_FUNCTION_TRACE ("NsEvaluateByHandle"); ACPI_FUNCTION_TRACE ("NsEvaluateByHandle");
@ -373,17 +367,14 @@ AcpiNsEvaluateByHandle (
/* Parameter Validation */ /* Parameter Validation */
if (!Handle) if (!Info)
{ {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
if (ReturnObject) /* Initialize the return value to an invalid object */
{
/* Initialize the return value to an invalid object */
*ReturnObject = NULL; Info->ReturnObject = NULL;
}
/* Get the prefix handle and Node */ /* Get the prefix handle and Node */
@ -393,8 +384,8 @@ AcpiNsEvaluateByHandle (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
Node = AcpiNsMapHandleToNode (Handle); Info->Node = AcpiNsMapHandleToNode (Info->Node);
if (!Node) if (!Info->Node)
{ {
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
@ -405,9 +396,9 @@ AcpiNsEvaluateByHandle (
* so that proper scoping context will be established * so that proper scoping context will be established
* before execution. * before execution.
*/ */
if (AcpiNsGetType (Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{ {
Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); Info->Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->Node->Object);
} }
/* /*
@ -419,13 +410,12 @@ AcpiNsEvaluateByHandle (
* In both cases, the namespace is unlocked by the * In both cases, the namespace is unlocked by the
* AcpiNs* procedure * AcpiNs* procedure
*/ */
if (AcpiNsGetType (Node) == ACPI_TYPE_METHOD) if (AcpiNsGetType (Info->Node) == ACPI_TYPE_METHOD)
{ {
/* /*
* Case 1) We have an actual control method to execute * Case 1) We have an actual control method to execute
*/ */
Status = AcpiNsExecuteControlMethod (Node, Params, Status = AcpiNsExecuteControlMethod (Info);
&LocalReturnObject);
} }
else else
{ {
@ -433,7 +423,7 @@ AcpiNsEvaluateByHandle (
* Case 2) Object is NOT a method, just return its * Case 2) Object is NOT a method, just return its
* current value * current value
*/ */
Status = AcpiNsGetObjectValue (Node, &LocalReturnObject); Status = AcpiNsGetObjectValue (Info);
} }
/* /*
@ -442,21 +432,6 @@ AcpiNsEvaluateByHandle (
*/ */
if (Status == AE_CTRL_RETURN_VALUE) if (Status == AE_CTRL_RETURN_VALUE)
{ {
/*
* If the Method returned a value and the caller
* provided a place to store a returned value, Copy
* the returned value to the object descriptor provided
* by the caller.
*/
if (ReturnObject)
{
/*
* Valid return object, copy the pointer to
* the returned object
*/
*ReturnObject = LocalReturnObject;
}
/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
Status = AE_OK; Status = AE_OK;
@ -491,9 +466,7 @@ AcpiNsEvaluateByHandle (
ACPI_STATUS ACPI_STATUS
AcpiNsExecuteControlMethod ( AcpiNsExecuteControlMethod (
ACPI_NAMESPACE_NODE *MethodNode, ACPI_PARAMETER_INFO *Info)
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObjDesc)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *ObjDesc;
@ -504,7 +477,7 @@ AcpiNsExecuteControlMethod (
/* Verify that there is a method associated with this object */ /* Verify that there is a method associated with this object */
ObjDesc = AcpiNsGetAttachedObject (MethodNode); ObjDesc = AcpiNsGetAttachedObject (Info->Node);
if (!ObjDesc) if (!ObjDesc)
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
@ -513,7 +486,7 @@ AcpiNsExecuteControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT); return_ACPI_STATUS (AE_NULL_OBJECT);
} }
ACPI_DUMP_PATHNAME (MethodNode, "Execute Method:", ACPI_DUMP_PATHNAME (Info->Node, "Execute Method:",
ACPI_LV_INFO, _COMPONENT); ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
@ -542,7 +515,7 @@ AcpiNsExecuteControlMethod (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
Status = AcpiPsxExecute (MethodNode, Params, ReturnObjDesc); Status = AcpiPsxExecute (Info);
AcpiExExitInterpreter (); AcpiExExitInterpreter ();
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
@ -566,11 +539,10 @@ AcpiNsExecuteControlMethod (
ACPI_STATUS ACPI_STATUS
AcpiNsGetObjectValue ( AcpiNsGetObjectValue (
ACPI_NAMESPACE_NODE *Node, ACPI_PARAMETER_INFO *Info)
ACPI_OPERAND_OBJECT **ReturnObjDesc)
{ {
ACPI_STATUS Status = AE_OK; ACPI_STATUS Status = AE_OK;
ACPI_NAMESPACE_NODE *ResolvedNode = Node; ACPI_NAMESPACE_NODE *ResolvedNode = Info->Node;
ACPI_FUNCTION_TRACE ("NsGetObjectValue"); ACPI_FUNCTION_TRACE ("NsGetObjectValue");
@ -619,9 +591,9 @@ AcpiNsGetObjectValue (
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
Status = AE_CTRL_RETURN_VALUE; Status = AE_CTRL_RETURN_VALUE;
*ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode); Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
*ReturnObjDesc, AcpiUtGetObjectTypeName (*ReturnObjDesc))); Info->ReturnObject, AcpiUtGetObjectTypeName (Info->ReturnObject)));
} }
} }

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsinit - namespace initialization * Module Name: nsinit - namespace initialization
* $Revision: 58 $ * $Revision: 60 $
* *
*****************************************************************************/ *****************************************************************************/
@ -226,7 +226,7 @@ AcpiNsInitializeDevices (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
/* Walk namespace for all objects of type Device or Processor */ /* Walk namespace for all objects */
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, TRUE, AcpiNsInitOneDevice, &Info, NULL); ACPI_UINT32_MAX, TRUE, AcpiNsInitOneDevice, &Info, NULL);
@ -422,26 +422,30 @@ AcpiNsInitOneDevice (
void *Context, void *Context,
void **ReturnValue) void **ReturnValue)
{ {
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
UINT32 Flags;
ACPI_DEVICE_WALK_INFO *Info = (ACPI_DEVICE_WALK_INFO *) Context; ACPI_DEVICE_WALK_INFO *Info = (ACPI_DEVICE_WALK_INFO *) Context;
ACPI_PARAMETER_INFO Pinfo;
UINT32 Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("NsInitOneDevice"); ACPI_FUNCTION_TRACE ("NsInitOneDevice");
Node = AcpiNsMapHandleToNode (ObjHandle); Pinfo.Parameters = NULL;
if (!Node) Pinfo.ParameterType = ACPI_PARAM_ARGS;
Pinfo.Node = AcpiNsMapHandleToNode (ObjHandle);
if (!Pinfo.Node)
{ {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
/* /*
* We will run _STA/_INI on Devices and Processors only * We will run _STA/_INI on Devices, Processors and ThermalZones only
*/ */
if ((Node->Type != ACPI_TYPE_DEVICE) && if ((Pinfo.Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR)) (Pinfo.Node->Type != ACPI_TYPE_PROCESSOR) &&
(Pinfo.Node->Type != ACPI_TYPE_THERMAL))
{ {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -456,19 +460,19 @@ AcpiNsInitOneDevice (
/* /*
* Run _STA to determine if we can run _INI on the device. * Run _STA to determine if we can run _INI on the device.
*/ */
ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Node, "_STA")); ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Pinfo.Node, "_STA"));
Status = AcpiUtExecute_STA (Node, &Flags); Status = AcpiUtExecute_STA (Pinfo.Node, &Flags);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
if (Node->Type == ACPI_TYPE_DEVICE) if (Pinfo.Node->Type == ACPI_TYPE_DEVICE)
{ {
/* Ignore error and move on to next device */ /* Ignore error and move on to next device */
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* _STA is not required for Processor objects */ /* _STA is not required for Processor or ThermalZone objects */
} }
else else
{ {
@ -485,8 +489,8 @@ AcpiNsInitOneDevice (
/* /*
* The device is present. Run _INI. * The device is present. Run _INI.
*/ */
ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, ObjHandle, "_INI")); ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Pinfo.Node, "_INI"));
Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL); Status = AcpiNsEvaluateRelative ("_INI", &Pinfo);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
/* No _INI (AE_NOT_FOUND) means device requires no initialization */ /* No _INI (AE_NOT_FOUND) means device requires no initialization */
@ -495,14 +499,14 @@ AcpiNsInitOneDevice (
{ {
/* Ignore error and move on to next device */ /* Ignore error and move on to next device */
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
char *ScopeName = AcpiNsGetExternalPathname (ObjHandle); char *ScopeName = AcpiNsGetExternalPathname (Pinfo.Node);
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
ScopeName, AcpiFormatException (Status))); ScopeName, AcpiFormatException (Status)));
ACPI_MEM_FREE (ScopeName); ACPI_MEM_FREE (ScopeName);
#endif #endif
} }
Status = AE_OK; Status = AE_OK;
@ -518,7 +522,7 @@ AcpiNsInitOneDevice (
{ {
/* External initialization handler is present, call it */ /* External initialization handler is present, call it */
Status = AcpiGbl_InitHandler (ObjHandle, ACPI_INIT_DEVICE_INI); Status = AcpiGbl_InitHandler (Pinfo.Node, ACPI_INIT_DEVICE_INI);
} }

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsparse - namespace interface to AML parser * Module Name: nsparse - namespace interface to AML parser
* $Revision: 5 $ * $Revision: 6 $
* *
*****************************************************************************/ *****************************************************************************/
@ -170,8 +170,9 @@ AcpiNsOneCompleteParse (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart, Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
TableDesc->AmlLength, NULL, NULL, PassNumber); TableDesc->AmlStart, TableDesc->AmlLength,
NULL, PassNumber);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
AcpiDsDeleteWalkState (WalkState); AcpiDsDeleteWalkState (WalkState);

View File

@ -2,7 +2,7 @@
* *
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces * ACPI Object evaluation interfaces
* $Revision: 12 $ * $Revision: 14 $
* *
******************************************************************************/ ******************************************************************************/
@ -256,8 +256,7 @@ AcpiEvaluateObject (
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_STATUS Status2; ACPI_STATUS Status2;
ACPI_OPERAND_OBJECT **InternalParams = NULL; ACPI_PARAMETER_INFO Info;
ACPI_OPERAND_OBJECT *InternalReturnObj = NULL;
ACPI_SIZE BufferSpaceNeeded; ACPI_SIZE BufferSpaceNeeded;
UINT32 i; UINT32 i;
@ -265,6 +264,11 @@ AcpiEvaluateObject (
ACPI_FUNCTION_TRACE ("AcpiEvaluateObject"); ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
Info.Node = Handle;
Info.Parameters = NULL;
Info.ReturnObject = NULL;
Info.ParameterType = ACPI_PARAM_ARGS;
/* /*
* If there are parameters to be passed to the object * If there are parameters to be passed to the object
* (which must be a control method), the external objects * (which must be a control method), the external objects
@ -276,9 +280,10 @@ AcpiEvaluateObject (
* Allocate a new parameter block for the internal objects * Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list * Add 1 to count to allow for null terminated internal list
*/ */
InternalParams = ACPI_MEM_CALLOCATE (((ACPI_SIZE) ExternalParams->Count + 1) * Info.Parameters = ACPI_MEM_CALLOCATE (
sizeof (void *)); ((ACPI_SIZE) ExternalParams->Count + 1) *
if (!InternalParams) sizeof (void *));
if (!Info.Parameters)
{ {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
@ -290,16 +295,17 @@ AcpiEvaluateObject (
for (i = 0; i < ExternalParams->Count; i++) for (i = 0; i < ExternalParams->Count; i++)
{ {
Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i], Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
&InternalParams[i]); &Info.Parameters[i]);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
AcpiUtDeleteInternalObjectList (InternalParams); AcpiUtDeleteInternalObjectList (Info.Parameters);
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
} }
InternalParams[ExternalParams->Count] = NULL; Info.Parameters[ExternalParams->Count] = NULL;
} }
/* /*
* Three major cases: * Three major cases:
* 1) Fully qualified pathname * 1) Fully qualified pathname
@ -312,8 +318,7 @@ AcpiEvaluateObject (
/* /*
* The path is fully qualified, just evaluate by name * The path is fully qualified, just evaluate by name
*/ */
Status = AcpiNsEvaluateByName (Pathname, InternalParams, Status = AcpiNsEvaluateByName (Pathname, &Info);
&InternalReturnObj);
} }
else if (!Handle) else if (!Handle)
{ {
@ -348,16 +353,14 @@ AcpiEvaluateObject (
* The null pathname case means the handle is for * The null pathname case means the handle is for
* the actual object to be evaluated * the actual object to be evaluated
*/ */
Status = AcpiNsEvaluateByHandle (Handle, InternalParams, Status = AcpiNsEvaluateByHandle (&Info);
&InternalReturnObj);
} }
else else
{ {
/* /*
* Both a Handle and a relative Pathname * Both a Handle and a relative Pathname
*/ */
Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams, Status = AcpiNsEvaluateRelative (Pathname, &Info);
&InternalReturnObj);
} }
} }
@ -368,13 +371,13 @@ AcpiEvaluateObject (
*/ */
if (ReturnBuffer) if (ReturnBuffer)
{ {
if (!InternalReturnObj) if (!Info.ReturnObject)
{ {
ReturnBuffer->Length = 0; ReturnBuffer->Length = 0;
} }
else else
{ {
if (ACPI_GET_DESCRIPTOR_TYPE (InternalReturnObj) == ACPI_DESC_TYPE_NAMED) if (ACPI_GET_DESCRIPTOR_TYPE (Info.ReturnObject) == ACPI_DESC_TYPE_NAMED)
{ {
/* /*
* If we received a NS Node as a return object, this means that * If we received a NS Node as a return object, this means that
@ -385,7 +388,7 @@ AcpiEvaluateObject (
* support for various types at a later date if necessary. * support for various types at a later date if necessary.
*/ */
Status = AE_TYPE; Status = AE_TYPE;
InternalReturnObj = NULL; /* No need to delete a NS Node */ Info.ReturnObject = NULL; /* No need to delete a NS Node */
ReturnBuffer->Length = 0; ReturnBuffer->Length = 0;
} }
@ -395,7 +398,7 @@ AcpiEvaluateObject (
* Find out how large a buffer is needed * Find out how large a buffer is needed
* to contain the returned object * to contain the returned object
*/ */
Status = AcpiUtGetObjectSize (InternalReturnObj, Status = AcpiUtGetObjectSize (Info.ReturnObject,
&BufferSpaceNeeded); &BufferSpaceNeeded);
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
@ -409,14 +412,15 @@ AcpiEvaluateObject (
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n", "Needed buffer size %X, %s\n",
(UINT32) BufferSpaceNeeded, AcpiFormatException (Status))); (UINT32) BufferSpaceNeeded,
AcpiFormatException (Status)));
} }
else else
{ {
/* /*
* We have enough space for the object, build it * We have enough space for the object, build it
*/ */
Status = AcpiUtCopyIobjectToEobject (InternalReturnObj, Status = AcpiUtCopyIobjectToEobject (Info.ReturnObject,
ReturnBuffer); ReturnBuffer);
} }
} }
@ -424,9 +428,9 @@ AcpiEvaluateObject (
} }
} }
if (InternalReturnObj) if (Info.ReturnObject)
{ {
/* /*
* Delete the internal return object. NOTE: Interpreter * Delete the internal return object. NOTE: Interpreter
* must be locked to avoid race condition. * must be locked to avoid race condition.
*/ */
@ -437,7 +441,7 @@ AcpiEvaluateObject (
* Delete the internal return object. (Or at least * Delete the internal return object. (Or at least
* decrement the reference count by one) * decrement the reference count by one)
*/ */
AcpiUtRemoveReference (InternalReturnObj); AcpiUtRemoveReference (Info.ReturnObject);
AcpiExExitInterpreter (); AcpiExExitInterpreter ();
} }
} }
@ -445,11 +449,11 @@ AcpiEvaluateObject (
/* /*
* Free the input parameter list (if we created one), * Free the input parameter list (if we created one),
*/ */
if (InternalParams) if (Info.Parameters)
{ {
/* Free the allocated parameter block */ /* Free the allocated parameter block */
AcpiUtDeleteInternalObjectList (InternalParams); AcpiUtDeleteInternalObjectList (Info.Parameters);
} }
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);

View File

@ -2,7 +2,7 @@
* *
* Module Name: nsxfname - Public interfaces to the ACPI subsystem * Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces * ACPI Namespace oriented interfaces
* $Revision: 100 $ * $Revision: 101 $
* *
*****************************************************************************/ *****************************************************************************/
@ -374,7 +374,7 @@ AcpiGetObjectInfo (
{ {
/* /*
* Get extra info for ACPI Devices objects only: * Get extra info for ACPI Devices objects only:
* Run the Device _HID, _UID, _CID, _STA, and _ADR methods. * Run the Device _HID, _UID, _CID, _STA, _ADR and _SxD methods.
* *
* Note: none of these methods are required, so they may or may * Note: none of these methods are required, so they may or may
* not be present for this device. The Info.Valid bitfield is used * not be present for this device. The Info.Valid bitfield is used
@ -429,7 +429,7 @@ AcpiGetObjectInfo (
Status = AcpiUtExecute_Sxds (Node, Info.HighestDstates); Status = AcpiUtExecute_Sxds (Node, Info.HighestDstates);
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
Info.Valid |= ACPI_VALID_STA; Info.Valid |= ACPI_VALID_SXDS;
} }
Status = AE_OK; Status = AE_OK;

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: psxface - Parser external interfaces * Module Name: psxface - Parser external interfaces
* $Revision: 71 $ * $Revision: 75 $
* *
*****************************************************************************/ *****************************************************************************/
@ -131,7 +131,7 @@
* *
* FUNCTION: AcpiPsxExecute * FUNCTION: AcpiPsxExecute
* *
* PARAMETERS: MethodNode - A method object containing both the AML * PARAMETERS: Info->Node - A method object containing both the AML
* address and length. * address and length.
* **Params - List of parameters to pass to method, * **Params - List of parameters to pass to method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
@ -147,9 +147,7 @@
ACPI_STATUS ACPI_STATUS
AcpiPsxExecute ( AcpiPsxExecute (
ACPI_NAMESPACE_NODE *MethodNode, ACPI_PARAMETER_INFO *Info)
ACPI_OPERAND_OBJECT **Params,
ACPI_OPERAND_OBJECT **ReturnObjDesc)
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *ObjDesc;
@ -163,12 +161,12 @@ AcpiPsxExecute (
/* Validate the Node and get the attached object */ /* Validate the Node and get the attached object */
if (!MethodNode) if (!Info || !Info->Node)
{ {
return_ACPI_STATUS (AE_NULL_ENTRY); return_ACPI_STATUS (AE_NULL_ENTRY);
} }
ObjDesc = AcpiNsGetAttachedObject (MethodNode); ObjDesc = AcpiNsGetAttachedObject (Info->Node);
if (!ObjDesc) if (!ObjDesc)
{ {
return_ACPI_STATUS (AE_NULL_OBJECT); return_ACPI_STATUS (AE_NULL_OBJECT);
@ -176,21 +174,22 @@ AcpiPsxExecute (
/* Init for new method, wait on concurrency semaphore */ /* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL); Status = AcpiDsBeginMethodExecution (Info->Node, ObjDesc, NULL);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
if (Params) if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
(Info->Parameters))
{ {
/* /*
* The caller "owns" the parameters, so give each one an extra * The caller "owns" the parameters, so give each one an extra
* reference * reference
*/ */
for (i = 0; Params[i]; i++) for (i = 0; Info->Parameters[i]; i++)
{ {
AcpiUtAddReference (Params[i]); AcpiUtAddReference (Info->Parameters[i]);
} }
} }
@ -200,7 +199,7 @@ AcpiPsxExecute (
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Parse **** Entry=%p obj=%p\n", "**** Begin Method Parse **** Entry=%p obj=%p\n",
MethodNode, ObjDesc)); Info->Node, ObjDesc));
/* Create and init a Root Node */ /* Create and init a Root Node */
@ -228,8 +227,9 @@ AcpiPsxExecute (
goto Cleanup2; goto Cleanup2;
} }
Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
ObjDesc->Method.AmlLength, NULL, NULL, 1); ObjDesc->Method.AmlStart,
ObjDesc->Method.AmlLength, NULL, 1);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup3; goto Cleanup3;
@ -242,7 +242,6 @@ AcpiPsxExecute (
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup1; /* Walk state is already deleted */ goto Cleanup1; /* Walk state is already deleted */
} }
/* /*
@ -250,7 +249,7 @@ AcpiPsxExecute (
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Execution **** Entry=%p obj=%p\n", "**** Begin Method Execution **** Entry=%p obj=%p\n",
MethodNode, ObjDesc)); Info->Node, ObjDesc));
/* Create and init a Root Node */ /* Create and init a Root Node */
@ -263,8 +262,8 @@ AcpiPsxExecute (
/* Init new op with the method name and pointer back to the NS node */ /* Init new op with the method name and pointer back to the NS node */
AcpiPsSetName (Op, MethodNode->Name.Integer); AcpiPsSetName (Op, Info->Node->Name.Integer);
Op->Common.Node = MethodNode; Op->Common.Node = Info->Node;
/* Create and initialize a new walk state */ /* Create and initialize a new walk state */
@ -275,8 +274,9 @@ AcpiPsxExecute (
goto Cleanup2; goto Cleanup2;
} }
Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3); ObjDesc->Method.AmlStart,
ObjDesc->Method.AmlLength, Info, 3);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup3; goto Cleanup3;
@ -296,15 +296,16 @@ AcpiPsxExecute (
AcpiPsDeleteParseTree (Op); AcpiPsDeleteParseTree (Op);
Cleanup1: Cleanup1:
if (Params) if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
(Info->Parameters))
{ {
/* Take away the extra reference that we gave the parameters above */ /* Take away the extra reference that we gave the parameters above */
for (i = 0; Params[i]; i++) for (i = 0; Info->Parameters[i]; i++)
{ {
/* Ignore errors, just do them all */ /* Ignore errors, just do them all */
(void) AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT); (void) AcpiUtUpdateObjectReference (Info->Parameters[i], REF_DECREMENT);
} }
} }
@ -317,11 +318,11 @@ AcpiPsxExecute (
* If the method has returned an object, signal this to the caller with * If the method has returned an object, signal this to the caller with
* a control exception code * a control exception code
*/ */
if (*ReturnObjDesc) if (Info->ReturnObject)
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
*ReturnObjDesc)); Info->ReturnObject));
ACPI_DUMP_STACK_ENTRY (*ReturnObjDesc); ACPI_DUMP_STACK_ENTRY (Info->ReturnObject);
Status = AE_CTRL_RETURN_VALUE; Status = AE_CTRL_RETURN_VALUE;
} }

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rsutils - Utilities for the resource manager * Module Name: rsutils - Utilities for the resource manager
* $Revision: 38 $ * $Revision: 39 $
* *
******************************************************************************/ ******************************************************************************/
@ -367,6 +367,7 @@ AcpiRsSetSrsMethodData (
ACPI_HANDLE Handle, ACPI_HANDLE Handle,
ACPI_BUFFER *InBuffer) ACPI_BUFFER *InBuffer)
{ {
ACPI_PARAMETER_INFO Info;
ACPI_OPERAND_OBJECT *Params[2]; ACPI_OPERAND_OBJECT *Params[2];
ACPI_STATUS Status; ACPI_STATUS Status;
ACPI_BUFFER Buffer; ACPI_BUFFER Buffer;
@ -409,10 +410,14 @@ AcpiRsSetSrsMethodData (
Params[0]->Common.Flags = AOPOBJ_DATA_VALID; Params[0]->Common.Flags = AOPOBJ_DATA_VALID;
Params[1] = NULL; Params[1] = NULL;
Info.Node = Handle;
Info.Parameters = Params;
Info.ParameterType = ACPI_PARAM_ARGS;
/* /*
* Execute the method, no return value * Execute the method, no return value
*/ */
Status = AcpiNsEvaluateRelative (Handle, "_SRS", Params, NULL); Status = AcpiNsEvaluateRelative ("_SRS", &Info);
/* /*
* Clean up and return the status from AcpiNsEvaluateRelative * Clean up and return the status from AcpiNsEvaluateRelative

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rsxface - Public interfaces to the resource manager * Module Name: rsxface - Public interfaces to the resource manager
* $Revision: 29 $ * $Revision: 30 $
* *
******************************************************************************/ ******************************************************************************/
@ -342,7 +342,8 @@ AcpiWalkResources (
/* Setup pointers */ /* Setup pointers */
Resource = (ACPI_RESOURCE *) Buffer.Pointer; Resource = (ACPI_RESOURCE *) Buffer.Pointer;
BufferEnd = (ACPI_RESOURCE *) ((UINT8 *) Buffer.Pointer + Buffer.Length); BufferEnd = ACPI_CAST_PTR (ACPI_RESOURCE,
((UINT8 *) Buffer.Pointer + Buffer.Length));
/* Walk the resource list */ /* Walk the resource list */

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: utxface - External interfaces for "global" ACPI functions * Module Name: utxface - External interfaces for "global" ACPI functions
* $Revision: 105 $ * $Revision: 106 $
* *
*****************************************************************************/ *****************************************************************************/
@ -237,9 +237,8 @@ AcpiEnableSubsystem (
} }
} }
/* /* Enable ACPI mode */
* Enable ACPI mode
*/
if (!(Flags & ACPI_NO_ACPI_ENABLE)) if (!(Flags & ACPI_NO_ACPI_ENABLE))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
@ -255,7 +254,23 @@ AcpiEnableSubsystem (
} }
/* /*
* Initialize ACPI Event handling * Install the default OpRegion handlers. These are installed unless
* other handlers have already been installed via the
* InstallAddressSpaceHandler interface.
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
Status = AcpiEvInstallRegionHandlers ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Initialize ACPI Event handling (Fixed and General Purpose)
* *
* NOTE: We must have the hardware AND events initialized before we can execute * NOTE: We must have the hardware AND events initialized before we can execute
* ANY control methods SAFELY. Any control method can require ACPI hardware * ANY control methods SAFELY. Any control method can require ACPI hardware
@ -265,20 +280,20 @@ AcpiEnableSubsystem (
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n"));
Status = AcpiEvInitialize (); Status = AcpiEvInitializeEvents ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
} }
/* Install the SCI handler, Global Lock handler, and GPE handlers */ /* Install the SCI handler and Global Lock handler */
if (!(Flags & ACPI_NO_HANDLER_INIT)) if (!(Flags & ACPI_NO_HANDLER_INIT))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL/GPE handlers\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n"));
Status = AcpiEvHandlerInitialize (); Status = AcpiEvInstallXruptHandlers ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
@ -312,19 +327,17 @@ AcpiInitializeObjects (
/* /*
* Install the default OpRegion handlers. These are installed unless * Run all _REG methods
* other handlers have already been installed via the
* InstallAddressSpaceHandler interface.
* *
* NOTE: This will cause _REG methods to be run. Any objects accessed * NOTE: Any objects accessed
* by the _REG methods will be automatically initialized, even if they * by the _REG methods will be automatically initialized, even if they
* contain executable AML (see call to AcpiNsInitializeObjects below). * contain executable AML (see call to AcpiNsInitializeObjects below).
*/ */
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG OpRegion methods\n"));
Status = AcpiEvInitAddressSpaces (); Status = AcpiEvInitializeOpRegions ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
@ -338,7 +351,7 @@ AcpiInitializeObjects (
*/ */
if (!(Flags & ACPI_NO_OBJECT_INIT)) if (!(Flags & ACPI_NO_OBJECT_INIT))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n"));
Status = AcpiNsInitializeObjects (); Status = AcpiNsInitializeObjects ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))