Finished updating to the new ACPI-CA version (subversion didn't notice some of the changes the first time around) and reimplemented get_device_hid() in a way that allows us better error reporting, and should be more compatible with broken BIOSes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12440 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Nathan Whitehorn
2005-04-19 00:29:09 +00:00
parent 387242437d
commit 52c415a86c
132 changed files with 832 additions and 606 deletions
@@ -208,23 +208,35 @@ status_t get_device (const char *hid, uint32 index, char *result) {
status_t get_device_hid (const char *path, char *hid) {
ACPI_HANDLE handle;
ACPI_DEVICE_INFO *info;
ACPI_OBJECT info;
ACPI_BUFFER info_buffer;
if (AcpiGetHandle(NULL,path,&handle) != AE_OK)
return B_ENTRY_NOT_FOUND;
info_buffer.Pointer = info = (ACPI_DEVICE_INFO *)malloc(sizeof(ACPI_DEVICE_INFO));
info_buffer.Length = sizeof(ACPI_DEVICE_INFO);
info_buffer.Pointer = &info;
info_buffer.Length = sizeof(ACPI_OBJECT);
info.String.Pointer = hid;
info.String.Length = 9;
info.String.Type = ACPI_TYPE_STRING;
if (AcpiGetObjectInfo(handle,&info_buffer) != AE_OK) {
free(info_buffer.Pointer);
if (AcpiEvaluateObject(handle,"_HID",NULL,&info_buffer) != AE_OK)
return B_BAD_TYPE;
if (info.Type == ACPI_TYPE_INTEGER) {
uint32 EisaId = AcpiUtDwordByteSwap (info.Integer.Value);
hid[0] = (char) ('@' + (((unsigned long) EisaId >> 26) & 0x1f));
hid[1] = (char) ('@' + ((EisaId >> 21) & 0x1f));
hid[2] = (char) ('@' + ((EisaId >> 16) & 0x1f));
hid[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12);
hid[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8);
hid[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4);
hid[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0);
hid[7] = 0;
}
strncpy(hid,info->HardwareId.Value,ACPI_DEVICE_ID_LENGTH);
free(info_buffer.Pointer);
hid[8] = '\0';
hid[ACPI_DEVICE_ID_LENGTH] = '\0';
return B_OK;
}
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
* $Revision: 1.1 $
* $Revision: 67 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
* $Revision: 1.1 $
* $Revision: 66 $
*
*****************************************************************************/
@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 1.1 $
* $Revision: 163 $
*
******************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 1.1 $
* $Revision: 71 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
* $Revision: 1.1 $
* $Revision: 29 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 1.1 $
* $Revision: 180 $
*
*****************************************************************************/
@@ -137,7 +137,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20050211
#define ACPI_CA_VERSION 0x20050309
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -271,7 +271,7 @@
/* Number of strings associated with the _OSI reserved method */
#define ACPI_NUM_OSI_STRINGS 9
#define ACPI_NUM_OSI_STRINGS 10
/******************************************************************************
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 1.1 $
* $Revision: 76 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
* $Revision: 1.1 $
* $Revision: 15 $
*
*****************************************************************************/
@@ -149,6 +149,13 @@ extern const char *AcpiGbl_SHRDecode[2];
extern const char *AcpiGbl_TYPDecode[4];
extern const char *AcpiGbl_BMDecode[2];
extern const char *AcpiGbl_SIZDecode[4];
extern const char *AcpiGbl_TTPDecode[2];
extern const char *AcpiGbl_MTPDecode[4];
extern const char *AcpiGbl_TRSDecode[2];
extern const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES];
extern const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES];
extern const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES];
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
* $Revision: 1.1 $
* $Revision: 61 $
*
*****************************************************************************/
@@ -443,6 +443,16 @@ AcpiDsCreateNode (
/* dsutils - Parser/Interpreter interface utility routines */
void
AcpiDsClearImplicitReturn (
ACPI_WALK_STATE *WalkState);
BOOLEAN
AcpiDsDoImplicitReturn (
ACPI_OPERAND_OBJECT *ReturnDesc,
ACPI_WALK_STATE *WalkState,
BOOLEAN AddReference);
BOOLEAN
AcpiDsIsResultUsed (
ACPI_PARSE_OBJECT *Op,
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
* $Revision: 1.1 $
* $Revision: 97 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
* $Revision: 1.1 $
* $Revision: 73 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 1.1 $
* $Revision: 163 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
* $Revision: 1.1 $
* $Revision: 74 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 1.1 $
* $Revision: 158 $
*
*****************************************************************************/
@@ -689,7 +689,6 @@ AcpiExStoreObjectToObject (
ACPI_STATUS
AcpiExStoreBufferToBuffer (
ACPI_OBJECT_TYPE OriginalSrcType,
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 1.1 $
* $Revision: 205 $
*
*****************************************************************************/
@@ -883,6 +883,7 @@ typedef struct acpi_bit_register_info
#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_WAKE_STATUS 0x8000
#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
@@ -898,6 +899,7 @@ typedef struct acpi_bit_register_info
#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_SCI_ENABLE 0x0001
#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
@@ -916,6 +918,7 @@ typedef struct acpi_bit_register_info
#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
@@ -923,6 +926,7 @@ typedef struct acpi_bit_register_info
#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
#define ACPI_BITPOSITION_SCI_ENABLE 0x00
#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 1.1 $
* $Revision: 157 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 1.1 $
* $Revision: 137 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
* $Revision: 1.1 $
* $Revision: 128 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
* $Revision: 1.1 $
* $Revision: 96 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
* $Revision: 1.1 $
* $Revision: 69 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
* $Revision: 1.1 $
* $Revision: 58 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
* $Revision: 1.1 $
* $Revision: 39 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
* $Revision: 1.1 $
* $Revision: 30 $
*
*****************************************************************************/
@@ -167,6 +167,7 @@ typedef struct acpi_walk_state
ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
struct acpi_gpe_event_info *GpeEventInfo; /* Info for GPE (_Lxx/_Exx methods only */
union acpi_operand_object *ImplicitReturnObj;
struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
* $Revision: 1.1 $
* $Revision: 47 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
* $Revision: 1.1 $
* $Revision: 68 $
*
*****************************************************************************/
@@ -345,6 +345,8 @@ typedef struct madt_local_sapic
UINT8 LocalSapicEid; /* SAPIC EID */
UINT8 Reserved [3]; /* Reserved - must be zero */
LOCAL_APIC_FLAGS
UINT32 ProcessorUID; /* Numeric UID - ACPI 3.0 */
char ProcessorUIDString[1]; /* String UID - ACPI 3.0 */
} MADT_LOCAL_SAPIC;
@@ -357,7 +359,7 @@ typedef struct madt_interrupt_source
UINT8 ProcessorEid; /* Processor EID */
UINT8 IoSapicVector; /* Vector value for PMI interrupts */
UINT32 Interrupt; /* Global system interrupt */
UINT32 Reserved; /* Reserved - must be zero */
UINT32 Flags; /* Interrupt Source Flags */
} MADT_INTERRUPT_SOURCE;
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
* $Revision: 1.1 $
* $Revision: 29 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
* $Revision: 1.1 $
* $Revision: 41 $
*
*****************************************************************************/
@@ -182,7 +182,7 @@ typedef struct facs_descriptor_rev2
/*
* ACPI 2.0 Generic Address Structure (GAS)
* ACPI 2.0+ Generic Address Structure (GAS)
*/
typedef struct acpi_generic_address
{
@@ -234,7 +234,7 @@ typedef struct acpi_generic_address
UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
/*
* ACPI 2.0 Fixed ACPI Description Table (FADT)
* ACPI 2.0+ Fixed ACPI Description Table (FADT)
*/
typedef struct fadt_descriptor_rev2
{
@@ -249,17 +249,25 @@ typedef struct fadt_descriptor_rev2
UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits*/
UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits */
UINT32_BIT DockCap : 1; /* Supports Docking */
UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/
UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */
UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/
UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG */
UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed */
UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices */
UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */
/* Must be executed after writing the SLP_TYPx register. */
UINT32_BIT Reserved6 : 18; /* Reserved - must be zero */
/* must be executed after writing the SLP_TYPx register */
/* ACPI 3.0 flag bits */
UINT32_BIT PciExpWak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */
UINT32_BIT UsePlatformClock : 1; /* OSPM should use platform-provided timer */
UINT32_BIT S4RtcStsValid : 1; /* Contents of RTC_STS valid after S4 wake */
UINT32_BIT RemotePowerOnCapable : 1; /* System is compatible with remote power on */
UINT32_BIT ForceApicClusterModel : 1; /* All local APICs must use cluster model */
UINT32_BIT ForceApicPhysicalDestinationMode : 1; /* All local xAPICs must use physical dest mode */
UINT32_BIT Reserved6 : 12;/* Reserved - must be zero */
ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */
UINT8 Reserved7[3]; /* These three bytes must be zero */
UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */
UINT64 XDsdt; /* 64-bit physical address of DSDT */
@@ -275,7 +283,7 @@ typedef struct fadt_descriptor_rev2
} FADT_DESCRIPTOR_REV2;
/* "Downrevved" ACPI 2.0 FADT descriptor */
/* "Down-revved" ACPI 2.0 FADT descriptor */
typedef struct fadt_descriptor_rev2_minus
{
@@ -290,7 +298,7 @@ typedef struct fadt_descriptor_rev2_minus
} FADT_DESCRIPTOR_REV2_MINUS;
/* Embedded Controller */
/* ECDT - Embedded Controller Boot Resources Table */
typedef struct ec_boot_resources
{
@@ -304,6 +312,59 @@ typedef struct ec_boot_resources
} EC_BOOT_RESOURCES;
/* SRAT - System Resource Affinity Table */
typedef struct static_resource_alloc
{
UINT8 Type;
UINT8 Length;
UINT8 ProximityDomainLo;
UINT8 ApicId;
UINT32_BIT Enabled :1;
UINT32_BIT Reserved3 :31;
UINT8 LocalSapicEid;
UINT8 ProximityDomainHi[3];
UINT32 Reserved4;
} STATIC_RESOURCE_ALLOC;
typedef struct memory_affinity
{
UINT8 Type;
UINT8 Length;
UINT32 ProximityDomain;
UINT16 Reserved3;
UINT64 BaseAddress;
UINT64 AddressLength;
UINT32 Reserved4;
UINT32_BIT Enabled :1;
UINT32_BIT HotPluggable :1;
UINT32_BIT NonVolatile :1;
UINT32_BIT Reserved5 :29;
UINT64 Reserved6;
} MEMORY_AFFINITY;
typedef struct system_resource_affinity
{
ACPI_TABLE_HEADER_DEF
UINT32 Reserved1; /* Must be value '1' */
UINT64 Reserved2;
} SYSTEM_RESOURCE_AFFINITY;
/* SLIT - System Locality Distance Information Table */
typedef struct system_locality_info
{
ACPI_TABLE_HEADER_DEF
UINT64 LocalityCount;
UINT8 Entry[1][1];
} SYSTEM_LOCALITY_INFO;
#pragma pack()
#endif /* __ACTBL2_H__ */
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 1.1 $
* $Revision: 277 $
*
*****************************************************************************/
@@ -732,24 +732,26 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
#define ACPI_BITREG_WAKE_STATUS 0x06
#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07
#define ACPI_BITREG_TIMER_ENABLE 0x07
#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08
#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09
#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A
#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B
#define ACPI_BITREG_WAKE_ENABLE 0x0C
#define ACPI_BITREG_TIMER_ENABLE 0x08
#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
#define ACPI_BITREG_WAKE_ENABLE 0x0D
#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E
#define ACPI_BITREG_SCI_ENABLE 0x0D
#define ACPI_BITREG_BUS_MASTER_RLD 0x0E
#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F
#define ACPI_BITREG_SLEEP_TYPE_A 0x10
#define ACPI_BITREG_SLEEP_TYPE_B 0x11
#define ACPI_BITREG_SLEEP_ENABLE 0x12
#define ACPI_BITREG_SCI_ENABLE 0x0F
#define ACPI_BITREG_BUS_MASTER_RLD 0x10
#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11
#define ACPI_BITREG_SLEEP_TYPE_A 0x12
#define ACPI_BITREG_SLEEP_TYPE_B 0x13
#define ACPI_BITREG_SLEEP_ENABLE 0x14
#define ACPI_BITREG_ARB_DISABLE 0x13
#define ACPI_BITREG_ARB_DISABLE 0x15
#define ACPI_BITREG_MAX 0x13
#define ACPI_BITREG_MAX 0x15
#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
@@ -1314,6 +1316,7 @@ typedef struct acpi_resource_address64
UINT64 MaxAddressRange;
UINT64 AddressTranslationOffset;
UINT64 AddressLength;
UINT64 TypeSpecificAttributes;
ACPI_RESOURCE_SOURCE ResourceSource;
} ACPI_RESOURCE_ADDRESS64;
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 1.1 $
* $Revision: 166 $
*
*****************************************************************************/
@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
* $Revision: 1.1 $
* $Revision: 80 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amlresrc.h - AML resource descriptors
* $Revision: 1.1 $
* $Revision: 29 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdos16.h - DOS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 11 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acefi.h - OS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 16 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
* $Revision: 1.1 $
* $Revision: 112 $
*
*****************************************************************************/
@@ -213,15 +213,15 @@
#elif defined(__NetBSD__)
#include "acnetbsd.h"
#elif defined(__BEOS__)
#include "achaiku.h"
#elif defined(MODESTO)
#include "acmodesto.h"
#elif defined(NETWARE)
#include "acnetware.h"
#elif defined(__BEOS__)
#include "achaiku.h"
#else
/* All other environments */
@@ -302,6 +302,7 @@
*/
#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
#define ACPI_STRCHR(s1,c) strchr((s1), (c))
#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s))
#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s))
#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
@@ -365,19 +366,20 @@ typedef char *va_list;
#endif /* va_arg */
#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
#define ACPI_STRCHR(s1,c) AcpiUtStrchr ((s1), (c))
#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s))
#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s))
#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s))
#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s))
#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n))
#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n))
#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s))
#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s))
#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s))
#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s))
#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n))
#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((s1), (s2), (ACPI_SIZE)(n))
#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
#define ACPI_TOUPPER AcpiUtToUpper
#define ACPI_TOLOWER AcpiUtToLower
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 18 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 1.1 $
* $Revision: 27 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acintel.h - VC specific defines, etc.
* $Revision: 1.1 $
* $Revision: 12 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 36 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmsvc.h - VC specific defines, etc.
* $Revision: 1.1 $
* $Revision: 20 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnetbsd.h - OS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 6 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acwin.h - OS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 20 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acwin.h - OS specific defines, etc.
* $Revision: 1.1 $
* $Revision: 13 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 1.1 $
* $Revision: 75 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
* $Revision: 1.1 $
* $Revision: 11 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.1 $
* $Revision: 103 $
*
*****************************************************************************/
@@ -549,7 +549,16 @@ AcpiDsRestartControlMethod (
*/
WalkState->ReturnDesc = ReturnDesc;
}
else
/*
* The following code is the
* optional support for a so-called "implicit return". Some AML code
* assumes that the last value of the method is "implicitly" returned
* to the caller. Just save the last result as the return value.
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
else if (!AcpiDsDoImplicitReturn (ReturnDesc, WalkState, FALSE))
{
/*
* Delete the return value if it will not be used by the
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 1.1 $
* $Revision: 81 $
*
******************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 1.1 $
* $Revision: 121 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.1 $
* $Revision: 98 $
*
*****************************************************************************/
@@ -1126,6 +1126,10 @@ AcpiDsExecEndControlOp (
*/
if (Op->Common.Value.Arg)
{
/* Since we have a real Return(), delete any implicit return */
AcpiDsClearImplicitReturn (WalkState);
/* Return statement has an immediate operand */
Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
@@ -1155,6 +1159,10 @@ AcpiDsExecEndControlOp (
else if ((WalkState->Results) &&
(WalkState->Results->Results.NumResults > 0))
{
/* Since we have a real Return(), delete any implicit return */
AcpiDsClearImplicitReturn (WalkState);
/*
* The return value has come from a previous calculation.
*
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.1 $
* $Revision: 111 $
*
******************************************************************************/
@@ -128,8 +128,124 @@
ACPI_MODULE_NAME ("dsutils")
/*******************************************************************************
*
* FUNCTION: AcpiDsClearImplicitReturn
*
* PARAMETERS: WalkState - Current State
*
* RETURN: None.
*
* DESCRIPTION: Clear and remove a reference on an implicit return value. Used
* to delete "stale" return values (if enabled, the return value
* from every operator is saved at least momentarily, in case the
* parent method exits.)
*
******************************************************************************/
void
AcpiDsClearImplicitReturn (
ACPI_WALK_STATE *WalkState)
{
ACPI_FUNCTION_NAME ("DsClearImplicitReturn");
/*
* Slack must be enabled for this feature
*/
if (!AcpiGbl_EnableInterpreterSlack)
{
return;
}
if (WalkState->ImplicitReturnObj)
{
/*
* Delete any "stale" implicit return. However, in
* complex statements, the implicit return value can be
* bubbled up several levels.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Removing reference on stale implicit return obj %p\n",
WalkState->ImplicitReturnObj));
AcpiUtRemoveReference (WalkState->ImplicitReturnObj);
WalkState->ImplicitReturnObj = NULL;
}
}
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: AcpiDsDoImplicitReturn
*
* PARAMETERS: ReturnDesc - The return value
* WalkState - Current State
* AddReference - True if a reference should be added to the
* return object
*
* RETURN: TRUE if implicit return enabled, FALSE otherwise
*
* DESCRIPTION: Implements the optional "implicit return". We save the result
* of every ASL operator and control method invocation in case the
* parent method exit. Before storing a new return value, we
* delete the previous return value.
*
******************************************************************************/
BOOLEAN
AcpiDsDoImplicitReturn (
ACPI_OPERAND_OBJECT *ReturnDesc,
ACPI_WALK_STATE *WalkState,
BOOLEAN AddReference)
{
ACPI_FUNCTION_NAME ("DsDoImplicitReturn");
/*
* Slack must be enabled for this feature, and we must
* have a valid return object
*/
if ((!AcpiGbl_EnableInterpreterSlack) ||
(!ReturnDesc))
{
return (FALSE);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result %p will be implicitly returned; Prev=%p\n",
ReturnDesc,
WalkState->ImplicitReturnObj));
/*
* Delete any "stale" implicit return value first. However, in
* complex statements, the implicit return value can be
* bubbled up several levels, so we don't clear the value if it
* is the same as the ReturnDesc.
*/
if (WalkState->ImplicitReturnObj)
{
if (WalkState->ImplicitReturnObj == ReturnDesc)
{
return (TRUE);
}
AcpiDsClearImplicitReturn (WalkState);
}
/* Save the implicit return value, add a reference if requested */
WalkState->ImplicitReturnObj = ReturnDesc;
if (AddReference)
{
AcpiUtAddReference (ReturnDesc);
}
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsIsResultUsed
@@ -150,7 +266,6 @@ AcpiDsIsResultUsed (
{
const ACPI_OPCODE_INFO *ParentInfo;
ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
@@ -163,6 +278,19 @@ AcpiDsIsResultUsed (
}
/*
* We know that this operator is not a
* Return() operator (would not come here.) The following code is the
* optional support for a so-called "implicit return". Some AML code
* assumes that the last value of the method is "implicitly" returned
* to the caller. Just save the last result as the return value.
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
AcpiDsDoImplicitReturn (WalkState->ResultObj, WalkState, TRUE);
/*
* Now determine if the parent will use the result
*
* If there is no parent, or the parent is a ScopeOp, we are executing
* at the method level. An executing method typically has no parent,
* since each method is parsed separately. A method invoked externally
@@ -171,30 +299,10 @@ AcpiDsIsResultUsed (
if ((!Op->Common.Parent) ||
(Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP))
{
/*
* If this is the last statement in the method, we know it is not a
* Return() operator (would not come here.) The following code is the
* optional support for a so-called "implicit return". Some AML code
* assumes that the last value of the method is "implicitly" returned
* to the caller. Just save the last result as the return value.
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
if ((AcpiGbl_EnableInterpreterSlack) &&
(WalkState->ParserState.Aml >= WalkState->ParserState.AmlEnd))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result of [%s] will be implicitly returned\n",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
/* Use the top of the result stack as the implicit return value */
WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc[0];
return_VALUE (TRUE);
}
/* No parent, the return value cannot possibly be used */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
return_VALUE (FALSE);
}
@@ -347,9 +455,8 @@ AcpiDsDeleteResultIfNotUsed (
if (!AcpiDsIsResultUsed (Op, WalkState))
{
/*
* Must pop the result stack (ObjDesc should be equal to ResultObj)
*/
/* Must pop the result stack (ObjDesc should be equal to ResultObj) */
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_SUCCESS (Status))
{
@@ -426,9 +533,8 @@ AcpiDsClearOperands (
ACPI_FUNCTION_TRACE_PTR ("DsClearOperands", WalkState);
/*
* Remove a reference on each operand on the stack
*/
/* Remove a reference on each operand on the stack */
for (i = 0; i < WalkState->NumOperands; i++)
{
/*
@@ -498,11 +604,7 @@ AcpiDsCreateOperand (
return_ACPI_STATUS (Status);
}
/*
* All prefixes have been handled, and the name is
* in NameString
*/
/* All prefixes have been handled, and the name is in NameString */
/*
* Special handling for BufferField declarations. This is a deferred
@@ -697,7 +799,8 @@ AcpiDsCreateOperand (
*
* FUNCTION: AcpiDsCreateOperands
*
* PARAMETERS: FirstArg - First argument of a parser argument tree
* PARAMETERS: WalkState - Current state
* FirstArg - First argument of a parser argument tree
*
* RETURN: Status
*
@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.1 $
* $Revision: 117 $
*
*****************************************************************************/
@@ -166,6 +166,7 @@ AcpiDsGetPredicateValue (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
ACPI_FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
@@ -211,13 +212,19 @@ AcpiDsGetPredicateValue (
}
/*
* Result of predicate evaluation currently must
* be a number
* Result of predicate evaluation must be an Integer
* object. Implicitly convert the argument if necessary.
*/
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad predicate (not a number) ObjDesc=%p State=%p Type=%X\n",
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X\n",
ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_OPERAND_TYPE;
@@ -226,13 +233,13 @@ AcpiDsGetPredicateValue (
/* Truncate the predicate to 32-bits if necessary */
AcpiExTruncateFor32bitTable (ObjDesc);
AcpiExTruncateFor32bitTable (LocalObjDesc);
/*
* Save the result of the predicate evaluation on
* the control stack
*/
if (ObjDesc->Integer.Value)
if (LocalObjDesc->Integer.Value)
{
WalkState->ControlState->Common.Value = TRUE;
}
@@ -254,12 +261,16 @@ Cleanup:
/* Break to debugger to display result */
ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState));
/*
* Delete the predicate result object (we know that
* we don't need it anymore)
*/
if (LocalObjDesc != ObjDesc)
{
AcpiUtRemoveReference (LocalObjDesc);
}
AcpiUtRemoveReference (ObjDesc);
WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
@@ -402,9 +413,10 @@ AcpiDsExecBeginOp (
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
/* most operators with arguments */
/* Start a new result/operand state */
/*
* Most operators with arguments.
* Start a new result/operand state
*/
Status = AcpiDsResultStackPush (WalkState);
break;
@@ -579,21 +591,45 @@ AcpiDsExecEndOp (
/* 1 Operand, 0 ExternalResult, 0 InternalResult */
Status = AcpiDsExecEndControlOp (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
Status = AcpiDsResultStackPop (WalkState);
/* Make sure to properly pop the result stack */
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPop (WalkState);
}
else if (Status == AE_CTRL_PENDING)
{
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_PENDING;
}
}
break;
case AML_TYPE_METHOD_CALL:
/*
* If the method is referenced from within a package
* declaration, it is not a invocation of the method, just
* a reference to it.
*/
if ((Op->Asl.Parent) &&
((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", Op));
Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node->Object;
AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
return_ACPI_STATUS (AE_OK);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op));
/*
* (AML_METHODCALL) Op->Value->Arg->Node contains
* (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
* the method Node pointer
*/
/* NextOp points to the op that holds the method name */
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.1 $
* $Revision: 89 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 1.1 $
* $Revision: 61 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 1.1 $
* $Revision: 83 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 1.1 $
* $Revision: 80 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 1.1 $
* $Revision: 63 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 1.1 $
* $Revision: 104 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.1 $
* $Revision: 178 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 1.1 $
* $Revision: 121 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 1.1 $
* $Revision: 113 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 1.1 $
* $Revision: 129 $
*
*****************************************************************************/
@@ -173,6 +173,7 @@ AcpiExGetObjectReference (
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case AML_DEBUG_OP:
/* The referenced object is the pseudo-node for the local/arg */
@@ -181,7 +182,7 @@ AcpiExGetObjectReference (
default:
ACPI_REPORT_ERROR (("Unknown Reference subtype in get ref %X\n",
ACPI_REPORT_ERROR (("Unknown Reference opcode in GetReference %X\n",
ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -199,7 +200,7 @@ AcpiExGetObjectReference (
default:
ACPI_REPORT_ERROR (("Invalid descriptor type in get ref: %X\n",
ACPI_REPORT_ERROR (("Invalid descriptor type in GetReference: %X\n",
ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
return_ACPI_STATUS (AE_TYPE);
}
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 1.1 $
* $Revision: 25 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 1.1 $
* $Revision: 96 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 1.1 $
* $Revision: 165 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 1.1 $
* $Revision: 131 $
*
*****************************************************************************/
@@ -540,6 +540,12 @@ AcpiExOpcode_2A_1T_1R (
ReturnDesc->Reference.Object = Operand[0];
}
/*
* Add a reference to the target package/buffer/string for the life
* of the index.
*/
AcpiUtAddReference (Operand[0]);
/* Complete the Index reference object */
ReturnDesc->Reference.Opcode = AML_INDEX_OP;
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 1.1 $
* $Revision: 21 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
* $Revision: 1.1 $
* $Revision: 18 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 1.1 $
* $Revision: 130 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
* $Revision: 1.1 $
* $Revision: 88 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 1.1 $
* $Revision: 66 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 1.1 $
* $Revision: 127 $
*
*****************************************************************************/
@@ -516,6 +516,13 @@ AcpiExResolveMultiple (
* This could of course in turn be another reference object.
*/
ObjDesc = *(ObjDesc->Reference.Where);
if (!ObjDesc)
{
/* NULL package elements are allowed */
Type = 0; /* Uninitialized */
goto Exit;
}
break;
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 1.1 $
* $Revision: 74 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 1.1 $
* $Revision: 187 $
*
*****************************************************************************/
@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 1.1 $
* $Revision: 62 $
*
*****************************************************************************/
@@ -285,7 +285,6 @@ AcpiExStoreObjectToObject (
{
ACPI_OPERAND_OBJECT *ActualSrcDesc;
ACPI_STATUS Status = AE_OK;
ACPI_OBJECT_TYPE OriginalSrcType;
ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToObject", SourceDesc);
@@ -303,8 +302,7 @@ AcpiExStoreObjectToObject (
return_ACPI_STATUS (Status);
}
OriginalSrcType = ACPI_GET_OBJECT_TYPE (SourceDesc);
if (OriginalSrcType != ACPI_GET_OBJECT_TYPE (DestDesc))
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc))
{
/*
* The source type does not match the type of the destination.
@@ -359,8 +357,7 @@ AcpiExStoreObjectToObject (
* Note: There is different store behavior depending on the original
* source type
*/
Status = AcpiExStoreBufferToBuffer (OriginalSrcType, ActualSrcDesc,
DestDesc);
Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
break;
case ACPI_TYPE_PACKAGE:
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 1.1 $
* $Revision: 55 $
*
*****************************************************************************/
@@ -140,7 +140,6 @@
ACPI_STATUS
AcpiExStoreBufferToBuffer (
ACPI_OBJECT_TYPE OriginalSrcType,
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc)
{
@@ -151,9 +150,8 @@ AcpiExStoreBufferToBuffer (
ACPI_FUNCTION_TRACE_PTR ("ExStoreBufferToBuffer", SourceDesc);
/*
* We know that SourceDesc is a buffer by now
*/
/* We know that SourceDesc is a buffer by now */
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
Length = SourceDesc->Buffer.Length;
@@ -182,7 +180,17 @@ AcpiExStoreBufferToBuffer (
ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
#ifdef ACPI_OBSOLETE_BEHAVIOR
/*
* NOTE: ACPI versions up to 3.0 specified that the buffer must be
* truncated if the string is smaller than the buffer. However, "other"
* implementations of ACPI never did this and thus became the defacto
* standard. ACPI 3.0A changes this behavior such that the buffer
* is no longer truncated.
*/
/*
* OBSOLETE BEHAVIOR:
* If the original source was a string, we must truncate the buffer,
* according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer
* copy must not truncate the original buffer.
@@ -193,6 +201,7 @@ AcpiExStoreBufferToBuffer (
TargetDesc->Buffer.Length = Length;
}
#endif
}
else
{
@@ -238,9 +247,8 @@ AcpiExStoreStringToString (
ACPI_FUNCTION_TRACE_PTR ("ExStoreStringToString", SourceDesc);
/*
* We know that SourceDesc is a string by now.
*/
/* We know that SourceDesc is a string by now */
Buffer = (UINT8 *) SourceDesc->String.Pointer;
Length = SourceDesc->String.Length;
@@ -267,9 +275,8 @@ AcpiExStoreStringToString (
if (TargetDesc->String.Pointer &&
(!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
{
/*
* Only free if not a pointer into the DSDT
*/
/* Only free if not a pointer into the DSDT */
ACPI_MEM_FREE (TargetDesc->String.Pointer);
}
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
* $Revision: 1.1 $
* $Revision: 82 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 1.1 $
* $Revision: 113 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
* $Revision: 1.1 $
* $Revision: 77 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 1.1 $
* $Revision: 89 $
*
*****************************************************************************/
@@ -595,7 +595,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 1.1 $
* $Revision: 148 $
*
*****************************************************************************/
@@ -1358,8 +1358,8 @@ AcpiPsParseAml (
PreviousWalkState = WalkState;
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "ReturnValue=%p, State=%p\n",
WalkState->ReturnDesc, WalkState));
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "ReturnValue=%p, ImplicitValue=%p State=%p\n",
WalkState->ReturnDesc, WalkState->ImplicitReturnObj, WalkState));
/* Check if we have restarted a preempted walk */
@@ -1373,8 +1373,22 @@ AcpiPsParseAml (
* If the method return value is not used by the parent,
* The object is deleted
*/
Status = AcpiDsRestartControlMethod (WalkState,
PreviousWalkState->ReturnDesc);
if (!PreviousWalkState->ReturnDesc)
{
Status = AcpiDsRestartControlMethod (WalkState,
PreviousWalkState->ImplicitReturnObj);
}
else
{
/*
* We have a valid return value, delete any implicit
* return value.
*/
AcpiDsClearImplicitReturn (PreviousWalkState);
Status = AcpiDsRestartControlMethod (WalkState,
PreviousWalkState->ReturnDesc);
}
if (ACPI_SUCCESS (Status))
{
WalkState->WalkType |= ACPI_WALK_METHOD_RESTART;
@@ -1394,13 +1408,31 @@ AcpiPsParseAml (
*/
else if (PreviousWalkState->CallerReturnDesc)
{
*(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */
}
else if (PreviousWalkState->ReturnDesc)
{
/* Caller doesn't want it, must delete it */
if (PreviousWalkState->ImplicitReturnObj)
{
*(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ImplicitReturnObj;
}
else
{
/* NULL if no return value */
AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
*(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc;
}
}
else
{
if (PreviousWalkState->ReturnDesc)
{
/* Caller doesn't want it, must delete it */
AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
}
if (PreviousWalkState->ImplicitReturnObj)
{
/* Caller doesn't want it, must delete it */
AcpiUtRemoveReference (PreviousWalkState->ImplicitReturnObj);
}
}
AcpiDsDeleteWalkState (PreviousWalkState);
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psscope - Parser scope stack management routines
* $Revision: 1.1 $
* $Revision: 39 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
* $Revision: 1.1 $
* $Revision: 43 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
* $Revision: 1.1 $
* $Revision: 60 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
* $Revision: 1.1 $
* $Revision: 73 $
*
*****************************************************************************/
@@ -117,205 +117,11 @@
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("pswalk")
/*******************************************************************************
*
* FUNCTION: AcpiPsGetNextWalkOp
*
* PARAMETERS: WalkState - Current state of the walk
* Op - Current Op to be walked
* AscendingCallback - Procedure called when Op is complete
*
* RETURN: Status
*
* DESCRIPTION: Get the next Op in a walk of the parse tree.
*
******************************************************************************/
ACPI_STATUS
AcpiPsGetNextWalkOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_PARSE_UPWARDS AscendingCallback)
{
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *Parent;
ACPI_PARSE_OBJECT *GrandParent;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
/* Check for a argument only if we are descending in the tree */
if (WalkState->NextOpInfo != ACPI_NEXT_OP_UPWARD)
{
/* Look for an argument or child of the current op */
Next = AcpiPsGetArg (Op, 0);
if (Next)
{
/* Still going downward in tree (Op is not completed yet) */
WalkState->PrevOp = Op;
WalkState->NextOp = Next;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (AE_OK);
}
/*
* No more children, this Op is complete. Save Next and Parent
* in case the Op object gets deleted by the callback routine
*/
Next = Op->Common.Next;
Parent = Op->Common.Parent;
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = AscendingCallback (WalkState);
/*
* If we are back to the starting point, the walk is complete.
*/
if (Op == WalkState->Origin)
{
/* Reached the point of origin, the walk is complete */
WalkState->PrevOp = Op;
WalkState->NextOp = NULL;
return_ACPI_STATUS (Status);
}
/*
* Check for a sibling to the current op. A sibling means
* we are still going "downward" in the tree.
*/
if (Next)
{
/* There is a sibling, it will be next */
WalkState->PrevOp = Op;
WalkState->NextOp = Next;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
/* Continue downward */
return_ACPI_STATUS (Status);
}
/*
* Drop into the loop below because we are moving upwards in
* the tree
*/
}
else
{
/*
* We are resuming a walk, and we were (are) going upward in the tree.
* So, we want to drop into the parent loop below.
*/
Parent = Op;
}
/*
* Look for a sibling of the current Op's parent
* Continue moving up the tree until we find a node that has not been
* visited, or we get back to where we started.
*/
while (Parent)
{
/* We are moving up the tree, therefore this parent Op is complete */
GrandParent = Parent->Common.Parent;
Next = Parent->Common.Next;
WalkState->Op = Parent;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Common.AmlOpcode);
WalkState->Opcode = Parent->Common.AmlOpcode;
Status = AscendingCallback (WalkState);
/*
* If we are back to the starting point, the walk is complete.
*/
if (Parent == WalkState->Origin)
{
/* Reached the point of origin, the walk is complete */
WalkState->PrevOp = Parent;
WalkState->NextOp = NULL;
return_ACPI_STATUS (Status);
}
/*
* If there is a sibling to this parent (it is not the starting point
* Op), then we will visit it.
*/
if (Next)
{
/* found sibling of parent */
WalkState->PrevOp = Parent;
WalkState->NextOp = Next;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (Status);
}
/* No siblings, no errors, just move up one more level in the tree */
Op = Parent;
Parent = GrandParent;
WalkState->PrevOp = Op;
}
/*
* Got all the way to the top of the tree, we must be done!
* However, the code should have terminated in the loop above
*/
WalkState->NextOp = NULL;
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsDeleteCompletedOp
*
* PARAMETERS: State - Walk state
* Op - Completed op
*
* RETURN: AE_OK
*
* DESCRIPTION: Callback function for AcpiPsGetNextWalkOp(). Used during
* AcpiPsDeleteParse tree to delete Op objects when all sub-objects
* have been visited (and deleted.)
*
******************************************************************************/
ACPI_STATUS
AcpiPsDeleteCompletedOp (
ACPI_WALK_STATE *WalkState)
{
AcpiPsFreeOp (WalkState->Op);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsDeleteParseTree
@@ -332,62 +138,57 @@ void
AcpiPsDeleteParseTree (
ACPI_PARSE_OBJECT *SubtreeRoot)
{
ACPI_WALK_STATE *WalkState;
ACPI_THREAD_STATE *Thread;
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *Op = SubtreeRoot;
ACPI_PARSE_OBJECT *Next = NULL;
ACPI_PARSE_OBJECT *Parent = NULL;
ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
if (!SubtreeRoot)
{
return_VOID;
}
/* Create and initialize a new walk list */
Thread = AcpiUtCreateThreadState ();
if (!Thread)
{
return_VOID;
}
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, Thread);
if (!WalkState)
{
return_VOID;
}
WalkState->ParseFlags = 0;
WalkState->DescendingCallback = NULL;
WalkState->AscendingCallback = NULL;
WalkState->Origin = SubtreeRoot;
WalkState->NextOp = SubtreeRoot;
/* Head downward in the tree */
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
/* Visit all nodes in the subtree */
while (WalkState->NextOp)
while (Op)
{
Status = AcpiPsGetNextWalkOp (WalkState, WalkState->NextOp,
AcpiPsDeleteCompletedOp);
if (ACPI_FAILURE (Status))
/* Check if we are not ascending */
if (Op != Parent)
{
break;
/* Look for an argument or child of the current op */
Next = AcpiPsGetArg (Op, 0);
if (Next)
{
/* Still going downward in tree (Op is not completed yet) */
Op = Next;
continue;
}
}
/*
* No more children, this Op is complete.
*/
Next = Op->Common.Next;
Parent = Op->Common.Parent;
AcpiPsFreeOp (Op);
/*
* If we are back to the starting point, the walk is complete.
*/
if (Op == SubtreeRoot)
{
return_VOID;
}
if (Next)
{
Op = Next;
}
else
{
Op = Parent;
}
}
/* We are done with this walk */
AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread));
AcpiDsDeleteWalkState (WalkState);
return_VOID;
}
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
* $Revision: 1.1 $
* $Revision: 76 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 1.1 $
* $Revision: 187 $
*
******************************************************************************/
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 1.1 $
* $Revision: 89 $
*
******************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 1.1 $
* $Revision: 161 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 1.1 $
* $Revision: 13 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 1.1 $
* $Revision: 130 $
*
******************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
* $Revision: 1.1 $
* $Revision: 64 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
* $Revision: 1.1 $
* $Revision: 70 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
* $Revision: 1.1 $
* $Revision: 87 $
*
******************************************************************************/
@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
* $Revision: 1.1 $
* $Revision: 91 $
*
******************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsparse - namespace interface to AML parser
* $Revision: 1.1 $
* $Revision: 7 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
* $Revision: 1.1 $
* $Revision: 104 $
*
******************************************************************************/
@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 1.1 $
* $Revision: 137 $
*
*****************************************************************************/
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
* $Revision: 1.1 $
* $Revision: 38 $
*
*****************************************************************************/
@@ -2,7 +2,7 @@
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
* $Revision: 1.1 $
* $Revision: 15 $
*
******************************************************************************/
@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
* $Revision: 1.1 $
* $Revision: 103 $
*
*****************************************************************************/

Some files were not shown because too many files have changed in this diff Show More