diff options
author | Nate Lawson <njl@FreeBSD.org> | 2003-12-09 02:45:16 +0000 |
---|---|---|
committer | Nate Lawson <njl@FreeBSD.org> | 2003-12-09 02:45:16 +0000 |
commit | e50beb517da1c050acb9fb2b9751bcd9651df1a1 (patch) | |
tree | 24e5ad5d8b4fb5681ddaa34c6ae30814c80ffe56 /sys/contrib | |
parent | 4f023945aca7d5e935e9d22b62c9b02de662d383 (diff) | |
download | src-e50beb517da1c050acb9fb2b9751bcd9651df1a1.tar.gz src-e50beb517da1c050acb9fb2b9751bcd9651df1a1.zip |
Import ACPI-CA 20031203
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=123315
Diffstat (limited to 'sys/contrib')
100 files changed, 1951 insertions, 1199 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index bba73c621c56..47ea169288d4 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 139 $ + * $Revision: 145 $ * *****************************************************************************/ @@ -137,7 +137,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20030619 +#define ACPI_CA_VERSION 0x20031203 /* Maximum objects in the various object caches */ diff --git a/sys/contrib/dev/acpica/acdisasm.h b/sys/contrib/dev/acpica/acdisasm.h index 801e6d6b6058..c7aee64f268e 100644 --- a/sys/contrib/dev/acpica/acdisasm.h +++ b/sys/contrib/dev/acpica/acdisasm.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdisasm.h - AML disassembler - * $Revision: 9 $ + * $Revision: 10 $ * *****************************************************************************/ diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h index 825ad596f9b6..6352e3a67956 100644 --- a/sys/contrib/dev/acpica/acenv.h +++ b/sys/contrib/dev/acpica/acenv.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acenv.h - Generation environment specific items - * $Revision: 104 $ + * $Revision: 105 $ * *****************************************************************************/ @@ -207,6 +207,9 @@ #elif defined(__FreeBSD__) #include "acfreebsd.h" +#elif defined(__NetBSD__) +#include "acnetbsd.h" + #elif defined(MODESTO) #include "acmodesto.h" @@ -260,13 +263,14 @@ #define DEBUGGER_SINGLE_THREADED 0 #define DEBUGGER_MULTI_THREADED 1 +#ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif - +#endif /* !DEBUGGER_THREADING */ /****************************************************************************** * diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h index 172a5f7a30e2..70202811fe43 100644 --- a/sys/contrib/dev/acpica/acevents.h +++ b/sys/contrib/dev/acpica/acevents.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 91 $ + * $Revision: 92 $ * *****************************************************************************/ @@ -255,6 +255,17 @@ AcpiEvDetachRegion ( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked); +ACPI_STATUS +AcpiEvExecuteRegMethod ( + ACPI_OPERAND_OBJECT *RegionObj, + UINT32 Function); + +ACPI_STATUS +AcpiEvRegRun ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); /* * Evregini - Region initialization and setup diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h index 8aaacf2fe763..dc5f6e07ef3f 100644 --- a/sys/contrib/dev/acpica/acexcep.h +++ b/sys/contrib/dev/acpica/acexcep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 68 $ + * $Revision: 69 $ * *****************************************************************************/ @@ -236,6 +236,7 @@ #define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001E | AE_CODE_AML) #define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML) #define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x0020 | AE_CODE_AML) +#define AE_AML_BAD_RESOURCE_LENGTH (ACPI_STATUS) (0x0021 | AE_CODE_AML) #define AE_CODE_AML_MAX 0x0020 @@ -353,7 +354,8 @@ char const *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_ALIGNMENT", "AE_AML_NO_RESOURCE_END_TAG", "AE_AML_BAD_RESOURCE_VALUE", - "AE_AML_CIRCULAR_REFERENCE" + "AE_AML_CIRCULAR_REFERENCE", + "AE_AML_BAD_RESOURCE_LENGTH" }; char const *AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h index 7ee14d3922e2..287906b4ba9a 100644 --- a/sys/contrib/dev/acpica/acglobal.h +++ b/sys/contrib/dev/acpica/acglobal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 143 $ + * $Revision: 144 $ * *****************************************************************************/ @@ -179,6 +179,9 @@ ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS; ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; + +/* Keep local copies of these FADT-based registers */ + ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index a0212aa84e54..5cc8d18cda95 100644 --- a/sys/contrib/dev/acpica/acmacros.h +++ b/sys/contrib/dev/acpica/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 145 $ + * $Revision: 147 $ * *****************************************************************************/ @@ -121,7 +121,6 @@ /* * Data manipulation macros */ - #define ACPI_LOWORD(l) ((UINT16)(UINT32)(l)) #define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF)) #define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) @@ -167,10 +166,18 @@ #endif #endif - /* - * Extract a byte of data using a pointer. Any more than a byte and we - * get into potential aligment issues -- see the STORE macros below - */ +/* + * printf() format helpers + */ + +/* 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) + +/* + * Extract a byte of data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below + */ #define ACPI_GET8(addr) (*(UINT8*)(addr)) /* Pointer arithmetic */ @@ -202,7 +209,6 @@ * If the hardware supports the transfer of unaligned data, just do the store. * Otherwise, we have to move one byte at a time. */ - #ifdef ACPI_BIG_ENDIAN /* * Macros for big-endian machines @@ -372,7 +378,6 @@ /* * Fast power-of-two math macros for non-optimized compilers */ - #define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) #define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) #define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) @@ -516,7 +521,6 @@ /* * Reporting macros that are never compiled out */ - #define ACPI_PARAM_LIST(pl) pl /* @@ -524,7 +528,6 @@ * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only * use it in debug mode. */ - #ifdef ACPI_DEBUG_OUTPUT #define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \ @@ -563,7 +566,6 @@ /* * Debug macros that are conditionally compiled */ - #ifdef ACPI_DEBUG_OUTPUT #define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; @@ -573,7 +575,6 @@ * The first parameter should be the procedure name as a quoted string. This is declared * as a local string ("_ProcName) so that it can be also used by the function exit macros below. */ - #define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \ _Dbg.ComponentId = _COMPONENT; \ _Dbg.ProcName = a; \ @@ -635,7 +636,6 @@ /* * Generate INT3 on ACPI_ERROR (Debug only!) */ - #define ACPI_ERROR_BREAK #ifdef ACPI_ERROR_BREAK #define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \ @@ -650,7 +650,6 @@ * 1) Debug print for the current component is enabled * 2) Debug error level or trace level for the print statement is enabled */ - #define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl) #define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl) @@ -660,7 +659,6 @@ * This is the non-debug case -- make everything go away, * leaving no executable debug code! */ - #define ACPI_MODULE_NAME(name) #define _THIS_MODULE "" @@ -735,7 +733,6 @@ /* * Memory allocation tracking (DEBUG ONLY) */ - #ifndef ACPI_DBG_TRACK_ALLOCATIONS /* Memory allocation */ diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h index 5abe9839d2d4..4955b06dac34 100644 --- a/sys/contrib/dev/acpica/acobject.h +++ b/sys/contrib/dev/acpica/acobject.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 120 $ + * $Revision: 122 $ * *****************************************************************************/ @@ -187,7 +187,7 @@ #define ACPI_COMMON_NOTIFY_INFO \ union acpi_operand_object *SystemNotify; /* Handler for system notifies */\ union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\ - union acpi_operand_object *AddressSpace; /* Handler for Address space */ + union acpi_operand_object *Handler; /* Handler for Address space */ /****************************************************************************** @@ -295,7 +295,7 @@ typedef struct acpi_object_region ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId; - union acpi_operand_object *AddressSpace; /* Handler for region access */ + union acpi_operand_object *Handler; /* Handler for region access */ ACPI_NAMESPACE_NODE *Node; /* containing object */ union acpi_operand_object *Next; UINT32 Length; @@ -562,21 +562,22 @@ typedef union acpi_operand_object /* Object descriptor types */ -#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */ -#define ACPI_DESC_TYPE_STATE 0x20 -#define ACPI_DESC_TYPE_STATE_UPDATE 0x21 -#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22 -#define ACPI_DESC_TYPE_STATE_CONTROL 0x23 -#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24 -#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25 -#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26 -#define ACPI_DESC_TYPE_STATE_RESULT 0x27 -#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28 -#define ACPI_DESC_TYPE_STATE_THREAD 0x29 -#define ACPI_DESC_TYPE_WALK 0x44 -#define ACPI_DESC_TYPE_PARSER 0x66 -#define ACPI_DESC_TYPE_OPERAND 0x88 -#define ACPI_DESC_TYPE_NAMED 0xAA +#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x02 +#define ACPI_DESC_TYPE_STATE_UPDATE 0x03 +#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 +#define ACPI_DESC_TYPE_STATE_CONTROL 0x05 +#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06 +#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07 +#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08 +#define ACPI_DESC_TYPE_STATE_RESULT 0x09 +#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A +#define ACPI_DESC_TYPE_STATE_THREAD 0x0B +#define ACPI_DESC_TYPE_WALK 0x0C +#define ACPI_DESC_TYPE_PARSER 0x0D +#define ACPI_DESC_TYPE_OPERAND 0x0E +#define ACPI_DESC_TYPE_NAMED 0x0F +#define ACPI_DESC_TYPE_MAX 0x0F typedef union acpi_descriptor diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h index 9ce641ee83dd..0e8c5fdbd341 100644 --- a/sys/contrib/dev/acpica/acstruct.h +++ b/sys/contrib/dev/acpica/acstruct.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 25 $ + * $Revision: 26 $ * *****************************************************************************/ @@ -164,11 +164,12 @@ typedef struct acpi_walk_state struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ union acpi_operand_object **CallerReturnDesc; ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ + struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */ 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 */ union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */ - struct acpi_namespace_node *MethodNode; /* Method Node if running a method */ + struct acpi_namespace_node *MethodNode; /* Method node if running a method. */ ACPI_PARSE_OBJECT *Op; /* Current parser op */ union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/actbl.h index 0482fac6ae0f..cca9c3dace5b 100644 --- a/sys/contrib/dev/acpica/actbl.h +++ b/sys/contrib/dev/acpica/actbl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl.h - Table data structures defined in ACPI specification - * $Revision: 59 $ + * $Revision: 60 $ * *****************************************************************************/ @@ -138,16 +138,6 @@ #define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ -/* values of Mapic.Model */ - -#define DUAL_PIC 0 -#define MULTIPLE_APIC 1 - -/* values of Type in APIC_HEADER */ - -#define APIC_PROC 0 -#define APIC_IO 1 - /* * Common table types. The base code can remain @@ -162,8 +152,10 @@ #pragma pack(1) /* - * Architecture-independent tables - * The architecture dependent tables are in separate files + * ACPI Version-independent tables + * + * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) + * are in separate files. */ typedef struct rsdp_descriptor /* Root System Descriptor Pointer */ { @@ -180,21 +172,6 @@ typedef struct rsdp_descriptor /* Root System Descriptor Pointer */ } RSDP_DESCRIPTOR; -typedef struct acpi_table_header /* ACPI common table header */ -{ - char Signature [4]; /* ACPI signature (4 ASCII characters) */ - UINT32 Length; /* Length of table, in bytes, including header */ - UINT8 Revision; /* ACPI Specification minor version # */ - UINT8 Checksum; /* To make sum of entire table == 0 */ - char OemId [6]; /* OEM identification */ - char OemTableId [8]; /* OEM table identification */ - UINT32 OemRevision; /* OEM revision number */ - char AslCompilerId [4]; /* ASL compiler vendor ID */ - UINT32 AslCompilerRevision; /* ASL compiler revision number */ - -} ACPI_TABLE_HEADER; - - typedef struct acpi_common_facs /* Common FACS for internal use */ { UINT32 *GlobalLock; @@ -204,73 +181,208 @@ typedef struct acpi_common_facs /* Common FACS for internal use */ } ACPI_COMMON_FACS; -typedef struct apic_table +#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ + char Signature [4]; /* ACPI signature (4 ASCII characters) */\ + UINT32 Length; /* Length of table, in bytes, including header */\ + UINT8 Revision; /* ACPI Specification minor version # */\ + UINT8 Checksum; /* To make sum of entire table == 0 */\ + char OemId [6]; /* OEM identification */\ + char OemTableId [8]; /* OEM table identification */\ + UINT32 OemRevision; /* OEM revision number */\ + char AslCompilerId [4]; /* ASL compiler vendor ID */\ + UINT32 AslCompilerRevision; /* ASL compiler revision number */ + + +typedef struct acpi_table_header /* ACPI common table header */ { - ACPI_TABLE_HEADER Header; /* ACPI table header */ - UINT32 LocalApicAddress; /* Physical address for accessing local APICs */ - UINT32_BIT PCATCompat : 1; /* a one indicates system also has dual 8259s */ - UINT32_BIT Reserved1 : 31; + ACPI_TABLE_HEADER_DEF -} APIC_TABLE; +} ACPI_TABLE_HEADER; -typedef struct apic_header -{ - UINT8 Type; /* APIC type. Either APIC_PROC or APIC_IO */ - UINT8 Length; /* Length of APIC structure */ +/* + * MADT values and structures + */ + +/* Values for MADT PCATCompat */ + +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 -} APIC_HEADER; +/* Master MADT */ -typedef struct processor_apic +typedef struct multiple_apic_table { - APIC_HEADER Header; - UINT8 ProcessorApicId; /* ACPI processor id */ - UINT8 LocalApicId; /* Processor's local APIC id */ - UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + UINT32 LocalApicAddress; /* Physical address of local APIC */ + UINT32_BIT PCATCompat : 1; /* A one indicates system also has dual 8259s */ UINT32_BIT Reserved1 : 31; -} PROCESSOR_APIC; +} MULTIPLE_APIC_TABLE; + + +/* Values for Type in APIC_HEADER_DEF */ + +#define APIC_PROCESSOR 0 +#define APIC_IO 1 +#define APIC_XRUPT_OVERRIDE 2 +#define APIC_NMI 3 +#define APIC_LOCAL_NMI 4 +#define APIC_ADDRESS_OVERRIDE 5 +#define APIC_IO_SAPIC 6 +#define APIC_LOCAL_SAPIC 7 +#define APIC_XRUPT_SOURCE 8 +#define APIC_RESERVED 9 /* 9 and greater are reserved */ + +/* + * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) + */ +#define APIC_HEADER_DEF /* Common APIC sub-structure header */\ + UINT8 Type; \ + UINT8 Length; + +/* Values for MPS INTI flags */ + +#define POLARITY_CONFORMS 0 +#define POLARITY_ACTIVE_HIGH 1 +#define POLARITY_RESERVED 2 +#define POLARITY_ACTIVE_LOW 3 +#define TRIGGER_CONFORMS 0 +#define TRIGGER_EDGE 1 +#define TRIGGER_RESERVED 2 +#define TRIGGER_LEVEL 3 -typedef struct io_apic +/* Common flag definitions */ + +#define MPS_INTI_FLAGS \ + UINT16_BIT Polarity : 2; /* Polarity of APIC I/O input signals */\ + UINT16_BIT TriggerMode : 2; /* Trigger mode of APIC input signals */\ + UINT16_BIT Reserved1 : 12; /* Reserved, must be zero */ + +#define LOCAL_APIC_FLAGS \ + UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */\ + UINT32_BIT Reserved2 : 31; /* Reserved, must be zero */ + +/* Sub-structures for MADT */ + +typedef struct madt_processor_apic { - APIC_HEADER Header; + APIC_HEADER_DEF + UINT8 ProcessorId; /* ACPI processor id */ + UINT8 LocalApicId; /* Processor's local APIC id */ + LOCAL_APIC_FLAGS + +} MADT_PROCESSOR_APIC; + +typedef struct madt_io_apic +{ + APIC_HEADER_DEF UINT8 IoApicId; /* I/O APIC ID */ UINT8 Reserved; /* Reserved - must be zero */ - UINT32 IoApicAddress; /* APIC's physical address */ - UINT32 Vector; /* Interrupt vector index where INTI + UINT32 Address; /* APIC physical address */ + UINT32 Interrupt; /* Global system interrupt where INTI * lines start */ -} IO_APIC; +} MADT_IO_APIC; + +typedef struct madt_interrupt_override +{ + APIC_HEADER_DEF + UINT8 Bus; /* 0 - ISA */ + UINT8 Source; /* Interrupt source (IRQ) */ + UINT32 Interrupt; /* Global system interrupt */ + MPS_INTI_FLAGS +} MADT_INTERRUPT_OVERRIDE; -/* - * IA64 TBD: Add SAPIC Tables - */ +typedef struct madt_nmi_source +{ + APIC_HEADER_DEF + MPS_INTI_FLAGS + UINT32 Interrupt; /* Global system interrupt */ -/* - * IA64 TBD: Modify Smart Battery Description to comply with ACPI IA64 - * extensions. +} MADT_NMI_SOURCE; + +typedef struct madt_local_apic_nmi +{ + APIC_HEADER_DEF + UINT8 ProcessorId; /* ACPI processor id */ + MPS_INTI_FLAGS + UINT8 Lint; /* LINTn to which NMI is connected */ + +} MADT_LOCAL_APIC_NMI; + +typedef struct madt_address_override +{ + APIC_HEADER_DEF + UINT16 Reserved; /* Reserved - must be zero */ + UINT32 Address; /* APIC physical address */ + +} MADT_ADDRESS_OVERRIDE; + +typedef struct madt_io_sapic +{ + APIC_HEADER_DEF + UINT8 IoSapicId; /* I/O SAPIC ID */ + UINT8 Reserved; /* Reserved - must be zero */ + UINT32 InterruptBase; /* Glocal interrupt for SAPIC start */ + UINT64 Address; /* SAPIC physical address */ + +} MADT_IO_SAPIC; + +typedef struct madt_local_sapic +{ + APIC_HEADER_DEF + UINT8 ProcessorId; /* ACPI processor id */ + UINT8 LocalSapicId; /* SAPIC ID */ + UINT8 LocalSapicEid; /* SAPIC EID */ + UINT8 Reserved [3]; /* Reserved - must be zero */ + LOCAL_APIC_FLAGS + +} MADT_LOCAL_SAPIC; + +typedef struct madt_interrupt_source +{ + APIC_HEADER_DEF + MPS_INTI_FLAGS + UINT8 InterruptType; /* 1=PMI, 2=INIT, 3=corrected */ + UINT8 ProcessorId; /* Processor ID */ + UINT8 ProcessorEid; /* Processor EID */ + UINT8 IoSapicVector; /* Vector value for PMI interrupts */ + UINT32 Interrupt; /* Global system interrupt */ + UINT32 Reserved; /* Reserved - must be zero */ + +} MADT_INTERRUPT_SOURCE; + + +/* + * Smart Battery */ -typedef struct smart_battery_description_table +typedef struct smart_battery_table { - ACPI_TABLE_HEADER Header; + ACPI_TABLE_HEADER_DEF UINT32 WarningLevel; UINT32 LowLevel; UINT32 CriticalLevel; -} SMART_BATTERY_DESCRIPTION_TABLE; +} SMART_BATTERY_TABLE; -typedef struct hpet_description_table + +/* + * High performance timer + */ +typedef struct hpet_table { - ACPI_TABLE_HEADER Header; + ACPI_TABLE_HEADER_DEF UINT32 HardwareId; - UINT32 BaseAddress[3]; + UINT32 BaseAddress [3]; UINT8 HpetNumber; UINT16 ClockTick; UINT8 Attributes; -} HPET_DESCRIPTION_TABLE; +} HPET_TABLE; + #pragma pack() @@ -309,9 +421,10 @@ typedef struct acpi_table_support /* - * Get the architecture-specific tables + * Get the ACPI version-specific tables */ #include "actbl1.h" /* Acpi 1.0 table definitions */ #include "actbl2.h" /* Acpi 2.0 table definitions */ + #endif /* __ACTBL_H__ */ diff --git a/sys/contrib/dev/acpica/actbl1.h b/sys/contrib/dev/acpica/actbl1.h index 5b931a373cbb..7bdd38c23c77 100644 --- a/sys/contrib/dev/acpica/actbl1.h +++ b/sys/contrib/dev/acpica/actbl1.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl1.h - ACPI 1.0 tables - * $Revision: 26 $ + * $Revision: 27 $ * *****************************************************************************/ @@ -124,7 +124,7 @@ */ typedef struct rsdt_descriptor_rev1 { - ACPI_TABLE_HEADER Header; /* ACPI Table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 TableOffsetEntry [1]; /* Array of pointers to other */ /* ACPI tables */ } RSDT_DESCRIPTOR_REV1; @@ -152,7 +152,7 @@ typedef struct facs_descriptor_rev1 */ typedef struct fadt_descriptor_rev1 { - ACPI_TABLE_HEADER Header; /* ACPI Table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 FirmwareCtrl; /* Physical address of FACS */ UINT32 Dsdt; /* Physical address of DSDT */ UINT8 Model; /* System Interrupt Model */ diff --git a/sys/contrib/dev/acpica/actbl2.h b/sys/contrib/dev/acpica/actbl2.h index a6836452e4df..f60c99e49e57 100644 --- a/sys/contrib/dev/acpica/actbl2.h +++ b/sys/contrib/dev/acpica/actbl2.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 32 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -144,7 +144,7 @@ */ typedef struct rsdt_descriptor_rev2 { - ACPI_TABLE_HEADER Header; /* ACPI table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 TableOffsetEntry [1]; /* Array of pointers to */ /* ACPI table headers */ } RSDT_DESCRIPTOR_REV2; @@ -155,7 +155,7 @@ typedef struct rsdt_descriptor_rev2 */ typedef struct xsdt_descriptor_rev2 { - ACPI_TABLE_HEADER Header; /* ACPI table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT64 TableOffsetEntry [1]; /* Array of pointers to */ /* ACPI table headers */ } XSDT_DESCRIPTOR_REV2; @@ -199,7 +199,7 @@ typedef struct acpi_generic_address */ typedef struct fadt_descriptor_rev2 { - ACPI_TABLE_HEADER Header; /* ACPI table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ @@ -271,6 +271,21 @@ typedef struct fadt_descriptor_rev2 } FADT_DESCRIPTOR_REV2; +/* Embedded Controller */ + +typedef struct ec_boot_resources +{ + ACPI_TABLE_HEADER_DEF + ACPI_GENERIC_ADDRESS EcControl; /* Address of EC command/status register */ + ACPI_GENERIC_ADDRESS EcData; /* Address of EC data register */ + UINT32 Uid; /* Unique ID - must be same as the EC _UID method */ + UINT8 GpeBit; /* The GPE for the EC */ + UINT8 EcId[1]; /* Full namepath of the EC in the ACPI namespace */ + +} EC_BOOT_RESOURCES; + + + #pragma pack() #endif /* __ACTBL2_H__ */ diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index 3064a1fa513b..730a2b52057a 100644 --- a/sys/contrib/dev/acpica/actypes.h +++ b/sys/contrib/dev/acpica/actypes.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 261 $ + * $Revision: 262 $ * *****************************************************************************/ @@ -281,6 +281,7 @@ typedef UINT32 ACPI_SIZE; /* * Miscellaneous common types */ +typedef UINT16 UINT16_BIT; typedef UINT32 UINT32_BIT; typedef ACPI_NATIVE_UINT ACPI_PTRDIFF; diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index ca5202453599..db94284534f8 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 155 $ + * $Revision: 157 $ * *****************************************************************************/ @@ -199,6 +199,14 @@ AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type); char * +AcpiUtGetNodeName ( + void *Object); + +char * +AcpiUtGetDescriptorName ( + void *Object); + +char * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc); diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index a13baf8baad9..e54480ed34bc 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adisasm - Application-level disassembler routines - * $Revision: 58 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -521,12 +521,16 @@ AdAmlDisassemble ( if (!OutFilename) { fprintf (stderr, "Could not generate output filename\n"); + Status = AE_ERROR; + goto Cleanup; } File = fopen (DisasmFilename, "w+"); if (!File) { fprintf (stderr, "Could not open output file\n"); + Status = AE_ERROR; + goto Cleanup; } AcpiOsRedirectOutput (File); @@ -560,7 +564,7 @@ Cleanup: } AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot); - return AE_OK; + return Status; } @@ -593,7 +597,7 @@ AdCreateTableHeader ( AcpiOsPrintf (" *\n * Disassembly of %s, %s */\n", Filename, ctime (&Timer)); AcpiOsPrintf ( - "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", %d)\n", + "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", %u)\n", Table->Signature, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); } @@ -869,12 +873,17 @@ AdGetLocalTables ( if (GetAllTables) { - ACPI_STRNCPY (TableHeader.Signature, "RSDT", 4); + ACPI_STRNCPY (TableHeader.Signature, RSDT_SIG, 4); AcpiOsTableOverride (&TableHeader, &NewTable); + if (!NewTable) + { + fprintf (stderr, "Could not obtain RSDT\n"); + return AE_NO_ACPI_TABLES; + } #if ACPI_MACHINE_WIDTH != 64 - if (!ACPI_STRNCMP (NewTable->Signature, "RSDT", 4)) + if (!ACPI_STRNCMP (NewTable->Signature, RSDT_SIG, 4)) { PointerSize = sizeof (UINT32); } @@ -896,25 +905,25 @@ AdGetLocalTables ( /* Get the FADT */ - ACPI_STRNCPY (TableHeader.Signature, "FADT", 4); + ACPI_STRNCPY (TableHeader.Signature, FADT_SIG, 4); AcpiOsTableOverride (&TableHeader, &NewTable); if (NewTable) { AcpiGbl_FADT = (void *) NewTable; AdWriteTable (NewTable, NewTable->Length, - "FADT", NewTable->OemTableId); + FADT_SIG, NewTable->OemTableId); } AcpiOsPrintf ("\n"); /* Get the FACS */ - ACPI_STRNCPY (TableHeader.Signature, "FACS", 4); + ACPI_STRNCPY (TableHeader.Signature, FACS_SIG, 4); AcpiOsTableOverride (&TableHeader, &NewTable); if (NewTable) { AcpiGbl_FACS = (void *) NewTable; AdWriteTable (NewTable, AcpiGbl_FACS->Length, - "FACS", AcpiGbl_FADT->Header.OemTableId); + FACS_SIG, AcpiGbl_FADT->OemTableId); } AcpiOsPrintf ("\n"); } @@ -933,7 +942,7 @@ AdGetLocalTables ( else { fprintf (stderr, "Could not obtain DSDT\n"); - Status = AE_NO_ACPI_TABLES; + return AE_NO_ACPI_TABLES; } AcpiOsPrintf ("\n"); diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index a843f17bbaa5..ee3563fb5723 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslanalyze.c - check for semantic errors - * $Revision: 77 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -890,6 +890,15 @@ AnMethodAnalysisWalkBegin ( break; + case PARSEOP_STALL: + + if (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL); + } + break; + + case PARSEOP_DEVICE: case PARSEOP_EVENT: case PARSEOP_MUTEX: diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index fa3d45e2c7d5..dbcd94acd4f3 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslcompile - top level compile module - * $Revision: 69 $ + * $Revision: 72 $ * *****************************************************************************/ @@ -179,7 +179,7 @@ AslCompilerSignon ( /* Compiler signon with copyright */ FlPrintFile (FileId, - "%s\n%s%s\n%s%s version %X [%s]\n%s%s\n%sSupports ACPI Specification Revision 2.0b\n%s\n", + "%s\n%s%s\n%s%s version %X [%s]\n%s%s\n%sSupports ACPI Specification Revision 2.0c\n%s\n", Prefix, Prefix, IntelAcpiCA, Prefix, CompilerId, ACPI_CA_VERSION, __DATE__, @@ -298,6 +298,60 @@ CmFlushSourceCode (void) /******************************************************************************* * + * FUNCTION: FlCheckForAscii + * + * PARAMETERS: FileInfo - Points to an open input file + * + * RETURN: Status (0 = OK) + * + * DESCRIPTION: Verify that the input file is entirely ASCII. + * + ******************************************************************************/ + +ACPI_STATUS +FlCheckForAscii ( + ASL_FILE_INFO *FileInfo) +{ + UINT8 Byte; + ACPI_SIZE BadBytes = 0; + ACPI_SIZE Offset = 0; + + + /* Read the entire file */ + + while (fread (&Byte, 1, 1, FileInfo->Handle)) + { + /* Check for an ASCII character */ + + if (!isascii (Byte)) + { + if (BadBytes < 10) + { + AcpiOsPrintf ("Non-ASCII character: 0x%2.2X at offset 0x%X\n", Byte, Offset); + } + BadBytes++; + } + Offset++; + } + + /* Were there any non-ASCII characters in the file? */ + + if (BadBytes) + { + AcpiOsPrintf ("%d non-ASCII characters found in input file, appears to be binary\n", BadBytes); + AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename); + return (AE_BAD_CHARACTER); + } + + /* File is OK, seek back to the beginning */ + + fseek (FileInfo->Handle, 0, SEEK_SET); + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: CmDoCompile * * PARAMETERS: None @@ -327,6 +381,15 @@ CmDoCompile (void) return -1; } + /* Ensure that the input file is 100% ASCII text */ + + Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]); + if (ACPI_FAILURE (Status)) + { + AePrintErrorLog (ASL_FILE_STDERR); + return -1; + } + Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y index 307e876776ce..49f17b60fa4f 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.y +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y @@ -177,6 +177,9 @@ AslLocalAllocate (unsigned int Size); /* * Token types: These are returned by the lexer + * + * NOTE: This list MUST match the AslKeywordMapping table found + * in aslmap.c EXACTLY! Double check any changes! */ %token <i> PARSEOP_ACCESSAS @@ -187,7 +190,6 @@ AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_ACCESSATTRIB_QUICK %token <i> PARSEOP_ACCESSATTRIB_SND_RCV %token <i> PARSEOP_ACCESSATTRIB_WORD -%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL %token <i> PARSEOP_ACCESSTYPE_ANY %token <i> PARSEOP_ACCESSTYPE_BUF %token <i> PARSEOP_ACCESSTYPE_BYTE diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c index 3dbcf59f6fbe..17636fd5fd59 100644 --- a/sys/contrib/dev/acpica/compiler/aslfold.c +++ b/sys/contrib/dev/acpica/compiler/aslfold.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: aslfold - Constant folding - * $Revision: 7 $ + * $Revision: 8 $ * *****************************************************************************/ @@ -461,8 +461,7 @@ OpcAmlConstantWalk ( OpcSetOptimalIntegerSize (Op); DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (INTEGER) %8.8X%8.8X\n", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index 0518303ce3bc..b2ac72b7fc65 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asltree - parse tree management - * $Revision: 53 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -488,7 +488,7 @@ TrCreateValuedLeafNode ( DbgPrint (ASL_PARSE_OUTPUT, "\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %8.8X%8.8X ", Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode), - ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); + ACPI_FORMAT_UINT64 (Value)); Op->Asl.Value.Integer = Value; switch (ParseOpcode) diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index 8881ba506ab5..cc8da389318f 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: asltypes.h - compiler data types and struct definitions - * $Revision: 59 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -385,7 +385,9 @@ typedef enum ASL_MSG_CORE_EXCEPTION, ASL_MSG_UNREACHABLE_CODE, ASL_MSG_EARLY_EOF, - ASL_MSG_SCOPE_FWD_REF + ASL_MSG_SCOPE_FWD_REF, + ASL_MSG_NON_ASCII, + ASL_MSG_INVALID_TIME } ASL_MESSAGE_IDS; @@ -473,7 +475,10 @@ char *AslMessages [] = { /* ASL_MSG_CORE_EXCEPTION, */ "From ACPI CA Subsystem", /* ASL_MSG_UNREACHABLE_CODE, */ "Statement is unreachable", /* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", -/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope() not allowed" +/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope() not allowed", +/* ASL_MSG_NON_ASCII */ "Invalid characters found in file", +/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)" + }; diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 18d0ec8c34d0..0583d1b5aac3 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -126,7 +126,7 @@ #ifdef _USE_BERKELEY_YACC extern const char * const AslCompilername[]; -static const char * const *yytname = &AslCompilername[254]; +static const char * const *yytname = &AslCompilername[255]; #else extern const char * const yytname[]; #endif diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index 6ac31de22fdf..3e72daf3e730 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 105 $ + * $Revision: 109 $ * ******************************************************************************/ @@ -187,14 +187,16 @@ AcpiDbWalkForReferences ( if (Node == (void *) ObjDesc) { - AcpiOsPrintf ("Object is a Node [%4.4s]\n", Node->Name.Ascii); + AcpiOsPrintf ("Object is a Node [%4.4s]\n", + AcpiUtGetNodeName (Node)); } /* Check for match against the object attached to the node */ if (AcpiNsGetAttachedObject (Node) == ObjDesc) { - AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, Node->Name.Ascii); + AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", + Node, AcpiUtGetNodeName (Node)); } return (AE_OK); @@ -506,7 +508,8 @@ AcpiDbDumpNamespace ( if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED) { - AcpiOsPrintf ("Address %p is not a valid Named object\n", SubtreeEntry); + AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", + SubtreeEntry, AcpiUtGetDescriptorName (SubtreeEntry)); return; } } @@ -807,8 +810,7 @@ AcpiDbWalkForSpecificObjects ( case ACPI_TYPE_INTEGER: AcpiOsPrintf (" Value %8.8X%8.8X", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: @@ -819,8 +821,7 @@ AcpiDbWalkForSpecificObjects ( AcpiOsPrintf (" SpaceId %X Length %X Address %8.8X%8.8X", ObjDesc->Region.SpaceId, ObjDesc->Region.Length, - ACPI_HIDWORD (ObjDesc->Region.Address), - ACPI_LODWORD (ObjDesc->Region.Address)); + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address)); break; case ACPI_TYPE_PACKAGE: @@ -1208,8 +1209,8 @@ AcpiDbIntegrityWalk ( Info->Nodes++; if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { - AcpiOsPrintf ("Invalid Descriptor Type for Node %p, Type = %X\n", - Node, ACPI_GET_DESCRIPTOR_TYPE (Node)); + AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node)); } if (Node->Type > ACPI_TYPE_LOCAL_MAX) @@ -1229,8 +1230,8 @@ AcpiDbIntegrityWalk ( Info->Objects++; if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { - AcpiOsPrintf ("Invalid Descriptor Type for Object %p, Type = %X\n", - Object, ACPI_GET_DESCRIPTOR_TYPE (Object)); + AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n", + Object, AcpiUtGetDescriptorName (Object)); } } @@ -1290,7 +1291,7 @@ AcpiDbGenerateGpe ( BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); - GpeEventInfo = AcpiEvGetGpeEventInfo ((void *) BlockNumber, GpeNumber); + GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), GpeNumber); if (!GpeEventInfo) { AcpiOsPrintf ("Invalid GPE\n"); diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index 11f6930fc356..faaff168eb69 100644 --- a/sys/contrib/dev/acpica/dbdisply.c +++ b/sys/contrib/dev/acpica/dbdisply.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 95 $ + * $Revision: 98 $ * ******************************************************************************/ @@ -433,8 +433,10 @@ AcpiDbDisplayMethodInfo ( NumArgs = ObjDesc->Method.ParamCount; Concurrency = ObjDesc->Method.Concurrency; - AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", Node->Name.Ascii); - AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); + AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", + AcpiUtGetNodeName (Node)); + AcpiOsPrintf ("%X arguments, max concurrency = %X\n", + NumArgs, Concurrency); RootOp = StartOp; @@ -586,7 +588,7 @@ AcpiDbDisplayResults (void) } ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; + Node = WalkState->MethodNode; if (WalkState->Results) { @@ -594,7 +596,7 @@ AcpiDbDisplayResults (void) } AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - Node->Name.Ascii, NumResults); + AcpiUtGetNodeName (Node), NumResults); for (i = 0; i < NumResults; i++) { @@ -638,7 +640,7 @@ AcpiDbDisplayCallingTree (void) { Node = WalkState->MethodNode; - AcpiOsPrintf (" [%4.4s]\n", Node->Name.Ascii); + AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); WalkState = WalkState->Next; } @@ -649,11 +651,11 @@ AcpiDbDisplayCallingTree (void) * * FUNCTION: AcpiDbDisplayObjectType * - * PARAMETERS: None + * PARAMETERS: ObjectArg - User entered NS node handle * * RETURN: None * - * DESCRIPTION: Display current calling tree of nested control methods + * DESCRIPTION: Display type of an arbitrary NS node * ******************************************************************************/ @@ -677,7 +679,7 @@ AcpiDbDisplayObjectType ( Info = Buffer.Pointer; AcpiOsPrintf ("HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n", &Info->HardwareId, - ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address), + ACPI_FORMAT_UINT64 (Info->Address), Info->CurrentStatus); if (Info->Valid & ACPI_VALID_CID) @@ -694,7 +696,6 @@ AcpiDbDisplayObjectType ( { AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); } - } @@ -767,11 +768,11 @@ AcpiDbDisplayArgumentObject ( * * FUNCTION: AcpiDbDisplayGpes * - * PARAMETERS: + * PARAMETERS: None * * RETURN: None * - * DESCRIPTION: Display the GPE structures + * DESCRIPTION: Display the current GPE structures * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c index 309fe78de7a1..8b746c222262 100644 --- a/sys/contrib/dev/acpica/dbexec.c +++ b/sys/contrib/dev/acpica/dbexec.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 54 $ + * $Revision: 55 $ * ******************************************************************************/ @@ -329,8 +329,8 @@ AcpiDbExecutionWalk ( Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj); - AcpiOsPrintf ("[%4.4s] returned %s\n", Node->Name.Ascii, - AcpiFormatException (Status)); + AcpiOsPrintf ("[%4.4s] returned %s\n", AcpiUtGetNodeName (Node), + AcpiFormatException (Status)); AcpiGbl_MethodExecuting = FALSE; return (AE_OK); diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index a0dd713c6546..58b11b74d945 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/dbfileio.c @@ -2,7 +2,7 @@ * * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 74 $ + * $Revision: 75 $ * ******************************************************************************/ @@ -261,12 +261,12 @@ AcpiDbCheckTextModeCorruption ( } } - /* + /* * Entire table scanned, each CR is part of a CR/LF pair -- * meaning that the table was treated as a text file somewhere. * * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the - * original table are left untouched by the text conversion process -- + * original table are left untouched by the text conversion process -- * meaning that we cannot simply replace CR/LF pairs with LFs. */ AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); @@ -358,7 +358,7 @@ AcpiDbReadTable ( if (Status == AE_BAD_CHECKSUM) { - Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table, + Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table, FileSize, (*Table)->Length); return (Status); } diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c index 68c68dffd5bd..a13301049408 100644 --- a/sys/contrib/dev/acpica/dbstats.c +++ b/sys/contrib/dev/acpica/dbstats.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbstats - Generation and display of ACPI table statistics - * $Revision: 68 $ + * $Revision: 69 $ * ******************************************************************************/ @@ -204,7 +204,7 @@ AcpiDbEnumerateObject ( AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify); AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify); - AcpiDbEnumerateObject (ObjDesc->Device.AddressSpace); + AcpiDbEnumerateObject (ObjDesc->Device.Handler); break; case ACPI_TYPE_BUFFER_FIELD: @@ -218,7 +218,7 @@ AcpiDbEnumerateObject ( case ACPI_TYPE_REGION: AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++; - AcpiDbEnumerateObject (ObjDesc->Region.AddressSpace); + AcpiDbEnumerateObject (ObjDesc->Region.Handler); break; case ACPI_TYPE_POWER: @@ -231,14 +231,14 @@ AcpiDbEnumerateObject ( AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify); AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify); - AcpiDbEnumerateObject (ObjDesc->Processor.AddressSpace); + AcpiDbEnumerateObject (ObjDesc->Processor.Handler); break; case ACPI_TYPE_THERMAL: AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify); AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify); - AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddressSpace); + AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler); break; default: diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c index 70c84fab0b0d..1c34edc9a27e 100644 --- a/sys/contrib/dev/acpica/dbutils.c +++ b/sys/contrib/dev/acpica/dbutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbutils - AML debugger utilities - * $Revision: 64 $ + * $Revision: 65 $ * ******************************************************************************/ @@ -268,8 +268,7 @@ AcpiDbDumpObject ( case ACPI_TYPE_INTEGER: AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; diff --git a/sys/contrib/dev/acpica/dmobject.c b/sys/contrib/dev/acpica/dmobject.c index 692e7c62af44..5ddb1144b93b 100644 --- a/sys/contrib/dev/acpica/dmobject.c +++ b/sys/contrib/dev/acpica/dmobject.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmobject - ACPI object decode and display - * $Revision: 1 $ + * $Revision: 6 $ * ******************************************************************************/ @@ -119,6 +119,7 @@ #include "amlcode.h" #include "acnamesp.h" #include "acdisasm.h" +#include "acparser.h" #ifdef ACPI_DISASSEMBLER @@ -127,7 +128,6 @@ ACPI_MODULE_NAME ("dmnames") - /***************************************************************************** * * FUNCTION: AcpiDmDumpMethodInfo @@ -163,6 +163,14 @@ AcpiDmDumpMethodInfo ( return; } + /* We may be executing a deferred opcode */ + + if (WalkState->DeferredNode) + { + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); + return; + } + /* Display exception and method name */ AcpiOsPrintf ("\n**** Exception %s during execution of method ", @@ -180,7 +188,7 @@ AcpiDmDumpMethodInfo ( while (NextWalkState) { AcpiOsPrintf (" Method [%4.4s] executing: ", - NextWalkState->MethodNode->Name.Ascii); + AcpiUtGetNodeName (NextWalkState->MethodNode)); /* First method is the currently executing method */ @@ -247,7 +255,7 @@ AcpiDmDecodeInternalObject ( if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { - AcpiOsPrintf (" %p", ObjDesc); + AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); return; } @@ -257,8 +265,8 @@ AcpiDmDecodeInternalObject ( { case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + AcpiOsPrintf (" %8.8X%8.8X", + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -315,7 +323,7 @@ AcpiDmDecodeNode ( AcpiOsPrintf ("<Node> Name %4.4s", - Node->Name.Ascii); + AcpiUtGetNodeName (Node)); if (Node->Flags & ANOBJ_METHOD_ARG) { @@ -436,7 +444,13 @@ AcpiDmDisplayInternalObject ( break; - case AML_REF_OF_OP: + case AML_LOAD_OP: + + AcpiOsPrintf ("[DdbHandle] "); + break; + + + case AML_REF_OF_OP: AcpiOsPrintf ("[RefOf] "); @@ -460,8 +474,9 @@ AcpiDmDisplayInternalObject ( default: - AcpiOsPrintf ("Unknown Reference opcode %X\n", - ObjDesc->Reference.Opcode); + AcpiOsPrintf ("Unknown Reference opcode %X (%s)\n", + ObjDesc->Reference.Opcode, + AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); break; } break; @@ -478,7 +493,8 @@ AcpiDmDisplayInternalObject ( default: - AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> "); + AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]", + AcpiUtGetDescriptorName (ObjDesc)); break; } @@ -508,14 +524,21 @@ AcpiDmDisplayLocals ( ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; + Node = WalkState->MethodNode; if (!Node) { AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n"); return; } - AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii); + if (Node->Type != ACPI_TYPE_METHOD) + { + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); + return; + } + + AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", + AcpiUtGetNodeName (Node)); for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { @@ -557,11 +580,17 @@ AcpiDmDisplayArguments ( return; } + if (Node->Type != ACPI_TYPE_METHOD) + { + AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); + return; + } + NumArgs = ObjDesc->Method.ParamCount; Concurrency = ObjDesc->Method.Concurrency; AcpiOsPrintf ("Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n", - Node->Name.Ascii, NumArgs, Concurrency); + AcpiUtGetNodeName (Node), NumArgs, Concurrency); for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { @@ -574,7 +603,3 @@ AcpiDmDisplayArguments ( #endif - - - - diff --git a/sys/contrib/dev/acpica/dmresrc.c b/sys/contrib/dev/acpica/dmresrc.c index fe1d81bb1b22..437bf5c54e77 100644 --- a/sys/contrib/dev/acpica/dmresrc.c +++ b/sys/contrib/dev/acpica/dmresrc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmresrc.c - Resource Descriptor disassembly - * $Revision: 8 $ + * $Revision: 10 $ * ******************************************************************************/ @@ -134,7 +134,7 @@ * * RETURN: None * - * DESCRIPTION: Dump a bit mask as a list of individual interrupt/dma levels. + * DESCRIPTION: Dump a bit mask as a list of individual interrupt/DMA levels. * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/dmresrcl.c b/sys/contrib/dev/acpica/dmresrcl.c index 34993ed5ef56..491415054334 100644 --- a/sys/contrib/dev/acpica/dmresrcl.c +++ b/sys/contrib/dev/acpica/dmresrcl.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly - * $Revision: 10 $ + * $Revision: 11 $ * ******************************************************************************/ @@ -358,28 +358,23 @@ AcpiDmQwordDescriptor ( AcpiOsPrintf ("\n"); AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X%8.8X,\n", - ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->Granularity)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->Granularity))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->Granularity))); AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X%8.8X,\n", - ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressMin)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressMin))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->AddressMin))); AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X%8.8X,\n", - ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressMax)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressMax))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->AddressMax))); AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X%8.8X,\n", - ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->TranslationOffset)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->TranslationOffset))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->TranslationOffset))); AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X%8.8X", - ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->AddressLength)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->AddressLength))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->AddressLength))); /* Optional fields */ @@ -518,8 +513,7 @@ AcpiDmGenericRegisterDescriptor ( AcpiOsPrintf ("0x%2.2X, 0x%2.2X, 0x%8.8X%8.8X)\n", (UINT32) Resource->BitWidth, (UINT32) Resource->BitOffset, - ACPI_HIDWORD (ACPI_GET_ADDRESS (Resource->Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Resource->Address))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->Address))); } diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c index aef5bc2c62ae..ed4920d6e9be 100644 --- a/sys/contrib/dev/acpica/dsfield.c +++ b/sys/contrib/dev/acpica/dsfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 72 $ + * $Revision: 73 $ * *****************************************************************************/ @@ -182,30 +182,38 @@ AcpiDsCreateBufferField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - /* - * During the load phase, we want to enter the name of the field into - * the namespace. During the execute phase (when we evaluate the size - * operand), we want to lookup the name - */ - if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE) + if (WalkState->DeferredNode) { - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; + Node = WalkState->DeferredNode; + Status = AE_OK; } else { - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; - } + /* + * During the load phase, we want to enter the name of the field into + * the namespace. During the execute phase (when we evaluate the size + * operand), we want to lookup the name + */ + if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE) + { + Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; + } + else + { + Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; + } - /* - * Enter the NameString into the namespace - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status); - return_ACPI_STATUS (Status); + /* + * Enter the NameString into the namespace + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status); + return_ACPI_STATUS (Status); + } } /* We could put the returned object (Node) on the object stack for later, but diff --git a/sys/contrib/dev/acpica/dsinit.c b/sys/contrib/dev/acpica/dsinit.c index 2045bf2e2f47..6905547306f1 100644 --- a/sys/contrib/dev/acpica/dsinit.c +++ b/sys/contrib/dev/acpica/dsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsinit - Object initialization namespace walk - * $Revision: 7 $ + * $Revision: 9 $ * *****************************************************************************/ @@ -183,7 +183,7 @@ AcpiDsInitOneObject ( if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", - ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, + ObjHandle, AcpiUtGetNodeName (ObjHandle), AcpiFormatException (Status))); } @@ -214,14 +214,14 @@ AcpiDsInitOneObject ( } /* - * Always parse methods to detect errors, we may delete + * Always parse methods to detect errors, we will delete * the parse tree below */ Status = AcpiDsParseMethod (ObjHandle); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", - ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, + ObjHandle, AcpiUtGetNodeName (ObjHandle), AcpiFormatException (Status))); /* This parse failed, but we will continue parsing more methods */ @@ -230,7 +230,7 @@ AcpiDsInitOneObject ( } /* - * Delete the parse tree. We simple re-parse the method + * Delete the parse tree. We simply re-parse the method * for every execution since there isn't much overhead */ AcpiNsDeleteNamespaceSubtree (ObjHandle); diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c index 83968c4652cb..46510034dd0d 100644 --- a/sys/contrib/dev/acpica/dsmethod.c +++ b/sys/contrib/dev/acpica/dsmethod.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 91 $ + * $Revision: 92 $ * *****************************************************************************/ @@ -169,7 +169,7 @@ AcpiDsParseMethod ( } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n", - ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle)); + AcpiUtGetNodeName (ObjHandle), ObjHandle)); /* Extract the method object from the method Node */ @@ -251,7 +251,7 @@ AcpiDsParseMethod ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", - ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle, Op)); + AcpiUtGetNodeName (ObjHandle), ObjHandle, Op)); AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c index 3515957d2329..2a632349710a 100644 --- a/sys/contrib/dev/acpica/dsmthdat.c +++ b/sys/contrib/dev/acpica/dsmthdat.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 71 $ + * $Revision: 74 $ * ******************************************************************************/ @@ -410,7 +410,7 @@ AcpiDsMethodDataSetValue ( return_ACPI_STATUS (Status); } - /* + /* * Increment ref count so object can't be deleted while installed. * NOTE: We do not copy the object in order to preserve the call by * reference semantics of ACPI Control Method invocation. @@ -662,13 +662,13 @@ AcpiDsStoreObjectToLocal ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *CurrentObjDesc; + ACPI_OPERAND_OBJECT *NewObjDesc; ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal"); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n", Opcode, Index, ObjDesc)); - /* Parameter validation */ if (!ObjDesc) @@ -693,6 +693,21 @@ AcpiDsStoreObjectToLocal ( } /* + * If the reference count on the object is more than one, we must + * take a copy of the object before we store. + */ + NewObjDesc = ObjDesc; + if (ObjDesc->Common.ReferenceCount > 1) + { + Status = AcpiUtCopyIobjectToIobject (ObjDesc, &NewObjDesc, WalkState); + NewObjDesc; + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* * If there is an object already in this slot, we either * have to delete it, or if this is an argument and there * is an object reference stored there, we have to do @@ -725,8 +740,8 @@ AcpiDsStoreObjectToLocal ( */ if (ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) != ACPI_DESC_TYPE_OPERAND) { - ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: %X\n", - CurrentObjDesc->Common.Type)); + ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", + AcpiUtGetDescriptorName (CurrentObjDesc))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -738,15 +753,22 @@ AcpiDsStoreObjectToLocal ( (CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Arg (%p) is an ObjRef(Node), storing in node %p\n", - ObjDesc, CurrentObjDesc)); + "Arg (%p) is an ObjRef(Node), storing in node %p\n", + NewObjDesc, CurrentObjDesc)); /* * Store this object to the Node * (perform the indirect store) */ - Status = AcpiExStoreObjectToNode (ObjDesc, + Status = AcpiExStoreObjectToNode (NewObjDesc, CurrentObjDesc->Reference.Object, WalkState); + + /* Remove local reference if we copied the object above */ + + if (NewObjDesc != ObjDesc) + { + AcpiUtRemoveReference (NewObjDesc); + } return_ACPI_STATUS (Status); } } @@ -759,12 +781,19 @@ AcpiDsStoreObjectToLocal ( } /* - * Install the ObjStack descriptor (*ObjDesc) into + * Install the Obj descriptor (*NewObjDesc) into * the descriptor for the Arg or Local. - * Install the new object in the stack entry * (increments the object reference count by one) */ - Status = AcpiDsMethodDataSetValue (Opcode, Index, ObjDesc, WalkState); + Status = AcpiDsMethodDataSetValue (Opcode, Index, NewObjDesc, WalkState); + + /* Remove local reference if we copied the object above */ + + if (NewObjDesc != ObjDesc) + { + AcpiUtRemoveReference (NewObjDesc); + } + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index 62d14f489188..82d72c236c2d 100644 --- a/sys/contrib/dev/acpica/dsopcode.c +++ b/sys/contrib/dev/acpica/dsopcode.c @@ -2,7 +2,7 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 87 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -139,7 +139,7 @@ * * RETURN: Status. * - * DESCRIPTION: Late execution of region or field arguments + * DESCRIPTION: Late (deferred) execution of region or field arguments * ****************************************************************************/ @@ -188,7 +188,10 @@ AcpiDsExecuteArguments ( return_ACPI_STATUS (Status); } + /* Mark this parse as a deferred opcode */ + WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP; + WalkState->DeferredNode = Node; /* Pass1: Parse the entire declaration */ @@ -206,7 +209,7 @@ AcpiDsExecuteArguments ( Arg->Common.Node = Node; AcpiPsDeleteParseTree (Op); - /* Evaluate the address and length arguments for the Buffer Field */ + /* Evaluate the deferred arguments */ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); if (!Op) @@ -224,6 +227,8 @@ AcpiDsExecuteArguments ( return_ACPI_STATUS (AE_NO_MEMORY); } + /* Execute the opcode and arguments */ + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, AmlLength, NULL, NULL, 3); if (ACPI_FAILURE (Status)) @@ -232,6 +237,9 @@ AcpiDsExecuteArguments ( return_ACPI_STATUS (Status); } + /* Mark this execution as a deferred opcode */ + + WalkState->DeferredNode = Node; Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); @@ -274,8 +282,8 @@ AcpiDsGetBufferFieldArguments ( Node = ObjDesc->BufferField.Node; ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n", - Node->Name.Ascii)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", + AcpiUtGetNodeName (Node))); /* Execute the AML code for the TermArg arguments */ @@ -289,7 +297,7 @@ AcpiDsGetBufferFieldArguments ( * * FUNCTION: AcpiDsGetBufferArguments * - * PARAMETERS: ObjDesc - A valid Bufferobject + * PARAMETERS: ObjDesc - A valid Buffer object * * RETURN: Status. * @@ -324,7 +332,7 @@ AcpiDsGetBufferArguments ( return_ACPI_STATUS (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer JIT Init\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); /* Execute the AML code for the TermArg arguments */ @@ -338,7 +346,7 @@ AcpiDsGetBufferArguments ( * * FUNCTION: AcpiDsGetPackageArguments * - * PARAMETERS: ObjDesc - A valid Packageobject + * PARAMETERS: ObjDesc - A valid Package object * * RETURN: Status. * @@ -373,7 +381,7 @@ AcpiDsGetPackageArguments ( return_ACPI_STATUS (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package JIT Init\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); /* Execute the AML code for the TermArg arguments */ @@ -423,11 +431,12 @@ AcpiDsGetRegionArguments ( Node = ObjDesc->Region.Node; - ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n", - Node->Name.Ascii, ExtraDesc->Extra.AmlStart)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); + /* Execute the argument AML */ Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); @@ -519,8 +528,8 @@ AcpiDsInitBufferField ( */ if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n", - AcpiPsGetOpcodeName (AmlOpcode))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", + AcpiPsGetOpcodeName (AmlOpcode), AcpiUtGetDescriptorName (ResultDesc))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -596,15 +605,17 @@ AcpiDsInitBufferField ( goto Cleanup; } - /* Entire field must fit within the current length of the buffer */ if ((BitOffset + BitCount) > (8 * (UINT32) BufferDesc->Buffer.Length)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field size %d exceeds Buffer size %d (bits)\n", - BitOffset + BitCount, 8 * (UINT32) BufferDesc->Buffer.Length)); + "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", + AcpiUtGetNodeName (ResultDesc), + BitOffset + BitCount, + AcpiUtGetNodeName (BufferDesc->Buffer.Node), + 8 * (UINT32) BufferDesc->Buffer.Length)); Status = AE_AML_BUFFER_LIMIT; goto Cleanup; } @@ -837,7 +848,7 @@ AcpiDsEvalRegionOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", ObjDesc, - ACPI_HIDWORD (ObjDesc->Region.Address), ACPI_LODWORD (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c index 11a140a0cebd..b6291fb0d42c 100644 --- a/sys/contrib/dev/acpica/dsutils.c +++ b/sys/contrib/dev/acpica/dsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 99 $ + * $Revision: 100 $ * ******************************************************************************/ @@ -127,6 +127,7 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsutils") + #ifndef ACPI_NO_METHOD_EXECUTION /******************************************************************************* @@ -277,7 +278,6 @@ ResultNotUsed: AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); return_VALUE (FALSE); - } @@ -322,7 +322,6 @@ AcpiDsDeleteResultIfNotUsed ( return_VOID; } - if (!AcpiDsIsResultUsed (Op, WalkState)) { /* @@ -479,67 +478,85 @@ AcpiDsCreateOperand ( * in NameString */ + /* - * Differentiate between a namespace "create" operation - * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. - * IMODE_EXECUTE) in order to support the creation of - * namespace objects during the execution of control methods. + * Special handling for BufferField declarations. This is a deferred + * opcode that unfortunately defines the field name as the last + * parameter instead of the first. We get here when we are performing + * the deferred execution, so the actual name of the field is already + * in the namespace. We don't want to attempt to look it up again + * because we may be executing in a different scope than where the + * actual opcode exists. */ - ParentOp = Arg->Common.Parent; - OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); - if ((OpInfo->Flags & AML_NSNODE) && - (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && - (ParentOp->Common.AmlOpcode != AML_REGION_OP) && - (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) + if ((WalkState->DeferredNode) && + (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) && + (ArgIndex != 0)) { - /* Enter name into namespace if not found */ - - InterpreterMode = ACPI_IMODE_LOAD_PASS2; + ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, WalkState->DeferredNode); + Status = AE_OK; } - - else + else /* All other opcodes */ { - /* Return a failure if name not found */ - - InterpreterMode = ACPI_IMODE_EXECUTE; - } + /* + * Differentiate between a namespace "create" operation + * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. + * IMODE_EXECUTE) in order to support the creation of + * namespace objects during the execution of control methods. + */ + ParentOp = Arg->Common.Parent; + OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); + if ((OpInfo->Flags & AML_NSNODE) && + (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && + (ParentOp->Common.AmlOpcode != AML_REGION_OP) && + (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) + { + /* Enter name into namespace if not found */ - Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, - ACPI_TYPE_ANY, InterpreterMode, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); - /* - * The only case where we pass through (ignore) a NOT_FOUND - * error is for the CondRefOf opcode. - */ - if (Status == AE_NOT_FOUND) - { - if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP) + InterpreterMode = ACPI_IMODE_LOAD_PASS2; + } + else { - /* - * For the Conditional Reference op, it's OK if - * the name is not found; We just need a way to - * indicate this to the interpreter, set the - * object to the root - */ - ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); - Status = AE_OK; + /* Return a failure if name not found */ + + InterpreterMode = ACPI_IMODE_EXECUTE; } - else + Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, + ACPI_TYPE_ANY, InterpreterMode, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); + /* + * The only case where we pass through (ignore) a NOT_FOUND + * error is for the CondRefOf opcode. + */ + if (Status == AE_NOT_FOUND) { - /* - * We just plain didn't find it -- which is a - * very serious error at this point - */ - Status = AE_AML_NAME_NOT_FOUND; + if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP) + { + /* + * For the Conditional Reference op, it's OK if + * the name is not found; We just need a way to + * indicate this to the interpreter, set the + * object to the root + */ + ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); + Status = AE_OK; + } + else + { + /* + * We just plain didn't find it -- which is a + * very serious error at this point + */ + Status = AE_AML_NAME_NOT_FOUND; + } } - } - if (ACPI_FAILURE (Status)) - { - ACPI_REPORT_NSERROR (NameString, Status); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_NSERROR (NameString, Status); + } } /* Free the namestring created above */ @@ -562,8 +579,6 @@ AcpiDsCreateOperand ( } ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState)); } - - else { /* Check for null name case */ @@ -580,7 +595,6 @@ AcpiDsCreateOperand ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg)); } - else { Opcode = Arg->Common.AmlOpcode; diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c index 6466788ac251..33ae710342a4 100644 --- a/sys/contrib/dev/acpica/dswexec.c +++ b/sys/contrib/dev/acpica/dswexec.c @@ -2,7 +2,7 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 103 $ + * $Revision: 105 $ * *****************************************************************************/ @@ -518,10 +518,26 @@ AcpiDsExecEndOp ( } else { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "[%s]: Could not resolve operands, %s\n", - AcpiPsGetOpcodeName (WalkState->Opcode), - AcpiFormatException (Status))); + /* + * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the + * Local is uninitialized. + */ + if ((Status == AE_AML_UNINITIALIZED_LOCAL) && + (WalkState->Opcode == AML_STORE_OP) && + (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + (WalkState->Operands[0]->Reference.Opcode == + WalkState->Operands[1]->Reference.Opcode)) + { + Status = AE_OK; + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "[%s]: Could not resolve operands, %s\n", + AcpiPsGetOpcodeName (WalkState->Opcode), + AcpiFormatException (Status))); + } } /* Always delete the argument objects and clear the operand stack */ diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c index bc9a30817463..c8f324ac6272 100644 --- a/sys/contrib/dev/acpica/dswload.c +++ b/sys/contrib/dev/acpica/dswload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 83 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -246,7 +246,7 @@ AcpiDsLoad1BeginOp ( ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p [%s] ", WalkState, Op, AcpiUtGetTypeName (ObjectType))); + "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType))); switch (WalkState->Opcode) { @@ -330,16 +330,27 @@ AcpiDsLoad1BeginOp ( * BufferField, or Package), the name of the object is already * in the namespace. */ + if (WalkState->DeferredNode) + { + /* This name is already in the namespace, get the node */ + + Node = WalkState->DeferredNode; + Status = AE_OK; + break; + } + Flags = ACPI_NS_NO_UPSEARCH; if ((WalkState->Opcode != AML_SCOPE_OP) && (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) { Flags |= ACPI_NS_ERROR_IF_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Cannot already exist\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", + AcpiUtGetTypeName (ObjectType))); } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Both Find or Create allowed\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", + AcpiUtGetTypeName (ObjectType))); } /* @@ -700,7 +711,18 @@ AcpiDsLoad2BeginOp ( * Enter the named type into the internal namespace. We enter the name * as we go downward in the parse tree. Any necessary subobjects that involve * arguments to the opcode must be created as we go back up the parse tree later. + * + * Note: Name may already exist if we are executing a deferred opcode. */ + if (WalkState->DeferredNode) + { + /* This name is already in the namespace, get the node */ + + Node = WalkState->DeferredNode; + Status = AE_OK; + break; + } + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node)); break; diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dswscope.c index fb6f579619b3..4ff6ed74ef06 100644 --- a/sys/contrib/dev/acpica/dswscope.c +++ b/sys/contrib/dev/acpica/dswscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 57 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -198,10 +198,9 @@ AcpiDsScopeStackPush ( if (!AcpiUtValidObjectType (Type)) { - ACPI_REPORT_WARNING (("DsScopeStackPush: type code out of range\n")); + ACPI_REPORT_WARNING (("DsScopeStackPush: Invalid object type: 0x%X\n", Type)); } - /* Allocate a new scope object */ ScopeInfo = AcpiUtCreateGenericState (); @@ -225,25 +224,24 @@ AcpiDsScopeStackPush ( if (OldScopeInfo) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[%4.4s] (%10s)", - OldScopeInfo->Scope.Node->Name.Ascii, + "[%4.4s] (%s)", + AcpiUtGetNodeName (OldScopeInfo->Scope.Node), AcpiUtGetTypeName (OldScopeInfo->Common.Value))); } else { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (%10s)", "ROOT")); + "[\\___] (%s)", "ROOT")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ", New scope -> [%4.4s] (%s)\n", - ScopeInfo->Scope.Node->Name.Ascii, + AcpiUtGetNodeName (ScopeInfo->Scope.Node), AcpiUtGetTypeName (ScopeInfo->Common.Value))); /* Push new scope object onto stack */ AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo); - return_ACPI_STATUS (AE_OK); } @@ -288,9 +286,9 @@ AcpiDsScopeStackPop ( WalkState->ScopeDepth--; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[%.2d] Popped scope [%4.4s] (%10s), New scope -> ", + "[%.2d] Popped scope [%4.4s] (%s), New scope -> ", (UINT32) WalkState->ScopeDepth, - ScopeInfo->Scope.Node->Name.Ascii, + AcpiUtGetNodeName (ScopeInfo->Scope.Node), AcpiUtGetTypeName (ScopeInfo->Common.Value))); NewScopeInfo = WalkState->ScopeInfo; @@ -298,7 +296,7 @@ AcpiDsScopeStackPop ( { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "[%4.4s] (%s)\n", - NewScopeInfo->Scope.Node->Name.Ascii, + AcpiUtGetNodeName (NewScopeInfo->Scope.Node), AcpiUtGetTypeName (NewScopeInfo->Common.Value))); } else @@ -308,7 +306,6 @@ AcpiDsScopeStackPop ( } AcpiUtDeleteGenericState (ScopeInfo); - return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c index 783dcab2da66..af595afa8cf3 100644 --- a/sys/contrib/dev/acpica/dswstate.c +++ b/sys/contrib/dev/acpica/dswstate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 75 $ + * $Revision: 76 $ * *****************************************************************************/ @@ -131,11 +131,12 @@ * FUNCTION: AcpiDsResultInsert * * PARAMETERS: Object - Object to push + * Index - Where to insert the object * WalkState - Current Walk state * * RETURN: Status * - * DESCRIPTION: Push an object onto this walk's result stack + * DESCRIPTION: Insert an object onto this walk's result stack * ******************************************************************************/ @@ -192,6 +193,7 @@ AcpiDsResultInsert ( * FUNCTION: AcpiDsResultRemove * * PARAMETERS: Object - Where to return the popped object + * Index - Where to extract the object * WalkState - Current Walk state * * RETURN: Status @@ -318,6 +320,7 @@ AcpiDsResultPop ( return (AE_AML_NO_RETURN_VALUE); } + /******************************************************************************* * * FUNCTION: AcpiDsResultPopFromBottom @@ -384,7 +387,6 @@ AcpiDsResultPopFromBottom ( *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", State, WalkState)); - return (AE_OK); } @@ -450,8 +452,7 @@ AcpiDsResultPush ( * * FUNCTION: AcpiDsResultStackPush * - * PARAMETERS: Object - Object to push - * WalkState - Current Walk state + * PARAMETERS: WalkState - Current Walk state * * RETURN: Status * @@ -514,7 +515,6 @@ AcpiDsResultStackPop ( return (AE_AML_NO_OPERAND); } - State = AcpiUtPopGenericState (&WalkState->Results); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, @@ -671,6 +671,7 @@ AcpiDsObjStackPopObject ( } #endif + /******************************************************************************* * * FUNCTION: AcpiDsObjStackPop @@ -742,6 +743,7 @@ AcpiDsObjStackPopAndDelete ( UINT32 i; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete"); @@ -994,8 +996,15 @@ AcpiDsCreateWalkState ( * FUNCTION: AcpiDsInitAmlWalk * * PARAMETERS: WalkState - New state to be initialized + * Op - Current parse op + * MethodNode - Control method NS node, if any + * AmlStart - Start of AML + * AmlLength - Length of AML + * Params - Method args, if any + * ReturnObjDesc - Where to store a return object, if any + * PassNumber - 1, 2, or 3 * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk * @@ -1039,10 +1048,10 @@ AcpiDsInitAmlWalk ( if (MethodNode) { - WalkState->ParserState.StartNode = MethodNode; - WalkState->WalkType = ACPI_WALK_METHOD; - WalkState->MethodNode = MethodNode; - WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode); + WalkState->ParserState.StartNode = MethodNode; + WalkState->WalkType = ACPI_WALK_METHOD; + WalkState->MethodNode = MethodNode; + WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode); /* Push start scope on scope stack and make it current */ @@ -1073,6 +1082,7 @@ AcpiDsInitAmlWalk ( { ExtraOp = ExtraOp->Common.Parent; } + if (!ExtraOp) { ParserState->StartNode = NULL; @@ -1138,7 +1148,7 @@ AcpiDsDeleteWalkState ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState)); } - /* Always must free any linked control states */ + /* Always must free any linked control states */ while (WalkState->ControlState) { diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c index 6f6402da7f68..925d0327102d 100644 --- a/sys/contrib/dev/acpica/evgpe.c +++ b/sys/contrib/dev/acpica/evgpe.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 27 $ + * $Revision: 31 $ * *****************************************************************************/ @@ -218,12 +218,10 @@ AcpiEvGpeDetect ( { UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT8 EnabledStatusByte; - UINT8 BitMask; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; UINT32 InValue; ACPI_STATUS Status; ACPI_GPE_BLOCK_INFO *GpeBlock; - UINT32 GpeNumber; UINT32 i; UINT32 j; @@ -270,11 +268,9 @@ AcpiEvGpeDetect ( ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n", - ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), GpeRegisterInfo->Status, - ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), GpeRegisterInfo->Enable)); /* First check if there is anything active at all in this register */ @@ -290,21 +286,19 @@ AcpiEvGpeDetect ( /* Now look at the individual GPEs in this byte register */ - for (j = 0, BitMask = 1; j < ACPI_GPE_REGISTER_WIDTH; j++, BitMask <<= 1) + for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { /* Examine one GPE bit */ - if (EnabledStatusByte & BitMask) + if (EnabledStatusByte & AcpiGbl_DecodeTo8bit[j]) { /* * Found an active GPE. Dispatch the event to a handler * or method. */ - GpeNumber = (i * ACPI_GPE_REGISTER_WIDTH) + j; - IntStatus |= AcpiEvGpeDispatch ( - &GpeBlock->EventInfo[GpeNumber], - GpeNumber + GpeBlock->RegisterInfo[GpeNumber].BaseGpeNumber); + &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j], + j + GpeRegisterInfo->BaseGpeNumber); } } } @@ -385,7 +379,7 @@ AcpiEvAsynchExecuteGpeMethod ( { ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2X]\n", AcpiFormatException (Status), - LocalGpeEventInfo.MethodNode->Name.Ascii, GpeNumber)); + AcpiUtGetNodeName (LocalGpeEventInfo.MethodNode), GpeNumber)); } } @@ -463,6 +457,20 @@ AcpiEvGpeDispatch ( /* Invoke the installed handler (at interrupt level) */ GpeEventInfo->Handler (GpeEventInfo->Context); + + /* It is now safe to clear level-triggered events. */ + + if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED) + { + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (( + "AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n", + GpeNumber)); + return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + } + } } else if (GpeEventInfo->MethodNode) { @@ -473,13 +481,16 @@ AcpiEvGpeDispatch ( Status = AcpiHwDisableGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", + ACPI_REPORT_ERROR (( + "AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", GpeNumber)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } - /* Execute the method associated with the GPE. */ - + /* + * Execute the method associated with the GPE + * NOTE: Level-triggered GPEs are cleared after the method completes. + */ if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE, AcpiEvAsynchExecuteGpeMethod, GpeEventInfo))) @@ -499,25 +510,13 @@ AcpiEvGpeDispatch ( /* * Disable the GPE. The GPE will remain disabled until the ACPI - * Core Subsystem is restarted, or the handler is reinstalled. + * Core Subsystem is restarted, or a handler is installed. */ Status = AcpiHwDisableGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", - GpeNumber)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); - } - } - - /* It is now safe to clear level-triggered events. */ - - if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED) - { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n", + ACPI_REPORT_ERROR (( + "AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", GpeNumber)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/evgpeblk.c index bd2fd226fb37..232726f15102 100644 --- a/sys/contrib/dev/acpica/evgpeblk.c +++ b/sys/contrib/dev/acpica/evgpeblk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpeblk - GPE block creation and initialization. - * $Revision: 23 $ + * $Revision: 26 $ * *****************************************************************************/ @@ -280,7 +280,7 @@ AcpiEvSaveMethodInfo ( Name[ACPI_NAME_SIZE] = 0; /* - * Edge/Level determination is based on the 2nd character + * Edge/Level determination is based on the 2nd character * of the method name */ switch (Name[1]) @@ -577,7 +577,7 @@ UnlockAndExit: * * RETURN: Status * - * DESCRIPTION: Install new GPE block with mutex support + * DESCRIPTION: Remove a GPE block * ******************************************************************************/ @@ -862,8 +862,7 @@ AcpiEvCreateGpeBlock ( ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)), GpeDevice->Name.Ascii, GpeBlock->RegisterCount, - ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)), InterruptLevel)); /* Find all GPE methods (_Lxx, _Exx) for this block */ diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c index a2f08b9d2c61..ec301c2a1235 100644 --- a/sys/contrib/dev/acpica/evmisc.c +++ b/sys/contrib/dev/acpica/evmisc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evmisc - Miscellaneous event manager support functions - * $Revision: 68 $ + * $Revision: 69 $ * *****************************************************************************/ @@ -278,7 +278,8 @@ AcpiEvQueueNotifyRequest ( /* There is no per-device notify handler for this device */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "No notify handler for [%4.4s] node %p\n", Node->Name.Ascii, Node)); + "No notify handler for [%4.4s] node %p\n", + AcpiUtGetNodeName (Node), Node)); } return (Status); diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c index 1404b31ca0ec..4a15e7fd4137 100644 --- a/sys/contrib/dev/acpica/evregion.c +++ b/sys/contrib/dev/acpica/evregion.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch - * $Revision: 141 $ + * $Revision: 146 $ * *****************************************************************************/ @@ -214,7 +214,7 @@ AcpiEvInitAddressSpaces ( * ******************************************************************************/ -static ACPI_STATUS +ACPI_STATUS AcpiEvExecuteRegMethod ( ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function) @@ -284,7 +284,7 @@ Cleanup: * * FUNCTION: AcpiEvAddressSpaceDispatch * - * PARAMETERS: RegionObj - internal region object + * PARAMETERS: RegionObj - Internal region object * SpaceId - ID of the address space (0-255) * Function - Read or Write operation * Address - Where in the space to read or write @@ -326,10 +326,12 @@ AcpiEvAddressSpaceDispatch ( /* Ensure that there is a handler associated with this region */ - HandlerDesc = RegionObj->Region.AddressSpace; + HandlerDesc = RegionObj->Region.Handler; if (!HandlerDesc) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "No handler for Region [%4.4s] (%p) [%s]\n", + AcpiUtGetNodeName (RegionObj->Region.Node), RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); @@ -411,8 +413,8 @@ AcpiEvAddressSpaceDispatch ( ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - &RegionObj->Region.AddressSpace->AddressSpace, Handler, - ACPI_HIDWORD (Address), ACPI_LODWORD (Address), + &RegionObj->Region.Handler->AddressSpace, Handler, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) @@ -454,6 +456,7 @@ AcpiEvAddressSpaceDispatch ( return_ACPI_STATUS (Status); } + /******************************************************************************* * * FUNCTION: AcpiEvDetachRegion @@ -477,7 +480,7 @@ AcpiEvDetachRegion( ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; - void *RegionContext; + void **RegionContext; ACPI_OPERAND_OBJECT *RegionObj2; ACPI_STATUS Status; @@ -490,11 +493,11 @@ AcpiEvDetachRegion( { return_VOID; } - RegionContext = RegionObj2->Extra.RegionContext; + RegionContext = &RegionObj2->Extra.RegionContext; /* Get the address handler from the region object */ - HandlerObj = RegionObj->Region.AddressSpace; + HandlerObj = RegionObj->Region.Handler; if (!HandlerObj) { /* This region has no handler, all done */ @@ -554,7 +557,7 @@ AcpiEvDetachRegion( RegionSetup = HandlerObj->AddressSpace.Setup; Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, - HandlerObj->AddressSpace.Context, &RegionContext); + HandlerObj->AddressSpace.Context, RegionContext); /* Init routine may fail, Just ignore errors */ @@ -577,7 +580,7 @@ AcpiEvDetachRegion( * If the region is on the handler's list * this better be the region's handler */ - RegionObj->Region.AddressSpace = NULL; + RegionObj->Region.Handler = NULL; AcpiUtRemoveReference (HandlerObj); return_VOID; @@ -620,17 +623,15 @@ AcpiEvAttachRegion ( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked) { - ACPI_STATUS Status; - ACPI_STATUS Status2; - ACPI_FUNCTION_TRACE ("EvAttachRegion"); ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Adding Region %p to address handler %p [%s]\n", - RegionObj, HandlerObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - + "Adding Region [%4.4s] %p to address handler %p [%s]\n", + AcpiUtGetNodeName (RegionObj->Region.Node), + RegionObj, HandlerObj, + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); /* Link this region to the front of the handler's list */ @@ -639,39 +640,15 @@ AcpiEvAttachRegion ( /* Install the region's handler */ - if (RegionObj->Region.AddressSpace) + if (RegionObj->Region.Handler) { return_ACPI_STATUS (AE_ALREADY_EXISTS); } - RegionObj->Region.AddressSpace = HandlerObj; + RegionObj->Region.Handler = HandlerObj; AcpiUtAddReference (HandlerObj); - /* - * Tell all users that this region is usable by running the _REG - * method - */ - if (AcpiNsIsLocked) - { - Status2 = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - } - - Status = AcpiEvExecuteRegMethod (RegionObj, 1); - - if (AcpiNsIsLocked) - { - Status2 = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - } - - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } @@ -679,9 +656,7 @@ AcpiEvAttachRegion ( * * FUNCTION: AcpiEvInstallHandler * - * PARAMETERS: Handle - Node to be dumped - * Level - Nesting level of the handle - * Context - Passed into AcpiNsWalkNamespace + * PARAMETERS: WalkNamespace callback * * DESCRIPTION: This routine installs an address handler into objects that are * of type Region or Device. @@ -755,7 +730,7 @@ AcpiEvInstallHandler ( { /* Check if this Device already has a handler for this address space */ - NextHandlerObj = ObjDesc->Device.AddressSpace; + NextHandlerObj = ObjDesc->Device.Handler; while (NextHandlerObj) { /* Found a handler, is it for the same address space? */ @@ -815,4 +790,82 @@ AcpiEvInstallHandler ( return (Status); } +/******************************************************************************* + * + * FUNCTION: AcpiEvRegRun + * + * PARAMETERS: WalkNamespace callback + * + * DESCRIPTION: Run _REG method for region objects of the requested spaceID + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvRegRun ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_OPERAND_OBJECT *HandlerObj; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME ("EvRegRun"); + + + HandlerObj = (ACPI_OPERAND_OBJECT *) Context; + + /* Parameter validation */ + + if (!HandlerObj) + { + return (AE_OK); + } + + /* Convert and validate the device handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + return (AE_BAD_PARAMETER); + } + + /* + * We only care about regions.and objects + * that are allowed to have address space handlers + */ + if ((Node->Type != ACPI_TYPE_REGION) && + (Node != AcpiGbl_RootNode)) + { + return (AE_OK); + } + + /* Check for an existing internal object */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + /* No object, just exit */ + + return (AE_OK); + } + + + /* Object is a Region */ + + if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId) + { + /* + * This region is for a different address space + * -- just ignore it + */ + return (AE_OK); + } + + Status = AcpiEvExecuteRegMethod (ObjDesc, 1); + return (Status); +} diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c index 12bb9273e2d9..499559715138 100644 --- a/sys/contrib/dev/acpica/evrgnini.c +++ b/sys/contrib/dev/acpica/evrgnini.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * $Revision: 69 $ + * $Revision: 72 $ * *****************************************************************************/ @@ -257,7 +257,7 @@ AcpiEvPciConfigRegionSetup ( ACPI_FUNCTION_TRACE ("EvPciConfigRegionSetup"); - HandlerObj = RegionObj->Region.AddressSpace; + HandlerObj = RegionObj->Region.Handler; if (!HandlerObj) { /* @@ -329,7 +329,7 @@ AcpiEvPciConfigRegionSetup ( { ACPI_REPORT_ERROR (( "Could not install PciConfig handler for Root Bridge %4.4s, %s\n", - PciRootNode->Name.Ascii, AcpiFormatException (Status))); + AcpiUtGetNodeName (PciRootNode), AcpiFormatException (Status))); } } break; @@ -570,7 +570,7 @@ AcpiEvInitializeRegion ( /* Setup defaults */ - RegionObj->Region.AddressSpace = NULL; + RegionObj->Region.Handler = NULL; RegionObj2->Extra.Method_REG = NULL; RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE); RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED; @@ -607,17 +607,17 @@ AcpiEvInitializeRegion ( { case ACPI_TYPE_DEVICE: - HandlerObj = ObjDesc->Device.AddressSpace; + HandlerObj = ObjDesc->Device.Handler; break; case ACPI_TYPE_PROCESSOR: - HandlerObj = ObjDesc->Processor.AddressSpace; + HandlerObj = ObjDesc->Processor.Handler; break; case ACPI_TYPE_THERMAL: - HandlerObj = ObjDesc->ThermalZone.AddressSpace; + HandlerObj = ObjDesc->ThermalZone.Handler; break; default: @@ -640,6 +640,30 @@ AcpiEvInitializeRegion ( Status = AcpiEvAttachRegion (HandlerObj, RegionObj, AcpiNsLocked); + /* + * Tell all users that this region is usable by running the _REG + * method + */ + if (AcpiNsLocked) + { + Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + Status = AcpiEvExecuteRegMethod (RegionObj, 1); + + if (AcpiNsLocked) + { + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c index ed16c7a89770..ebfb04818a7b 100644 --- a/sys/contrib/dev/acpica/evxfregn.c +++ b/sys/contrib/dev/acpica/evxfregn.c @@ -2,7 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 56 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -255,7 +255,7 @@ AcpiInstallAddressSpaceHandler ( * The attached device object already exists. * Make sure the handler is not already installed. */ - HandlerObj = ObjDesc->Device.AddressSpace; + HandlerObj = ObjDesc->Device.Handler; /* Walk the handler list for this device */ @@ -331,7 +331,8 @@ AcpiInstallAddressSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", - AcpiUtGetRegionName (SpaceId), SpaceId, Node->Name.Ascii, Node, ObjDesc)); + AcpiUtGetRegionName (SpaceId), SpaceId, + AcpiUtGetNodeName (Node), Node, ObjDesc)); /* * Install the handler @@ -359,13 +360,13 @@ AcpiInstallAddressSpaceHandler ( /* Install at head of Device.AddressSpace list */ - HandlerObj->AddressSpace.Next = ObjDesc->Device.AddressSpace; + 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.AddressSpace = HandlerObj; + ObjDesc->Device.Handler = HandlerObj; /* * Walk the namespace finding all of the regions this @@ -383,6 +384,17 @@ AcpiInstallAddressSpaceHandler ( 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: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); @@ -453,8 +465,8 @@ AcpiRemoveAddressSpaceHandler ( /* Find the address handler the user requested */ - HandlerObj = ObjDesc->Device.AddressSpace; - LastObjPtr = &ObjDesc->Device.AddressSpace; + HandlerObj = ObjDesc->Device.Handler; + LastObjPtr = &ObjDesc->Device.Handler; while (HandlerObj) { /* We have a handler, see if user requested this one */ diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index 77be255cecb3..46bade82ced0 100644 --- a/sys/contrib/dev/acpica/exconfig.c +++ b/sys/contrib/dev/acpica/exconfig.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 72 $ + * $Revision: 74 $ * *****************************************************************************/ @@ -168,6 +168,9 @@ AcpiExAddTable ( /* Install the new table into the local data structures */ + ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC)); + + TableInfo.Type = 5; TableInfo.Pointer = Table; TableInfo.Length = (ACPI_SIZE) Table->Length; TableInfo.Allocation = ACPI_MEM_ALLOCATED; @@ -259,7 +262,7 @@ AcpiExLoadTableOp ( return_ACPI_STATUS (Status); } - /* Not found, return an Integer=0 and AE_OK */ + /* Table not found, return an Integer=0 and AE_OK */ DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!DdbHandle) @@ -338,9 +341,11 @@ AcpiExLoadTableOp ( if (ACPI_FAILURE (Status)) { (void) AcpiExUnloadTable (DdbHandle); + return_ACPI_STATUS (Status); } } + *ReturnDesc = DdbHandle; return_ACPI_STATUS (Status); } @@ -519,7 +524,7 @@ ACPI_STATUS AcpiExUnloadTable ( ACPI_OPERAND_OBJECT *DdbHandle) { - ACPI_STATUS Status = AE_NOT_IMPLEMENTED; + ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; ACPI_TABLE_DESC *TableInfo; diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c index f5bc1760a5b3..53613ffc1e87 100644 --- a/sys/contrib/dev/acpica/excreate.c +++ b/sys/contrib/dev/acpica/excreate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 99 $ + * $Revision: 100 $ * *****************************************************************************/ @@ -367,7 +367,7 @@ AcpiExCreateRegion ( ACPI_FUNCTION_TRACE ("ExCreateRegion"); - /* Get the Node from the object stack */ + /* Get the Namespace Node */ Node = WalkState->Op->Common.Node; @@ -394,7 +394,6 @@ AcpiExCreateRegion ( ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", AcpiUtGetRegionName (RegionSpace), RegionSpace)); - /* Create the region descriptor */ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); @@ -459,6 +458,7 @@ AcpiExCreateTableRegion ( ACPI_FUNCTION_TRACE ("ExCreateTableRegion"); + /* Get the Node from the object stack */ Node = WalkState->Op->Common.Node; @@ -477,7 +477,6 @@ AcpiExCreateTableRegion ( Status = AcpiTbFindTable (Operand[1]->String.Pointer, Operand[2]->String.Pointer, Operand[3]->String.Pointer, &Table); - if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -581,7 +580,6 @@ AcpiExCreateProcessor ( Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], ObjDesc, ACPI_TYPE_PROCESSOR); - /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); @@ -633,7 +631,6 @@ AcpiExCreatePowerResource ( Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], ObjDesc, ACPI_TYPE_POWER); - /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); @@ -704,7 +701,6 @@ AcpiExCreateMethod ( ObjDesc->Method.Concurrency = (UINT8) (((MethodFlags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1); } - else { ObjDesc->Method.Concurrency = INFINITE_CONCURRENCY; diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c index 180c4e066d61..587f75ede0f5 100644 --- a/sys/contrib/dev/acpica/exdump.c +++ b/sys/contrib/dev/acpica/exdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 167 $ + * $Revision: 171 $ * *****************************************************************************/ @@ -165,29 +165,29 @@ AcpiExDumpOperand ( if (!ObjDesc) { /* - * This usually indicates that something serious is wrong -- - * since most (if not all) - * code that dumps the stack expects something to be there! + * This usually indicates that something serious is wrong */ - AcpiOsPrintf ("Null stack entry ptr\n"); + AcpiOsPrintf ("Null Object Descriptor\n"); return; } if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p NS Node: ", ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", ObjDesc)); ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC); return; } if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not a local object\n", ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "%p is not a node or operand object: [%s]\n", + ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)); return; } - /* ObjDesc is a valid object */ + /* ObjDesc is a valid object */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc)); @@ -232,11 +232,10 @@ AcpiExDumpOperand ( if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - /* Value is a Number */ + /* Value is an Integer */ AcpiOsPrintf (" value is [%8.8X%8.8x]", - ACPI_HIDWORD(ObjDesc->Integer.Value), - ACPI_LODWORD(ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); } AcpiOsPrintf ("\n"); @@ -251,11 +250,10 @@ AcpiExDumpOperand ( if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { - /* Value is a Number */ + /* Value is an Integer */ AcpiOsPrintf (" value is [%8.8X%8.8x]", - ACPI_HIDWORD(ObjDesc->Integer.Value), - ACPI_LODWORD(ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); } AcpiOsPrintf ("\n"); @@ -271,7 +269,7 @@ AcpiExDumpOperand ( default: - /* unknown opcode */ + /* Unknown opcode */ AcpiOsPrintf ("Unknown Reference opcode=%X\n", ObjDesc->Reference.Opcode); @@ -314,8 +312,7 @@ AcpiExDumpOperand ( case ACPI_TYPE_INTEGER: AcpiOsPrintf ("Integer %8.8X%8.8X\n", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -360,8 +357,7 @@ AcpiExDumpOperand ( else { AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", - ACPI_HIDWORD (ObjDesc->Region.Address), - ACPI_LODWORD (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length); } break; @@ -590,7 +586,7 @@ AcpiExOutAddress ( AcpiOsPrintf ("%20s : %p\n", Title, Value); #else AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title, - ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); + ACPI_FORMAT_UINT64 (Value)); #endif } @@ -623,7 +619,7 @@ AcpiExDumpNode ( } } - AcpiOsPrintf ("%20s : %4.4s\n", "Name", Node->Name.Ascii); + AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); AcpiExOutInteger ("Flags", Node->Flags); AcpiExOutInteger ("Owner Id", Node->OwnerId); @@ -675,7 +671,8 @@ AcpiExDumpObjectDescriptor ( if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { - AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not a valid ACPI object\n", ObjDesc); + AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", + ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); return_VOID; } @@ -692,8 +689,7 @@ AcpiExDumpObjectDescriptor ( case ACPI_TYPE_INTEGER: AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -741,7 +737,7 @@ AcpiExDumpObjectDescriptor ( case ACPI_TYPE_DEVICE: - AcpiExOutPointer ("AddressSpace", ObjDesc->Device.AddressSpace); + AcpiExOutPointer ("Handler", ObjDesc->Device.Handler); AcpiExOutPointer ("SystemNotify", ObjDesc->Device.SystemNotify); AcpiExOutPointer ("DeviceNotify", ObjDesc->Device.DeviceNotify); break; @@ -779,7 +775,7 @@ AcpiExDumpObjectDescriptor ( AcpiExOutInteger ("Flags", ObjDesc->Region.Flags); AcpiExOutAddress ("Address", ObjDesc->Region.Address); AcpiExOutInteger ("Length", ObjDesc->Region.Length); - AcpiExOutPointer ("AddressSpace", ObjDesc->Region.AddressSpace); + AcpiExOutPointer ("Handler", ObjDesc->Region.Handler); AcpiExOutPointer ("Next", ObjDesc->Region.Next); break; @@ -800,7 +796,7 @@ AcpiExDumpObjectDescriptor ( AcpiExOutAddress ("Address", (ACPI_PHYSICAL_ADDRESS) ObjDesc->Processor.Address); AcpiExOutPointer ("SystemNotify", ObjDesc->Processor.SystemNotify); AcpiExOutPointer ("DeviceNotify", ObjDesc->Processor.DeviceNotify); - AcpiExOutPointer ("AddressSpace", ObjDesc->Processor.AddressSpace); + AcpiExOutPointer ("Handler", ObjDesc->Processor.Handler); break; @@ -808,7 +804,7 @@ AcpiExDumpObjectDescriptor ( AcpiExOutPointer ("SystemNotify", ObjDesc->ThermalZone.SystemNotify); AcpiExOutPointer ("DeviceNotify", ObjDesc->ThermalZone.DeviceNotify); - AcpiExOutPointer ("AddressSpace", ObjDesc->ThermalZone.AddressSpace); + AcpiExOutPointer ("Handler", ObjDesc->ThermalZone.Handler); break; diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c index 2b253f3f26e2..882aa0e4443e 100644 --- a/sys/contrib/dev/acpica/exfield.c +++ b/sys/contrib/dev/acpica/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 118 $ + * $Revision: 119 $ * *****************************************************************************/ @@ -245,10 +245,10 @@ AcpiExReadDataFromField ( } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Obj=%p Type=%X Buf=%p Len=%X\n", + "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "FieldWrite: BitLen=%X BitOff=%X ByteOff=%X\n", + "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", ObjDesc->CommonField.BitLength, ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BaseByteOffset)); @@ -433,10 +433,13 @@ AcpiExWriteDataToField ( } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Obj=%p Type=%X Buf=%p Len=%X\n", - ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, Length)); + "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", + SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)), + ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "FieldRead: BitLen=%X BitOff=%X ByteOff=%X\n", + "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", + ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)), + ACPI_GET_OBJECT_TYPE (ObjDesc), ObjDesc->CommonField.BitLength, ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BaseByteOffset)); diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index c1e7d595acd6..cb3f713eeddc 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 96 $ + * $Revision: 100 $ * *****************************************************************************/ @@ -139,7 +139,8 @@ * RETURN: Status * * DESCRIPTION: Common processing for AcpiExExtractFromField and - * AcpiExInsertIntoField. Initialize the + * AcpiExInsertIntoField. Initialize the Region if necessary and + * validate the request. * ******************************************************************************/ @@ -172,7 +173,7 @@ AcpiExSetupRegion ( * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. */ - if (!(RgnDesc->Region.Flags & AOPOBJ_DATA_VALID)) + if (!(RgnDesc->Common.Flags & AOPOBJ_DATA_VALID)) { Status = AcpiDsGetRegionArguments (RgnDesc); if (ACPI_FAILURE (Status)) @@ -188,6 +189,20 @@ AcpiExSetupRegion ( return_ACPI_STATUS (AE_OK); } +#ifdef ACPI_UNDER_DEVELOPMENT + /* + * If the Field access is AnyAcc, we can now compute the optimal + * access (because we know know the length of the parent region) + */ + if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) + { + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } +#endif + /* * Validate the request. The entire request from the byte offset for a * length of one field datum (access width) must fit within the region. @@ -206,8 +221,9 @@ AcpiExSetupRegion ( */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", - ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.AccessByteWidth, - RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length)); + AcpiUtGetNodeName (ObjDesc->CommonField.Node), + ObjDesc->CommonField.AccessByteWidth, + AcpiUtGetNodeName (RgnDesc->Region.Node), RgnDesc->Region.Length)); } /* @@ -216,9 +232,10 @@ AcpiExSetupRegion ( */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", - ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.BaseByteOffset, + AcpiUtGetNodeName (ObjDesc->CommonField.Node), + ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, - RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length)); + AcpiUtGetNodeName (RgnDesc->Region.Node), RgnDesc->Region.Length)); return_ACPI_STATUS (AE_AML_REGION_LIMIT); } @@ -292,13 +309,13 @@ AcpiExAccessRegion ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, - " Region[%s-%X] Access %X Base:Off %X:%X at %8.8X%8.8X\n", + " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId, ObjDesc->CommonField.AccessByteWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, - ACPI_HIDWORD (Address), ACPI_LODWORD (Address))); + ACPI_FORMAT_UINT64 (Address))); /* Invoke the appropriate AddressSpace/OpRegion handler */ @@ -570,13 +587,15 @@ AcpiExFieldDatumIo ( { if (ReadWrite == ACPI_READ) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n", - ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value))); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", + ACPI_FORMAT_UINT64 (*Value), + ObjDesc->CommonField.AccessByteWidth)); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n", - ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value))); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", + ACPI_FORMAT_UINT64 (*Value), + ObjDesc->CommonField.AccessByteWidth)); } } @@ -638,6 +657,11 @@ AcpiExWriteWithUpdateRule ( */ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, &CurrentValue, ACPI_READ); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + MergedValue |= (CurrentValue & ~Mask); } break; @@ -657,6 +681,7 @@ AcpiExWriteWithUpdateRule ( break; default: + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WriteWithUpdateRule: Unknown UpdateRule setting: %X\n", (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK))); @@ -664,18 +689,19 @@ AcpiExWriteWithUpdateRule ( } } + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (Mask), + FieldDatumByteOffset, + ObjDesc->CommonField.AccessByteWidth, + ACPI_FORMAT_UINT64 (FieldValue), + ACPI_FORMAT_UINT64 (MergedValue))); + /* Write the merged value */ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, &MergedValue, ACPI_WRITE); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Mask %8.8X%8.8X DatumOffset %X Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", - ACPI_HIDWORD (Mask), ACPI_LODWORD (Mask), - FieldDatumByteOffset, - ACPI_HIDWORD (FieldValue), ACPI_LODWORD (FieldValue), - ACPI_HIDWORD (MergedValue),ACPI_LODWORD (MergedValue))); - return_ACPI_STATUS (Status); } @@ -709,7 +735,7 @@ AcpiExGetBufferDatum ( UINT32 Index; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_TRACE_U32 ("ExGetBufferDatum", ByteGranularity); /* Get proper index into buffer (handles big/little endian) */ @@ -744,6 +770,8 @@ AcpiExGetBufferDatum ( /* Should not get here */ break; } + + return_VOID; } @@ -775,7 +803,8 @@ AcpiExSetBufferDatum ( { UINT32 Index; - ACPI_FUNCTION_ENTRY (); + + ACPI_FUNCTION_TRACE_U32 ("ExSetBufferDatum", ByteGranularity); /* Get proper index into buffer (handles big/little endian) */ @@ -810,6 +839,8 @@ AcpiExSetBufferDatum ( /* Should not get here */ break; } + + return_VOID; } @@ -834,12 +865,13 @@ AcpiExExtractFromField ( { ACPI_STATUS Status; UINT32 FieldDatumByteOffset; - UINT32 DatumOffset; - ACPI_INTEGER PreviousRawDatum; + UINT32 BufferDatumOffset; + ACPI_INTEGER PreviousRawDatum = 0; ACPI_INTEGER ThisRawDatum = 0; ACPI_INTEGER MergedDatum = 0; UINT32 ByteFieldLength; UINT32 DatumCount; + UINT32 i; ACPI_FUNCTION_TRACE ("ExExtractFromField"); @@ -863,83 +895,80 @@ AcpiExExtractFromField ( DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth); + /* + * If the field is not aligned on a datum boundary and does not + * fit within a single datum, we must read an extra datum. + * + * We could just split the aligned and non-aligned cases since the + * aligned case is so very simple, but this would require more code. + */ + if ((ObjDesc->CommonField.EndFieldValidBits != 0) && + (!(ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))) + { + DatumCount++; + } + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "ByteLen=%X, DatumLen=%X, ByteGran=%X\n", + "ByteLen %X, DatumLen %X, ByteGran %X\n", ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth)); /* * Clear the caller's buffer (the whole buffer length as given) - * This is very important, especially in the cases where a byte is read, - * but the buffer is really a UINT32 (4 bytes). + * This is very important, especially in the cases where the buffer + * is longer than the size of the field. */ ACPI_MEMSET (Buffer, 0, BufferLength); - /* Read the first raw datum to prime the loop */ - FieldDatumByteOffset = 0; - DatumOffset= 0; + BufferDatumOffset= 0; - Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, - &PreviousRawDatum, ACPI_READ); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - - /* We might actually be done if the request fits in one datum */ + /* Read the entire field */ - if ((DatumCount == 1) && - (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM)) + for (i = 0; i < DatumCount; i++) { - /* 1) Shift the valid data bits down to start at bit 0 */ - - MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); + Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, + &ThisRawDatum, ACPI_READ); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - /* 2) Mask off any upper unused bits (bits not part of the field) */ + /* We might actually be done if the request fits in one datum */ - if (ObjDesc->CommonField.EndBufferValidBits) + if ((DatumCount == 1) && + (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM)) { - MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); - } + /* 1) Shift the valid data bits down to start at bit 0 */ - /* Store the datum to the caller buffer */ + MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); - AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, DatumOffset); + /* 2) Mask off any upper unused bits (bits not part of the field) */ - return_ACPI_STATUS (AE_OK); - } + if (ObjDesc->CommonField.EndBufferValidBits) + { + MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); + } + /* Store the datum to the caller buffer */ - /* We need to get more raw data to complete one or more field data */ + AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, + ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); - while (DatumOffset < DatumCount) - { - FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; + return_ACPI_STATUS (AE_OK); + } - /* - * If the field is aligned on a byte boundary, we don't want - * to perform a final read, since this would potentially read - * past the end of the region. - * - * We could just split the aligned and non-aligned cases since the - * aligned case is so very simple, but this would require more code. - */ - if ((ObjDesc->CommonField.StartFieldBitOffset != 0) || - ((ObjDesc->CommonField.StartFieldBitOffset == 0) && - (DatumOffset < (DatumCount -1)))) + /* Special handling for the last datum to ignore extra bits */ + + if ((i >= (DatumCount -1)) && + (ObjDesc->CommonField.EndFieldValidBits)) { /* - * Get the next raw datum, it contains some or all bits - * of the current field datum + * This is the last iteration of the loop. We need to clear + * any unused bits (bits that are not part of this field) before + * we store the final merged datum into the caller buffer. */ - Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, - &ThisRawDatum, ACPI_READ); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + ThisRawDatum &= + ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); } /* @@ -949,51 +978,51 @@ AcpiExExtractFromField ( { /* Field is not skewed and we can just copy the datum */ - MergedDatum = PreviousRawDatum; + AcpiExSetBufferDatum (ThisRawDatum, Buffer, BufferLength, + ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); + BufferDatumOffset++; } else { - /* - * Put together the appropriate bits of the two raw data to make a - * single complete field datum - * - * 1) Normalize the first datum down to bit 0 - */ - MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); - - /* 2) Insert the second datum "above" the first datum */ + /* Not aligned -- on the first iteration, just save the datum */ - MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits); - - if ((DatumOffset >= (DatumCount -1))) + if (i != 0) { /* - * This is the last iteration of the loop. We need to clear - * any unused bits (bits that are not part of this field) that - * came from the last raw datum before we store the final - * merged datum into the caller buffer. + * Put together the appropriate bits of the two raw data to make a + * single complete field datum + * + * 1) Normalize the first datum down to bit 0 */ - if (ObjDesc->CommonField.EndBufferValidBits) - { - MergedDatum &= - ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); - } + MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); + + /* 2) Insert the second datum "above" the first datum */ + + MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits); + + AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, + ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); + BufferDatumOffset++; } + + /* + * Save the raw datum that was just acquired since it may contain bits + * of the *next* field datum + */ + PreviousRawDatum = ThisRawDatum; } - /* - * Store the merged field datum in the caller's buffer, according to - * the granularity of the field (size of each datum). - */ - AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, DatumOffset); + FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; + } - /* - * Save the raw datum that was just acquired since it may contain bits - * of the *next* field datum. Update offsets - */ - PreviousRawDatum = ThisRawDatum; - DatumOffset++; + /* For non-aligned case, there is one last datum to insert */ + + if (ObjDesc->CommonField.StartFieldBitOffset != 0) + { + MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); + + AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, + ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); } return_ACPI_STATUS (AE_OK); @@ -1039,21 +1068,28 @@ AcpiExInsertIntoField ( * larger than the field, this typically happens when an integer is * written to a field that is actually smaller than an integer. */ - ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength); + ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength); if (BufferLength < ByteFieldLength) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Buffer length %X too small for field %X\n", BufferLength, ByteFieldLength)); return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } + ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.StartFieldBitOffset + + ObjDesc->CommonField.BitLength); + /* Convert byte count to datum count, round up if necessary */ - DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth); + DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, + ObjDesc->CommonField.AccessByteWidth); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "ByteLen=%X, DatumLen=%X, ByteGran=%X\n", + "Bytes %X, Datums %X, ByteGran %X\n", ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth)); /* @@ -1106,6 +1142,10 @@ AcpiExInsertIntoField ( return_ACPI_STATUS (Status); } + /* We just wrote the first datum */ + + DatumOffset++; + /* If the entire field fits within one datum, we are done. */ if ((DatumCount == 1) && @@ -1127,7 +1167,6 @@ AcpiExInsertIntoField ( */ while (DatumOffset < DatumCount) { - DatumOffset++; FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; /* @@ -1161,37 +1200,37 @@ AcpiExInsertIntoField ( * a datum boundary. Update Rule must be applied to the bits outside * the field. */ - if (DatumOffset == DatumCount) + DatumOffset++; + if ((DatumOffset == DatumCount) && + (ObjDesc->CommonField.EndFieldValidBits)) { /* * If there are dangling non-aligned bits, perform one more merged write * Else - field is aligned at the end, no need for any more writes */ - if (ObjDesc->CommonField.EndFieldValidBits) - { - /* - * Part3: - * This is the last datum and the field does not end on a datum boundary. - * Build the partial datum and write with the update rule. - * - * Mask off the unused bits above (after) the end-of-field - */ - Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); - MergedDatum &= Mask; - /* Write the last datum with the update rule */ + /* + * Part3: + * This is the last datum and the field does not end on a datum boundary. + * Build the partial datum and write with the update rule. + * + * Mask off the unused bits above (after) the end-of-field + */ + Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); + MergedDatum &= Mask; - Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, - FieldDatumByteOffset); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* Write the last datum with the update rule */ + + Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, + FieldDatumByteOffset); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); } } else { - /* Normal case -- write the completed datum */ + /* Normal (aligned) case -- write the completed datum */ Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, &MergedDatum, ACPI_WRITE); diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c index 2479d2d64c50..e55b6cc1cdf0 100644 --- a/sys/contrib/dev/acpica/exmisc.c +++ b/sys/contrib/dev/acpica/exmisc.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 115 $ + * $Revision: 116 $ * *****************************************************************************/ @@ -199,8 +199,8 @@ AcpiExGetObjectReference ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type %X in %p\n", - ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p has invalid descriptor [%s]\n", + ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); return_ACPI_STATUS (AE_TYPE); } @@ -218,7 +218,7 @@ AcpiExGetObjectReference ( *ReturnDesc = ReferenceObj; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc)); + ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/exmutex.c index 6b87cc5e0e28..a8f0ab441acf 100644 --- a/sys/contrib/dev/acpica/exmutex.c +++ b/sys/contrib/dev/acpica/exmutex.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 18 $ + * $Revision: 19 $ * *****************************************************************************/ @@ -240,7 +240,7 @@ AcpiExAcquireMutex ( if (!WalkState->Thread) { ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", - ObjDesc->Mutex.Node->Name.Ascii)); + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -251,7 +251,7 @@ AcpiExAcquireMutex ( if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) { ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect SyncLevel\n", - ObjDesc->Mutex.Node->Name.Ascii)); + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } @@ -328,7 +328,7 @@ AcpiExReleaseMutex ( if (!ObjDesc->Mutex.OwnerThread) { ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n", - ObjDesc->Mutex.Node->Name.Ascii)); + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } @@ -337,7 +337,7 @@ AcpiExReleaseMutex ( if (!WalkState->Thread) { ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n", - ObjDesc->Mutex.Node->Name.Ascii)); + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -348,7 +348,7 @@ AcpiExReleaseMutex ( ACPI_REPORT_ERROR (( "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", WalkState->Thread->ThreadId, - ObjDesc->Mutex.Node->Name.Ascii, + AcpiUtGetNodeName (ObjDesc->Mutex.Node), ObjDesc->Mutex.OwnerThread->ThreadId)); return_ACPI_STATUS (AE_AML_NOT_OWNER); } @@ -360,7 +360,7 @@ AcpiExReleaseMutex ( if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel) { ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect SyncLevel\n", - ObjDesc->Mutex.Node->Name.Ascii)); + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c index 46a149b114b2..e4e9f363e590 100644 --- a/sys/contrib/dev/acpica/exoparg1.c +++ b/sys/contrib/dev/acpica/exoparg1.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 148 $ + * $Revision: 151 $ * *****************************************************************************/ @@ -392,7 +392,7 @@ AcpiExOpcode_1A_1T_1R ( if (Temp32 > 9) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large (not decimal): 0x%X\n", Temp32)); @@ -436,8 +436,7 @@ AcpiExOpcode_1A_1T_1R ( if (Digit > 0) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Integer too large to convert to BCD: %8.8X%8.8X\n", - ACPI_HIDWORD(Operand[0]->Integer.Value), - ACPI_LODWORD(Operand[0]->Integer.Value))); + ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value))); Status = AE_AML_NUMERIC_OVERFLOW; goto Cleanup; } @@ -615,7 +614,7 @@ AcpiExOpcode_1A_0T_1R ( ACPI_INTEGER Value; - ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode)); + ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode)); /* Examine the AML opcode */ diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/exoparg3.c index 1953ec284fb3..454cb127b612 100644 --- a/sys/contrib/dev/acpica/exoparg3.c +++ b/sys/contrib/dev/acpica/exoparg3.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 17 $ + * $Revision: 18 $ * *****************************************************************************/ @@ -177,15 +177,14 @@ AcpiExOpcode_3A_0T_0R ( switch (WalkState->Opcode) { - case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", - (UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value, + (UINT32) Operand[0]->Integer.Value, + (UINT32) Operand[1]->Integer.Value, (UINT32) Operand[2]->Integer.Value)); - Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO)); if (Fatal) { diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c index 6071e0dd3b1a..6ed7cd4ad582 100644 --- a/sys/contrib/dev/acpica/exprep.c +++ b/sys/contrib/dev/acpica/exprep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 122 $ + * $Revision: 125 $ * *****************************************************************************/ @@ -127,6 +127,139 @@ ACPI_MODULE_NAME ("exprep") +#ifdef ACPI_UNDER_DEVELOPMENT +/******************************************************************************* + * + * FUNCTION: AcpiExGenerateAccess + * + * PARAMETERS: FieldBitOffset - Start of field within parent region/buffer + * FieldBitLength - Length of field in bits + * RegionLength - Length of parent in bytes + * + * RETURN: Field granularity (8, 16, 32 or 64) and + * ByteAlignment (1, 2, 3, or 4) + * + * DESCRIPTION: Generate an optimal access width for fields defined with the + * AnyAcc keyword. + * + * NOTE: Need to have the RegionLength in order to check for boundary + * conditions (end-of-region). However, the RegionLength is a deferred + * operation. Therefore, to complete this implementation, the generation + * of this access width must be deferred until the region length has + * been evaluated. + * + ******************************************************************************/ + +static UINT32 +AcpiExGenerateAccess ( + UINT32 FieldBitOffset, + UINT32 FieldBitLength, + UINT32 RegionLength) +{ + UINT32 FieldByteLength; + UINT32 FieldByteOffset; + UINT32 FieldByteEndOffset; + UINT32 AccessByteWidth; + UINT32 FieldStartOffset; + UINT32 FieldEndOffset; + UINT32 MinimumAccessWidth = 0xFFFFFFFF; + UINT32 MinimumAccesses = 0xFFFFFFFF; + UINT32 Accesses; + + + ACPI_FUNCTION_TRACE ("ExGenerateAccess"); + + + /* Round Field start offset and length to "minimal" byte boundaries */ + + FieldByteOffset = ACPI_DIV_8 (ACPI_ROUND_DOWN (FieldBitOffset, 8)); + FieldByteEndOffset = ACPI_DIV_8 (ACPI_ROUND_UP (FieldBitLength + FieldBitOffset, 8)); + FieldByteLength = FieldByteEndOffset - FieldByteOffset; + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Bit length %d, Bit offset %d\n", + FieldBitLength, FieldBitOffset)); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Byte Length %d, Byte Offset %d, End Offset %d\n", + FieldByteLength, FieldByteOffset, FieldByteEndOffset)); + + /* + * Iterative search for the maximum access width that is both aligned + * and does not go beyond the end of the region + * + * Start at ByteAcc and work upwards to QwordAcc max. (1,2,4,8 bytes) + */ + for (AccessByteWidth = 1; AccessByteWidth <= 8; AccessByteWidth <<= 1) + { + /* + * 1) Round end offset up to next access boundary and make sure that this + * does not go beyond the end of the parent region. + * 2) When the Access width is greater than the FieldByteLength, we are done. + * (This does not optimize for the perfectly aligned case yet). + */ + if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= RegionLength) + { + FieldStartOffset = ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) / + AccessByteWidth; + FieldEndOffset = ACPI_ROUND_UP ((FieldByteLength + FieldByteOffset), + AccessByteWidth) / AccessByteWidth; + Accesses = FieldEndOffset - FieldStartOffset; + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "AccessWidth %d end is within region\n", AccessByteWidth)); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Field Start %d, Field End %d -- requires %d accesses\n", + FieldStartOffset, FieldEndOffset, Accesses)); + + /* Single access is optimal */ + + if (Accesses <= 1) + { + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Entire field can be accessed with one operation of size %d\n", + AccessByteWidth)); + return_VALUE (AccessByteWidth); + } + + /* + * Fits in the region, but requires more than one read/write. + * try the next wider access on next iteration + */ + if (Accesses < MinimumAccesses) + { + MinimumAccesses = Accesses; + MinimumAccessWidth = AccessByteWidth; + } + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "AccessWidth %d end is NOT within region\n", AccessByteWidth)); + if (AccessByteWidth == 1) + { + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Field goes beyond end-of-region!\n")); + return_VALUE (0); /* Field does not fit in the region at all */ + } + + /* This width goes beyond the end-of-region, back off to previous access */ + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Backing off to previous optimal access width of %d\n", + MinimumAccessWidth)); + return_VALUE (MinimumAccessWidth); + } + } + + /* Could not read/write field with one operation, just use max access width */ + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Cannot access field in one operation, using width 8\n")); + return_VALUE (8); +} +#endif /* ACPI_UNDER_DEVELOPMENT */ + + /******************************************************************************* * * FUNCTION: AcpiExDecodeFieldAccess @@ -148,12 +281,11 @@ AcpiExDecodeFieldAccess ( UINT32 *ReturnByteAlignment) { UINT32 Access; - UINT8 ByteAlignment; - UINT8 BitLength; -/* UINT32 Length; */ + UINT32 ByteAlignment; + UINT32 BitLength; - ACPI_FUNCTION_NAME ("ExDecodeFieldAccess"); + ACPI_FUNCTION_TRACE ("ExDecodeFieldAccess"); Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK); @@ -162,46 +294,15 @@ AcpiExDecodeFieldAccess ( { case AML_FIELD_ACCESS_ANY: +#ifdef ACPI_UNDER_DEVELOPMENT + ByteAlignment = AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.BitLength, + 0xFFFFFFFF /* Temp until we pass RegionLength as param */); + BitLength = ByteAlignment * 8; +#endif + ByteAlignment = 1; BitLength = 8; - -#if 0 - /* - * TBD: optimize - * - * Any attempt to optimize the access size to the size of the field - * must take into consideration the length of the region and take - * care that an access to the field will not attempt to access - * beyond the end of the region. - */ - - /* Use the length to set the access type */ - - Length = ObjDesc->CommonField.BitLength; - - if (Length <= 8) - { - BitLength = 8; - } - else if (Length <= 16) - { - BitLength = 16; - } - else if (Length <= 32) - { - BitLength = 32; - } - else if (Length <= 64) - { - BitLength = 64; - } - else - { - /* Larger than Qword - just use byte-size chunks */ - - BitLength = 8; - } -#endif break; case AML_FIELD_ACCESS_BYTE: @@ -231,7 +332,7 @@ AcpiExDecodeFieldAccess ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown field access type %X\n", Access)); - return (0); + return_VALUE (0); } if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) @@ -245,7 +346,7 @@ AcpiExDecodeFieldAccess ( } *ReturnByteAlignment = ByteAlignment; - return (BitLength); + return_VALUE (BitLength); } @@ -333,7 +434,7 @@ AcpiExPrepCommonFieldObject ( */ NearestByteAddress = ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); - ObjDesc->CommonField.BaseByteOffset = + ObjDesc->CommonField.BaseByteOffset = (UINT32) ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment); /* @@ -422,7 +523,7 @@ AcpiExPrepFieldValue ( if (Type != ACPI_TYPE_REGION) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Needed Region, found type %X %s\n", + "Needed Region, found type %X (%s)\n", Type, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -461,7 +562,7 @@ AcpiExPrepFieldValue ( AcpiUtAddReference (ObjDesc->Field.RegionObj); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "RegionField: Bitoff=%X Off=%X Gran=%X Region %p\n", + "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset, ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj)); break; @@ -479,7 +580,7 @@ AcpiExPrepFieldValue ( AcpiUtAddReference (ObjDesc->BankField.BankObj); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Bank Field: BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n", + "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", ObjDesc->BankField.StartFieldBitOffset, ObjDesc->BankField.BaseByteOffset, ObjDesc->Field.AccessByteWidth, @@ -507,9 +608,10 @@ AcpiExPrepFieldValue ( AcpiUtAddReference (ObjDesc->IndexField.IndexObj); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "IndexField: bitoff=%X off=%X gran=%X Index %p Data %p\n", + "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", ObjDesc->IndexField.StartFieldBitOffset, ObjDesc->IndexField.BaseByteOffset, + ObjDesc->IndexField.Value, ObjDesc->Field.AccessByteWidth, ObjDesc->IndexField.IndexObj, ObjDesc->IndexField.DataObj)); @@ -527,8 +629,8 @@ AcpiExPrepFieldValue ( Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc, AcpiNsGetType (Info->FieldNode)); - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set NamedObj %p (%4.4s) val = %p\n", - Info->FieldNode, Info->FieldNode->Name.Ascii, ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n", + Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc)); /* Remove local reference to the object */ diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c index 41363054ea0f..fc62ca937361 100644 --- a/sys/contrib/dev/acpica/exregion.c +++ b/sys/contrib/dev/acpica/exregion.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 84 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -242,7 +242,7 @@ AcpiExSystemMemorySpaceHandler ( if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", - ACPI_HIDWORD (Address), ACPI_LODWORD (Address), (UINT32) WindowSize)); + ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize)); MemInfo->MappedLength = 0; return_ACPI_STATUS (Status); } @@ -261,8 +261,8 @@ AcpiExSystemMemorySpaceHandler ( ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth, - ACPI_HIDWORD (Address), ACPI_LODWORD (Address))); + "SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth, + ACPI_FORMAT_UINT64 (Address))); /* * Perform the memory read or write @@ -374,8 +374,8 @@ AcpiExSystemIoSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth, - ACPI_HIDWORD (Address), ACPI_LODWORD (Address))); + "SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth, + ACPI_FORMAT_UINT64 (Address))); /* Decode the function parameter */ diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c index 5e450dd767cb..2267ef44719b 100644 --- a/sys/contrib/dev/acpica/exresnte.c +++ b/sys/contrib/dev/acpica/exresnte.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 62 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -121,6 +121,8 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -327,12 +329,27 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_LOCAL_REFERENCE: - /* No named references are allowed here */ + switch (SourceDesc->Reference.Opcode) + { + case AML_LOAD_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X\n", - SourceDesc->Reference.Opcode)); + /* This is a DdbHandle */ + /* Return an additional reference to the object */ - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + ObjDesc = SourceDesc; + AcpiUtAddReference (ObjDesc); + break; + + default: + /* No named references are allowed here */ + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", + SourceDesc->Reference.Opcode, + AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode))); + + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + break; /* Default case is for unknown types */ diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index fb673e06bea1..b4c1944d60e8 100644 --- a/sys/contrib/dev/acpica/exresolv.c +++ b/sys/contrib/dev/acpica/exresolv.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 119 $ + * $Revision: 121 $ * *****************************************************************************/ @@ -122,6 +122,7 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" +#include "acparser.h" #define _COMPONENT ACPI_EXECUTER @@ -333,6 +334,7 @@ AcpiExResolveObjectToValue ( case AML_REF_OF_OP: case AML_DEBUG_OP: + case AML_LOAD_OP: /* Just leave the object as-is */ @@ -341,8 +343,8 @@ AcpiExResolveObjectToValue ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X in %p\n", - Opcode, StackDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X (%s) in %p\n", + Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc)); Status = AE_AML_INTERNAL; break; } @@ -435,6 +437,8 @@ AcpiExResolveMultiple ( if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { + ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Not a NS node %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -489,7 +493,9 @@ AcpiExResolveMultiple ( if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { - return_ACPI_STATUS (AE_AML_INTERNAL); + ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Not a NS node %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node))); + return_ACPI_STATUS (AE_AML_INTERNAL); } /* Get the attached object */ diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c index 2245d7ec798e..23125ba0ffc0 100644 --- a/sys/contrib/dev/acpica/exresop.c +++ b/sys/contrib/dev/acpica/exresop.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 62 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -311,6 +311,7 @@ AcpiExResolveOperands ( case AML_REF_OF_OP: case AML_ARG_OP: case AML_LOCAL_OP: + case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */ ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Reference Opcode: %s\n", OpInfo->Name))); @@ -318,8 +319,9 @@ AcpiExResolveOperands ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown Reference Opcode %X\n", - ObjDesc->Reference.Opcode)); + "Unknown Reference Opcode %X [%s]\n", + ObjDesc->Reference.Opcode, + (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -332,8 +334,8 @@ AcpiExResolveOperands ( /* Invalid descriptor */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Bad descriptor type %X in Obj %p\n", - ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), ObjDesc)); + "Invalid descriptor %p [%s]\n", + ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -473,6 +475,13 @@ AcpiExResolveOperands ( TypeNeeded = ACPI_TYPE_ANY; break; + case ARGI_DDBHANDLE: + + /* Need an operand of type ACPI_TYPE_DDB_HANDLE */ + + TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE; + break; + /* * The more complex cases allow multiple resolved object types diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index b43b47c22f3a..91ecfd89846d 100644 --- a/sys/contrib/dev/acpica/exstore.c +++ b/sys/contrib/dev/acpica/exstore.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 176 $ + * $Revision: 177 $ * *****************************************************************************/ @@ -270,8 +270,7 @@ AcpiExStore ( case ACPI_TYPE_INTEGER: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n", - ACPI_HIDWORD (SourceDesc->Integer.Value), - ACPI_LODWORD (SourceDesc->Integer.Value))); + ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value))); break; diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c index 22c5d1f1fcf4..0f380d8ed61c 100644 --- a/sys/contrib/dev/acpica/exstoren.c +++ b/sys/contrib/dev/acpica/exstoren.c @@ -3,7 +3,7 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 55 $ + * $Revision: 56 $ * *****************************************************************************/ @@ -120,6 +120,7 @@ #include "acpi.h" #include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -191,9 +192,10 @@ AcpiExResolveObject ( /* * Must have a Integer, Buffer, or String */ - if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) && - (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)) + if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) && + (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) && + (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) && + !((ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) && (SourceDesc->Reference.Opcode == AML_LOAD_OP))) { /* * Conversion successful but still not a valid type diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c index ae38ec810a40..ba4ef4ed0133 100644 --- a/sys/contrib/dev/acpica/exsystem.c +++ b/sys/contrib/dev/acpica/exsystem.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exsystem - Interface to OS services - * $Revision: 76 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -188,11 +188,16 @@ AcpiExSystemWaitSemaphore ( * * FUNCTION: AcpiExSystemDoStall * - * PARAMETERS: HowLong - The amount of time to stall + * PARAMETERS: HowLong - The amount of time to stall, + * in microseconds * * RETURN: Status * * DESCRIPTION: Suspend running thread for specified amount of time. + * Note: ACPI specification requires that Stall() does not + * relinquish the processor, and delays longer than 100 usec + * should use Sleep() instead. We allow stalls up to 255 usec + * for compatibility with other interpreters and existing BIOSs. * ******************************************************************************/ @@ -206,19 +211,17 @@ AcpiExSystemDoStall ( ACPI_FUNCTION_ENTRY (); - if (HowLong > 1000) /* 1 millisecond */ + if (HowLong > 255) /* 255 microseconds */ { - /* Since this thread will sleep, we must release the interpreter */ - - AcpiExExitInterpreter (); - - AcpiOsSleep (0, (HowLong / 1000) + 1); - - /* And now we must get the interpreter again */ - - Status = AcpiExEnterInterpreter (); + /* + * Longer than 255 usec, this is an error + * + * (ACPI specifies 100 usec as max, but this gives some slack in + * order to support existing BIOSs) + */ + ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", HowLong)); + Status = AE_AML_OPERAND_VALUE; } - else { AcpiOsStall (HowLong); @@ -232,7 +235,8 @@ AcpiExSystemDoStall ( * * FUNCTION: AcpiExSystemDoSuspend * - * PARAMETERS: HowLong - The amount of time to suspend + * PARAMETERS: HowLong - The amount of time to suspend, + * in milliseconds * * RETURN: None * diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c index 6d3083dad291..e9c270db912f 100644 --- a/sys/contrib/dev/acpica/exutils.c +++ b/sys/contrib/dev/acpica/exutils.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 109 $ + * $Revision: 110 $ * *****************************************************************************/ @@ -374,7 +374,7 @@ AcpiExDigitsNeeded ( */ if ((CurrentValue = Value) == 0) { - return_VALUE (1); + return_VALUE (1); } NumDigits = 0; diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c index e2719655c15a..e69ff83e7904 100644 --- a/sys/contrib/dev/acpica/hwacpi.c +++ b/sys/contrib/dev/acpica/hwacpi.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * $Revision: 63 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -196,7 +196,7 @@ AcpiHwSetMode ( */ if (!AcpiGbl_FADT->SmiCmd) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No SMI_CMD in FADT, mode transition failed.\n")); + ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n")); return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } @@ -209,7 +209,7 @@ AcpiHwSetMode ( */ if (!AcpiGbl_FADT->AcpiEnable && !AcpiGbl_FADT->AcpiDisable) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No mode transition supported in this system.\n")); + ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n")); return_ACPI_STATUS (AE_OK); } @@ -242,6 +242,7 @@ AcpiHwSetMode ( if (ACPI_FAILURE (Status)) { + ACPI_REPORT_ERROR (("Could not write mode change, %s\n", AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -252,19 +253,17 @@ AcpiHwSetMode ( Retry = 3000; while (Retry) { - Status = AE_NO_HARDWARE_RESPONSE; - if (AcpiHwGetMode() == Mode) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode)); - Status = AE_OK; - break; + return_ACPI_STATUS (AE_OK); } AcpiOsStall(1000); Retry--; } - return_ACPI_STATUS (Status); + ACPI_REPORT_ERROR (("Hardware never changed modes\n")); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } @@ -290,6 +289,16 @@ AcpiHwGetMode (void) ACPI_FUNCTION_TRACE ("HwGetMode"); + + /* + * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, + * system does not support mode transition. + */ + if (!AcpiGbl_FADT->SmiCmd) + { + return_VALUE (ACPI_SYS_MODE_ACPI); + } + Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c index e4a55d3e6c6a..6997d293d91c 100644 --- a/sys/contrib/dev/acpica/hwregs.c +++ b/sys/contrib/dev/acpica/hwregs.c @@ -3,7 +3,7 @@ * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. - * $Revision: 149 $ + * $Revision: 152 $ * ******************************************************************************/ @@ -389,7 +389,7 @@ AcpiGetRegister ( *ReturnValue = RegisterValue; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n", RegisterValue, BitRegInfo->ParentRegister)); } @@ -455,9 +455,9 @@ AcpiSetRegister ( /* * Decode the Register ID - * Register id = Register block id | bit id + * Register ID = [Register block ID] | [bit ID] * - * Check bit id to fine locate Register offset. + * Check bit ID to fine locate Register offset. * Check Mask to determine Register offset, and then read-write. */ switch (BitRegInfo->ParentRegister) @@ -466,9 +466,9 @@ AcpiSetRegister ( /* * Status Registers are different from the rest. Clear by - * writing 1, writing 0 has no effect. So, the only relevant + * writing 1, and writing 0 has no effect. So, the only relevant * information is the single bit we're interested in, all others should - * be written as 0 so they will be left unchanged + * be written as 0 so they will be left unchanged. */ Value = ACPI_REGISTER_PREPARE_BITS (Value, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); @@ -494,9 +494,9 @@ AcpiSetRegister ( case ACPI_REGISTER_PM1_CONTROL: /* - * Read the PM1 Control register. + * Write the PM1 Control register. * Note that at this level, the fact that there are actually TWO - * registers (A and B - and that B may not exist) is abstracted. + * registers (A and B - and B may not exist) is abstracted. */ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", RegisterValue)); @@ -504,7 +504,7 @@ AcpiSetRegister ( BitRegInfo->AccessBitMask, Value); Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue); + ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue); break; @@ -519,16 +519,14 @@ AcpiSetRegister ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", RegisterValue, - ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", RegisterValue, - ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue)); @@ -842,7 +840,7 @@ AcpiHwLowLevelRead ( /* * Three address spaces supported: - * Memory, Io, or PCI config. + * Memory, IO, or PCI_Config. */ switch (Reg->AddressSpaceId) { @@ -881,9 +879,8 @@ AcpiHwLowLevelRead ( } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, Width, - ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)), + *Value, Width, + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Reg->Address)), AcpiUtGetRegionName (Reg->AddressSpaceId))); return (Status); @@ -928,9 +925,10 @@ AcpiHwLowLevelWrite ( { return (AE_OK); } + /* * Three address spaces supported: - * Memory, Io, or PCI config. + * Memory, IO, or PCI_Config. */ switch (Reg->AddressSpaceId) { @@ -969,9 +967,8 @@ AcpiHwLowLevelWrite ( } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, Width, - ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)), + Value, Width, + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Reg->Address)), AcpiUtGetRegionName (Reg->AddressSpaceId))); return (Status); diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index 73c89abe8641..137a4771999c 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 56 $ + * $Revision: 58 $ * *****************************************************************************/ @@ -262,6 +262,14 @@ AcpiEnterSleepStatePrep ( return_ACPI_STATUS (Status); } + /* Set the system indicators to show the desired sleep state. */ + + Status = AcpiEvaluateObject (NULL, "\\_SI._SST", &ArgList, NULL); + if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) + { + ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); + } + return_ACPI_STATUS (AE_OK); } @@ -302,30 +310,32 @@ AcpiEnterSleepState ( return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } - SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A); SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); - /* Clear wake status */ - - Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (Status)) + if (SleepState != ACPI_STATE_S5) { - return_ACPI_STATUS (Status); - } + /* Clear wake status */ - Status = AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - /* Disable BM arbitration */ + Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); + /* Disable BM arbitration */ + + Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } Status = AcpiHwDisableNonWakeupGpes(); @@ -388,12 +398,14 @@ AcpiEnterSleepState ( return_ACPI_STATUS (Status); } - /* - * Wait a second, then try again. This is to get S4/5 to work on all machines. - */ if (SleepState > ACPI_STATE_S3) { /* + * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that + * we are still executing!) + * + * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. + * * We wait so long to allow chipsets that poll this reg very slowly to * still read the right value. Ideally, this entire block would go * away entirely. @@ -449,6 +461,7 @@ AcpiEnterSleepStateS4bios ( ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4bios"); + AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK); @@ -485,15 +498,39 @@ AcpiEnterSleepStateS4bios ( ACPI_STATUS AcpiLeaveSleepState ( - UINT8 SleepState) + UINT8 SleepState) { - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg; - ACPI_STATUS Status; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg; + ACPI_STATUS Status; + ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; + ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; + UINT32 PM1xControl; ACPI_FUNCTION_TRACE ("AcpiLeaveSleepState"); + /* Some machines require SLP_TYPE and SLP_EN to be cleared */ + + SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A); + SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); + + /* Get current value of PM1A control */ + + Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, &PM1xControl); + if (ACPI_SUCCESS (Status)) + { + /* Clear SLP_TYP and SLP_EN */ + + PM1xControl &= ~(SleepTypeRegInfo->AccessBitMask | + SleepEnableRegInfo->AccessBitMask); + + AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1A_CONTROL, PM1xControl); + AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1B_CONTROL, PM1xControl); + } /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */ @@ -503,12 +540,18 @@ AcpiLeaveSleepState ( ArgList.Count = 1; ArgList.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; - Arg.Integer.Value = SleepState; /* Ignore any errors from these methods */ + Arg.Integer.Value = 0; + Status = AcpiEvaluateObject (NULL, "\\_SI._SST", &ArgList, NULL); + if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) + { + ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); + } + + Arg.Integer.Value = SleepState; Status = AcpiEvaluateObject (NULL, "\\_BFS", &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { @@ -529,8 +572,8 @@ AcpiLeaveSleepState ( return_ACPI_STATUS (Status); } - /* Disable BM arbitration */ - Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); + /* Enable BM arbitration */ + Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index a1c8a191b286..2ab0b9079f6f 100644 --- a/sys/contrib/dev/acpica/nsaccess.c +++ b/sys/contrib/dev/acpica/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 173 $ + * $Revision: 175 $ * ******************************************************************************/ @@ -406,8 +406,8 @@ AcpiNsLookup ( PrefixNode = ScopeInfo->Scope.Node; if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%p] Not a namespace node\n", - PrefixNode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p Not a namespace node [%s]\n", + PrefixNode, AcpiUtGetDescriptorName (PrefixNode))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -476,7 +476,7 @@ AcpiNsLookup ( ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching relative to prefix scope [%4.4s] (%p)\n", - PrefixNode->Name.Ascii, PrefixNode)); + AcpiUtGetNodeName (PrefixNode), PrefixNode)); /* * Handle multiple Parent Prefixes (carat) by just getting @@ -513,7 +513,7 @@ AcpiNsLookup ( { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Search scope is [%4.4s], path has %d carat(s)\n", - ThisNode->Name.Ascii, NumCarats)); + AcpiUtGetNodeName (ThisNode), NumCarats)); } } diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c index e221973dc25c..26ddd8551d6f 100644 --- a/sys/contrib/dev/acpica/nsalloc.c +++ b/sys/contrib/dev/acpica/nsalloc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 82 $ + * $Revision: 83 $ * ******************************************************************************/ @@ -359,7 +359,7 @@ AcpiNsInstallNode ( * alphabetic placement. */ PreviousChildNode = NULL; - while (AcpiNsCompareNames (ChildNode->Name.Ascii, Node->Name.Ascii) < 0) + while (AcpiNsCompareNames (AcpiUtGetNodeName (ChildNode), AcpiUtGetNodeName (Node)) < 0) { if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST) { @@ -429,8 +429,9 @@ AcpiNsInstallNode ( Node->Type = (UINT8) Type; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s (%s) added to %4.4s (%s) %p at %p\n", - Node->Name.Ascii, AcpiUtGetTypeName (Node->Type), - ParentNode->Name.Ascii, AcpiUtGetTypeName (ParentNode->Type), ParentNode, Node)); + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), + AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type), + ParentNode, Node)); /* * Increment the reference count(s) of all parents up to diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index 085565de0772..a71b913ff33c 100644 --- a/sys/contrib/dev/acpica/nsdump.c +++ b/sys/contrib/dev/acpica/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 151 $ + * $Revision: 156 $ * *****************************************************************************/ @@ -125,8 +125,8 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsdump") -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /******************************************************************************* * @@ -152,7 +152,7 @@ AcpiNsPrintPathname ( return; } - /* Print the entire name */ + /* Print the entire name */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); @@ -289,7 +289,7 @@ AcpiNsDumpOneObject ( * Now we can print out the pertinent information */ AcpiOsPrintf ("%4.4s %-12s %p ", - ThisNode->Name.Ascii, AcpiUtGetTypeName (Type), ThisNode); + AcpiUtGetNodeName (ThisNode), AcpiUtGetTypeName (Type), ThisNode); DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; @@ -321,7 +321,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_DEVICE: - AcpiOsPrintf ("Notify object: %p", ObjDesc); + AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); break; @@ -337,8 +337,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: AcpiOsPrintf ("= %8.8X%8.8X\n", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -396,8 +395,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_HIDWORD (ObjDesc->Region.Address), - ACPI_LODWORD (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length); } else @@ -420,7 +418,7 @@ AcpiNsDumpOneObject ( ObjDesc->BufferField.BufferObj->Buffer.Node) { AcpiOsPrintf ("Buf [%4.4s]", - ObjDesc->BufferField.BufferObj->Buffer.Node->Name.Ascii); + AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node)); } break; @@ -428,29 +426,29 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_REGION_FIELD: AcpiOsPrintf ("Rgn [%4.4s]", - ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii); + AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node)); break; case ACPI_TYPE_LOCAL_BANK_FIELD: AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", - ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii, - ObjDesc->BankField.BankObj->CommonField.Node->Name.Ascii); + AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node), + AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node)); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", - ObjDesc->IndexField.IndexObj->CommonField.Node->Name.Ascii, - ObjDesc->IndexField.DataObj->CommonField.Node->Name.Ascii); + AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node), + AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node)); break; case ACPI_TYPE_LOCAL_ALIAS: - AcpiOsPrintf ("Target %4.4s (%p)\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Name.Ascii, ObjDesc); + AcpiOsPrintf ("Target %4.4s (%p)\n", AcpiUtGetNodeName (ObjDesc), ObjDesc); break; default: @@ -468,7 +466,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2hd\n", + AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BitLength, @@ -507,8 +505,8 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value), - ACPI_LODWORD(ObjDesc->Integer.Value)); + AcpiOsPrintf (" I:%8.8X8.8%X\n", + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: @@ -589,7 +587,8 @@ AcpiNsDumpOneObject ( default: - AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n"); + AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor) [%s]\n", + AcpiUtGetDescriptorName (ObjDesc)); BytesToDump = 16; break; } @@ -687,7 +686,6 @@ AcpiNsDumpObjects ( Info.OwnerId = OwnerId; Info.DisplayType = DisplayType; - (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, (void *) &Info, NULL); @@ -736,7 +734,6 @@ AcpiNsDumpTables ( ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); } - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, ACPI_UINT32_MAX, SearchHandle); return_VOID; diff --git a/sys/contrib/dev/acpica/nsdumpdv.c b/sys/contrib/dev/acpica/nsdumpdv.c index 702b1d1fcf22..ac259b04fa06 100644 --- a/sys/contrib/dev/acpica/nsdumpdv.c +++ b/sys/contrib/dev/acpica/nsdumpdv.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 8 $ + * $Revision: 9 $ * *****************************************************************************/ @@ -170,7 +170,7 @@ AcpiNsDumpOneDevice ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", Info->HardwareId.Value, - ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address), + ACPI_FORMAT_UINT64 (Info->Address), Info->CurrentStatus)); ACPI_MEM_FREE (Info); } diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c index 87cae8dd055e..16f05b0c10af 100644 --- a/sys/contrib/dev/acpica/nsinit.c +++ b/sys/contrib/dev/acpica/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 55 $ + * $Revision: 57 $ * *****************************************************************************/ @@ -220,10 +220,18 @@ AcpiNsInitializeDevices ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Executing all Device _STA and_INI methods:")); - /* Walk namespace for all objects of type Device */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Walk namespace for all objects of type Device or Processor */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL); + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, TRUE, AcpiNsInitOneDevice, &Info, NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { @@ -373,7 +381,8 @@ AcpiNsInitOneObject ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not execute arguments for [%4.4s] (%s), %s\n", - Node->Name.Ascii, AcpiUtGetTypeName (Type), AcpiFormatException (Status))); + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type), + AcpiFormatException (Status))); } /* Print a dot for each object unless we are going to print the entire pathname */ @@ -422,51 +431,55 @@ AcpiNsInitOneDevice ( ACPI_FUNCTION_TRACE ("NsInitOneDevice"); - if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) && (!(AcpiDbgLevel & ACPI_LV_INFO))) + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); + return_ACPI_STATUS (AE_BAD_PARAMETER); } - Info->DeviceCount++; - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) + /* + * We will run _STA/_INI on Devices and Processors only + */ + if ((Node->Type != ACPI_TYPE_DEVICE) && + (Node->Type != ACPI_TYPE_PROCESSOR)) { - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } - Node = AcpiNsMapHandleToNode (ObjHandle); - if (!Node) + if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) && (!(AcpiDbgLevel & ACPI_LV_INFO))) { - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); } - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + Info->DeviceCount++; /* * Run _STA to determine if we can run _INI on the device. */ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Node, "_STA")); Status = AcpiUtExecute_STA (Node, &Flags); + if (ACPI_FAILURE (Status)) { - /* Ignore error and move on to next device */ - - return_ACPI_STATUS (AE_OK); - } + if (Node->Type == ACPI_TYPE_DEVICE) + { + /* Ignore error and move on to next device */ - Info->Num_STA++; + return_ACPI_STATUS (AE_OK); + } - if (!(Flags & 0x01)) + /* _STA is not required for Processor objects */ + } + else { - /* don't look at children of a not present device */ + Info->Num_STA++; - return_ACPI_STATUS(AE_CTRL_DEPTH); + if (!(Flags & 0x01)) + { + /* Don't look at children of a not present device */ + + return_ACPI_STATUS(AE_CTRL_DEPTH); + } } /* diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c index 6a6250dff735..35749e533f12 100644 --- a/sys/contrib/dev/acpica/nsobject.c +++ b/sys/contrib/dev/acpica/nsobject.c @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 87 $ + * $Revision: 89 $ * ******************************************************************************/ @@ -182,7 +182,8 @@ AcpiNsAttachObject ( { /* Not a name handle */ - ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle\n")); + ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -233,7 +234,7 @@ AcpiNsAttachObject ( } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", - ObjDesc, Node, Node->Name.Ascii)); + ObjDesc, Node, AcpiUtGetNodeName (Node))); /* Detach an existing attached object if present */ @@ -322,7 +323,7 @@ AcpiNsDetachObject ( Node->Type = ACPI_TYPE_ANY; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", - Node, Node->Name.Ascii, ObjDesc)); + Node, AcpiUtGetNodeName (Node), ObjDesc)); /* Remove one reference on the object (and all subobjects) */ diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c index 4051d3f9f7ab..945f42664ccd 100644 --- a/sys/contrib/dev/acpica/nssearch.c +++ b/sys/contrib/dev/acpica/nssearch.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 97 $ + * $Revision: 99 $ * ******************************************************************************/ @@ -172,7 +172,7 @@ AcpiNsSearchNode ( ScopeName = AcpiNsGetExternalPathname (Node); if (ScopeName) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (%s)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", ScopeName, Node, (char *) &TargetName, AcpiUtGetTypeName (Type))); ACPI_MEM_FREE (ScopeName); @@ -195,9 +195,9 @@ AcpiNsSearchNode ( * Found matching entry. */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name %4.4s Type [%s] found in scope [%4.4s] %p\n", + "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type), - NextNode->Name.Ascii, NextNode)); + NextNode, AcpiUtGetNodeName (Node), Node)); *ReturnNode = NextNode; return_ACPI_STATUS (AE_OK); @@ -222,9 +222,9 @@ AcpiNsSearchNode ( /* Searched entire namespace level, not found */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name %4.4s Type [%s] not found in search in scope [%4.4s] %p first child %p\n", + "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", (char *) &TargetName, AcpiUtGetTypeName (Type), - Node->Name.Ascii, Node, Node->Child)); + AcpiUtGetNodeName (Node), Node, Node->Child)); return_ACPI_STATUS (AE_NOT_FOUND); } diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c index 3f1b5745853e..7cbfdf8fdf6f 100644 --- a/sys/contrib/dev/acpica/nsutils.c +++ b/sys/contrib/dev/acpica/nsutils.c @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 129 $ + * $Revision: 131 $ * *****************************************************************************/ @@ -256,6 +256,12 @@ AcpiNsPrintNodePathname ( ACPI_STATUS Status; + if (!Node) + { + AcpiOsPrintf ("[NULL NAME]"); + return; + } + /* Convert handle to a full pathname and print it (with supplied message) */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; @@ -577,12 +583,12 @@ AcpiNsBuildInternalName ( if (Info->FullyQualified) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (abs) \"\\%s\"\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n", InternalName, InternalName)); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (rel) \"%s\"\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n", InternalName, InternalName)); } @@ -1110,8 +1116,8 @@ AcpiNsFindParentName ( if (ParentNode) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n", - ChildNode, ChildNode->Name.Ascii, - ParentNode, ParentNode->Name.Ascii)); + ChildNode, AcpiUtGetNodeName (ChildNode), + ParentNode, AcpiUtGetNodeName (ParentNode))); if (ParentNode->Name.Integer) { @@ -1120,7 +1126,7 @@ AcpiNsFindParentName ( } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n", - ChildNode, ChildNode->Name.Ascii)); + ChildNode, AcpiUtGetNodeName (ChildNode))); } return_VALUE (ACPI_UNKNOWN_NAME); diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c index cac3914c5c1a..b26db60bf44e 100644 --- a/sys/contrib/dev/acpica/nsxfname.c +++ b/sys/contrib/dev/acpica/nsxfname.c @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 97 $ + * $Revision: 98 $ * *****************************************************************************/ @@ -286,7 +286,7 @@ AcpiGetName ( /* Just copy the ACPI name from the Node and zero terminate it */ - ACPI_STRNCPY (Buffer->Pointer, Node->Name.Ascii, + ACPI_STRNCPY (Buffer->Pointer, AcpiUtGetNodeName (Node), ACPI_NAME_SIZE); ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0; Status = AE_OK; @@ -374,8 +374,8 @@ AcpiGetObjectInfo ( { /* * 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, and _ADR methods. + * * Note: none of these methods are required, so they may or may * not be present for this device. The Info.Valid bitfield is used * to indicate which methods were found and ran successfully. @@ -402,7 +402,7 @@ AcpiGetObjectInfo ( Status = AcpiUtExecute_CID (Node, &CidList); if (ACPI_SUCCESS (Status)) { - Size += ((ACPI_SIZE) CidList->Count - 1) * + Size += ((ACPI_SIZE) CidList->Count - 1) * sizeof (ACPI_COMPATIBLE_ID); Info.Valid |= ACPI_VALID_CID; } @@ -417,7 +417,7 @@ AcpiGetObjectInfo ( /* Execute the Device._ADR method */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &Info.Address); if (ACPI_SUCCESS (Status)) { diff --git a/sys/contrib/dev/acpica/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c index 0e8e26bd012f..eb42b9238d93 100644 --- a/sys/contrib/dev/acpica/osunixxf.c +++ b/sys/contrib/dev/acpica/osunixxf.c @@ -243,8 +243,9 @@ AcpiOsTableOverride ( return (AE_BAD_PARAMETER); } + /* TODO: Add table-getting code here */ *NewTable = NULL; - return (AE_OK); + return (AE_NO_ACPI_TABLES); } @@ -455,7 +456,7 @@ AcpiOsMapMemory ( ACPI_SIZE length, void **there) { - *there = (void *) (uintptr_t) where; + *there = ACPI_TO_POINTER (where); return AE_OK; } @@ -792,6 +793,10 @@ AcpiOsStall ( UINT32 microseconds) { + if (microseconds) + { + usleep (microseconds); + } return; } @@ -815,7 +820,13 @@ AcpiOsSleep ( UINT32 milliseconds) { - usleep (((seconds * 1000) + milliseconds) * 1000); + sleep (seconds + (milliseconds / 1000)); /* Sleep for whole seconds */ + + /* + * Arg to usleep() must be less than 1,000,000 (1 second) + */ + usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ + return; } diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c index 7ada38926eda..7b1b69baf944 100644 --- a/sys/contrib/dev/acpica/psargs.c +++ b/sys/contrib/dev/acpica/psargs.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 73 $ + * $Revision: 74 $ * *****************************************************************************/ @@ -579,7 +579,7 @@ ACPI_PARSE_OBJECT * AcpiPsGetNextField ( ACPI_PARSE_STATE *ParserState) { - UINT32 AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, + UINT32 AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart); ACPI_PARSE_OBJECT *Field; UINT16 Opcode; @@ -778,8 +778,8 @@ AcpiPsGetNextArg ( /* Fill in bytelist data */ - Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd, - ParserState->Aml); + Arg->Common.Value.Size = (UINT32) ACPI_PTR_DIFF (ParserState->PkgEnd, + ParserState->Aml); Arg->Named.Data = ParserState->Aml; /* Skip to End of byte data */ diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index dc6c729a73ac..fd65fb9b53be 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 139 $ + * $Revision: 142 $ * *****************************************************************************/ @@ -534,7 +534,6 @@ AcpiPsParseLoop ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - ParserState = &WalkState->ParserState; WalkState->ArgTypes = 0; @@ -604,8 +603,8 @@ AcpiPsParseLoop ( { /* Get the next opcode from the AML stream */ - WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); + WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); WalkState->Opcode = AcpiPsPeekOpcode (ParserState); /* @@ -830,16 +829,15 @@ AcpiPsParseLoop ( WalkState->ArgTypes = 0; break; - default: - /* Op is not a constant or string, append each argument */ + /* Op is not a constant or string, append each argument to the Op */ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) { - WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); + WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); Status = AcpiPsGetNextArg (WalkState, ParserState, GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); if (ACPI_FAILURE (Status)) @@ -855,24 +853,24 @@ AcpiPsParseLoop ( INCREMENT_ARG_LIST (WalkState->ArgTypes); } + /* Special processing for certain opcodes */ + switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: - /* For a method, save the length and address of the body */ - /* - * Skip parsing of control method or opregion body, + * Skip parsing of control method * because we don't have enough info in the first pass - * to parse them correctly. + * to parse it correctly. + * + * Save the length and address of the body */ Op->Named.Data = ParserState->Aml; Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml); - /* - * Skip body of method. For OpRegions, we must continue - * parsing because the opregion is not a standalone - * package (We don't know where the end is). - */ + + /* Skip body of method */ + ParserState->Aml = ParserState->PkgEnd; WalkState->ArgCount = 0; break; @@ -886,15 +884,15 @@ AcpiPsParseLoop ( (WalkState->DescendingCallback != AcpiDsExecBeginOp)) { /* - * Skip parsing of + * Skip parsing of Buffers and Packages * because we don't have enough info in the first pass * to parse them correctly. */ Op->Named.Data = AmlOpStart; Op->Named.Length = (UINT32) (ParserState->PkgEnd - AmlOpStart); - /* - * Skip body - */ + + /* Skip body */ + ParserState->Aml = ParserState->PkgEnd; WalkState->ArgCount = 0; } @@ -909,6 +907,7 @@ AcpiPsParseLoop ( break; default: + /* No action for all other opcodes */ break; } diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c index 4f8795a93ae4..05ad58a59e78 100644 --- a/sys/contrib/dev/acpica/psxface.c +++ b/sys/contrib/dev/acpica/psxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 68 $ + * $Revision: 69 $ * *****************************************************************************/ @@ -207,7 +207,8 @@ AcpiPsxExecute ( Op = AcpiPsCreateScopeOp (); if (!Op) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup1; } /* @@ -223,21 +224,26 @@ AcpiPsxExecute ( NULL, NULL, NULL); if (!WalkState) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup2; } Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, NULL, 1); if (ACPI_FAILURE (Status)) { - AcpiDsDeleteWalkState (WalkState); - return_ACPI_STATUS (Status); + goto Cleanup3; } /* Parse the AML */ Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); + if (ACPI_FAILURE (Status)) + { + goto Cleanup1; /* Walk state is already deleted */ + + } /* * 2) Execute the method. Performs second pass parse simultaneously @@ -251,7 +257,8 @@ AcpiPsxExecute ( Op = AcpiPsCreateScopeOp (); if (!Op) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup1; } /* Init new op with the method name and pointer back to the NS node */ @@ -264,23 +271,32 @@ AcpiPsxExecute ( WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); if (!WalkState) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup2; } Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3); if (ACPI_FAILURE (Status)) { - AcpiDsDeleteWalkState (WalkState); - return_ACPI_STATUS (Status); + goto Cleanup3; } /* * The walk of the parse tree is where we actually execute the method */ Status = AcpiPsParseAml (WalkState); + goto Cleanup2; /* Walk state already deleted */ + + + +Cleanup3: + AcpiDsDeleteWalkState (WalkState); + +Cleanup2: AcpiPsDeleteParseTree (Op); +Cleanup1: if (Params) { /* Take away the extra reference that we gave the parameters above */ @@ -293,6 +309,11 @@ AcpiPsxExecute ( } } + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* * If the method has returned an object, signal this to the caller with * a control exception code diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c index 8f3ecebde142..b6a5e8211dd0 100644 --- a/sys/contrib/dev/acpica/rsaddr.c +++ b/sys/contrib/dev/acpica/rsaddr.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 32 $ + * $Revision: 33 $ * ******************************************************************************/ @@ -168,9 +168,12 @@ AcpiRsAddress16Resource ( Buffer += 1; ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - /* Check for the minimum length. */ + /* Validate minimum descriptor length */ + if (Temp16 < 13) - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_ADDRESS16; @@ -279,13 +282,14 @@ AcpiRsAddress16Resource ( /* * This will leave us pointing to the Resource Source Index * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes. + * pointer to where the null terminated string goes: + * Each Interrupt takes 32-bits + the 5 bytes of the + * stream that are default. * - * Note that some buggy resources have a length that indicates the - * Index byte is present even though it isn't (since there is no - * following Resource String.) We add one to catch these. + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ - if (*BytesConsumed > 16 + 1) + if (*BytesConsumed > (16 + 1)) { /* Dereference the Index */ @@ -492,7 +496,7 @@ AcpiRsAddress16Stream ( /* * Buffer needs to be set to the length of the sting + one for the - * terminating null + * terminating null */ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1); } @@ -562,11 +566,14 @@ AcpiRsAddress32Resource ( Buffer += 1; ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - /* Check for the minimum length. */ + /* Validate minimum descriptor length */ + if (Temp16 < 23) - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - *BytesConsumed = Temp16 + 3; + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } + *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_ADDRESS32; /* @@ -677,13 +684,12 @@ AcpiRsAddress32Resource ( /* * This will leave us pointing to the Resource Source Index * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes. + * pointer to where the null terminated string goes: * - * Note that some buggy resources have a length that indicates the - * Index byte is present even though it isn't (since there is no - * following Resource String.) We add one to catch these. + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ - if (*BytesConsumed > 26 + 1) + if (*BytesConsumed > (26 + 1)) { /* Dereference the Index */ @@ -722,8 +728,8 @@ AcpiRsAddress32Resource ( /* * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundary. + * calculate the length of the string and expand the + * StructSize to the next 32-bit boundary. */ Temp8 = (UINT8) (Index + 1); StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); @@ -958,11 +964,14 @@ AcpiRsAddress64Resource ( Buffer += 1; ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - /* Check for the minimum length. */ + /* Validate minimum descriptor length */ + if (Temp16 < 43) - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - *BytesConsumed = Temp16 + 3; + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } + *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_ADDRESS64; /* @@ -1074,13 +1083,14 @@ AcpiRsAddress64Resource ( /* * This will leave us pointing to the Resource Source Index * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes. + * pointer to where the null terminated string goes: + * Each Interrupt takes 32-bits + the 5 bytes of the + * stream that are default. * - * Note that some buggy resources have a length that indicates the - * Index byte is present even though it isn't (since there is no - * following Resource String.) We add one to catch these. + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ - if (*BytesConsumed > 46 + 1) + if (*BytesConsumed > (46 + 1)) { /* Dereference the Index */ @@ -1115,7 +1125,6 @@ AcpiRsAddress64Resource ( * Add the terminating null */ *TempPtr = 0x00; - OutputStruct->Data.Address64.ResourceSource.StringLength = Index + 1; /* @@ -1188,7 +1197,6 @@ AcpiRsAddress64Stream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; @@ -1288,7 +1296,7 @@ AcpiRsAddress64Stream ( /* * Buffer needs to be set to the length of the sting + one for the - * terminating null + * terminating null */ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); } diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c index f1aafceb78d8..aabf837a1f84 100644 --- a/sys/contrib/dev/acpica/rscalc.c +++ b/sys/contrib/dev/acpica/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 48 $ + * $Revision: 49 $ * ******************************************************************************/ @@ -796,7 +796,7 @@ AcpiRsGetListLength ( default: /* * If we get here, everything is out of sync, - * so exit with an error + * exit with an error */ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } @@ -804,7 +804,7 @@ AcpiRsGetListLength ( /* * Update the return value and counter */ - BufferSize += ACPI_ALIGN_RESOURCE_SIZE(StructureSize); + BufferSize += (UINT32) ACPI_ALIGN_RESOURCE_SIZE (StructureSize); BytesParsed += BytesConsumed; /* diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index 83fee4f42031..168fd6c7135b 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/rscreate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 64 $ + * $Revision: 65 $ * ******************************************************************************/ @@ -420,7 +420,7 @@ AcpiRsCreatePciRoutingTable ( /* Now align the current length */ - UserPrt->Length = ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); + UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); /* * 4) Fourth subobject: Dereference the PRT.SourceIndex diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c index 23b9e4920ef2..cd177d847877 100644 --- a/sys/contrib/dev/acpica/rsdump.c +++ b/sys/contrib/dev/acpica/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 36 $ + * $Revision: 37 $ * ******************************************************************************/ @@ -992,24 +992,19 @@ AcpiRsDumpAddress64 ( "" : "not "); AcpiOsPrintf (" Granularity: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->Granularity), - ACPI_LODWORD (Address64Data->Granularity)); + ACPI_FORMAT_UINT64 (Address64Data->Granularity)); AcpiOsPrintf (" Address range min: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->MinAddressRange), - ACPI_HIDWORD (Address64Data->MinAddressRange)); + ACPI_FORMAT_UINT64 (Address64Data->MinAddressRange)); AcpiOsPrintf (" Address range max: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->MaxAddressRange), - ACPI_HIDWORD (Address64Data->MaxAddressRange)); + ACPI_FORMAT_UINT64 (Address64Data->MaxAddressRange)); AcpiOsPrintf (" Address translation offset: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->AddressTranslationOffset), - ACPI_HIDWORD (Address64Data->AddressTranslationOffset)); + ACPI_FORMAT_UINT64 (Address64Data->AddressTranslationOffset)); AcpiOsPrintf (" Address Length: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->AddressLength), - ACPI_HIDWORD (Address64Data->AddressLength)); + ACPI_FORMAT_UINT64 (Address64Data->AddressLength)); if(0xFF != Address64Data->ResourceSource.Index) { @@ -1227,8 +1222,7 @@ AcpiRsDumpIrqList ( AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++); AcpiOsPrintf (" Address: %8.8X%8.8X\n", - ACPI_HIDWORD (PrtElement->Address), - ACPI_LODWORD (PrtElement->Address)); + ACPI_FORMAT_UINT64 (PrtElement->Address)); AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin); diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c index e0e1c38c5815..7b2d66819317 100644 --- a/sys/contrib/dev/acpica/rsirq.c +++ b/sys/contrib/dev/acpica/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 34 $ + * $Revision: 37 $ * ******************************************************************************/ @@ -210,30 +210,29 @@ AcpiRsIrqResource ( Temp8 = *Buffer; /* - * Check for HE, LL or HL + * Check for HE, LL interrupts */ - if (Temp8 & 0x01) + switch (Temp8 & 0x09) { + case 0x01: /* HE */ OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE; OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH; - } - else - { - if (Temp8 & 0x8) - { - OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW; - } - else - { - /* - * Only _LL and _HE polarity/trigger interrupts - * are allowed (ACPI spec v1.0b ection 6.4.2.1), - * so an error will occur if we reach this point - */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list\n")); - return_ACPI_STATUS (AE_BAD_DATA); - } + break; + + case 0x08: /* LL */ + OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE; + OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW; + break; + + default: + /* + * Only _LL and _HE polarity/trigger interrupts + * are allowed (ACPI spec, section "IRQ Format") + * so 0x00 and 0x09 are illegal. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Invalid interrupt polarity/trigger in resource list, %X\n", Temp8)); + return_ACPI_STATUS (AE_BAD_DATA); } /* @@ -408,11 +407,14 @@ AcpiRsExtendedIrqResource ( Buffer += 1; ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - /* Check for the minimum length. */ + /* Validate minimum descriptor length */ + if (Temp16 < 6) - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - *BytesConsumed = Temp16 + 3; + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } + *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ; /* @@ -450,10 +452,11 @@ AcpiRsExtendedIrqResource ( Buffer += 1; Temp8 = *Buffer; - /* Minimum number of IRQs is one. */ - if (Temp8 < 1) { - *BytesConsumed = 0; - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + /* Must have at least one IRQ */ + + if (Temp8 < 1) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); } OutputStruct->Data.ExtendedIrq.NumberOfInterrupts = Temp8; @@ -488,10 +491,12 @@ AcpiRsExtendedIrqResource ( * pointer to where the null terminated string goes: * Each Interrupt takes 32-bits + the 5 bytes of the * stream that are default. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ if (*BytesConsumed > - ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) - + 5 + 1) + ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + (5 + 1)) { /* Dereference the Index */ @@ -506,7 +511,7 @@ AcpiRsExtendedIrqResource ( * Point the String pointer to the end of this structure. */ OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = - (char *)(OutputStruct + StructSize); + (char *)((char *) OutputStruct + StructSize); TempPtr = (UINT8 *) OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/rslist.c index fd802c013dd5..1920e20e7d1e 100644 --- a/sys/contrib/dev/acpica/rslist.c +++ b/sys/contrib/dev/acpica/rslist.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 32 $ + * $Revision: 33 $ * ******************************************************************************/ @@ -390,8 +390,8 @@ AcpiRsByteStreamToList ( * Set the Buffer to the next structure */ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer); - Resource->Length = ACPI_ALIGN_RESOURCE_SIZE(Resource->Length); - Buffer += ACPI_ALIGN_RESOURCE_SIZE(StructureSize); + Resource->Length = (UINT32) ACPI_ALIGN_RESOURCE_SIZE (Resource->Length); + Buffer += ACPI_ALIGN_RESOURCE_SIZE (StructureSize); } /* end while */ diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c index c3502e5f8205..502fb6dee04c 100644 --- a/sys/contrib/dev/acpica/tbconvrt.c +++ b/sys/contrib/dev/acpica/tbconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbconvrt - ACPI Table conversion utilities - * $Revision: 52 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -149,14 +149,11 @@ AcpiTbGetTableCount ( ACPI_FUNCTION_ENTRY (); -#if ACPI_MACHINE_WIDTH != 64 - if (RSDP->Revision < 2) { PointerSize = sizeof (UINT32); } else -#endif { PointerSize = sizeof (UINT64); } @@ -211,7 +208,7 @@ AcpiTbConvertToXsdt ( /* Copy the header and set the length */ ACPI_MEMCPY (NewTable, TableInfo->Pointer, sizeof (ACPI_TABLE_HEADER)); - NewTable->Header.Length = (UINT32) TableSize; + NewTable->Length = (UINT32) TableSize; /* Copy the table pointers */ @@ -526,20 +523,20 @@ AcpiTbConvertTableFadt (void) * FADT length and version validation. The table must be at least as * long as the version 1.0 FADT */ - if (AcpiGbl_FADT->Header.Length < sizeof (FADT_DESCRIPTOR_REV1)) + if (AcpiGbl_FADT->Length < sizeof (FADT_DESCRIPTOR_REV1)) { - ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", AcpiGbl_FADT->Header.Length)); + ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", AcpiGbl_FADT->Length)); return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); } - if (AcpiGbl_FADT->Header.Revision >= FADT2_REVISION_ID) + if (AcpiGbl_FADT->Revision >= FADT2_REVISION_ID) { - if (AcpiGbl_FADT->Header.Length < sizeof (FADT_DESCRIPTOR_REV2)) + if (AcpiGbl_FADT->Length < sizeof (FADT_DESCRIPTOR_REV2)) { /* Length is too short to be a V2.0 table */ ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", - AcpiGbl_FADT->Header.Length, AcpiGbl_FADT->Header.Revision)); + AcpiGbl_FADT->Length, AcpiGbl_FADT->Revision)); AcpiTbConvertFadt1 (LocalFadt, (void *) AcpiGbl_FADT); } @@ -561,7 +558,7 @@ AcpiTbConvertTableFadt (void) * Global FADT pointer will point to the new common V2.0 FADT */ AcpiGbl_FADT = LocalFadt; - AcpiGbl_FADT->Header.Length = sizeof (FADT_DESCRIPTOR); + AcpiGbl_FADT->Length = sizeof (FADT_DESCRIPTOR); /* Free the original table */ @@ -578,8 +575,8 @@ AcpiTbConvertTableFadt (void) ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Hex dump of common internal FADT, size %d (%X)\n", - AcpiGbl_FADT->Header.Length, AcpiGbl_FADT->Header.Length)); - ACPI_DUMP_BUFFER ((UINT8 *) (AcpiGbl_FADT), AcpiGbl_FADT->Header.Length); + AcpiGbl_FADT->Length, AcpiGbl_FADT->Length)); + ACPI_DUMP_BUFFER ((UINT8 *) (AcpiGbl_FADT), AcpiGbl_FADT->Length); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c index 01fac0e854f2..0850f5fd6358 100644 --- a/sys/contrib/dev/acpica/tbget.c +++ b/sys/contrib/dev/acpica/tbget.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines - * $Revision: 84 $ + * $Revision: 87 $ * *****************************************************************************/ @@ -222,12 +222,11 @@ AcpiTbGetTableHeader ( /* Create a logical address for the physical pointer*/ Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (ACPI_TABLE_HEADER), - (void **) &Header); + (void *) &Header); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", - ACPI_HIDWORD (Address->Pointer.Physical), - ACPI_LODWORD (Address->Pointer.Physical), + ACPI_FORMAT_UINT64 (Address->Pointer.Physical), sizeof (ACPI_TABLE_HEADER))); return_ACPI_STATUS (Status); } @@ -446,13 +445,12 @@ AcpiTbGetThisTable ( * into our address space. */ Status = AcpiOsMapMemory (Address->Pointer.Physical, (ACPI_SIZE) Header->Length, - (void **) &FullTable); + (void *) &FullTable); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", Header->Signature, - ACPI_HIDWORD (Address->Pointer.Physical), - ACPI_LODWORD (Address->Pointer.Physical), Header->Length)); + ACPI_FORMAT_UINT64 (Address->Pointer.Physical), Header->Length)); return (Status); } @@ -496,8 +494,7 @@ AcpiTbGetThisTable ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n", FullTable->Signature, - ACPI_HIDWORD (Address->Pointer.Physical), - ACPI_LODWORD (Address->Pointer.Physical), FullTable)); + ACPI_FORMAT_UINT64 (Address->Pointer.Physical), FullTable)); return_ACPI_STATUS (Status); } @@ -549,6 +546,7 @@ AcpiTbGetTablePtr ( { /* Get the first */ + *TablePtrLoc = NULL; if (AcpiGbl_TableLists[TableType].Next) { *TablePtrLoc = AcpiGbl_TableLists[TableType].Next->Pointer; diff --git a/sys/contrib/dev/acpica/tbgetall.c b/sys/contrib/dev/acpica/tbgetall.c index 4ed22b0e4a17..ef20eb835311 100644 --- a/sys/contrib/dev/acpica/tbgetall.c +++ b/sys/contrib/dev/acpica/tbgetall.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbgetall - Get all required ACPI tables - * $Revision: 7 $ + * $Revision: 8 $ * *****************************************************************************/ @@ -324,8 +324,7 @@ AcpiTbGetRequiredTables ( { ACPI_REPORT_WARNING (("%s, while getting table at %8.8X%8.8X\n", AcpiFormatException (Status), - ACPI_HIDWORD (Address.Pointer.Value), - ACPI_LODWORD (Address.Pointer.Value))); + ACPI_FORMAT_UINT64 (Address.Pointer.Value))); } } diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c index 4471e80871cb..691ef715a462 100644 --- a/sys/contrib/dev/acpica/tbinstal.c +++ b/sys/contrib/dev/acpica/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 69 $ + * $Revision: 72 $ * *****************************************************************************/ @@ -358,23 +358,45 @@ AcpiTbInitTableDescriptor ( { return_ACPI_STATUS (AE_ALREADY_EXISTS); } - } - /* - * Link the new table in to the list of tables of this type. - * Just insert at the start of the list, order unimportant. - * - * TableDesc->Prev is already NULL from calloc() - */ - TableDesc->Next = ListHead->Next; - ListHead->Next = TableDesc; + TableDesc->Next = ListHead->Next; + ListHead->Next = TableDesc; - if (TableDesc->Next) - { - TableDesc->Next->Prev = TableDesc; + if (TableDesc->Next) + { + TableDesc->Next->Prev = TableDesc; + } + + ListHead->Count++; } + else + { + /* + * Link the new table in to the list of tables of this type. + * Insert at the end of the list, order IS IMPORTANT. + * + * TableDesc->Prev & Next are already NULL from calloc() + */ + ListHead->Count++; - ListHead->Count++; + if (!ListHead->Next) + { + ListHead->Next = TableDesc; + } + else + { + TableDesc->Next = ListHead->Next; + + while (TableDesc->Next->Next) + { + TableDesc->Next = TableDesc->Next->Next; + } + + TableDesc->Next->Next = TableDesc; + TableDesc->Prev = TableDesc->Next; + TableDesc->Next = NULL; + } + } /* Finish initialization of the table descriptor */ @@ -421,7 +443,7 @@ AcpiTbInitTableDescriptor ( void AcpiTbDeleteAllTables (void) { - ACPI_TABLE_TYPE Type; + ACPI_TABLE_TYPE Type; /* @@ -450,7 +472,7 @@ AcpiTbDeleteAllTables (void) void AcpiTbDeleteTablesByType ( - ACPI_TABLE_TYPE Type) + ACPI_TABLE_TYPE Type) { ACPI_TABLE_DESC *TableDesc; UINT32 Count; @@ -500,15 +522,16 @@ AcpiTbDeleteTablesByType ( break; } - /* Free the table */ - /* Get the head of the list */ - + /* + * Free the table + * 1) Get the head of the list + */ TableDesc = AcpiGbl_TableLists[Type].Next; Count = AcpiGbl_TableLists[Type].Count; /* - * Walk the entire list, deleting both the allocated tables - * and the table descriptors + * 2) Walk the entire list, deleting both the allocated tables + * and the table descriptors */ for (i = 0; i < Count; i++) { diff --git a/sys/contrib/dev/acpica/tbrsdt.c b/sys/contrib/dev/acpica/tbrsdt.c index c93684c23994..90da4431ea87 100644 --- a/sys/contrib/dev/acpica/tbrsdt.c +++ b/sys/contrib/dev/acpica/tbrsdt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbrsdt - ACPI RSDT table utilities - * $Revision: 7 $ + * $Revision: 9 $ * *****************************************************************************/ @@ -160,7 +160,7 @@ AcpiTbVerifyRsdp ( * Obtain access to the RSDP structure */ Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (RSDP_DESCRIPTOR), - (void **) &Rsdp); + (void *) &Rsdp); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -366,8 +366,7 @@ AcpiTbGetTableRsdt ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", AcpiGbl_RSDP, - ACPI_HIDWORD (Address.Pointer.Value), - ACPI_LODWORD (Address.Pointer.Value))); + ACPI_FORMAT_UINT64 (Address.Pointer.Value))); /* Check the RSDT or XSDT signature */ diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c index ede9724919fb..b5ebb793c0d5 100644 --- a/sys/contrib/dev/acpica/tbxface.c +++ b/sys/contrib/dev/acpica/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 62 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -336,7 +336,7 @@ AcpiUnloadTable ( /* Find all tables of the requested type */ TableDesc = AcpiGbl_TableLists[TableType].Next; - while (TableDesc); + while (TableDesc) { /* * Delete all namespace entries owned by this table. Note that these diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c index 42c39bcec46a..55624cf4b278 100644 --- a/sys/contrib/dev/acpica/tbxfroot.c +++ b/sys/contrib/dev/acpica/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 68 $ + * $Revision: 70 $ * *****************************************************************************/ @@ -260,7 +260,7 @@ AcpiGetFirmwareTable ( if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { Status = AcpiOsMapMemory (RsdpAddress.Pointer.Physical, sizeof (RSDP_DESCRIPTOR), - (void **) &AcpiGbl_RSDP); + (void *) &AcpiGbl_RSDP); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -296,8 +296,7 @@ AcpiGetFirmwareTable ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", AcpiGbl_RSDP, - ACPI_HIDWORD (Address.Pointer.Value), - ACPI_LODWORD (Address.Pointer.Value))); + ACPI_FORMAT_UINT64 (Address.Pointer.Value))); /* Insert ProcessorMode flags */ @@ -521,7 +520,7 @@ AcpiTbFindRsdp ( * 1) Search EBDA (low memory) paragraphs */ Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE, - (void **) &TablePtr); + (void *) &TablePtr); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", @@ -547,7 +546,7 @@ AcpiTbFindRsdp ( * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h */ Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE, - (void **) &TablePtr); + (void *) &TablePtr); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index a05795dc433c..9234fe6e8fe7 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local cache and memory allocation routines - * $Revision: 131 $ + * $Revision: 134 $ * *****************************************************************************/ @@ -908,7 +908,7 @@ AcpiUtRemoveAllocation ( ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", Allocation->Size)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", Allocation->Size)); Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return_ACPI_STATUS (Status); @@ -1019,72 +1019,31 @@ AcpiUtDumpAllocations ( Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED) { - AcpiOsPrintf ("%p Len %04X %9.9s-%d ", + AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ", Descriptor, Element->Size, Element->Module, - Element->Line); + Element->Line, AcpiUtGetDescriptorName (Descriptor)); - /* Most of the elements will be internal objects. */ + /* Most of the elements will be Operand objects. */ switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor)) { case ACPI_DESC_TYPE_OPERAND: - AcpiOsPrintf ("ObjType %12.12s R%hd", + AcpiOsPrintf ("%12.12s R%hd", AcpiUtGetTypeName (Descriptor->Object.Common.Type), Descriptor->Object.Common.ReferenceCount); break; case ACPI_DESC_TYPE_PARSER: - AcpiOsPrintf ("ParseObj AmlOpcode %04hX", + AcpiOsPrintf ("AmlOpcode %04hX", Descriptor->Op.Asl.AmlOpcode); break; case ACPI_DESC_TYPE_NAMED: - AcpiOsPrintf ("Node %4.4s", - Descriptor->Node.Name.Ascii); - break; - - case ACPI_DESC_TYPE_STATE: - AcpiOsPrintf ("Untyped StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_UPDATE: - AcpiOsPrintf ("UPDATE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_PACKAGE: - AcpiOsPrintf ("PACKAGE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_CONTROL: - AcpiOsPrintf ("CONTROL StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_RPSCOPE: - AcpiOsPrintf ("ROOT-PARSE-SCOPE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_PSCOPE: - AcpiOsPrintf ("PARSE-SCOPE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_WSCOPE: - AcpiOsPrintf ("WALK-SCOPE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_RESULT: - AcpiOsPrintf ("RESULT StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_NOTIFY: - AcpiOsPrintf ("NOTIFY StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_THREAD: - AcpiOsPrintf ("THREAD StateObj"); + AcpiOsPrintf ("%4.4s", + AcpiUtGetNodeName (&Descriptor->Node)); break; default: - /* All types should appear above */ break; } diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index f3a51182f8ae..cca5f5dd1942 100644 --- a/sys/contrib/dev/acpica/utdebug.c +++ b/sys/contrib/dev/acpica/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 109 $ + * $Revision: 110 $ * *****************************************************************************/ @@ -530,7 +530,7 @@ AcpiUtValueExit ( AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, - ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); + ACPI_FORMAT_UINT64 (Value)); AcpiGbl_NestingLevel--; } diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c index 36da0ff484e8..50a5bb461010 100644 --- a/sys/contrib/dev/acpica/utdelete.c +++ b/sys/contrib/dev/acpica/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 97 $ + * $Revision: 98 $ * ******************************************************************************/ @@ -219,7 +219,7 @@ AcpiUtDeleteInternalObj ( /* Walk the handler list for this device */ - HandlerDesc = Object->Device.AddressSpace; + HandlerDesc = Object->Device.Handler; while (HandlerDesc) { NextDesc = HandlerDesc->AddressSpace.Next; @@ -275,7 +275,7 @@ AcpiUtDeleteInternalObj ( * default handlers -- and therefore, we created the context object * locally, it was not created by an external caller. */ - HandlerDesc = Object->Region.AddressSpace; + HandlerDesc = Object->Region.Handler; if (HandlerDesc) { if (HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) @@ -510,7 +510,6 @@ AcpiUtUpdateObjectReference ( UINT32 i; ACPI_GENERIC_STATE *StateList = NULL; ACPI_GENERIC_STATE *State; - ACPI_OPERAND_OBJECT *tmp; ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object); @@ -547,15 +546,8 @@ AcpiUtUpdateObjectReference ( { case ACPI_TYPE_DEVICE: - tmp = Object->Device.SystemNotify; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->Device.SystemNotify = NULL; - AcpiUtUpdateRefCount (tmp, Action); - - tmp = Object->Device.DeviceNotify; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->Device.DeviceNotify = NULL; - AcpiUtUpdateRefCount (tmp, Action); + AcpiUtUpdateRefCount (Object->Device.SystemNotify, Action); + AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action); break; @@ -578,10 +570,6 @@ AcpiUtUpdateObjectReference ( { goto ErrorExit; } - - tmp = Object->Package.Elements[i]; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->Package.Elements[i] = NULL; } break; @@ -594,10 +582,6 @@ AcpiUtUpdateObjectReference ( { goto ErrorExit; } - - tmp = Object->BufferField.BufferObj; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->BufferField.BufferObj = NULL; break; @@ -609,10 +593,6 @@ AcpiUtUpdateObjectReference ( { goto ErrorExit; } - - tmp = Object->Field.RegionObj; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->Field.RegionObj = NULL; break; @@ -625,20 +605,12 @@ AcpiUtUpdateObjectReference ( goto ErrorExit; } - tmp = Object->BankField.BankObj; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->BankField.BankObj = NULL; - Status = AcpiUtCreateUpdateStateAndPush ( Object->BankField.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; } - - tmp = Object->BankField.RegionObj; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->BankField.RegionObj = NULL; break; @@ -651,20 +623,12 @@ AcpiUtUpdateObjectReference ( goto ErrorExit; } - tmp = Object->IndexField.IndexObj; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->IndexField.IndexObj = NULL; - Status = AcpiUtCreateUpdateStateAndPush ( Object->IndexField.DataObj, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; } - - tmp = Object->IndexField.DataObj; - if (tmp && (tmp->Common.ReferenceCount <= 1) && Action == REF_DECREMENT) - Object->IndexField.DataObj = NULL; break; diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c index 49ef9e0fd39b..6ca97a2acc06 100644 --- a/sys/contrib/dev/acpica/uteval.c +++ b/sys/contrib/dev/acpica/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 48 $ + * $Revision: 49 $ * *****************************************************************************/ @@ -167,7 +167,7 @@ AcpiUtEvaluateObject ( if (Status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", - PrefixNode->Name.Ascii, Path)); + AcpiUtGetNodeName (PrefixNode), Path)); } else { @@ -646,7 +646,7 @@ AcpiUtExecute_STA ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_STA on %4.4s was not found, assuming device is present\n", - DeviceNode->Name.Ascii)); + AcpiUtGetNodeName (DeviceNode))); *Flags = 0x0F; Status = AE_OK; diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index 9a16eeaeeb2c..1a88f7c33862 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 185 $ + * $Revision: 191 $ * *****************************************************************************/ @@ -388,9 +388,9 @@ ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] = /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}, - /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE}, - /* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}, - /* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE}, + /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE}, + /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}, + /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE}, /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}, @@ -439,7 +439,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE}, /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, 0, 0}, + /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, }; /***************************************************************************** @@ -615,6 +615,99 @@ AcpiUtGetObjectTypeName ( } +/***************************************************************************** + * + * FUNCTION: AcpiUtGetNodeName + * + * PARAMETERS: Object - A namespace node + * + * RETURN: Pointer to a string + * + * DESCRIPTION: Validate the node and return the node's ACPI name. + * + ****************************************************************************/ + +char * +AcpiUtGetNodeName ( + void *Object) +{ + ACPI_NAMESPACE_NODE *Node; + + + if (!Object) + { + return ("NULL NODE"); + } + + Node = (ACPI_NAMESPACE_NODE *) Object; + + if (Node->Descriptor != ACPI_DESC_TYPE_NAMED) + { + return ("****"); + } + + if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii)) + { + return ("----"); + } + + return (Node->Name.Ascii); +} + + +/***************************************************************************** + * + * FUNCTION: AcpiUtGetDescriptorName + * + * PARAMETERS: Object - An ACPI object + * + * RETURN: Pointer to a string + * + * DESCRIPTION: Validate object and return the descriptor type + * + ****************************************************************************/ + +static const char *AcpiGbl_DescTypeNames[] = /* printable names of descriptor types */ +{ + /* 00 */ "Invalid", + /* 01 */ "Cached", + /* 02 */ "State-Generic", + /* 03 */ "State-Update", + /* 04 */ "State-Package", + /* 05 */ "State-Control", + /* 06 */ "State-RootParseScope", + /* 07 */ "State-ParseScope", + /* 08 */ "State-WalkScope", + /* 09 */ "State-Result", + /* 10 */ "State-Notify", + /* 11 */ "State-Thread", + /* 12 */ "Walk", + /* 13 */ "Parser", + /* 14 */ "Operand", + /* 15 */ "Node" +}; + + +char * +AcpiUtGetDescriptorName ( + void *Object) +{ + + if (!Object) + { + return ("NULL OBJECT"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) + { + return ((char *) AcpiGbl_BadType); + } + + return ((char *) AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]); + +} + + #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* * Strings and procedures used for debug only diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index cd8d04cb4dca..e652524b23da 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 83 $ + * $Revision: 84 $ * *****************************************************************************/ @@ -305,29 +305,10 @@ AcpiUtValidInternalObject ( return (TRUE); - case ACPI_DESC_TYPE_NAMED: - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Obj %p is a named obj, not ACPI obj\n", Object)); - break; - - case ACPI_DESC_TYPE_PARSER: - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Obj %p is a parser obj, not ACPI obj\n", Object)); - break; - - case ACPI_DESC_TYPE_CACHED: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "**** Obj %p has already been released to internal cache\n", Object)); - break; - default: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "**** Obj %p has unknown descriptor type %X\n", Object, - ACPI_GET_DESCRIPTOR_TYPE (Object))); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "%p is not not an ACPI operand obj [%s]\n", + Object, AcpiUtGetDescriptorName (Object))); break; } @@ -406,7 +387,8 @@ AcpiUtDeleteObjectDesc ( if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Obj %p is not an ACPI object\n", Object)); + "%p is not an ACPI Operand object [%s]\n", Object, + AcpiUtGetDescriptorName (Object))); return_VOID; } |