diff options
author | msmith <msmith@FreeBSD.org> | 2001-07-21 03:55:17 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-07-21 03:55:17 +0000 |
commit | 91b87ce244ba7faf775a62956dc8b93fefc09941 (patch) | |
tree | ace3ff94f32745a26e8a131379a4320fd8795556 /sys/contrib | |
parent | 4a8fbafe900e74a64bb295402c983efdae3b51ee (diff) | |
download | FreeBSD-src-91b87ce244ba7faf775a62956dc8b93fefc09941.zip FreeBSD-src-91b87ce244ba7faf775a62956dc8b93fefc09941.tar.gz |
Vendor import of the Intel ACPI CA 20010717 snapshot.
Diffstat (limited to 'sys/contrib')
82 files changed, 1320 insertions, 1401 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index 3b79b6a..b7f0d07 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: 65 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -144,7 +144,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20010615 +#define ACPI_CA_VERSION 0x20010717 /* Maximum objects in the various object caches */ diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h index 126c9cd..364d6d9 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: 75 $ + * $Revision: 76 $ * *****************************************************************************/ @@ -153,7 +153,7 @@ */ #ifdef ACPI_DEBUG #ifndef _IA16 -#define ACPI_DEBUG_TRACK_ALLOCATIONS +#define ACPI_DBG_TRACK_ALLOCATIONS #endif #endif diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h index 2bf4cf3..717c0df 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: 46 $ + * $Revision: 49 $ * *****************************************************************************/ @@ -244,7 +244,7 @@ * String versions of the exception codes above * These strings must match the corresponding defines exactly */ -static NATIVE_CHAR *AcpiGbl_ExceptionNames_Env[] = +NATIVE_CHAR *AcpiGbl_ExceptionNames_Env[] = { "AE_OK", "AE_ERROR", @@ -275,7 +275,7 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Env[] = "AE_NO_GLOBAL_LOCK", }; -static NATIVE_CHAR *AcpiGbl_ExceptionNames_Pgm[] = +NATIVE_CHAR *AcpiGbl_ExceptionNames_Pgm[] = { "AE_BAD_PARAMETER", "AE_BAD_CHARACTER", @@ -284,7 +284,7 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Pgm[] = "AE_BAD_ADDRESS", }; -static NATIVE_CHAR *AcpiGbl_ExceptionNames_Tbl[] = +NATIVE_CHAR *AcpiGbl_ExceptionNames_Tbl[] = { "AE_BAD_SIGNATURE", "AE_BAD_HEADER", @@ -292,7 +292,7 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Tbl[] = "AE_BAD_VALUE", }; -static NATIVE_CHAR *AcpiGbl_ExceptionNames_Aml[] = +NATIVE_CHAR *AcpiGbl_ExceptionNames_Aml[] = { "AE_AML_ERROR", "AE_AML_PARSE", @@ -321,7 +321,7 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_INVALID_RESOURCE_TYPE", }; -static NATIVE_CHAR *AcpiGbl_ExceptionNames_Ctrl[] = +NATIVE_CHAR *AcpiGbl_ExceptionNames_Ctrl[] = { "AE_CTRL_RETURN_VALUE", "AE_CTRL_PENDING", @@ -333,8 +333,7 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Ctrl[] = "AE_CTRL_TRANSFER", }; - -#endif /* DEFINE_ACPI_GLOBALS */ +#endif /* ACPI GLOBALS */ #endif /* __ACEXCEP_H__ */ diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h index 2fbcbe1..232ebd5 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: 101 $ + * $Revision: 102 $ * *****************************************************************************/ @@ -309,15 +309,6 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot; -/***************************************************************************** - * - * Hardware globals - * - ****************************************************************************/ - -extern ACPI_C_STATE_HANDLER AcpiHwCxHandlers[MAX_CX_STATES]; -extern UINT32 AcpiHwActiveCxState; - /***************************************************************************** * diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index a3518fa..9bb7f88 100644 --- a/sys/contrib/dev/acpica/acinterp.h +++ b/sys/contrib/dev/acpica/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 102 $ + * $Revision: 105 $ * *****************************************************************************/ @@ -166,17 +166,21 @@ AcpiExExecuteMethod ( ACPI_STATUS AcpiExConvertToInteger ( - ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExConvertToBuffer ( - ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExConvertToString ( - ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, + UINT32 MaxLength, ACPI_WALK_STATE *WalkState); ACPI_STATUS @@ -265,6 +269,18 @@ AcpiExWriteDataToField ( */ ACPI_STATUS +AcpiExTriadic ( + UINT16 Opcode, + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT **ReturnDesc); + +ACPI_STATUS +AcpiExHexadic ( + UINT16 Opcode, + ACPI_WALK_STATE *WalkState, + ACPI_OPERAND_OBJECT **ReturnDesc); + +ACPI_STATUS AcpiExCreateBufferField ( UINT8 *AmlPtr, UINT32 AmlLength, @@ -277,20 +293,6 @@ AcpiExReconfiguration ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiExFatal ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiExIndex ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); - -ACPI_STATUS -AcpiExMatch ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); - -ACPI_STATUS AcpiExCreateMutex ( ACPI_WALK_STATE *WalkState); diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h index 558ffa6..70bb299 100644 --- a/sys/contrib/dev/acpica/aclocal.h +++ b/sys/contrib/dev/acpica/aclocal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 123 $ + * $Revision: 124 $ * *****************************************************************************/ @@ -723,22 +723,7 @@ typedef struct acpi_parse_state /* PCI */ - #define PCI_ROOT_HID_STRING "PNP0A03" -#define PCI_ROOT_HID_VALUE 0x030AD041 /* EISAID("PNP0A03") */ - - -/* Sleep states */ - -#define SLWA_DEBUG_LEVEL 4 -#define GTS_CALL 0 -#define GTS_WAKE 1 - -/* Cx States */ - -#define MAX_CX_STATE_LATENCY 0xFFFFFFFF -#define MAX_CX_STATES 4 - /* * The #define's and enum below establish an abstract way of identifying what diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index 55e6064..a4dcfe7 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: 72 $ + * $Revision: 80 $ * *****************************************************************************/ @@ -117,18 +117,11 @@ #ifndef __ACMACROS_H__ #define __ACMACROS_H__ + /* * Data manipulation macros */ -#ifndef LODWORD -#define LODWORD(l) ((UINT32)(UINT64)(l)) -#endif - -#ifndef HIDWORD -#define HIDWORD(l) ((UINT32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF)) -#endif - #ifndef LOWORD #define LOWORD(l) ((UINT16)(NATIVE_UINT)(l)) #endif @@ -167,6 +160,14 @@ * For 16-bit addresses, we have to assume that the upper 32 bits * are zero. */ +#ifndef LODWORD +#define LODWORD(l) (l) +#endif + +#ifndef HIDWORD +#define HIDWORD(l) (0) +#endif + #define ACPI_GET_ADDRESS(a) ((a).Lo) #define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(b);} #define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo) @@ -175,6 +176,14 @@ /* * Full 64-bit address on 32-bit and 64-bit platforms */ +#ifndef LODWORD +#define LODWORD(l) ((UINT32)(UINT64)(l)) +#endif + +#ifndef HIDWORD +#define HIDWORD(l) ((UINT32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF)) +#endif + #define ACPI_GET_ADDRESS(a) (a) #define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) #define ACPI_VALID_ADDRESS(a) (a) @@ -269,7 +278,6 @@ /* * Rounding macros (Power of two boundaries only) */ - #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) #define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1))) @@ -299,32 +307,30 @@ * MASK_BITS_ABOVE creates a mask starting AT the position and above * MASK_BITS_BELOW creates a mask starting one bit BELOW the position */ - - #define MASK_BITS_ABOVE(position) (~(((UINT32)(-1)) << ((UINT32) (position)))) #define MASK_BITS_BELOW(position) (((UINT32)(-1)) << ((UINT32) (position))) -#ifdef DEBUG_ASSERT -#undef DEBUG_ASSERT -#endif /* Macros for GAS addressing */ +#ifndef _IA16 + #define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000 #define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000 #define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF -#define ACPI_PCI_FUNCTION(a) (UINT32) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16)) -#define ACPI_PCI_DEVICE(a) (UINT32) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32)) - -#ifndef _IA16 -#define ACPI_PCI_REGISTER(a) (UINT32) (((a) & ACPI_PCI_REGISTER_MASK)) -#define ACPI_PCI_DEVFUN(a) (UINT32) ((ACPI_PCI_DEVICE(a) << 16) | ACPI_PCI_FUNCTION(a)) +#define ACPI_PCI_FUNCTION(a) (UINT16) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16)) +#define ACPI_PCI_DEVICE(a) (UINT16) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32)) +#define ACPI_PCI_REGISTER(a) (UINT16) (((a) & ACPI_PCI_REGISTER_MASK)) #else -#define ACPI_PCI_REGISTER(a) (UINT32) (((a) & 0x0000FFFF)) -#define ACPI_PCI_DEVFUN(a) (UINT32) ((((a) & 0xFFFF0000) >> 16)) + +/* No support for GAS and PCI IDs in 16-bit mode */ + +#define ACPI_PCI_FUNCTION(a) (UINT16) ((a) & 0xFFFF0000) +#define ACPI_PCI_DEVICE(a) (UINT16) ((a) & 0x0000FFFF) +#define ACPI_PCI_REGISTER(a) (UINT16) ((a) & 0x0000FFFF) #endif @@ -335,7 +341,6 @@ * * The DataType field is the first field in both structures. */ - #define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->DataType == t) @@ -357,7 +362,6 @@ * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, * and ((UINT8 *)b+b->Length) points one byte past the end of the table. */ - #ifndef _IA16 #define IS_IN_ACPI_TABLE(a,b) (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\ ((UINT8 *)(a) < ((UINT8 *)b + b->Length))) @@ -371,7 +375,6 @@ /* * Macros for the master AML opcode table */ - #ifdef ACPI_DEBUG #define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs,Name} #else @@ -526,7 +529,8 @@ #define DUMP_TABLES(a,b) AcpiNsDumpTables(a,b) #define DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) #define DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) -#define BREAK_MSG(a) AcpiOsBreakpoint (a) +#define BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a)) + /* * Generate INT3 on ACPI_ERROR (Debug only!) @@ -534,7 +538,7 @@ #define ERROR_BREAK #ifdef ERROR_BREAK -#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) AcpiOsBreakpoint("Fatal error encountered\n") +#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n") #else #define BREAK_ON_ERROR(lvl) #endif @@ -563,16 +567,6 @@ #define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ DebugPrintRaw PARAM_LIST(fp);} - -/* Assert macros */ - -#define ACPI_ASSERT(exp) if(!(exp)) \ - AcpiOsDbgAssert(#exp, __FILE__, __LINE__, "Failed Assertion") - -#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ - AcpiOsDbgAssert(#exp, __FILE__, __LINE__, msg) - - #else /* * This is the non-debug case -- make everything go away, @@ -611,9 +605,6 @@ #define return_VALUE(s) return(s) #define return_PTR(s) return(s) -#define ACPI_ASSERT(exp) -#define DEBUG_ASSERT(msg, exp) - #endif /* @@ -660,12 +651,14 @@ * Memory allocation tracking (DEBUG ONLY) */ -#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS +#ifndef ACPI_DBG_TRACK_ALLOCATIONS + +/* Memory allocation */ + +#define ACPI_MEM_ALLOCATE(a) AcpiOsAllocate(a) +#define ACPI_MEM_CALLOCATE(a) AcpiOsCallocate(a) +#define ACPI_MEM_FREE(a) AcpiOsFree(a) -#define AcpiUtAddElementToAllocList(a,b,c,d,e,f) -#define AcpiUtDeleteElementFromAllocList(a,b,c,d) -#define AcpiUtDumpCurrentAllocations(a,b) -#define AcpiUtDumpAllocationInfo() #define DECREMENT_OBJECT_METRICS(a) #define INCREMENT_OBJECT_METRICS(a) @@ -675,6 +668,12 @@ #else +/* Memory allocation */ + +#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_FREE(a) AcpiUtFree(a,_COMPONENT,_THIS_MODULE,__LINE__) + #define INITIALIZE_ALLOCATION_METRICS() \ AcpiGbl_CurrentObjectCount = 0; \ AcpiGbl_CurrentObjectSize = 0; \ @@ -722,7 +721,7 @@ { \ AcpiGbl_MaxConcurrentNodeCount = AcpiGbl_CurrentNodeCount; \ } -#endif /* ACPI_DEBUG_TRACK_ALLOCATIONS */ +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ #endif /* ACMACROS_H */ diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/acoutput.h index 4c64734..de793d7 100644 --- a/sys/contrib/dev/acpica/acoutput.h +++ b/sys/contrib/dev/acpica/acoutput.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 78 $ + * $Revision: 80 $ * *****************************************************************************/ @@ -137,17 +137,18 @@ #define ACPI_DEBUGGER 0x00000200 #define ACPI_OS_SERVICES 0x00000400 -#define ACPI_BUS 0x00001000 -#define ACPI_SYSTEM 0x00002000 -#define ACPI_POWER 0x00004000 -#define ACPI_EC 0x00008000 -#define ACPI_AC_ADAPTER 0x00010000 -#define ACPI_BATTERY 0x00020000 -#define ACPI_BUTTON 0x00040000 -#define ACPI_PROCESSOR 0x00080000 -#define ACPI_THERMAL 0x00100000 - -#define ACPI_ALL_COMPONENTS 0x00FFFFFF +#define ACPI_BUS 0x00010000 +#define ACPI_SYSTEM 0x00020000 +#define ACPI_POWER 0x00040000 +#define ACPI_EC 0x00080000 +#define ACPI_AC_ADAPTER 0x00100000 +#define ACPI_BATTERY 0x00200000 +#define ACPI_BUTTON 0x00400000 +#define ACPI_PROCESSOR 0x00800000 +#define ACPI_THERMAL 0x01000000 +#define ACPI_FAN 0x02000000 + +#define ACPI_ALL_COMPONENTS 0x0FFFFFFF #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h index 4d798d5..ade1e00 100644 --- a/sys/contrib/dev/acpica/acpiosxf.h +++ b/sys/contrib/dev/acpica/acpiosxf.h @@ -135,6 +135,20 @@ #define ACPI_MUTEX_SEM 1 +/* Functions for AcpiOsSignal */ + +#define ACPI_SIGNAL_FATAL 0 +#define ACPI_SIGNAL_BREAKPOINT 1 + +typedef struct AcpiFatalInfo +{ + UINT32 Type; + UINT32 Code; + UINT32 Argument; + +} ACPI_SIGNAL_FATAL_INFO; + + /* * Types specific to the OS service interfaces */ @@ -160,6 +174,11 @@ ACPI_STATUS AcpiOsTerminate ( void); +ACPI_STATUS +AcpiOsGetRootPointer ( + UINT32 Flags, + ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress); + /* * Synchronization primitives @@ -256,131 +275,70 @@ AcpiOsSleep ( UINT32 Milliseconds); void -AcpiOsSleepUsec ( +AcpiOsStall ( UINT32 Microseconds); /* - * Platform/Hardware independent I/O interfaces + * Platform and hardware-independent I/O interfaces */ -UINT8 -AcpiOsIn8 ( - ACPI_IO_ADDRESS InPort); - - -UINT16 -AcpiOsIn16 ( - ACPI_IO_ADDRESS InPort); - -UINT32 -AcpiOsIn32 ( - ACPI_IO_ADDRESS InPort); - -void -AcpiOsOut8 ( - ACPI_IO_ADDRESS OutPort, - UINT8 Value); +ACPI_STATUS +AcpiOsReadPort ( + ACPI_IO_ADDRESS Address, + void *Value, + UINT32 Width); -void -AcpiOsOut16 ( - ACPI_IO_ADDRESS OutPort, - UINT16 Value); -void -AcpiOsOut32 ( - ACPI_IO_ADDRESS OutPort, - UINT32 Value); +ACPI_STATUS +AcpiOsWritePort ( + ACPI_IO_ADDRESS Address, + NATIVE_UINT Value, + UINT32 Width); /* - * Platform/Hardware independent physical memory interfaces + * Platform and hardware-independent physical memory interfaces */ -UINT8 -AcpiOsMemIn8 ( - ACPI_PHYSICAL_ADDRESS InAddr); - -UINT16 -AcpiOsMemIn16 ( - ACPI_PHYSICAL_ADDRESS InAddr); - -UINT32 -AcpiOsMemIn32 ( - ACPI_PHYSICAL_ADDRESS InAddr); - -void -AcpiOsMemOut8 ( - ACPI_PHYSICAL_ADDRESS OutAddr, - UINT8 Value); +ACPI_STATUS +AcpiOsReadMemory ( + ACPI_PHYSICAL_ADDRESS Address, + void *Value, + UINT32 Width); -void -AcpiOsMemOut16 ( - ACPI_PHYSICAL_ADDRESS OutAddr, - UINT16 Value); -void -AcpiOsMemOut32 ( - ACPI_PHYSICAL_ADDRESS OutAddr, - UINT32 Value); +ACPI_STATUS +AcpiOsWriteMemory ( + ACPI_PHYSICAL_ADDRESS Address, + NATIVE_UINT Value, + UINT32 Width); /* - * Standard access to PCI configuration space + * Platform and hardware-independent PCI configuration space access */ ACPI_STATUS -AcpiOsReadPciCfgByte ( - UINT32 Bus, - UINT32 DeviceFunction, +AcpiOsReadPciConfiguration ( + ACPI_PCI_ID *PciId, UINT32 Register, - UINT8 *Value); + void *Value, + UINT32 Width); -ACPI_STATUS -AcpiOsReadPciCfgWord ( - UINT32 Bus, - UINT32 DeviceFunction, - UINT32 Register, - UINT16 *Value); ACPI_STATUS -AcpiOsReadPciCfgDword ( - UINT32 Bus, - UINT32 DeviceFunction, +AcpiOsWritePciConfiguration ( + ACPI_PCI_ID *PciId, UINT32 Register, - UINT32 *Value); - -ACPI_STATUS -AcpiOsWritePciCfgByte ( - UINT32 Bus, - UINT32 DeviceFunction, - UINT32 Register, - UINT8 Value); - -ACPI_STATUS -AcpiOsWritePciCfgWord ( - UINT32 Bus, - UINT32 DeviceFunction, - UINT32 Register, - UINT16 Value); - - -ACPI_STATUS -AcpiOsWritePciCfgDword ( - UINT32 Bus, - UINT32 DeviceFunction, - UINT32 Register, - UINT32 Value); + NATIVE_UINT Value, + UINT32 Width); /* * Miscellaneous */ -ACPI_STATUS -AcpiOsBreakpoint ( - NATIVE_CHAR *Message); - BOOLEAN AcpiOsReadable ( void *Pointer, @@ -396,7 +354,10 @@ UINT32 AcpiOsGetTimer ( void); - +ACPI_STATUS +AcpiOsSignal ( + UINT32 Function, + void *Info); /* * Debug print routines diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h index 28a1761..367065f 100644 --- a/sys/contrib/dev/acpica/acpixf.h +++ b/sys/contrib/dev/acpica/acpixf.h @@ -122,7 +122,7 @@ #include "actbl.h" -/* + /* * Global interfaces */ @@ -139,6 +139,10 @@ AcpiTerminate ( void); ACPI_STATUS +AcpiSubsystemStatus ( + void); + +ACPI_STATUS AcpiEnable ( void); @@ -147,13 +151,12 @@ AcpiDisable ( void); ACPI_STATUS -AcpiGetSystemInfo( +AcpiGetSystemInfo ( ACPI_BUFFER *RetBuffer); -ACPI_STATUS +const char * AcpiFormatException ( - ACPI_STATUS Exception, - ACPI_BUFFER *OutBuffer); + ACPI_STATUS Exception); /* @@ -179,11 +182,12 @@ AcpiFree ( ACPI_STATUS AcpiFindRootPointer ( + UINT32 Flags, ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress); ACPI_STATUS AcpiLoadTables ( - ACPI_PHYSICAL_ADDRESS RsdpPhysicalAddress); + void); ACPI_STATUS AcpiLoadTable ( diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index a003944..828a6be 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: 180 $ + * $Revision: 184 $ * *****************************************************************************/ @@ -281,7 +281,7 @@ typedef UINT64 u64; */ typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ -typedef UINT32 ACPI_NAME; /* 4-INT8 ACPI name */ +typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ typedef char* ACPI_STRING; /* Null terminated ASCII string */ typedef void* ACPI_HANDLE; /* Actually a ptr to an Node */ @@ -334,6 +334,10 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_NO_DEVICE_INIT 0x10 #define ACPI_NO_OBJECT_INIT 0x20 +/* + * Initialization state + */ +#define ACPI_INITIALIZED_OK 0x01 /* * Power state values @@ -347,8 +351,6 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_STATE_S3 (UINT8) 3 #define ACPI_STATE_S4 (UINT8) 4 #define ACPI_STATE_S5 (UINT8) 5 -/* let's pretend S4BIOS didn't exist for now. ASG */ -#define ACPI_STATE_S4BIOS (UINT8) 6 #define ACPI_S_STATES_MAX ACPI_STATE_S5 #define ACPI_S_STATE_COUNT 6 @@ -676,30 +678,6 @@ typedef struct #define SYS_MODE_LEGACY 0x0002 #define SYS_MODES_MASK 0x0003 -/* - * ACPI CPU Cx state handler - */ -typedef -ACPI_STATUS (*ACPI_SET_C_STATE_HANDLER) ( - NATIVE_UINT PblkAddress); - -/* - * ACPI Cx State info - */ -typedef struct -{ - UINT32 StateNumber; - UINT32 Latency; -} ACPI_CX_STATE; - -/* - * ACPI CPU throttling info - */ -typedef struct -{ - UINT32 StateNumber; - UINT32 PercentOfClock; -} ACPI_CPU_THROTTLING_STATE; /* * ACPI Table Info. One per ACPI table _type_ @@ -731,18 +709,6 @@ typedef struct _AcpiSysInfo /* - * System Initiailization data. This data is passed to ACPIInitialize - * copyied to global data and retained by ACPI CA - */ - -typedef struct _AcpiInitData -{ - void *RSDP_PhysicalAddress; /* Address of RSDP, needed it it is */ - /* not found in the IA32 manner */ -} ACPI_INIT_DATA; - - -/* * Various handlers and callback procedures */ @@ -837,10 +803,11 @@ typedef struct typedef struct { - UINT32 Seg; - UINT32 Bus; - UINT32 DevFunc; -} ACPI_PCI_SPACE_CONTEXT; + UINT16 Segment; + UINT16 Bus; + UINT16 Device; + UINT16 Function; +} ACPI_PCI_ID; typedef struct @@ -852,13 +819,6 @@ typedef struct /* - * C-state handler - */ - -typedef ACPI_STATUS (*ACPI_C_STATE_HANDLER) (ACPI_IO_ADDRESS, UINT32*); - - -/* * Definitions for Resource Attributes */ diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 1e463b8..b083205 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: 100 $ + * $Revision: 104 $ * *****************************************************************************/ @@ -524,15 +524,6 @@ AcpiUtExecute_UID ( /* - * UtError - exception interfaces - */ - -NATIVE_CHAR * -AcpiUtFormatException ( - ACPI_STATUS Status); - - -/* * UtMutex - mutual exclusion interfaces */ @@ -709,21 +700,21 @@ AcpiUtDisplayInitPathname ( */ void * -_UtAllocate ( +AcpiUtAllocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line); void * -_UtCallocate ( +AcpiUtCallocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line); void -_UtFree ( +AcpiUtFree ( void *Address, UINT32 Component, NATIVE_CHAR *Module, @@ -734,7 +725,7 @@ AcpiUtInitStaticObject ( ACPI_OPERAND_OBJECT *ObjDesc); -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS +#ifdef ACPI_DBG_TRACK_ALLOCATIONS void AcpiUtDumpAllocationInfo ( void); @@ -746,9 +737,5 @@ AcpiUtDumpCurrentAllocations ( #endif -#define AcpiUtAllocate(a) _UtAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__) -#define AcpiUtCallocate(a) _UtCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__) -#define AcpiUtFree(a) _UtFree(a,_COMPONENT,_THIS_MODULE,__LINE__) - #endif /* _ACUTILS_H */ diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h index 2dbcd49..0cba99b 100644 --- a/sys/contrib/dev/acpica/amlcode.h +++ b/sys/contrib/dev/acpica/amlcode.h @@ -3,7 +3,7 @@ * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. - * $Revision: 52 $ + * $Revision: 53 $ * *****************************************************************************/ @@ -371,7 +371,6 @@ #define OPTYPE_MONADIC1 6 #define OPTYPE_DYADIC1 7 - /* Type 2 opcodes */ #define OPTYPE_MONADIC2 8 @@ -379,18 +378,20 @@ #define OPTYPE_DYADIC2 10 #define OPTYPE_DYADIC2R 11 #define OPTYPE_DYADIC2S 12 -#define OPTYPE_INDEX 13 -#define OPTYPE_MATCH 14 -/* Generic for an op that returns a value */ +/* Multi-operand (>=3) opcodes */ -#define OPTYPE_METHOD_CALL 15 +#define OPTYPE_TRIADIC 13 +#define OPTYPE_QUADRADIC 14 +#define OPTYPE_HEXADIC 15 + +/* Generic for an op that returns a value */ +#define OPTYPE_METHOD_CALL 16 /* Misc */ -#define OPTYPE_CREATE_FIELD 16 -#define OPTYPE_FATAL 17 +#define OPTYPE_CREATE_FIELD 17 #define OPTYPE_CONTROL 18 #define OPTYPE_RECONFIGURATION 19 #define OPTYPE_NAMED_OBJECT 20 diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index c1bded4..b729ae2 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: 60 $ + * $Revision: 61 $ * ******************************************************************************/ @@ -326,7 +326,8 @@ AcpiDbUnloadAcpiTable ( for (i = 0; i < NUM_ACPI_TABLES; i++) { - if (!STRNCMP (TableArg, AcpiGbl_AcpiTableData[i].Signature, AcpiGbl_AcpiTableData[i].SigLength)) + if (!STRNCMP (TableArg, AcpiGbl_AcpiTableData[i].Signature, + AcpiGbl_AcpiTableData[i].SigLength)) { /* Found the table, unload it */ @@ -337,7 +338,8 @@ AcpiDbUnloadAcpiTable ( } else { - AcpiOsPrintf ("%s, while unloading [%s]\n", AcpiUtFormatException (Status), TableArg); + AcpiOsPrintf ("%s, while unloading [%s]\n", + AcpiFormatException (Status), TableArg); } return; @@ -1046,7 +1048,7 @@ AcpiDbDisplayResources ( Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiFormatException (Status)); goto GoCRS; } @@ -1056,7 +1058,7 @@ AcpiDbDisplayResources ( Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiFormatException (Status)); goto GoCRS; } @@ -1073,7 +1075,7 @@ GoCRS: Status = AcpiEvaluateObject (ObjDesc, "_CRS", NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiFormatException (Status)); goto GoPRS; } @@ -1083,7 +1085,7 @@ GoCRS: Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status)); goto GoPRS; } @@ -1099,7 +1101,7 @@ GoPRS: Status = AcpiEvaluateObject (ObjDesc, "_PRS", NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiFormatException (Status)); goto Cleanup; } @@ -1109,7 +1111,7 @@ GoPRS: Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status)); goto Cleanup; } diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index 81f15b7..8ef647d 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: 45 $ + * $Revision: 46 $ * ******************************************************************************/ @@ -416,8 +416,17 @@ AcpiDbDecodeInternalObject ( break; case ACPI_TYPE_STRING: - AcpiOsPrintf ("(%d) \"%.16s\"...", + AcpiOsPrintf ("(%d) \"%.24s", ObjDesc->String.Length, ObjDesc->String.Pointer); + + if (ObjDesc->String.Length > 24) + { + AcpiOsPrintf ("..."); + } + else + { + AcpiOsPrintf ("\""); + } break; case ACPI_TYPE_BUFFER: diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c index 4bf2f15..b0f9dc5 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: 26 $ + * $Revision: 27 $ * ******************************************************************************/ @@ -322,7 +322,7 @@ AcpiDbExecute ( if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Execution of %s failed with status %s\n", - Info.Pathname, AcpiUtFormatException (Status)); + Info.Pathname, AcpiFormatException (Status)); } else @@ -429,7 +429,7 @@ AcpiDbCreateExecutionThreads ( Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiUtFormatException (Status)); + AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiFormatException (Status)); return; } diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index f3f45bf..57e430d 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: 41 $ + * $Revision: 43 $ * ******************************************************************************/ @@ -311,7 +311,7 @@ AcpiDbLoadTable( /* Allocate a buffer for the table */ *TableLength = TableHeader.Length; - *TablePtr = (ACPI_TABLE_HEADER *) AcpiUtAllocate ((size_t) *TableLength); + *TablePtr = ACPI_MEM_ALLOCATE ((size_t) *TableLength); if (!*TablePtr) { AcpiOsPrintf ("Could not allocate memory for the table (size=%X)\n", TableHeader.Length); @@ -342,7 +342,7 @@ AcpiDbLoadTable( AcpiOsPrintf ("Error - could not read the table file\n"); - AcpiUtFree (*TablePtr); + ACPI_MEM_FREE (*TablePtr); *TablePtr = NULL; *TableLength = 0; @@ -469,12 +469,14 @@ AcpiDbLoadAcpiTable ( AcpiOsPrintf ("Table %4.4s is already installed\n", &TablePtr->Signature); } + else { AcpiOsPrintf ("Could not install table, %s\n", - AcpiUtFormatException (Status)); + AcpiFormatException (Status)); } - AcpiUtFree (TablePtr); + + ACPI_MEM_FREE (TablePtr); return (Status); } diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c index bcc42d0..1eb93d5 100644 --- a/sys/contrib/dev/acpica/dbinput.c +++ b/sys/contrib/dev/acpica/dbinput.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger - * $Revision: 61 $ + * $Revision: 62 $ * ******************************************************************************/ @@ -600,7 +600,9 @@ AcpiDbCommandDispatch ( break; case CMD_ALLOCATIONS: +#ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpCurrentAllocations ((UINT32) -1, NULL); +#endif break; case CMD_ARGS: diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c index 8d0c9bb..89019eb 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: 40 $ + * $Revision: 41 $ * ******************************************************************************/ @@ -409,7 +409,9 @@ AcpiDbDisplayStatistics ( { #ifndef PARSER_ONLY case CMD_ALLOCATIONS: +#ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpAllocationInfo (); +#endif break; #endif diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c index 6d1ae06..06cf8f8 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: 37 $ + * $Revision: 39 $ * ******************************************************************************/ @@ -450,11 +450,11 @@ AcpiDbLocalNsLookup ( if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiUtFormatException (Status)); + AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiFormatException (Status)); } - AcpiUtFree (InternalPath); + ACPI_MEM_FREE (InternalPath); return (Node); } diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c index 100c3a1..6c0bdc7 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: 46 $ + * $Revision: 47 $ * ******************************************************************************/ @@ -154,7 +154,7 @@ AcpiDsMethodDataInit ( /* * WalkState fields are initialized to zero by the - * AcpiUtCallocate(). + * ACPI_MEM_CALLOCATE(). * * An Node is assigned to each argument and local so * that RefOf() can return a pointer to the Node. diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c index 78d3e23..daf7205 100644 --- a/sys/contrib/dev/acpica/dsobject.c +++ b/sys/contrib/dev/acpica/dsobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 65 $ + * $Revision: 67 $ * *****************************************************************************/ @@ -225,7 +225,7 @@ AcpiDsInitOneObject ( { DEBUG_PRINTP (ACPI_ERROR, ("Method %p [%4.4s] parse failed! %s\n", ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); break; } @@ -395,8 +395,8 @@ AcpiDsInitObjectFromOp ( else { - (*ObjDesc)->Buffer.Pointer = - AcpiUtCallocate ((*ObjDesc)->Buffer.Length); + (*ObjDesc)->Buffer.Pointer = ACPI_MEM_CALLOCATE ( + (*ObjDesc)->Buffer.Length); if (!(*ObjDesc)->Buffer.Pointer) { @@ -565,13 +565,15 @@ AcpiDsBuildInternalSimpleObj ( { REPORT_WARNING (("Reference %s at AML %X not found\n", Name, Op->AmlOffset)); - AcpiUtFree (Name); + ACPI_MEM_FREE (Name); } + else { REPORT_WARNING (("Reference %s at AML %X not found\n", Op->Value.String, Op->AmlOffset)); } + *ObjDescPtr = NULL; } @@ -662,8 +664,8 @@ AcpiDsBuildInternalPackageObj ( * that the list is always null terminated. */ - ObjDesc->Package.Elements = - AcpiUtCallocate ((ObjDesc->Package.Count + 1) * sizeof (void *)); + ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE ( + (ObjDesc->Package.Count + 1) * sizeof (void *)); if (!ObjDesc->Package.Elements) { diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index c76a942..a8e916c 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: 44 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -802,8 +802,9 @@ AcpiDsEvalRegionOperands ( AcpiUtRemoveReference (OperandDesc); - DEBUG_PRINTP (TRACE_EXEC, ("RgnObj %p Addr %X Len %X\n", - ObjDesc, ObjDesc->Region.Address, ObjDesc->Region.Length)); + DEBUG_PRINTP (TRACE_EXEC, ("RgnObj %p Addr %8.8lX%8.8lX Len %X\n", + ObjDesc, HIDWORD(ObjDesc->Region.Address), LODWORD(ObjDesc->Region.Address), + ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ @@ -936,7 +937,6 @@ AcpiDsExecEndControlOp ( * Save the result of the predicate in case there is an * ELSE to come */ - WalkState->LastPredicate = (BOOLEAN) WalkState->ControlState->Common.Value; @@ -944,7 +944,6 @@ AcpiDsExecEndControlOp ( * Pop the control state that was created at the start * of the IF and free it */ - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); AcpiUtDeleteGenericState (ControlState); break; @@ -1014,7 +1013,6 @@ AcpiDsExecEndControlOp ( * value. This is the only place where WalkState->ReturnDesc * is set to anything other than zero! */ - WalkState->ReturnDesc = WalkState->Operands[0]; } @@ -1065,6 +1063,7 @@ AcpiDsExecEndControlOp ( WalkState, WalkState->ReturnDesc)); /* End the control method execution right now */ + Status = AE_CTRL_TERMINATE; break; @@ -1077,11 +1076,11 @@ AcpiDsExecEndControlOp ( case AML_BREAK_POINT_OP: - /* Call up to the OS dependent layer to handle this */ + /* Call up to the OS service layer to handle this */ - AcpiOsBreakpoint (NULL); + AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode"); - /* If it returns, we are done! */ + /* If and when it returns, all done. */ break; @@ -1091,6 +1090,8 @@ AcpiDsExecEndControlOp ( DEBUG_PRINTP (ACPI_INFO, ("Break to end of current package, Op=%p\n", Op)); + /* TBD: update behavior for ACPI 2.0 */ + /* * As per the ACPI specification: * "The break operation causes the current package @@ -1102,11 +1103,16 @@ AcpiDsExecEndControlOp ( * the current package, and execution will continue one * level up, starting with the completion of the parent Op. */ - Status = AE_CTRL_FALSE; break; + case AML_CONTINUE_OP: /* ACPI 2.0 */ + + Status = AE_NOT_IMPLEMENTED; + break; + + default: DEBUG_PRINTP (ACPI_ERROR, ("Unknown control opcode=%X Op=%p\n", diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c index 8d89f67..96a1656 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: 58 $ + * $Revision: 62 $ * ******************************************************************************/ @@ -424,7 +424,7 @@ AcpiDsCreateOperand ( /* Free the namestring created above */ - AcpiUtFree (NameString); + ACPI_MEM_FREE (NameString); /* * The only case where we pass through (ignore) a NOT_FOUND @@ -528,7 +528,7 @@ AcpiDsCreateOperand ( * a missing or null operand! */ DEBUG_PRINTP (ACPI_ERROR, ("Missing or null operand, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -629,7 +629,7 @@ Cleanup: AcpiDsObjStackPopAndDelete (ArgCount, WalkState); DEBUG_PRINTP (ACPI_ERROR, ("While creating Arg %d - %s\n", - (ArgCount + 1), AcpiUtFormatException (Status))); + (ArgCount + 1), AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -761,6 +761,7 @@ AcpiDsMapOpcodeToDataType ( break; case AML_PACKAGE_OP: + case AML_VAR_PACKAGE_OP: DataType = ACPI_TYPE_PACKAGE; break; @@ -786,14 +787,16 @@ AcpiDsMapOpcodeToDataType ( case OPTYPE_DYADIC2: case OPTYPE_DYADIC2R: case OPTYPE_DYADIC2S: - case OPTYPE_INDEX: - case OPTYPE_MATCH: + case OPTYPE_TRIADIC: + case OPTYPE_QUADRADIC: + case OPTYPE_HEXADIC: case OPTYPE_RETURN: Flags = OP_HAS_RETURN_VALUE; DataType = ACPI_TYPE_ANY; break; + case OPTYPE_METHOD_CALL: Flags = OP_HAS_RETURN_VALUE; diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c index dfbe2e4..7f6f160 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: 61 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -164,7 +164,7 @@ AcpiDsGetPredicateValue ( { DEBUG_PRINTP (ACPI_ERROR, ("Could not get result from predicate evaluation, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -394,9 +394,9 @@ AcpiDsExecBeginOp ( case OPTYPE_DYADIC2R: case OPTYPE_DYADIC2S: case OPTYPE_RECONFIGURATION: - case OPTYPE_INDEX: - case OPTYPE_MATCH: - case OPTYPE_FATAL: + case OPTYPE_TRIADIC: + case OPTYPE_QUADRADIC: + case OPTYPE_HEXADIC: case OPTYPE_CREATE_FIELD: /* Start a new result/operand state */ @@ -509,9 +509,9 @@ AcpiDsExecEndOp ( case OPTYPE_DYADIC2R: case OPTYPE_DYADIC2S: case OPTYPE_RECONFIGURATION: - case OPTYPE_INDEX: - case OPTYPE_MATCH: - case OPTYPE_FATAL: + case OPTYPE_TRIADIC: + case OPTYPE_QUADRADIC: + case OPTYPE_HEXADIC: /* Build resolved operand stack */ @@ -588,19 +588,21 @@ AcpiDsExecEndOp ( break; - case OPTYPE_INDEX: /* Type 2 opcode with 3 operands */ + case OPTYPE_TRIADIC: /* Opcode with 3 operands */ /* 3 Operands, 1 ExternalResult, 1 InternalResult */ - Status = AcpiExIndex (WalkState, &ResultObj); + Status = AcpiExTriadic (Opcode, WalkState, &ResultObj); break; + case OPTYPE_QUADRADIC: /* Opcode with 4 operands */ + break; - case OPTYPE_MATCH: /* Type 2 opcode with 6 operands */ + case OPTYPE_HEXADIC: /* Opcode with 6 operands */ /* 6 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiExMatch (WalkState, &ResultObj); + Status = AcpiExHexadic (Opcode, WalkState, &ResultObj); break; @@ -610,14 +612,6 @@ AcpiDsExecEndOp ( Status = AcpiExReconfiguration (Opcode, WalkState); break; - - - case OPTYPE_FATAL: - - /* 3 Operands, 0 ExternalResult, 0 InternalResult */ - - Status = AcpiExFatal (WalkState); - break; } /* diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c index 561378c..95b27b8 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: 45 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -971,11 +971,11 @@ AcpiDsCreateWalkState ( { /* The cache is empty, create a new object */ - /* Avoid deadlock with AcpiUtCallocate */ + /* Avoid deadlock with ACPI_MEM_CALLOCATE */ AcpiUtReleaseMutex (ACPI_MTX_CACHES); - WalkState = AcpiUtCallocate (sizeof (ACPI_WALK_STATE)); + WalkState = ACPI_MEM_CALLOCATE (sizeof (ACPI_WALK_STATE)); if (!WalkState) { return_PTR (NULL); @@ -1080,7 +1080,7 @@ AcpiDsDeleteWalkState ( if (AcpiGbl_WalkStateCacheDepth >= MAX_WALK_CACHE_DEPTH) { - AcpiUtFree (WalkState); + ACPI_MEM_FREE (WalkState); } /* Otherwise put this object back into the cache */ @@ -1138,7 +1138,8 @@ AcpiDsDeleteWalkStateCache ( /* Delete one cached state object */ Next = AcpiGbl_WalkStateCache->Next; - AcpiUtFree (AcpiGbl_WalkStateCache); + ACPI_MEM_FREE (AcpiGbl_WalkStateCache); + AcpiGbl_WalkStateCache = Next; AcpiGbl_WalkStateCacheDepth--; } diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c index 7428e87..042a2aa 100644 --- a/sys/contrib/dev/acpica/evevent.c +++ b/sys/contrib/dev/acpica/evevent.c @@ -2,7 +2,7 @@ * * Module Name: evevent - Fixed and General Purpose AcpiEvent * handling and dispatch - * $Revision: 43 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -455,8 +455,8 @@ AcpiEvGpeInitialize (void) * Allocate the Gpe information block */ - AcpiGbl_GpeRegisters = AcpiUtCallocate (AcpiGbl_GpeRegisterCount * - sizeof (ACPI_GPE_REGISTERS)); + AcpiGbl_GpeRegisters = ACPI_MEM_CALLOCATE (AcpiGbl_GpeRegisterCount * + sizeof (ACPI_GPE_REGISTERS)); if (!AcpiGbl_GpeRegisters) { DEBUG_PRINTP (ACPI_ERROR, @@ -470,11 +470,11 @@ AcpiEvGpeInitialize (void) * Initialization to zeros is sufficient */ - AcpiGbl_GpeInfo = AcpiUtCallocate (MUL_8 (AcpiGbl_GpeRegisterCount) * - sizeof (ACPI_GPE_LEVEL_INFO)); + AcpiGbl_GpeInfo = ACPI_MEM_CALLOCATE (MUL_8 (AcpiGbl_GpeRegisterCount) * + sizeof (ACPI_GPE_LEVEL_INFO)); if (!AcpiGbl_GpeInfo) { - AcpiUtFree (AcpiGbl_GpeRegisters); + ACPI_MEM_FREE (AcpiGbl_GpeRegisters); DEBUG_PRINTP (ACPI_ERROR, ("Could not allocate the GpeInfo block\n")); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -515,8 +515,8 @@ AcpiEvGpeInitialize (void) * are cleared by writing a '1', while enable registers are cleared * by writing a '0'. */ - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00); - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8); RegisterIndex++; } @@ -545,8 +545,8 @@ AcpiEvGpeInitialize (void) * are cleared by writing a '1', while enable registers are cleared * by writing a '0'. */ - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00); - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, 0x00, 8); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, 0xFF, 8); RegisterIndex++; } @@ -733,14 +733,13 @@ AcpiEvGpeDetect (void) * in both of the register blocks, saving all of it. * Find all currently active GP events. */ - for (i = 0; i < AcpiGbl_GpeRegisterCount; i++) { - AcpiGbl_GpeRegisters[i].Status = - AcpiOsIn8 (AcpiGbl_GpeRegisters[i].StatusAddr); + AcpiOsReadPort (AcpiGbl_GpeRegisters[i].StatusAddr, + &AcpiGbl_GpeRegisters[i].Status, 8); - AcpiGbl_GpeRegisters[i].Enable = - AcpiOsIn8 (AcpiGbl_GpeRegisters[i].EnableAddr); + AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr, + &AcpiGbl_GpeRegisters[i].Enable, 8); DEBUG_PRINT (TRACE_INTERRUPTS, ("GPE block at %X - Enable %08X Status %08X\n", @@ -751,7 +750,7 @@ AcpiEvGpeDetect (void) /* First check if there is anything active at all in this register */ EnabledStatusByte = (UINT8) (AcpiGbl_GpeRegisters[i].Status & - AcpiGbl_GpeRegisters[i].Enable); + AcpiGbl_GpeRegisters[i].Enable); if (!EnabledStatusByte) { @@ -772,8 +771,8 @@ AcpiEvGpeDetect (void) * Found an active GPE. Dispatch the event to a handler * or method. */ - IntStatus |= - AcpiEvGpeDispatch (AcpiGbl_GpeRegisters[i].GpeBase + j); + IntStatus |= AcpiEvGpeDispatch ( + AcpiGbl_GpeRegisters[i].GpeBase + j); } } } @@ -904,17 +903,21 @@ AcpiEvGpeDispatch ( if (GpeInfo.Handler) { /* Invoke function handler (at interrupt level). */ + GpeInfo.Handler (GpeInfo.Context); /* Level-Triggered? */ + if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED) { AcpiHwClearGpe (GpeNumber); } /* Enable GPE */ + AcpiHwEnableGpe (GpeNumber); } + /* * Method Handler (e.g. _Exx/_Lxx)? */ @@ -931,6 +934,7 @@ AcpiEvGpeDispatch ( REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber)); } } + /* * No Handler? Report an error and leave the GPE disabled. */ @@ -939,6 +943,7 @@ AcpiEvGpeDispatch ( REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber)); /* Level-Triggered? */ + if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED) { AcpiHwClearGpe (GpeNumber); diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c index 2e2888d..10aef1e 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: 103 $ + * $Revision: 106 $ * *****************************************************************************/ @@ -355,7 +355,7 @@ AcpiEvAddressSpaceDispatch ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("Region Init: %s [%s]\n", - AcpiUtFormatException (Status), + AcpiFormatException (Status), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS(Status); } @@ -375,8 +375,9 @@ AcpiEvAddressSpaceDispatch ( Handler = HandlerDesc->AddrHandler.Handler; DEBUG_PRINTP ((TRACE_OPREGION | VERBOSE_INFO), - ("Addrhandler %p (%p), Address %p\n", - &RegionObj->Region.AddrHandler->AddrHandler, Handler, Address)); + ("Addrhandler %p (%p), Address %8.8lX%8.8lX\n", + &RegionObj->Region.AddrHandler->AddrHandler, Handler, HIDWORD(Address), + LODWORD(Address))); if (!(HandlerDesc->AddrHandler.Flags & ADDR_HANDLER_DEFAULT_INSTALLED)) { @@ -398,7 +399,7 @@ AcpiEvAddressSpaceDispatch ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("Region handler: %s [%s]\n", - AcpiUtFormatException (Status), + AcpiFormatException (Status), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } @@ -509,7 +510,7 @@ AcpiEvDisassociateRegionFromHandler( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("%s from region init, [%s]\n", - AcpiUtFormatException (Status), + AcpiFormatException (Status), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } @@ -525,8 +526,6 @@ AcpiEvDisassociateRegionFromHandler( * If the region is on the handler's list * this better be the region's handler */ - ACPI_ASSERT (RegionObj->Region.AddrHandler == HandlerObj); - RegionObj->Region.AddrHandler = NULL; return_VOID; @@ -582,25 +581,16 @@ AcpiEvAssociateRegionAndHandler ( ("Adding Region %p to address handler %p [%s]\n", RegionObj, HandlerObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - ACPI_ASSERT (RegionObj->Region.SpaceId == HandlerObj->AddrHandler.SpaceId); - ACPI_ASSERT (RegionObj->Region.AddrHandler == 0); /* * Link this region to the front of the handler's list */ - RegionObj->Region.Next = HandlerObj->AddrHandler.RegionList; HandlerObj->AddrHandler.RegionList = RegionObj; /* * set the region's handler */ - -/* - HandlerObj->Common.ReferenceCount = - (UINT16) (HandlerObj->Common.ReferenceCount + - RegionObj->Common.ReferenceCount - 1); -*/ RegionObj->Region.AddrHandler = HandlerObj; /* @@ -749,8 +739,6 @@ AcpiEvAddrHandlerHelper ( /* * Only here if it was a region */ - ACPI_ASSERT (ObjDesc->Common.Type == ACPI_TYPE_REGION); - if (ObjDesc->Region.SpaceId != HandlerObj->AddrHandler.SpaceId) { /* diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c index 105ee04..34440d5 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: 40 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -156,7 +156,7 @@ AcpiEvSystemMemoryRegionSetup ( { if (*RegionContext) { - AcpiUtFree (*RegionContext); + ACPI_MEM_FREE (*RegionContext); *RegionContext = NULL; } return_ACPI_STATUS (AE_OK); @@ -165,7 +165,7 @@ AcpiEvSystemMemoryRegionSetup ( /* Activate. Create a new context */ - *RegionContext = AcpiUtCallocate (sizeof (ACPI_MEM_SPACE_CONTEXT)); + *RegionContext = ACPI_MEM_CALLOCATE (sizeof (ACPI_MEM_SPACE_CONTEXT)); if (!(*RegionContext)) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -239,7 +239,7 @@ AcpiEvPciConfigRegionSetup ( { ACPI_STATUS Status = AE_OK; ACPI_INTEGER Temp; - ACPI_PCI_SPACE_CONTEXT *PciContext = *RegionContext; + ACPI_PCI_ID *PciId = *RegionContext; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle; @@ -263,9 +263,9 @@ AcpiEvPciConfigRegionSetup ( if (Function == ACPI_REGION_DEACTIVATE) { - if (PciContext) + if (PciId) { - AcpiUtFree (PciContext); + ACPI_MEM_FREE (PciId); *RegionContext = NULL; } @@ -275,8 +275,8 @@ AcpiEvPciConfigRegionSetup ( /* Create a new context */ - PciContext = AcpiUtCallocate (sizeof (ACPI_PCI_SPACE_CONTEXT)); - if (!PciContext) + PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID)); + if (!PciId) { return_ACPI_STATUS (AE_NO_MEMORY); } @@ -290,8 +290,6 @@ AcpiEvPciConfigRegionSetup ( * First get device and function numbers from the _ADR object * in the parent's scope. */ - ACPI_ASSERT (RegionObj->Region.Node); - Node = AcpiNsGetParentObject (RegionObj->Region.Node); @@ -305,7 +303,8 @@ AcpiEvPciConfigRegionSetup ( */ if (ACPI_SUCCESS (Status)) { - PciContext->DevFunc = (UINT32) Temp; + PciId->Device = HIWORD (Temp); + PciId->Function = LOWORD (Temp); } /* @@ -349,20 +348,25 @@ AcpiEvPciConfigRegionSetup ( Node = HandlerObj->AddrHandler.Node; } + /* + * The PCI segment number comes from the _SEG method + */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, Node, &Temp); if (ACPI_SUCCESS (Status)) { - PciContext->Seg = (UINT32) Temp; + PciId->Segment = LOWORD (Temp); } + /* + * The PCI bus number comes from the _BBN method + */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, Node, &Temp); if (ACPI_SUCCESS (Status)) { - PciContext->Bus = (UINT32) Temp; + PciId->Bus = LOWORD (Temp); } - *RegionContext = PciContext; - + *RegionContext = PciId; return_ACPI_STATUS (AE_OK); } @@ -448,8 +452,6 @@ AcpiEvInitializeRegion ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - ACPI_ASSERT (RegionObj->Region.Node); - Node = AcpiNsGetParentObject (RegionObj->Region.Node); SpaceId = RegionObj->Region.SpaceId; diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c index cc27238..d9dbd8b 100644 --- a/sys/contrib/dev/acpica/evsci.c +++ b/sys/contrib/dev/acpica/evsci.c @@ -2,7 +2,7 @@ * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions - * $Revision: 72 $ + * $Revision: 73 $ * ******************************************************************************/ @@ -378,12 +378,12 @@ AcpiEvTerminate (void) if (AcpiGbl_GpeRegisters) { - AcpiUtFree (AcpiGbl_GpeRegisters); + ACPI_MEM_FREE (AcpiGbl_GpeRegisters); } if (AcpiGbl_GpeInfo) { - AcpiUtFree (AcpiGbl_GpeInfo); + ACPI_MEM_FREE (AcpiGbl_GpeInfo); } return_VOID; diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index d5ca43d..88ed3b5 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: 34 $ + * $Revision: 36 $ * *****************************************************************************/ @@ -179,7 +179,7 @@ AcpiExLoadTableOp ( /* Allocate a buffer for the entire table */ - TablePtr = AcpiUtAllocate (TableHeader.Length); + TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length); if (!TablePtr) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -273,8 +273,8 @@ AcpiExLoadTableOp ( Cleanup: - AcpiUtFree (TableDesc); - AcpiUtFree (TablePtr); + ACPI_MEM_FREE (TableDesc); + ACPI_MEM_FREE (TablePtr); return_ACPI_STATUS (Status); } @@ -394,7 +394,7 @@ AcpiExReconfiguration ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (Load) (%s)\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); AcpiUtRemoveReference (RegionDesc); return_ACPI_STATUS (Status); @@ -409,7 +409,7 @@ AcpiExReconfiguration ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (unload) (%s)\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c index f7c8aea..c9df970 100644 --- a/sys/contrib/dev/acpica/exconvrt.c +++ b/sys/contrib/dev/acpica/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 13 $ + * $Revision: 16 $ * *****************************************************************************/ @@ -146,7 +146,8 @@ ACPI_STATUS AcpiExConvertToInteger ( - ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState) { UINT32 i; @@ -157,19 +158,20 @@ AcpiExConvertToInteger ( UINT32 IntegerSize = sizeof (ACPI_INTEGER); - switch ((*ObjDesc)->Common.Type) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: + *ResultDesc = ObjDesc; return (AE_OK); case ACPI_TYPE_STRING: - Pointer = (*ObjDesc)->String.Pointer; - Count = (*ObjDesc)->String.Length; + Pointer = ObjDesc->String.Pointer; + Count = ObjDesc->String.Length; break; case ACPI_TYPE_BUFFER: - Pointer = (char *) (*ObjDesc)->Buffer.Pointer; - Count = (*ObjDesc)->Buffer.Length; + Pointer = (char *) ObjDesc->Buffer.Pointer; + Count = ObjDesc->Buffer.Length; break; default: @@ -219,7 +221,7 @@ AcpiExConvertToInteger ( /* * String conversion is different than Buffer conversion */ - switch ((*ObjDesc)->Common.Type) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: @@ -257,13 +259,15 @@ AcpiExConvertToInteger ( RetDesc->Integer.Value = Result; - if (WalkState->Opcode != AML_STORE_OP) + if (*ResultDesc == ObjDesc) { - AcpiUtRemoveReference (*ObjDesc); + if (WalkState->Opcode != AML_STORE_OP) + { + AcpiUtRemoveReference (ObjDesc); + } } - *ObjDesc = RetDesc; - + *ResultDesc = RetDesc; return (AE_OK); } @@ -284,7 +288,8 @@ AcpiExConvertToInteger ( ACPI_STATUS AcpiExConvertToBuffer ( - ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *RetDesc; @@ -293,7 +298,7 @@ AcpiExConvertToBuffer ( UINT8 *NewBuf; - switch ((*ObjDesc)->Common.Type) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -321,7 +326,7 @@ AcpiExConvertToBuffer ( /* Need enough space for one integers */ RetDesc->Buffer.Length = IntegerSize; - NewBuf = AcpiUtCallocate (IntegerSize); + NewBuf = ACPI_MEM_CALLOCATE (IntegerSize); if (!NewBuf) { REPORT_ERROR @@ -334,25 +339,31 @@ AcpiExConvertToBuffer ( for (i = 0; i < IntegerSize; i++) { - NewBuf[i] = (UINT8) ((*ObjDesc)->Integer.Value >> (i * 8)); + NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8)); } RetDesc->Buffer.Pointer = NewBuf; /* Return the new buffer descriptor */ - if (WalkState->Opcode != AML_STORE_OP) + if (*ResultDesc == ObjDesc) { - AcpiUtRemoveReference (*ObjDesc); + if (WalkState->Opcode != AML_STORE_OP) + { + AcpiUtRemoveReference (ObjDesc); + } } - *ObjDesc = RetDesc; + + *ResultDesc = RetDesc; break; case ACPI_TYPE_STRING: + *ResultDesc = ObjDesc; break; case ACPI_TYPE_BUFFER: + *ResultDesc = ObjDesc; break; @@ -381,18 +392,23 @@ AcpiExConvertToBuffer ( ACPI_STATUS AcpiExConvertToString ( - ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **ResultDesc, + UINT32 MaxLength, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *RetDesc; UINT32 i; + UINT32 j; UINT32 Index; + UINT32 StringLength; UINT32 IntegerSize = sizeof (ACPI_INTEGER); UINT8 *NewBuf; UINT8 *Pointer; - switch ((*ObjDesc)->Common.Type) + + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -420,7 +436,7 @@ AcpiExConvertToString ( /* Need enough space for one ASCII integer plus null terminator */ RetDesc->String.Length = (IntegerSize * 2) + 1; - NewBuf = AcpiUtCallocate (RetDesc->String.Length); + NewBuf = ACPI_MEM_CALLOCATE (RetDesc->String.Length); if (!NewBuf) { REPORT_ERROR @@ -431,36 +447,52 @@ AcpiExConvertToString ( /* Copy the integer to the buffer */ - for (i = 0; i < (IntegerSize * 2); i++) + for (i = 0, j = ((IntegerSize * 2) -1); i < (IntegerSize * 2); i++, j--) { - NewBuf[i] = AcpiGbl_HexToAscii [((*ObjDesc)->Integer.Value >> (i * 4)) & 0xF]; + NewBuf[i] = AcpiGbl_HexToAscii [(ObjDesc->Integer.Value >> (j * 4)) & 0xF]; } - /* Null terminate */ + /* Null terminate at the correct place */ + + if (MaxLength < i) + { + NewBuf[MaxLength] = 0; + } + else + { + NewBuf [i] = 0; + } - NewBuf [i] = 0; RetDesc->Buffer.Pointer = NewBuf; /* Return the new buffer descriptor */ - if (WalkState->Opcode != AML_STORE_OP) + if (*ResultDesc == ObjDesc) { - AcpiUtRemoveReference (*ObjDesc); + if (WalkState->Opcode != AML_STORE_OP) + { + AcpiUtRemoveReference (ObjDesc); + } } - *ObjDesc = RetDesc; - return (AE_OK); + *ResultDesc = RetDesc; + break; case ACPI_TYPE_BUFFER: - if (((*ObjDesc)->Buffer.Length * 3) > ACPI_MAX_STRING_CONVERSION) + StringLength = ObjDesc->Buffer.Length * 3; + + if (MaxLength > ACPI_MAX_STRING_CONVERSION) { - return (AE_AML_STRING_LIMIT); + if (StringLength > ACPI_MAX_STRING_CONVERSION) + { + return (AE_AML_STRING_LIMIT); + } } /* - * Create a new String + * Create a new string object */ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); if (!RetDesc) @@ -468,10 +500,14 @@ AcpiExConvertToString ( return (AE_NO_MEMORY); } - /* Need enough space for one ASCII integer plus null terminator */ + /* String length is the lesser of the Max or the actual length */ - RetDesc->String.Length = (*ObjDesc)->Buffer.Length * 3; - NewBuf = AcpiUtCallocate (RetDesc->String.Length + 1); + if (MaxLength < StringLength) + { + StringLength = MaxLength; + } + + NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1); if (!NewBuf) { REPORT_ERROR @@ -483,9 +519,9 @@ AcpiExConvertToString ( /* * Convert each byte of the buffer to two ASCII characters plus a space. */ - Pointer = (*ObjDesc)->Buffer.Pointer; + Pointer = ObjDesc->Buffer.Pointer; Index = 0; - for (i = 0; i < (*ObjDesc)->Buffer.Length; i++) + for (i = 0; i < (StringLength/3); i++) { NewBuf[Index + 0] = AcpiGbl_HexToAscii [Pointer[i] & 0x0F]; NewBuf[Index + 1] = AcpiGbl_HexToAscii [(Pointer[i] >> 4) & 0x0F]; @@ -495,20 +531,38 @@ AcpiExConvertToString ( /* Null terminate */ - NewBuf [Index] = 0; + NewBuf [Index-1] = 0; RetDesc->Buffer.Pointer = NewBuf; + RetDesc->String.Length = STRLEN ((char *) NewBuf); + /* Return the new buffer descriptor */ - if (WalkState->Opcode != AML_STORE_OP) + if (*ResultDesc == ObjDesc) { - AcpiUtRemoveReference (*ObjDesc); + if (WalkState->Opcode != AML_STORE_OP) + { + AcpiUtRemoveReference (ObjDesc); + } } - *ObjDesc = RetDesc; + + *ResultDesc = RetDesc; break; case ACPI_TYPE_STRING: + + if (MaxLength >= ObjDesc->String.Length) + { + *ResultDesc = ObjDesc; + } + + else + { + /* Must copy the string first and then truncate it */ + + return (AE_NOT_IMPLEMENTED); + } break; @@ -592,7 +646,7 @@ AcpiExConvertToTargetType ( * These types require an Integer operand. We can convert * a Buffer or a String to an Integer if necessary. */ - Status = AcpiExConvertToInteger (ObjDesc, WalkState); + Status = AcpiExConvertToInteger (*ObjDesc, ObjDesc, WalkState); break; @@ -602,7 +656,7 @@ AcpiExConvertToTargetType ( * The operand must be a String. We can convert an * Integer or Buffer if necessary */ - Status = AcpiExConvertToString (ObjDesc, WalkState); + Status = AcpiExConvertToString (*ObjDesc, ObjDesc, ACPI_UINT32_MAX, WalkState); break; @@ -612,7 +666,7 @@ AcpiExConvertToTargetType ( * The operand must be a String. We can convert an * Integer or Buffer if necessary */ - Status = AcpiExConvertToBuffer (ObjDesc, WalkState); + Status = AcpiExConvertToBuffer (*ObjDesc, ObjDesc, WalkState); break; } break; diff --git a/sys/contrib/dev/acpica/exdyadic.c b/sys/contrib/dev/acpica/exdyadic.c index 46050da..451ad6b 100644 --- a/sys/contrib/dev/acpica/exdyadic.c +++ b/sys/contrib/dev/acpica/exdyadic.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: exdyadic - ACPI AML (p-code) execution for dyadic operators - * $Revision: 77 $ + * Module Name: exdyadic - ACPI AML execution for dyadic (2-operand) operators + * $Revision: 82 $ * *****************************************************************************/ @@ -134,8 +134,9 @@ * * FUNCTION: AcpiExDoConcatenate * - * PARAMETERS: *ObjDesc - Object to be converted. Must be an - * Integer, Buffer, or String + * PARAMETERS: *ObjDesc - Object to be converted. Must be an + * Integer, Buffer, or String + * WalkState - Current walk state * * RETURN: Status * @@ -191,7 +192,7 @@ AcpiExDoConcatenate ( /* Need enough space for two integers */ RetDesc->Buffer.Length = IntegerSize * 2; - NewBuf = AcpiUtCallocate (RetDesc->Buffer.Length); + NewBuf = ACPI_MEM_CALLOCATE (RetDesc->Buffer.Length); if (!NewBuf) { REPORT_ERROR @@ -233,8 +234,8 @@ AcpiExDoConcatenate ( /* Operand1 is string */ - NewBuf = AcpiUtAllocate (ObjDesc->String.Length + - ObjDesc2->String.Length + 1); + NewBuf = ACPI_MEM_ALLOCATE (ObjDesc->String.Length + + ObjDesc2->String.Length + 1); if (!NewBuf) { REPORT_ERROR @@ -265,8 +266,8 @@ AcpiExDoConcatenate ( return (AE_NO_MEMORY); } - NewBuf = AcpiUtAllocate (ObjDesc->Buffer.Length + - ObjDesc2->Buffer.Length); + NewBuf = ACPI_MEM_ALLOCATE (ObjDesc->Buffer.Length + + ObjDesc2->Buffer.Length); if (!NewBuf) { REPORT_ERROR @@ -311,6 +312,7 @@ Cleanup: * FUNCTION: AcpiExDyadic1 * * PARAMETERS: Opcode - The opcode to be executed + * WalkState - Current walk state * * RETURN: Status * @@ -350,7 +352,7 @@ AcpiExDyadic1 ( /* Invalid parameters on object stack */ DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); goto Cleanup; } @@ -425,6 +427,8 @@ Cleanup: * FUNCTION: AcpiExDyadic2R * * PARAMETERS: Opcode - The opcode to be executed + * WalkState - Current walk state + * ReturnDesc - Where to store the return object * * RETURN: Status * @@ -474,7 +478,7 @@ AcpiExDyadic2R ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) (%s)\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); goto Cleanup; } @@ -491,6 +495,7 @@ AcpiExDyadic2R ( case AML_BIT_NOR_OP: case AML_BIT_XOR_OP: case AML_DIVIDE_OP: + case AML_MOD_OP: case AML_MULTIPLY_OP: case AML_SHIFT_LEFT_OP: case AML_SHIFT_RIGHT_OP: @@ -575,7 +580,7 @@ AcpiExDyadic2R ( if (!ObjDesc2->Integer.Value) { REPORT_ERROR - (("ExDyadic2R/DivideOp: Divide by zero\n")); + (("DivideOp: Divide by zero\n")); Status = AE_AML_DIVIDE_BY_ZERO; goto Cleanup; @@ -600,6 +605,26 @@ AcpiExDyadic2R ( break; + /* DefMod := ModOp Dividend Divisor Remainder */ + + case AML_MOD_OP: /* ACPI 2.0 */ + + if (!ObjDesc2->Integer.Value) + { + REPORT_ERROR + (("ModOp: Divide by zero\n")); + + Status = AE_AML_DIVIDE_BY_ZERO; + goto Cleanup; + } + + /* Remainder (modulo) */ + + RetDesc->Integer.Value = ACPI_MODULO (ObjDesc->Integer.Value, + ObjDesc2->Integer.Value); + break; + + /* DefMultiply := MultiplyOp Operand1 Operand2 Result */ case AML_MULTIPLY_OP: @@ -640,7 +665,6 @@ AcpiExDyadic2R ( case AML_CONCAT_OP: - /* * Convert the second operand if necessary. The first operand * determines the type of the second operand, (See the Data Types @@ -648,19 +672,18 @@ AcpiExDyadic2R ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism above. */ - switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: - Status = AcpiExConvertToInteger (&ObjDesc2, WalkState); + Status = AcpiExConvertToInteger (ObjDesc2, &ObjDesc2, WalkState); break; case ACPI_TYPE_STRING: - Status = AcpiExConvertToString (&ObjDesc2, WalkState); + Status = AcpiExConvertToString (ObjDesc2, &ObjDesc2, ACPI_UINT32_MAX, WalkState); break; case ACPI_TYPE_BUFFER: - Status = AcpiExConvertToBuffer (&ObjDesc2, WalkState); + Status = AcpiExConvertToBuffer (ObjDesc2, &ObjDesc2, WalkState); break; default: @@ -686,6 +709,24 @@ AcpiExDyadic2R ( break; + /* DefToString := Buffer, Length, Result */ + + case AML_TO_STRING_OP: /* ACPI 2.0 */ + + Status = AcpiExConvertToString (ObjDesc, &RetDesc, + (UINT32) ObjDesc2->Integer.Value, WalkState); + break; + + + /* DefConcatRes := Buffer, Buffer, Result */ + + case AML_CONCAT_RES_OP: /* ACPI 2.0 */ + + Status = AE_NOT_IMPLEMENTED; + goto Cleanup; + break; + + default: REPORT_ERROR (("AcpiExDyadic2R: Unknown dyadic opcode %X\n", @@ -758,6 +799,8 @@ Cleanup: * FUNCTION: AcpiExDyadic2S * * PARAMETERS: Opcode - The opcode to be executed + * WalkState - Current walk state + * ReturnDesc - Where to store the return object * * RETURN: Status * @@ -797,7 +840,7 @@ AcpiExDyadic2S ( /* Invalid parameters on object stack */ DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); goto Cleanup; } @@ -887,6 +930,8 @@ Cleanup: * FUNCTION: AcpiExDyadic2 * * PARAMETERS: Opcode - The opcode to be executed + * WalkState - Current walk state + * ReturnDesc - Where to store the return object * * RETURN: Status * @@ -929,7 +974,7 @@ AcpiExDyadic2 ( /* Invalid parameters on object stack */ DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); goto Cleanup; } @@ -997,6 +1042,15 @@ AcpiExDyadic2 ( break; + /* DefCopy := Source, Destination */ + + case AML_COPY_OP: /* ACPI 2.0 */ + + Status = AE_NOT_IMPLEMENTED; + goto Cleanup; + break; + + default: REPORT_ERROR (("AcpiExDyadic2: Unknown dyadic opcode %X\n", Opcode)); diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c index f0f7c3d..361f0a9 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: 90 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -191,7 +191,7 @@ AcpiExReadDataFromField ( /* Create the actual read buffer */ - BufferDesc->Buffer.Pointer = AcpiUtCallocate (Length); + BufferDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (Length); if (!BufferDesc->Buffer.Pointer) { AcpiUtRemoveReference (BufferDesc); diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index 96f3227..fd49c6b 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: 57 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -153,7 +153,7 @@ AcpiExSetupField ( ACPI_OPERAND_OBJECT *RgnDesc; - FUNCTION_TRACE ("ExSetupField"); + FUNCTION_TRACE_U32 ("ExSetupField", FieldDatumByteOffset); /* Parameter validation */ @@ -309,11 +309,11 @@ AcpiExReadFieldDatum ( Address = RgnDesc->Region.Address + ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset; - DEBUG_PRINTP (TRACE_BFIELD, ("Region %s(%X) width %X base:off %X:%X at %08lX\n", + DEBUG_PRINTP (TRACE_BFIELD, ("Region %s(%X) width %X base:off %X:%X at %8.8lX%8.8lX\n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId, ObjDesc->CommonField.AccessBitWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, - Address)); + HIDWORD(Address), LODWORD(Address))); /* Invoke the appropriate AddressSpace/OpRegion handler */ @@ -696,9 +696,10 @@ AcpiExWriteFieldDatum ( FieldDatumByteOffset; DEBUG_PRINTP (TRACE_BFIELD, - ("Store %X in Region %s(%X) at %p width %X\n", + ("Store %X in Region %s(%X) at %8.8lX%8.8lX width %X\n", Value, AcpiUtGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId, Address, ObjDesc->CommonField.AccessBitWidth)); + RgnDesc->Region.SpaceId, HIDWORD(Address), LODWORD(Address), + ObjDesc->CommonField.AccessBitWidth)); /* Invoke the appropriate AddressSpace/OpRegion handler */ diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c index 58bc815..f4a510c 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: 77 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -214,40 +214,37 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiExIndex + * FUNCTION: AcpiExTriadic * - * PARAMETERS: none + * PARAMETERS: Opcode - The opcode to be executed + * WalkState - Current walk state + * ReturnDesc - Where to store the return object * * RETURN: Status * - * DESCRIPTION: Execute Index operator + * DESCRIPTION: Execute Triadic operator (3 operands) * * ALLOCATION: Deletes one operand descriptor -- other remains on stack * - * ACPI SPECIFICATION REFERENCES: - * DefIndex := IndexOp BuffPkgObj IndexValue Result - * IndexValue := TermArg=>Integer - * NameString := <RootChar NamePath> | <PrefixPath NamePath> - * Result := SuperName - * SuperName := NameString | ArgObj | LocalObj | DebugObj | DefIndex - * Local4Op | Local5Op | Local6Op | Local7Op - * ******************************************************************************/ ACPI_STATUS -AcpiExIndex ( +AcpiExTriadic ( + UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) { - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *IdxDesc; + ACPI_OPERAND_OBJECT *ObjDesc1; + ACPI_OPERAND_OBJECT *ObjDesc2; ACPI_OPERAND_OBJECT *ResDesc; ACPI_OPERAND_OBJECT *RetDesc = NULL; ACPI_OPERAND_OBJECT *TmpDesc; + ACPI_SIGNAL_FATAL_INFO *Fatal; ACPI_STATUS Status; - FUNCTION_TRACE ("ExIndex"); + + FUNCTION_TRACE ("ExTriadic"); /* Resolve operands */ @@ -261,8 +258,8 @@ AcpiExIndex ( /* Get all operands */ Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState); - Status |= AcpiDsObjStackPopObject (&IdxDesc, WalkState); - Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState); + Status |= AcpiDsObjStackPopObject (&ObjDesc2, WalkState); + Status |= AcpiDsObjStackPopObject (&ObjDesc1, WalkState); if (ACPI_FAILURE (Status)) { /* Invalid parameters on object stack */ @@ -273,94 +270,139 @@ AcpiExIndex ( } - /* Create the internal return object */ - RetDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE); - if (!RetDesc) + switch (Opcode) { - Status = AE_NO_MEMORY; - goto Cleanup; - } + case AML_FATAL_OP: - /* - * At this point, the ObjDesc operand is either a Package or a Buffer - */ + /* DefFatal := FatalOp FatalType FatalCode FatalArg */ - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - /* Object to be indexed is a Package */ + DEBUG_PRINTP (ACPI_INFO, + ("FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + (UINT32) ObjDesc1->Integer.Value, (UINT32) ObjDesc2->Integer.Value, + (UINT32) ResDesc->Integer.Value)); - if (IdxDesc->Integer.Value >= ObjDesc->Package.Count) + + Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO)); + if (Fatal) { - DEBUG_PRINTP (ACPI_ERROR, ("Index value beyond package end\n")); - Status = AE_AML_PACKAGE_LIMIT; - goto Cleanup; + Fatal->Type = (UINT32) ObjDesc1->Integer.Value; + Fatal->Code = (UINT32) ObjDesc2->Integer.Value; + Fatal->Argument = (UINT32) ResDesc->Integer.Value; } - if ((ResDesc->Common.Type == INTERNAL_TYPE_REFERENCE) && - (ResDesc->Reference.Opcode == AML_ZERO_OP)) - { - /* - * There is no actual result descriptor (the ZeroOp Result - * descriptor is a placeholder), so just delete the placeholder and - * return a reference to the package element - */ + /* + * Signal the OS + */ + AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal); - AcpiUtRemoveReference (ResDesc); - } + /* Might return while OS is shutting down */ - else - { - /* - * Each element of the package is an internal object. Get the one - * we are after. - */ + ACPI_MEM_FREE (Fatal); + break; - TmpDesc = ObjDesc->Package.Elements[IdxDesc->Integer.Value]; - RetDesc->Reference.Opcode = AML_INDEX_OP; - RetDesc->Reference.TargetType = TmpDesc->Common.Type; - RetDesc->Reference.Object = TmpDesc; - Status = AcpiExStore (RetDesc, ResDesc, WalkState); - RetDesc->Reference.Object = NULL; - } - /* - * The local return object must always be a reference to the package element, - * not the element itself. - */ - RetDesc->Reference.Opcode = AML_INDEX_OP; - RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE; - RetDesc->Reference.Where = &ObjDesc->Package.Elements[IdxDesc->Integer.Value]; - } + case AML_MID_OP: + + /* DefMid := MidOp Source Index Length Result */ + + /* Create the internal return object (string or buffer) */ + + break; - else - { - /* Object to be indexed is a Buffer */ - if (IdxDesc->Integer.Value >= ObjDesc->Buffer.Length) + case AML_INDEX_OP: + + /* DefIndex := IndexOp Source Index Destination */ + + /* Create the internal return object */ + + RetDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE); + if (!RetDesc) { - DEBUG_PRINTP (ACPI_ERROR, ("Index value beyond end of buffer\n")); - Status = AE_AML_BUFFER_LIMIT; + Status = AE_NO_MEMORY; goto Cleanup; } + /* + * At this point, the ObjDesc1 operand is either a Package or a Buffer + */ + if (ObjDesc1->Common.Type == ACPI_TYPE_PACKAGE) + { + /* Object to be indexed is a Package */ + + if (ObjDesc2->Integer.Value >= ObjDesc1->Package.Count) + { + DEBUG_PRINTP (ACPI_ERROR, ("Index value beyond package end\n")); + Status = AE_AML_PACKAGE_LIMIT; + goto Cleanup; + } + + if ((ResDesc->Common.Type == INTERNAL_TYPE_REFERENCE) && + (ResDesc->Reference.Opcode == AML_ZERO_OP)) + { + /* + * There is no actual result descriptor (the ZeroOp Result + * descriptor is a placeholder), so just delete the placeholder and + * return a reference to the package element + */ + AcpiUtRemoveReference (ResDesc); + } + + else + { + /* + * Each element of the package is an internal object. Get the one + * we are after. + */ + TmpDesc = ObjDesc1->Package.Elements[ObjDesc2->Integer.Value]; + RetDesc->Reference.Opcode = AML_INDEX_OP; + RetDesc->Reference.TargetType = TmpDesc->Common.Type; + RetDesc->Reference.Object = TmpDesc; + + Status = AcpiExStore (RetDesc, ResDesc, WalkState); + RetDesc->Reference.Object = NULL; + } + + /* + * The local return object must always be a reference to the package element, + * not the element itself. + */ + RetDesc->Reference.Opcode = AML_INDEX_OP; + RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE; + RetDesc->Reference.Where = &ObjDesc1->Package.Elements[ObjDesc2->Integer.Value]; + } + + else + { + /* Object to be indexed is a Buffer */ - RetDesc->Reference.Opcode = AML_INDEX_OP; - RetDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; - RetDesc->Reference.Object = ObjDesc; - RetDesc->Reference.Offset = (UINT32) IdxDesc->Integer.Value; + if (ObjDesc2->Integer.Value >= ObjDesc1->Buffer.Length) + { + DEBUG_PRINTP (ACPI_ERROR, ("Index value beyond end of buffer\n")); + Status = AE_AML_BUFFER_LIMIT; + goto Cleanup; + } - Status = AcpiExStore (RetDesc, ResDesc, WalkState); + RetDesc->Reference.Opcode = AML_INDEX_OP; + RetDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; + RetDesc->Reference.Object = ObjDesc1; + RetDesc->Reference.Offset = (UINT32) ObjDesc2->Integer.Value; + + Status = AcpiExStore (RetDesc, ResDesc, WalkState); + } + break; } + Cleanup: /* Always delete operands */ - AcpiUtRemoveReference (ObjDesc); - AcpiUtRemoveReference (IdxDesc); + AcpiUtRemoveReference (ObjDesc1); + AcpiUtRemoveReference (ObjDesc2); /* Delete return object on error */ @@ -384,28 +426,21 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiExMatch + * FUNCTION: AcpiExHexadic * - * PARAMETERS: none + * PARAMETERS: Opcode - The opcode to be executed + * WalkState - Current walk state + * ReturnDesc - Where to store the return object * * RETURN: Status * * DESCRIPTION: Execute Match operator * - * ACPI SPECIFICATION REFERENCES: - * DefMatch := MatchOp SearchPkg Opcode1 Operand1 - * Opcode2 Operand2 StartIndex - * Opcode1 := ByteData: MTR, MEQ, MLE, MLT, MGE, or MGT - * Opcode2 := ByteData: MTR, MEQ, MLE, MLT, MGE, or MGT - * Operand1 := TermArg=>Integer - * Operand2 := TermArg=>Integer - * SearchPkg := TermArg=>PackageObject - * StartIndex := TermArg=>Integer - * ******************************************************************************/ ACPI_STATUS -AcpiExMatch ( +AcpiExHexadic ( + UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) { @@ -421,7 +456,7 @@ AcpiExMatch ( UINT32 MatchValue = (UINT32) -1; - FUNCTION_TRACE ("ExMatch"); + FUNCTION_TRACE ("ExHexadic"); /* Resolve all operands */ @@ -449,197 +484,207 @@ AcpiExMatch ( goto Cleanup; } - /* Validate match comparison sub-opcodes */ - if ((Op1Desc->Integer.Value > MAX_MATCH_OPERATOR) || - (Op2Desc->Integer.Value > MAX_MATCH_OPERATOR)) + switch (Opcode) { - DEBUG_PRINTP (ACPI_ERROR, ("operation encoding out of range\n")); - Status = AE_AML_OPERAND_VALUE; - goto Cleanup; - } - Index = (UINT32) StartDesc->Integer.Value; - if (Index >= (UINT32) PkgDesc->Package.Count) - { - DEBUG_PRINTP (ACPI_ERROR, ("Start position value out of range\n")); - Status = AE_AML_PACKAGE_LIMIT; - goto Cleanup; - } + case AML_MATCH_OP: - RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!RetDesc) - { - Status = AE_NO_MEMORY; - goto Cleanup; + /* Validate match comparison sub-opcodes */ - } + if ((Op1Desc->Integer.Value > MAX_MATCH_OPERATOR) || + (Op2Desc->Integer.Value > MAX_MATCH_OPERATOR)) + { + DEBUG_PRINTP (ACPI_ERROR, ("operation encoding out of range\n")); + Status = AE_AML_OPERAND_VALUE; + goto Cleanup; + } - /* - * Examine each element until a match is found. Within the loop, - * "continue" signifies that the current element does not match - * and the next should be examined. - * Upon finding a match, the loop will terminate via "break" at - * the bottom. If it terminates "normally", MatchValue will be -1 - * (its initial value) indicating that no match was found. When - * returned as a Number, this will produce the Ones value as specified. - */ + Index = (UINT32) StartDesc->Integer.Value; + if (Index >= (UINT32) PkgDesc->Package.Count) + { + DEBUG_PRINTP (ACPI_ERROR, ("Start position value out of range\n")); + Status = AE_AML_PACKAGE_LIMIT; + goto Cleanup; + } - for ( ; Index < PkgDesc->Package.Count; ++Index) - { - /* - * Treat any NULL or non-numeric elements as non-matching. - * TBD [Unhandled] - if an element is a Name, - * should we examine its value? - */ - if (!PkgDesc->Package.Elements[Index] || - ACPI_TYPE_INTEGER != PkgDesc->Package.Elements[Index]->Common.Type) + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!RetDesc) { - continue; + Status = AE_NO_MEMORY; + goto Cleanup; + } /* - * Within these switch statements: - * "break" (exit from the switch) signifies a match; - * "continue" (proceed to next iteration of enclosing - * "for" loop) signifies a non-match. + * Examine each element until a match is found. Within the loop, + * "continue" signifies that the current element does not match + * and the next should be examined. + * Upon finding a match, the loop will terminate via "break" at + * the bottom. If it terminates "normally", MatchValue will be -1 + * (its initial value) indicating that no match was found. When + * returned as a Number, this will produce the Ones value as specified. */ - switch (Op1Desc->Integer.Value) + + for ( ; Index < PkgDesc->Package.Count; ++Index) { + /* + * Treat any NULL or non-numeric elements as non-matching. + * TBD [Unhandled] - if an element is a Name, + * should we examine its value? + */ + if (!PkgDesc->Package.Elements[Index] || + ACPI_TYPE_INTEGER != PkgDesc->Package.Elements[Index]->Common.Type) + { + continue; + } - case MATCH_MTR: /* always true */ + /* + * Within these switch statements: + * "break" (exit from the switch) signifies a match; + * "continue" (proceed to next iteration of enclosing + * "for" loop) signifies a non-match. + */ + switch (Op1Desc->Integer.Value) + { - break; + case MATCH_MTR: /* always true */ + break; - case MATCH_MEQ: /* true if equal */ - if (PkgDesc->Package.Elements[Index]->Integer.Value - != V1Desc->Integer.Value) - { - continue; - } - break; + case MATCH_MEQ: /* true if equal */ + if (PkgDesc->Package.Elements[Index]->Integer.Value + != V1Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MLE: /* true if less than or equal */ - if (PkgDesc->Package.Elements[Index]->Integer.Value - > V1Desc->Integer.Value) - { - continue; - } - break; + case MATCH_MLE: /* true if less than or equal */ + if (PkgDesc->Package.Elements[Index]->Integer.Value + > V1Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MLT: /* true if less than */ - if (PkgDesc->Package.Elements[Index]->Integer.Value - >= V1Desc->Integer.Value) - { - continue; - } - break; + case MATCH_MLT: /* true if less than */ + if (PkgDesc->Package.Elements[Index]->Integer.Value + >= V1Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MGE: /* true if greater than or equal */ - if (PkgDesc->Package.Elements[Index]->Integer.Value - < V1Desc->Integer.Value) - { - continue; - } - break; + case MATCH_MGE: /* true if greater than or equal */ + if (PkgDesc->Package.Elements[Index]->Integer.Value + < V1Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MGT: /* true if greater than */ - if (PkgDesc->Package.Elements[Index]->Integer.Value - <= V1Desc->Integer.Value) - { + case MATCH_MGT: /* true if greater than */ + + if (PkgDesc->Package.Elements[Index]->Integer.Value + <= V1Desc->Integer.Value) + { + continue; + } + break; + + + default: /* undefined */ + continue; } - break; - default: /* undefined */ + switch(Op2Desc->Integer.Value) + { - continue; - } + case MATCH_MTR: + break; - switch(Op2Desc->Integer.Value) - { - case MATCH_MTR: + case MATCH_MEQ: - break; + if (PkgDesc->Package.Elements[Index]->Integer.Value + != V2Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MEQ: + case MATCH_MLE: - if (PkgDesc->Package.Elements[Index]->Integer.Value - != V2Desc->Integer.Value) - { - continue; - } - break; + if (PkgDesc->Package.Elements[Index]->Integer.Value + > V2Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MLE: + case MATCH_MLT: - if (PkgDesc->Package.Elements[Index]->Integer.Value - > V2Desc->Integer.Value) - { - continue; - } - break; + if (PkgDesc->Package.Elements[Index]->Integer.Value + >= V2Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MLT: + case MATCH_MGE: - if (PkgDesc->Package.Elements[Index]->Integer.Value - >= V2Desc->Integer.Value) - { - continue; - } - break; + if (PkgDesc->Package.Elements[Index]->Integer.Value + < V2Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MGE: + case MATCH_MGT: - if (PkgDesc->Package.Elements[Index]->Integer.Value - < V2Desc->Integer.Value) - { - continue; - } - break; + if (PkgDesc->Package.Elements[Index]->Integer.Value + <= V2Desc->Integer.Value) + { + continue; + } + break; - case MATCH_MGT: + default: - if (PkgDesc->Package.Elements[Index]->Integer.Value - <= V2Desc->Integer.Value) - { continue; } - break; + /* Match found: exit from loop */ - default: - - continue; + MatchValue = Index; + break; } - /* Match found: exit from loop */ + /* MatchValue is the return value */ - MatchValue = Index; + RetDesc->Integer.Value = MatchValue; break; - } - /* MatchValue is the return value */ + } - RetDesc->Integer.Value = MatchValue; Cleanup: diff --git a/sys/contrib/dev/acpica/exmonad.c b/sys/contrib/dev/acpica/exmonad.c index d82b767..90dd7e8 100644 --- a/sys/contrib/dev/acpica/exmonad.c +++ b/sys/contrib/dev/acpica/exmonad.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: exmonad - ACPI AML (p-code) execution for monadic operators - * $Revision: 99 $ + * Module Name: exmonad - ACPI AML execution for monadic (1 operand) operators + * $Revision: 104 $ * *****************************************************************************/ @@ -227,31 +227,42 @@ AcpiExMonadic1 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState) { - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_STATUS Status; + ACPI_STATUS ResolveStatus; FUNCTION_TRACE_PTR ("ExMonadic1", WALK_OPERANDS); - /* Resolve all operands */ + /* Resolve the operand */ - Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); + ResolveStatus = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), 1, "after AcpiExResolveOperands"); - /* Get all operands */ + /* Get the operand */ - Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) + Status = AcpiDsObjStackPopObject (&ObjDesc, WalkState); + + /* Check operand status */ + + if (ACPI_FAILURE (ResolveStatus)) { - DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException(Status))); + DEBUG_PRINTP (ACPI_ERROR, ("[%s]: Could not resolve operands, %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (ResolveStatus))); goto Cleanup; } + if (ACPI_FAILURE (Status)) + { + DEBUG_PRINTP (ACPI_ERROR, ("[%s]: bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); + + goto Cleanup; + } /* Examine the opcode */ @@ -345,6 +356,7 @@ AcpiExMonadic2R ( ACPI_OPERAND_OBJECT *RetDesc2 = NULL; UINT32 ResVal; ACPI_STATUS Status; + ACPI_STATUS ResolveStatus; UINT32 i; UINT32 j; ACPI_INTEGER Digit; @@ -355,19 +367,30 @@ AcpiExMonadic2R ( /* Resolve all operands */ - Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); + ResolveStatus = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), 2, "after AcpiExResolveOperands"); /* Get all operands */ - Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState); + Status = AcpiDsObjStackPopObject (&ResDesc, WalkState); Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState); + + /* Now we can check the status codes */ + + if (ACPI_FAILURE (ResolveStatus)) + { + DEBUG_PRINTP (ACPI_ERROR, ("[%s]: Could not resolve operands, %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (ResolveStatus))); + + goto Cleanup; + } + if (ACPI_FAILURE (Status)) { - DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException(Status))); + DEBUG_PRINTP (ACPI_ERROR, ("[%s]: bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiFormatException(Status))); goto Cleanup; } @@ -610,6 +633,31 @@ AcpiExMonadic2R ( /* + * ACPI 2.0 Opcodes + */ + case AML_TO_DECSTRING_OP: + + DEBUG_PRINTP (ACPI_ERROR, ("%s is not implemented\n", + AcpiPsGetOpcodeName (Opcode))); + Status = AE_NOT_IMPLEMENTED; + goto Cleanup; + break; + + + case AML_TO_HEXSTRING_OP: + Status = AcpiExConvertToString (ObjDesc, &RetDesc, ACPI_UINT32_MAX, WalkState); + break; + + case AML_TO_BUFFER_OP: + Status = AcpiExConvertToBuffer (ObjDesc, &RetDesc, WalkState); + break; + + case AML_TO_INTEGER_OP: + Status = AcpiExConvertToInteger (ObjDesc, &RetDesc, WalkState); + break; + + + /* * These are obsolete opcodes */ @@ -710,7 +758,7 @@ AcpiExMonadic2 ( if (ACPI_FAILURE (ResolveStatus)) { DEBUG_PRINTP (ACPI_ERROR, ("[%s]: Could not resolve operands, %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (ResolveStatus))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (ResolveStatus))); goto Cleanup; } @@ -718,7 +766,7 @@ AcpiExMonadic2 ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("[%s]: Bad operand(s), %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); goto Cleanup; } @@ -793,7 +841,7 @@ AcpiExMonadic2 ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("%s: bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException(Status))); + AcpiPsGetOpcodeName (Opcode), AcpiFormatException(Status))); goto Cleanup; } diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c index f0ac7e9..c05113c 100644 --- a/sys/contrib/dev/acpica/exnames.c +++ b/sys/contrib/dev/acpica/exnames.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 79 $ + * $Revision: 80 $ * *****************************************************************************/ @@ -184,7 +184,7 @@ AcpiExAllocateNameString ( * This buffer must be deleted by the caller! */ - NameString = AcpiUtAllocate (SizeNeeded); + NameString = ACPI_MEM_ALLOCATE (SizeNeeded); if (!NameString) { REPORT_ERROR (("ExAllocateNameString: name allocation failure\n")); diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c index 76fe51e..184b17f 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: 90 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -144,13 +144,16 @@ static UINT32 AcpiExDecodeFieldAccessType ( UINT32 Access, - UINT16 Length) + UINT16 Length, + UINT32 *Alignment) { switch (Access) { case ACCESS_ANY_ACC: + *Alignment = 8; + /* Use the length to set the access type */ if (Length <= 8) @@ -176,18 +179,22 @@ AcpiExDecodeFieldAccessType ( break; case ACCESS_BYTE_ACC: + *Alignment = 8; return (8); break; case ACCESS_WORD_ACC: + *Alignment = 16; return (16); break; case ACCESS_DWORD_ACC: + *Alignment = 32; return (32); break; case ACCESS_QWORD_ACC: /* ACPI 2.0 */ + *Alignment = 64; return (64); break; @@ -228,6 +235,7 @@ AcpiExPrepCommonFieldObject ( UINT32 FieldBitLength) { UINT32 AccessBitWidth; + UINT32 Alignment; UINT32 NearestByteAddress; @@ -250,11 +258,18 @@ AcpiExPrepCommonFieldObject ( ObjDesc->CommonField.BitLength = (UINT16) FieldBitLength; - /* Decode the access type so we can compute offsets */ - + /* + * Decode the access type so we can compute offsets. The access type gives + * two pieces of information - the width of each field access and the + * necessary alignment of the access. For AnyAcc, the width used is the + * largest necessary/possible in an attempt to access the whole field in one + * I/O operation. However, for AnyAcc, the alignment is 8. For all other + * access types (Byte, Word, Dword, Qword), the width is the same as the + * alignment. + */ AccessBitWidth = AcpiExDecodeFieldAccessType ( ((FieldFlags & ACCESS_TYPE_MASK) >> ACCESS_TYPE_SHIFT), - ObjDesc->Field.BitLength); + ObjDesc->Field.BitLength, &Alignment); if (!AccessBitWidth) { return_ACPI_STATUS (AE_AML_OPERAND_VALUE); @@ -269,9 +284,10 @@ AcpiExPrepCommonFieldObject ( { /* * BufferField access can be on any byte boundary, so the - * granularity is always 8 + * alignment is always 8 (regardless of any alignment implied by the + * field access type.) */ - AccessBitWidth = 8; + Alignment = 8; } @@ -282,7 +298,7 @@ AcpiExPrepCommonFieldObject ( */ NearestByteAddress = ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); ObjDesc->CommonField.BaseByteOffset = ROUND_DOWN (NearestByteAddress, - DIV_8 (AccessBitWidth)); + DIV_8 (Alignment)); /* * StartFieldBitOffset is the offset of the first bit of the field within a field datum. diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c index 74894f5..b94c9da 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: 48 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -241,16 +241,17 @@ AcpiExSystemMemorySpaceHandler ( LogicalAddrPtr = MemInfo->MappedLogicalAddress + ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress); - /* Perform the memory read or write */ + DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), + ("IO %d (%d width) Address=%8.8lX%8.8lX\n", Function, BitWidth, + HIDWORD(Address), LODWORD(Address))); + + /* Perform the memory read or write */ switch (Function) { case ACPI_READ_ADR_SPACE: - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), - ("Read (%d width) Address=%p\n", BitWidth, Address)); - switch (BitWidth) { case 8: @@ -271,10 +272,6 @@ AcpiExSystemMemorySpaceHandler ( case ACPI_WRITE_ADR_SPACE: - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), - ("Write (%d width) Address=%p Value %X\n", - BitWidth, Address, *Value)); - switch (BitWidth) { case 8: @@ -335,6 +332,10 @@ AcpiExSystemIoSpaceHandler ( FUNCTION_TRACE ("ExSystemIoSpaceHandler"); + DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), + ("IO %d (%d width) Address=%8.8lX%8.8lX\n", Function, BitWidth, + HIDWORD(Address), LODWORD(Address))); + /* Decode the function parameter */ switch (Function) @@ -342,61 +343,14 @@ AcpiExSystemIoSpaceHandler ( case ACPI_READ_ADR_SPACE: - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), - ("Read(%d width) Address=%p\n", BitWidth, Address)); - - switch (BitWidth) - { - /* I/O Port width */ - - case 8: - *Value = (UINT32) AcpiOsIn8 ((ACPI_IO_ADDRESS) Address); - break; - - case 16: - *Value = (UINT32) AcpiOsIn16 ((ACPI_IO_ADDRESS) Address); - break; - - case 32: - *Value = AcpiOsIn32 ((ACPI_IO_ADDRESS) Address); - break; - - default: - DEBUG_PRINTP (ACPI_ERROR, ("Invalid SystemIO width %d\n", - BitWidth)); - Status = AE_AML_OPERAND_VALUE; - } - + *Value = 0; + Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, BitWidth); break; case ACPI_WRITE_ADR_SPACE: - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), - ("Write(%d width) Address=%p Value %X\n", - BitWidth, Address, *Value)); - - switch (BitWidth) - { - /* I/O Port width */ - case 8: - AcpiOsOut8 ((ACPI_IO_ADDRESS) Address, (UINT8) *Value); - break; - - case 16: - AcpiOsOut16 ((ACPI_IO_ADDRESS) Address, (UINT16) *Value); - break; - - case 32: - AcpiOsOut32 ((ACPI_IO_ADDRESS) Address, *Value); - break; - - default: - DEBUG_PRINTP (ACPI_ERROR, ("Invalid SystemIO width %d\n", - BitWidth)); - Status = AE_AML_OPERAND_VALUE; - } - + Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, *Value, BitWidth); break; @@ -408,6 +362,7 @@ AcpiExSystemIoSpaceHandler ( return_ACPI_STATUS (Status); } + /******************************************************************************* * * FUNCTION: AcpiExPciConfigSpaceHandler @@ -436,111 +391,46 @@ AcpiExPciConfigSpaceHandler ( void *RegionContext) { ACPI_STATUS Status = AE_OK; - UINT32 PciBus; - UINT32 DevFunc; - UINT8 PciReg; - ACPI_PCI_SPACE_CONTEXT *PCIContext; + ACPI_PCI_ID *PciId; + UINT16 PciRegister; FUNCTION_TRACE ("ExPciConfigSpaceHandler"); + /* * The arguments to AcpiOs(Read|Write)PciCfg(Byte|Word|Dword) are: * - * SegBus - 0xSSSSBBBB - SSSS is the PCI bus segment - * BBBB is the PCI bus number - * - * DevFunc - 0xDDDDFFFF - DDDD is the PCI device number - * FFFF is the PCI device function number + * PciSegment is the PCI bus segment range 0-31 + * PciBus is the PCI bus number range 0-255 + * PciDevice is the PCI device number range 0-31 + * PciFunction is the PCI device function number + * PciRegister is the Config space register range 0-255 bytes * - * RegNum - Config space register must be < 40h - * - * Value - input value for write, output for read + * Value - input value for write, output address for read * */ + PciId = (ACPI_PCI_ID *) RegionContext; + PciRegister = (UINT16) Address; - PCIContext = (ACPI_PCI_SPACE_CONTEXT *) RegionContext; - - PciBus = LOWORD (PCIContext->Seg) << 16; - PciBus |= LOWORD (PCIContext->Bus); - - DevFunc = PCIContext->DevFunc; - - PciReg = (UINT8) Address; + DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), + ("IO %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, + PciId->Function, PciRegister)); switch (Function) { case ACPI_READ_ADR_SPACE: - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), - ("R%d S(%04x) B(%04x) DF(%08x) R(%04x)\n", BitWidth, - PCIContext->Seg,PCIContext->Bus,PCIContext->DevFunc, PciReg)); - - *Value = 0; - - switch (BitWidth) - { - /* PCI Register width */ - - case 8: - Status = AcpiOsReadPciCfgByte (PciBus, DevFunc, PciReg, - (UINT8 *) Value); - break; - - case 16: - Status = AcpiOsReadPciCfgWord (PciBus, DevFunc, PciReg, - (UINT16 *) Value); - break; - - case 32: - Status = AcpiOsReadPciCfgDword (PciBus, DevFunc, PciReg, - Value); - break; - - default: - DEBUG_PRINTP (ACPI_ERROR, ("Invalid PCIConfig width %d\n", - BitWidth)); - Status = AE_AML_OPERAND_VALUE; - - } /* Switch bitWidth */ - + *Value = 0; + Status = AcpiOsReadPciConfiguration (PciId, PciRegister, Value, BitWidth); break; case ACPI_WRITE_ADR_SPACE: - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), - ("W%d S(%04x) B(%04x) DF(%08x) R(%04x) D(%08x)\n", BitWidth, - PCIContext->Seg,PCIContext->Bus,PCIContext->DevFunc, - PciReg,*Value)); - - switch (BitWidth) - { - /* PCI Register width */ - - case 8: - Status = AcpiOsWritePciCfgByte (PciBus, DevFunc, PciReg, - *(UINT8 *) Value); - break; - - case 16: - Status = AcpiOsWritePciCfgWord (PciBus, DevFunc, PciReg, - *(UINT16 *) Value); - break; - - case 32: - Status = AcpiOsWritePciCfgDword (PciBus, DevFunc, PciReg, - *Value); - break; - - default: - DEBUG_PRINTP (ACPI_ERROR, ("Invalid PCIConfig width %d\n", - BitWidth)); - Status = AE_AML_OPERAND_VALUE; - - } /* Switch bitWidth */ - + Status = AcpiOsWritePciConfiguration (PciId, PciRegister, *Value, BitWidth); break; @@ -548,7 +438,6 @@ AcpiExPciConfigSpaceHandler ( Status = AE_BAD_PARAMETER; break; - } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c index fb93f70..6746664 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: 29 $ + * $Revision: 31 $ * *****************************************************************************/ @@ -477,7 +477,7 @@ AcpiExResolveOperands ( * Need an operand of type ACPI_TYPE_INTEGER, * But we can implicitly convert from a STRING or BUFFER */ - Status = AcpiExConvertToInteger (StackPtr, WalkState); + Status = AcpiExConvertToInteger (*StackPtr, StackPtr, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) @@ -502,7 +502,7 @@ AcpiExResolveOperands ( * Need an operand of type ACPI_TYPE_BUFFER, * But we can implicitly convert from a STRING or INTEGER */ - Status = AcpiExConvertToBuffer (StackPtr, WalkState); + Status = AcpiExConvertToBuffer (*StackPtr, StackPtr, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) @@ -527,7 +527,7 @@ AcpiExResolveOperands ( * Need an operand of type ACPI_TYPE_STRING, * But we can implicitly convert from a BUFFER or INTEGER */ - Status = AcpiExConvertToString (StackPtr, WalkState); + Status = AcpiExConvertToString (*StackPtr, StackPtr, ACPI_UINT32_MAX, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index 91bd16c..8528457 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: 139 $ + * $Revision: 140 $ * *****************************************************************************/ @@ -603,7 +603,6 @@ AcpiExStoreObjectToNode ( /* * Assuming the parameters were already validated */ - ACPI_ASSERT((Node) && (SourceDesc)); /* @@ -734,7 +733,6 @@ AcpiExStoreObjectToObject ( /* * Assuming the parameters are valid! */ - ACPI_ASSERT((DestDesc) && (SourceDesc)); DEBUG_PRINTP (ACPI_INFO, ("Storing %p(%s) to %p(%s)\n", SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c index 1b27063..68e58e6 100644 --- a/sys/contrib/dev/acpica/exstorob.c +++ b/sys/contrib/dev/acpica/exstorob.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstorob - AML Interpreter object store support, store to object - * $Revision: 32 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -164,7 +164,7 @@ AcpiExCopyBufferToBuffer ( */ if (TargetDesc->Buffer.Length == 0) { - TargetDesc->Buffer.Pointer = AcpiUtAllocate (Length); + TargetDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (Length); if (!TargetDesc->Buffer.Pointer) { return (AE_NO_MEMORY); @@ -181,8 +181,8 @@ AcpiExCopyBufferToBuffer ( { /* Clear existing buffer and copy in the new one */ - MEMSET(TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); - MEMCPY(TargetDesc->Buffer.Pointer, Buffer, Length); + MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length); + MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length); } else @@ -190,7 +190,7 @@ AcpiExCopyBufferToBuffer ( /* * Truncate the source, copy only what will fit */ - MEMCPY(TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length); + MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length); DEBUG_PRINT (ACPI_INFO, ("ExCopyBufferToBuffer: Truncating src buffer from %X to %X\n", @@ -236,8 +236,8 @@ AcpiExCopyStringToString ( { /* Clear old string and copy in the new one */ - MEMSET(TargetDesc->String.Pointer, 0, TargetDesc->String.Length); - MEMCPY(TargetDesc->String.Pointer, Buffer, Length); + MEMSET (TargetDesc->String.Pointer, 0, TargetDesc->String.Length); + MEMCPY (TargetDesc->String.Pointer, Buffer, Length); } else @@ -252,10 +252,10 @@ AcpiExCopyStringToString ( /* * Only free if not a pointer into the DSDT */ - AcpiUtFree(TargetDesc->String.Pointer); + ACPI_MEM_FREE (TargetDesc->String.Pointer); } - TargetDesc->String.Pointer = AcpiUtAllocate (Length + 1); + TargetDesc->String.Pointer = ACPI_MEM_ALLOCATE (Length + 1); if (!TargetDesc->String.Pointer) { return (AE_NO_MEMORY); @@ -263,7 +263,7 @@ AcpiExCopyStringToString ( TargetDesc->String.Length = Length; - MEMCPY(TargetDesc->String.Pointer, Buffer, Length); + MEMCPY (TargetDesc->String.Pointer, Buffer, Length); } return (AE_OK); diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c index 3aca04f..bbe57ee 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: 62 $ + * $Revision: 64 $ * *****************************************************************************/ @@ -167,7 +167,7 @@ AcpiExSystemWaitSemaphore ( Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); DEBUG_PRINT (TRACE_EXEC, ("*** Thread awake after blocking, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); /* Reacquire the interpreter */ @@ -207,7 +207,7 @@ AcpiExSystemDoStall ( AcpiExExitInterpreter (); - AcpiOsSleepUsec (HowLong); + AcpiOsStall (HowLong); /* And now we must get the interpreter again */ @@ -216,7 +216,7 @@ AcpiExSystemDoStall ( else { - AcpiOsSleepUsec (HowLong); + AcpiOsSleep (0, (HowLong / 1000) + 1); } } diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c index 1468e84..dadd35a 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: 79 $ + * $Revision: 80 $ * *****************************************************************************/ @@ -295,7 +295,7 @@ AcpiExAcquireGlobalLock ( else { DEBUG_PRINTP (ACPI_ERROR, ("Could not acquire Global Lock, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); } } diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c index 9781d18..dcd0f8b 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: 40 $ + * $Revision: 42 $ * *****************************************************************************/ @@ -232,7 +232,8 @@ AcpiHwInitialize ( * be modified. The PM1bEvtBlk behaves as expected. */ - AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_EN); + AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead ( + ACPI_MTX_LOCK, PM1_EN); /* @@ -245,8 +246,8 @@ AcpiHwInitialize ( { /* GPE0 specified in FADT */ - AcpiGbl_Gpe0EnableRegisterSave = - AcpiUtAllocate (DIV_2 (AcpiGbl_FADT->Gpe0BlkLen)); + AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE ( + DIV_2 (AcpiGbl_FADT->Gpe0BlkLen)); if (!AcpiGbl_Gpe0EnableRegisterSave) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -271,8 +272,8 @@ AcpiHwInitialize ( { /* GPE1 defined */ - AcpiGbl_Gpe1EnableRegisterSave = - AcpiUtAllocate (DIV_2 (AcpiGbl_FADT->Gpe1BlkLen)); + AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE ( + DIV_2 (AcpiGbl_FADT->Gpe1BlkLen)); if (!AcpiGbl_Gpe1EnableRegisterSave) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -324,7 +325,7 @@ AcpiHwSetMode ( { /* BIOS should have disabled ALL fixed and GP events */ - AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable); + AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable, 8); DEBUG_PRINTP (ACPI_INFO, ("Attempting to enable ACPI mode\n")); } @@ -335,7 +336,7 @@ AcpiHwSetMode ( * enable bits to default */ - AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable); + AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable, 8); DEBUG_PRINTP (ACPI_INFO, ("Attempting to enable Legacy (non-ACPI) mode\n")); } diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c index 7302eb9..6340c80 100644 --- a/sys/contrib/dev/acpica/hwgpe.c +++ b/sys/contrib/dev/acpica/hwgpe.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 29 $ + * $Revision: 31 $ * *****************************************************************************/ @@ -140,9 +140,9 @@ void AcpiHwEnableGpe ( UINT32 GpeNumber) { - UINT8 InByte; + UINT32 InByte; UINT32 RegisterIndex; - UINT8 BitMask; + UINT32 BitMask; /* * Translate GPE number to index into global registers array. @@ -158,9 +158,10 @@ AcpiHwEnableGpe ( * Read the current value of the register, set the appropriate bit * to enable the GPE, and write out the new register. */ - InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr); - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, - (UINT8)(InByte | BitMask)); + InByte = 0; + AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, + (InByte | BitMask), 8); } @@ -180,9 +181,9 @@ void AcpiHwDisableGpe ( UINT32 GpeNumber) { - UINT8 InByte; + UINT32 InByte; UINT32 RegisterIndex; - UINT8 BitMask; + UINT32 BitMask; /* * Translate GPE number to index into global registers array. @@ -198,9 +199,10 @@ AcpiHwDisableGpe ( * Read the current value of the register, clear the appropriate bit, * and write out the new register value to disable the GPE. */ - InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr); - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, - (UINT8)(InByte & ~BitMask)); + InByte = 0; + AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, + (InByte & ~BitMask), 8); } @@ -221,7 +223,8 @@ AcpiHwClearGpe ( UINT32 GpeNumber) { UINT32 RegisterIndex; - UINT8 BitMask; + UINT32 BitMask; + /* * Translate GPE number to index into global registers array. @@ -237,7 +240,7 @@ AcpiHwClearGpe ( * Write a one to the appropriate bit in the status register to * clear this GPE. */ - AcpiOsOut8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, BitMask); + AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, BitMask, 8); } @@ -258,9 +261,10 @@ AcpiHwGetGpeStatus ( UINT32 GpeNumber, ACPI_EVENT_STATUS *EventStatus) { - UINT8 InByte = 0; + UINT32 InByte = 0; UINT32 RegisterIndex = 0; - UINT8 BitMask = 0; + UINT32 BitMask = 0; + if (!EventStatus) { @@ -282,8 +286,8 @@ AcpiHwGetGpeStatus ( /* * Enabled?: */ - InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr); - + InByte = 0; + AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8); if (BitMask & InByte) { (*EventStatus) |= ACPI_EVENT_FLAG_ENABLED; @@ -292,8 +296,8 @@ AcpiHwGetGpeStatus ( /* * Set? */ - InByte = AcpiOsIn8 (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr); - + InByte = 0; + AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].StatusAddr, &InByte, 8); if (BitMask & InByte) { (*EventStatus) |= ACPI_EVENT_FLAG_SET; diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c index 7f20418..7df3da2 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: 97 $ + * $Revision: 102 $ * ******************************************************************************/ @@ -196,8 +196,9 @@ AcpiHwClearAcpiStatus (void) if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address)) { - AcpiOsOut16 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address), - (UINT16) ALL_FIXED_STS_BITS); + AcpiOsWritePort ((ACPI_IO_ADDRESS) + ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address), + ALL_FIXED_STS_BITS, 16); } /* now clear the GPE Bits */ @@ -208,9 +209,9 @@ AcpiHwClearAcpiStatus (void) for (Index = 0; Index < GpeLength; Index++) { - AcpiOsOut8 ((ACPI_IO_ADDRESS) ( + AcpiOsWritePort ((ACPI_IO_ADDRESS) ( ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + Index), - (UINT8) 0xff); + 0xFF, 8); } } @@ -220,9 +221,9 @@ AcpiHwClearAcpiStatus (void) for (Index = 0; Index < GpeLength; Index++) { - AcpiOsOut8 ((ACPI_IO_ADDRESS) ( + AcpiOsWritePort ((ACPI_IO_ADDRESS) ( ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + Index), - (UINT8) 0xff); + 0xFF, 8); } } @@ -709,7 +710,7 @@ AcpiHwRegisterRead ( BOOLEAN UseLock, UINT32 RegisterId) { - UINT32 Value = 0; + UINT32 Value = 0; UINT32 BankOffset; @@ -786,12 +787,12 @@ AcpiHwRegisterRead ( case SMI_CMD_BLOCK: /* 8bit */ - Value = (UINT32) AcpiOsIn8 (AcpiGbl_FADT->SmiCmd); + AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value, 8); break; default: - Value = 0; + /* Value will be returned as 0 */ break; } @@ -915,7 +916,7 @@ AcpiHwRegisterWrite ( /* For 2.0, SMI_CMD is always in IO space */ /* TBD: what about 1.0? 0.71? */ - AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, (UINT8) Value); + AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8); break; @@ -957,8 +958,8 @@ AcpiHwLowLevelRead ( UINT32 Value = 0; ACPI_PHYSICAL_ADDRESS MemAddress; ACPI_IO_ADDRESS IoAddress; - UINT32 PciRegister; - UINT32 PciDevFunc; + ACPI_PCI_ID PciId; + UINT16 PciRegister; /* @@ -983,18 +984,7 @@ AcpiHwLowLevelRead ( MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); - switch (Width) - { - case 8: - Value = AcpiOsMemIn8 (MemAddress); - break; - case 16: - Value = AcpiOsMemIn16 (MemAddress); - break; - case 32: - Value = AcpiOsMemIn32 (MemAddress); - break; - } + AcpiOsReadMemory (MemAddress, &Value, Width); break; @@ -1002,38 +992,19 @@ AcpiHwLowLevelRead ( IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); - switch (Width) - { - case 8: - Value = AcpiOsIn8 (IoAddress); - break; - case 16: - Value = AcpiOsIn16 (IoAddress); - break; - case 32: - Value = AcpiOsIn32 (IoAddress); - break; - } + AcpiOsReadPort (IoAddress, &Value, Width); break; case ACPI_ADR_SPACE_PCI_CONFIG: - PciDevFunc = ACPI_PCI_DEVFUN (ACPI_GET_ADDRESS (Reg->Address)); - PciRegister = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset; + PciId.Segment = 0; + PciId.Bus = 0; + PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address)); + PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address)); + PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset); - switch (Width) - { - case 8: - AcpiOsReadPciCfgByte (0, PciDevFunc, PciRegister, (UINT8 *) &Value); - break; - case 16: - AcpiOsReadPciCfgWord (0, PciDevFunc, PciRegister, (UINT16 *) &Value); - break; - case 32: - AcpiOsReadPciCfgDword (0, PciDevFunc, PciRegister, (UINT32 *) &Value); - break; - } + AcpiOsReadPciConfiguration (&PciId, PciRegister, &Value, Width); break; } @@ -1066,8 +1037,8 @@ AcpiHwLowLevelWrite ( { ACPI_PHYSICAL_ADDRESS MemAddress; ACPI_IO_ADDRESS IoAddress; - UINT32 PciRegister; - UINT32 PciDevFunc; + ACPI_PCI_ID PciId; + UINT16 PciRegister; /* @@ -1092,18 +1063,7 @@ AcpiHwLowLevelWrite ( MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); - switch (Width) - { - case 8: - AcpiOsMemOut8 (MemAddress, (UINT8) Value); - break; - case 16: - AcpiOsMemOut16 (MemAddress, (UINT16) Value); - break; - case 32: - AcpiOsMemOut32 (MemAddress, (UINT32) Value); - break; - } + AcpiOsWriteMemory (MemAddress, Value, Width); break; @@ -1111,38 +1071,19 @@ AcpiHwLowLevelWrite ( IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); - switch (Width) - { - case 8: - AcpiOsOut8 (IoAddress, (UINT8) Value); - break; - case 16: - AcpiOsOut16 (IoAddress, (UINT16) Value); - break; - case 32: - AcpiOsOut32 (IoAddress, (UINT32) Value); - break; - } + AcpiOsWritePort (IoAddress, Value, Width); break; case ACPI_ADR_SPACE_PCI_CONFIG: - PciDevFunc = ACPI_PCI_DEVFUN (ACPI_GET_ADDRESS (Reg->Address)); - PciRegister = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset; + PciId.Segment = 0; + PciId.Bus = 0; + PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address)); + PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address)); + PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset); - switch (Width) - { - case 8: - AcpiOsWritePciCfgByte (0, PciDevFunc, PciRegister, (UINT8) Value); - break; - case 16: - AcpiOsWritePciCfgWord (0, PciDevFunc, PciRegister, (UINT16) Value); - break; - case 32: - AcpiOsWritePciCfgDword (0, PciDevFunc, PciRegister, (UINT32) Value); - break; - } + AcpiOsWritePciConfiguration (&PciId, PciRegister, Value, Width); break; } } diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index d58e3a5..cc4aae2 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: 12 $ + * $Revision: 14 $ * *****************************************************************************/ @@ -283,7 +283,7 @@ AcpiEnterSleepState ( PM1AControl |= (TypeA << AcpiHwGetBitShift (SLP_TYPE_X_MASK)); PM1BControl |= (TypeB << AcpiHwGetBitShift (SLP_TYPE_X_MASK)); - /* write #1: fill in SLP_TYPE data */ + /* write #1: fill in SLP_TYP data */ AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl); AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl); @@ -291,10 +291,16 @@ AcpiEnterSleepState ( PM1AControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK)); PM1BControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK)); - /* write #2: the whole tamale */ + /* write #2: SLP_TYP + SLP_EN */ AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl); AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl); + /* wait a second, then try again */ + AcpiOsStall(1000000); + + AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1_CONTROL, + (1 << AcpiHwGetBitShift (SLP_EN_MASK))); + enable(); return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c index a333e43..dccd941 100644 --- a/sys/contrib/dev/acpica/hwtimer.c +++ b/sys/contrib/dev/acpica/hwtimer.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwtimer.c - ACPI Power Management Timer Interface - * $Revision: 10 $ + * $Revision: 11 $ * *****************************************************************************/ @@ -161,6 +161,7 @@ AcpiGetTimerResolution ( { *Resolution = 24; } + else { *Resolution = 32; @@ -205,7 +206,8 @@ AcpiGetTimer ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - *Ticks = AcpiOsIn32 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address)); + AcpiOsReadPort ((ACPI_IO_ADDRESS) + ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address), Ticks, 32); return_ACPI_STATUS (AE_OK); } @@ -252,6 +254,7 @@ AcpiGetTimerDuration ( FUNCTION_TRACE ("AcpiGetTimerDuration"); + if (!TimeElapsed) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -266,19 +269,24 @@ AcpiGetTimerDuration ( { DeltaTicks = EndTicks - StartTicks; } + else if (StartTicks > EndTicks) { /* 24-bit Timer */ + if (0 == AcpiGbl_FADT->TmrValExt) { DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF); } + /* 32-bit Timer */ + else { DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks; } } + else { *TimeElapsed = 0; @@ -311,17 +319,21 @@ AcpiGetTimerDuration ( */ /* Step #1 */ + Seconds = DeltaTicks / PM_TIMER_FREQUENCY; Remainder = DeltaTicks % PM_TIMER_FREQUENCY; /* Step #2 */ + Milliseconds = (Remainder * 1000) / PM_TIMER_FREQUENCY; Remainder = (Remainder * 1000) % PM_TIMER_FREQUENCY; /* Step #3 */ + Microseconds = (Remainder * 1000) / PM_TIMER_FREQUENCY; /* Step #4 */ + *TimeElapsed = Seconds * 1000000; *TimeElapsed += Milliseconds * 1000; *TimeElapsed += Microseconds; diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index 965ee3a..bbc5b5a 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: 126 $ + * $Revision: 128 $ * ******************************************************************************/ @@ -189,7 +189,7 @@ AcpiNsRootInitialize (void) { DEBUG_PRINTP (ACPI_ERROR, ("Could not create predefined name %s, %s\n", - InitVal->Name, AcpiUtFormatException (Status))); + InitVal->Name, AcpiFormatException (Status))); } /* @@ -237,7 +237,7 @@ AcpiNsRootInitialize (void) * String.Pointers must be allocated buffers! * (makes deletion simpler) */ - ObjDesc->String.Pointer = AcpiUtAllocate ( + ObjDesc->String.Pointer = ACPI_MEM_ALLOCATE ( (ObjDesc->String.Length + 1)); if (!ObjDesc->String.Pointer) { diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c index baeb2b5..f5b332f 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: 50 $ + * $Revision: 51 $ * ******************************************************************************/ @@ -147,7 +147,7 @@ AcpiNsCreateNode ( FUNCTION_TRACE ("NsCreateNode"); - Node = AcpiUtCallocate (sizeof (ACPI_NAMESPACE_NODE)); + Node = ACPI_MEM_CALLOCATE (sizeof (ACPI_NAMESPACE_NODE)); if (!Node) { return_PTR (NULL); @@ -222,9 +222,7 @@ AcpiNsDeleteNode ( AcpiNsDetachObject (Node); } - AcpiUtFree (Node); - - + ACPI_MEM_FREE (Node); return_VOID; } @@ -429,7 +427,7 @@ AcpiNsDeleteChildren ( AcpiNsDetachObject (ChildNode); } - AcpiUtFree (ChildNode); + ACPI_MEM_FREE (ChildNode); /* And move on to the next child in the list */ diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index 9d7bbc5..def997d 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: 93 $ + * $Revision: 94 $ * *****************************************************************************/ @@ -163,7 +163,7 @@ AcpiNsDumpPathname ( return_ACPI_STATUS (AE_OK); } - Buffer = AcpiUtAllocate (PATHNAME_MAX); + Buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX); if (!Buffer) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -177,7 +177,7 @@ AcpiNsDumpPathname ( AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle); } - AcpiUtFree (Buffer); + ACPI_MEM_FREE (Buffer); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c index e4a35d6..49556d4 100644 --- a/sys/contrib/dev/acpica/nseval.c +++ b/sys/contrib/dev/acpica/nseval.c @@ -2,7 +2,7 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 91 $ + * $Revision: 93 $ * ******************************************************************************/ @@ -208,7 +208,7 @@ AcpiNsEvaluateRelative ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_INFO, ("Object [%s] not found [%s]\n", - Pathname, AcpiUtFormatException (Status))); + Pathname, AcpiFormatException (Status))); goto Cleanup; } @@ -227,7 +227,7 @@ AcpiNsEvaluateRelative ( Cleanup: - AcpiUtFree (InternalPath); + ACPI_MEM_FREE (InternalPath); return_ACPI_STATUS (Status); } @@ -311,7 +311,7 @@ Cleanup: if (InternalPath) { - AcpiUtFree (InternalPath); + ACPI_MEM_FREE (InternalPath); } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c index 3286d69..441767e 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: 25 $ + * $Revision: 28 $ * *****************************************************************************/ @@ -120,6 +120,7 @@ #include "acpi.h" #include "acnamesp.h" #include "acdispat.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsinit") @@ -281,6 +282,22 @@ AcpiNsInitOneObject ( return (AE_OK); } + if ((Type != ACPI_TYPE_REGION) && + (Type != ACPI_TYPE_BUFFER_FIELD)) + { + return (AE_OK); + } + + + /* + * Must lock the interpreter before executing AML code + */ + Status = AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + switch (Type) { @@ -299,7 +316,7 @@ AcpiNsInitOneObject ( DEBUG_PRINT_RAW (ACPI_ERROR, ("\n")); DEBUG_PRINT (ACPI_ERROR, ("%s while getting region arguments [%4.4s]\n", - AcpiUtFormatException (Status), &Node->Name)); + AcpiFormatException (Status), &Node->Name)); } if (!(AcpiDbgLevel & TRACE_INIT)) @@ -325,7 +342,7 @@ AcpiNsInitOneObject ( DEBUG_PRINT_RAW (ACPI_ERROR, ("\n")); DEBUG_PRINT (ACPI_ERROR, ("%s while getting buffer field arguments [%4.4s]\n", - AcpiUtFormatException (Status), &Node->Name)); + AcpiFormatException (Status), &Node->Name)); } if (!(AcpiDbgLevel & TRACE_INIT)) { @@ -339,10 +356,12 @@ AcpiNsInitOneObject ( break; } + /* * We ignore errors from above, and always return OK, since * we don't want to abort the walk on a single error. */ + AcpiExExitInterpreter (); return (AE_OK); } @@ -438,9 +457,9 @@ AcpiNsInitOneDevice ( NATIVE_CHAR *ScopeName = AcpiNsGetTablePathname (ObjHandle); DEBUG_PRINTP (ACPI_WARN, ("%s._INI failed: %s\n", - ScopeName, AcpiUtFormatException (Status))); + ScopeName, AcpiFormatException (Status))); - AcpiUtFree (ScopeName); + ACPI_MEM_FREE (ScopeName); #endif } diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c index 8fb0d3c..5ddeeaa 100644 --- a/sys/contrib/dev/acpica/nsnames.c +++ b/sys/contrib/dev/acpica/nsnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 59 $ + * $Revision: 60 $ * ******************************************************************************/ @@ -182,7 +182,7 @@ AcpiNsGetTablePathname ( /* Allocate a buffer to be returned to caller */ - NameBuffer = AcpiUtCallocate (Size + 1); + NameBuffer = ACPI_MEM_CALLOCATE (Size + 1); if (!NameBuffer) { REPORT_ERROR (("NsGetTablePathname: allocation failure\n")); diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c index bb3ca84..e33b962 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: 55 $ + * $Revision: 56 $ * ******************************************************************************/ @@ -470,7 +470,7 @@ AcpiNsDetachObject ( Node, ObjDesc, &Node->Name)); /* - * Not every value is an object allocated via AcpiUtCallocate, + * Not every value is an object allocated via ACPI_MEM_CALLOCATE, * - must check */ diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c index 6b4f50f..ac5747c 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: 70 $ + * $Revision: 71 $ * ******************************************************************************/ @@ -176,7 +176,7 @@ AcpiNsSearchNode ( DEBUG_PRINTP (TRACE_NAMES, ("Searching %s [%p] For %4.4s (type %X)\n", ScopeName, Node, &TargetName, Type)); - AcpiUtFree (ScopeName); + ACPI_MEM_FREE (ScopeName); } } #endif diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c index 56dd713..7388fc3 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: 83 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -493,7 +493,7 @@ AcpiNsInternalizeName ( /* We need a segment to store the internal name */ - InternalName = AcpiUtCallocate (Info.Length); + InternalName = ACPI_MEM_CALLOCATE (Info.Length); if (!InternalName) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -505,7 +505,7 @@ AcpiNsInternalizeName ( Status = AcpiNsBuildInternalName (&Info); if (ACPI_FAILURE (Status)) { - AcpiUtFree (InternalName); + ACPI_MEM_FREE (InternalName); return_ACPI_STATUS (Status); } @@ -645,7 +645,7 @@ AcpiNsExternalizeName ( * Build ConvertedName... */ - (*ConvertedName) = AcpiUtCallocate (*ConvertedNameLength); + (*ConvertedName) = ACPI_MEM_CALLOCATE (*ConvertedNameLength); if (!(*ConvertedName)) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -923,7 +923,7 @@ AcpiNsGetNode ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_INFO, ("%s, %s\n", - InternalPath, AcpiUtFormatException (Status))); + InternalPath, AcpiFormatException (Status))); } @@ -931,7 +931,7 @@ AcpiNsGetNode ( /* Cleanup */ - AcpiUtFree (InternalPath); + ACPI_MEM_FREE (InternalPath); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c index 1ef6f75..4f100a1 100644 --- a/sys/contrib/dev/acpica/nsxfobj.c +++ b/sys/contrib/dev/acpica/nsxfobj.c @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 86 $ + * $Revision: 87 $ * ******************************************************************************/ @@ -197,8 +197,8 @@ AcpiEvaluateObject ( ParamLength = (Count + 1) * sizeof (void *); ObjectLength = Count * sizeof (ACPI_OPERAND_OBJECT); - ParamPtr = AcpiUtCallocate (ParamLength + /* Parameter List part */ - ObjectLength); /* Actual objects */ + ParamPtr = ACPI_MEM_CALLOCATE (ParamLength + /* Parameter List part */ + ObjectLength); /* Actual objects */ if (!ParamPtr) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c index fa4303e..26af870 100644 --- a/sys/contrib/dev/acpica/psopcode.c +++ b/sys/contrib/dev/acpica/psopcode.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser opcode information table - * $Revision: 32 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -477,8 +477,8 @@ static ACPI_OPCODE_INFO AmlOpInfo[] = /* 2E */ /* AML_DEREF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), /* 2F */ /* AML_NOTIFY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1| AML_HAS_ARGS, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), /* 30 */ /* AML_SIZE_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), -/* 31 */ /* AML_INDEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX| AML_HAS_ARGS, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), -/* 32 */ /* AML_MATCH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH| AML_HAS_ARGS, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), +/* 31 */ /* AML_INDEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_TRIADIC| AML_HAS_ARGS, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), +/* 32 */ /* AML_MATCH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_HEXADIC| AML_HAS_ARGS, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), /* 33 */ /* AML_CREATE_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP), /* 34 */ /* AML_CREATE_WORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP), /* 35 */ /* AML_CREATE_BYTE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP), @@ -518,7 +518,7 @@ static ACPI_OPCODE_INFO AmlOpInfo[] = /* 54 */ /* AML_UNLOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP), /* 55 */ /* AML_REVISION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), /* 56 */ /* AML_DEBUG_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), -/* 57 */ /* AML_FATAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL| AML_HAS_ARGS, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), +/* 57 */ /* AML_FATAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_TRIADIC| AML_HAS_ARGS, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), /* 58 */ /* AML_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "OpRegion", ARGP_REGION_OP, ARGI_REGION_OP), /* 59 */ /* AML_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Field", ARGP_FIELD_OP, ARGI_FIELD_OP), /* 5A */ /* AML_DEVICE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), @@ -554,10 +554,10 @@ static ACPI_OPCODE_INFO AmlOpInfo[] = /* 71 */ /* AML_MOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Mod", ARGP_MOD_OP, ARGI_MOD_OP), /* 72 */ /* AML_CREATE_QWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP), /* 73 */ /* AML_TO_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP), -/* 74 */ /* AML_TO_DEC_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToDecString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP), -/* 75 */ /* AML_TO_HEX_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP), +/* 74 */ /* AML_TO_DECSTR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToDecString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP), +/* 75 */ /* AML_TO_HEXSTR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP), /* 76 */ /* AML_TO_INTEGER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP), -/* 77 */ /* AML_TO_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP), +/* 77 */ /* AML_TO_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP), /* 78 */ /* AML_COPY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "CopyObject", ARGP_COPY_OP, ARGI_COPY_OP), /* 79 */ /* AML_MID_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Mid", ARGP_MID_OP, ARGI_MID_OP), /* 7A */ /* AML_CONTINUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP), diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index fc68ef4..6e18ccc 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: 85 $ + * $Revision: 87 $ * *****************************************************************************/ @@ -249,7 +249,7 @@ AcpiPsCreateState ( FUNCTION_TRACE ("PsCreateState"); - ParserState = AcpiUtCallocate (sizeof (ACPI_PARSE_STATE)); + ParserState = ACPI_MEM_CALLOCATE (sizeof (ACPI_PARSE_STATE)); if (!ParserState) { return_PTR (NULL); @@ -666,11 +666,11 @@ AcpiPsParseLoop ( { DEBUG_PRINTP (ACPI_ERROR, ("Invoked method did not return a value, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); } DEBUG_PRINTP (ACPI_ERROR, ("GetPredicate Failed, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -1398,7 +1398,7 @@ AcpiPsParseAml ( /* Delete this walk state and all linked control states */ AcpiPsCleanupScope (WalkState->ParserState); - AcpiUtFree (WalkState->ParserState); + ACPI_MEM_FREE (WalkState->ParserState); AcpiDsDeleteWalkState (WalkState); /* Check if we have restarted a preempted walk */ @@ -1450,7 +1450,7 @@ Cleanup: AcpiDsDeleteWalkState (WalkState); AcpiPsCleanupScope (ParserState); - AcpiUtFree (ParserState); + ACPI_MEM_FREE (ParserState); AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *)&WalkList.AcquiredMutexList); AcpiGbl_CurrentWalkList = PrevWalkList; diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c index e22ea74..01e9dec 100644 --- a/sys/contrib/dev/acpica/psutils.c +++ b/sys/contrib/dev/acpica/psutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 37 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -290,7 +290,7 @@ AcpiPsAllocOp ( if (!Op) { - Op = AcpiUtCallocate (Size); + Op = ACPI_MEM_CALLOCATE (Size); } /* Initialize the Op */ @@ -381,8 +381,7 @@ AcpiPsFreeOp ( /* * Not a GENERIC OP, or the cache is full, just free the Op */ - - AcpiUtFree (Op); + ACPI_MEM_FREE (Op); } @@ -415,7 +414,8 @@ AcpiPsDeleteParseCache ( /* Delete one cached state object */ Next = AcpiGbl_ParseCache->Next; - AcpiUtFree (AcpiGbl_ParseCache); + ACPI_MEM_FREE (AcpiGbl_ParseCache); + AcpiGbl_ParseCache = Next; AcpiGbl_ParseCacheDepth--; } @@ -427,7 +427,8 @@ AcpiPsDeleteParseCache ( /* Delete one cached state object */ Next = AcpiGbl_ExtParseCache->Next; - AcpiUtFree (AcpiGbl_ExtParseCache); + ACPI_MEM_FREE (AcpiGbl_ExtParseCache); + AcpiGbl_ExtParseCache = (ACPI_PARSE2_OBJECT *) Next; AcpiGbl_ExtParseCacheDepth--; } diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c index acbb3e8..f794dee 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: 44 $ + * $Revision: 45 $ * *****************************************************************************/ @@ -128,7 +128,7 @@ MODULE_NAME ("psxface") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiPsxExecute * @@ -144,7 +144,7 @@ * * DESCRIPTION: Execute a control method * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiPsxExecute ( @@ -199,7 +199,6 @@ AcpiPsxExecute ( * Perform the first pass parse of the method to enter any * named objects that it creates into the namespace */ - DEBUG_PRINTP (ACPI_INFO, ("**** Begin Method Execution **** Entry=%p obj=%p\n", MethodNode, ObjDesc)); @@ -255,11 +254,9 @@ AcpiPsxExecute ( /* - * Normal exit is with Status == AE_RETURN_VALUE when a ReturnOp has been - * executed, or with Status == AE_PENDING at end of AML block (end of - * Method code) + * If the method has returned an object, signal this to the caller with + * a control exception code */ - if (*ReturnObjDesc) { DEBUG_PRINTP (ACPI_INFO, ("Method returned ObjDesc=%X\n", diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index 140f823..3114414 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: 33 $ + * $Revision: 34 $ * ******************************************************************************/ @@ -516,7 +516,7 @@ AcpiRsCreateByteStream ( &ByteStreamSizeNeeded); DEBUG_PRINTP (VERBOSE_INFO, ("ByteStreamSizeNeeded=%X, %s\n", - ByteStreamSizeNeeded, AcpiUtFormatException (Status))); + ByteStreamSizeNeeded, AcpiFormatException (Status))); /* * Exit with the error passed back diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c index 1225549..dcdd787 100644 --- a/sys/contrib/dev/acpica/rsutils.c +++ b/sys/contrib/dev/acpica/rsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 19 $ + * $Revision: 20 $ * ******************************************************************************/ @@ -447,7 +447,7 @@ AcpiRsSetSrsMethodData ( /* * Allocate the buffer needed */ - ByteStream = AcpiUtCallocate(BufferSizeNeeded); + ByteStream = ACPI_MEM_CALLOCATE (BufferSizeNeeded); if (NULL == ByteStream) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -491,7 +491,7 @@ AcpiRsSetSrsMethodData ( */ Cleanup: - AcpiUtFree (ByteStream); + ACPI_MEM_FREE (ByteStream); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c index 517f8a0..c6abe04 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: 23 $ + * $Revision: 24 $ * *****************************************************************************/ @@ -203,7 +203,7 @@ AcpiTbConvertToXsdt ( /* Allocate an XSDT */ - NewTable = AcpiUtCallocate (TableSize); + NewTable = ACPI_MEM_CALLOCATE (TableSize); if (!NewTable) { return (AE_NO_MEMORY); @@ -295,7 +295,7 @@ AcpiTbConvertTableFadt (void) /* AcpiGbl_FADT is valid */ /* Allocate and zero the 2.0 buffer */ - FADT2 = AcpiUtCallocate (sizeof (FADT_DESCRIPTOR_REV2)); + FADT2 = ACPI_MEM_CALLOCATE (sizeof (FADT_DESCRIPTOR_REV2)); if (FADT2 == NULL) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -614,7 +614,7 @@ AcpiTbBuildCommonFacs ( /* Allocate a common FACS */ - CommonFacs = AcpiUtCallocate (sizeof (ACPI_COMMON_FACS)); + CommonFacs = ACPI_MEM_CALLOCATE (sizeof (ACPI_COMMON_FACS)); if (!CommonFacs) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c index fce2f97..9c326c6 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: 48 $ + * $Revision: 51 $ * *****************************************************************************/ @@ -263,7 +263,7 @@ AcpiTbGetTable ( /* Allocate buffer for the entire table */ - FullTable = AcpiUtAllocate (TableHeader->Length); + FullTable = ACPI_MEM_ALLOCATE (TableHeader->Length); if (!FullTable) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -743,8 +743,9 @@ AcpiTbGetTableRsdt ( */ DEBUG_PRINTP (ACPI_INFO, - ("RSDP located at %p, RSDT physical=%p \n", - AcpiGbl_RSDP, AcpiGbl_RSDP->RsdtPhysicalAddress)); + ("RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n", + AcpiGbl_RSDP, HIDWORD(AcpiGbl_RSDP->RsdtPhysicalAddress), + LODWORD(AcpiGbl_RSDP->RsdtPhysicalAddress))); PhysicalAddress = AcpiTbGetRsdtAddress (); @@ -756,7 +757,7 @@ AcpiTbGetTableRsdt ( if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("Could not get the RSDT, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -846,7 +847,7 @@ AcpiTbGetTableFacs ( * Getting table from a file -- allocate a buffer and * read the table. */ - TablePtr = AcpiUtAllocate (Size); + TablePtr = ACPI_MEM_ALLOCATE (Size); if(!TablePtr) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c index 745307f..9981f61 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: 39 $ + * $Revision: 40 $ * *****************************************************************************/ @@ -345,7 +345,7 @@ AcpiTbInitTableDescriptor ( if (ListHead->Pointer) { - TableDesc = AcpiUtCallocate (sizeof (ACPI_TABLE_DESC)); + TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC)); if (!TableDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -586,7 +586,7 @@ AcpiTbDeleteSingleTable ( case ACPI_MEM_ALLOCATED: - AcpiUtFree (TableDesc->BasePointer); + ACPI_MEM_FREE (TableDesc->BasePointer); break; @@ -667,7 +667,7 @@ AcpiTbUninstallTable ( /* Free the table descriptor */ NextDesc = TableDesc->Next; - AcpiUtFree (TableDesc); + ACPI_MEM_FREE (TableDesc); } diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c index 86185b0..83f9269 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: 39 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -141,9 +141,9 @@ ******************************************************************************/ ACPI_STATUS -AcpiLoadTables ( - ACPI_PHYSICAL_ADDRESS RsdpPhysicalAddress) +AcpiLoadTables (void) { + ACPI_PHYSICAL_ADDRESS RsdpPhysicalAddress; ACPI_STATUS Status; UINT32 NumberOfTables = 0; @@ -159,13 +159,25 @@ AcpiLoadTables ( return_ACPI_STATUS (Status); } + + /* Get the RSDP */ + + Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING, + &RsdpPhysicalAddress); + if (ACPI_FAILURE (Status)) + { + REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n", + AcpiFormatException (Status))); + goto ErrorExit; + } + /* Map and validate the RSDP */ Status = AcpiTbVerifyRsdp (RsdpPhysicalAddress); if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -175,7 +187,7 @@ AcpiLoadTables ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -185,7 +197,7 @@ AcpiLoadTables ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -198,7 +210,7 @@ AcpiLoadTables ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); goto ErrorExit; } @@ -207,7 +219,7 @@ AcpiLoadTables ( ErrorExit: REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c index 0d1663d..0299e5f 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: 39 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -132,6 +132,7 @@ * FUNCTION: AcpiFindRootPointer * * PARAMETERS: **RsdpPhysicalAddress - Where to place the RSDP address + * Flags - Logical/Physical addressing * * RETURN: Status, Physical address of the RSDP * @@ -141,6 +142,7 @@ ACPI_STATUS AcpiFindRootPointer ( + UINT32 Flags, ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress) { ACPI_TABLE_DESC TableInfo; @@ -152,7 +154,7 @@ AcpiFindRootPointer ( /* Get the RSDP */ - Status = AcpiTbFindRsdp (&TableInfo, ACPI_LOGICAL_ADDRESSING); + Status = AcpiTbFindRsdp (&TableInfo, Flags); if (ACPI_FAILURE (Status)) { DEBUG_PRINTP (ACPI_ERROR, ("RSDP structure not found\n")); @@ -204,11 +206,14 @@ AcpiTbScanMemoryForRsdp ( { /* If so, we have found the RSDP */ + DEBUG_PRINTP (ACPI_INFO, + ("RSDP located at physical address %p\n",MemRover)); return_PTR (MemRover); } } /* Searched entire block, no RSDP was found */ + DEBUG_PRINTP (ACPI_INFO,("Searched entire block, no RSDP was found.\n")); return_PTR (NULL); } @@ -373,7 +378,6 @@ AcpiGetFirmwareTable ( ACPI_TABLE_HEADER **TablePointer) { ACPI_PHYSICAL_ADDRESS PhysicalAddress; - ACPI_TABLE_DESC TableInfo; ACPI_TABLE_HEADER *RsdtPtr; ACPI_TABLE_HEADER *TablePtr; ACPI_STATUS Status; @@ -403,16 +407,21 @@ AcpiGetFirmwareTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get the RSDP by scanning low memory */ + /* Get the RSDP */ - Status = AcpiTbFindRsdp (&TableInfo, Flags); + Status = AcpiOsGetRootPointer (Flags, &PhysicalAddress); if (ACPI_FAILURE (Status)) { - DEBUG_PRINTP (ACPI_ERROR, ("RSDP structure not found\n")); + DEBUG_PRINTP (ACPI_INFO, ("RSDP not found\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } - AcpiGbl_RSDP = (RSDP_DESCRIPTOR *) TableInfo.Pointer; + AcpiGbl_RSDP = (RSDP_DESCRIPTOR *) (ACPI_TBLPTR) PhysicalAddress; + + DEBUG_PRINTP (ACPI_INFO, + ("RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n", + AcpiGbl_RSDP, HIDWORD(AcpiGbl_RSDP->RsdtPhysicalAddress), + LODWORD(AcpiGbl_RSDP->RsdtPhysicalAddress))); /* Get the RSDT and validate it */ diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index ecef385..9b7a170 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local memory allocation routines - * $Revision: 90 $ + * $Revision: 93 $ * *****************************************************************************/ @@ -126,15 +126,18 @@ MODULE_NAME ("utalloc") -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + /* - * Most of this code is for tracking memory leaks in the subsystem, and it - * gets compiled out when the ACPI_DEBUG flag is not set. - * Every memory allocation is kept track of in a doubly linked list. Each + * This module is used for tracking memory leaks in the subsystem, and it + * gets compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. + * + * Each memory allocation is tracked via a doubly linked list. Each * element contains the caller's component, module name, function name, and - * line number. _UtAllocate and _UtCallocate call AcpiUtAddElementToAllocList - * to add an element to the list; deletion occurs in the bosy of _UtFree. + * line number. AcpiUtAllocate and AcpiUtCallocate call + * AcpiUtAddElementToAllocList to add an element to the list; deletion + * occurs in the body of AcpiUtFree. */ @@ -433,7 +436,7 @@ AcpiUtDeleteElementFromAllocList ( else { _REPORT_ERROR (Module, Line, Component, - ("_UtFree: Entry not found in list\n")); + ("AcpiUtFree: Entry not found in list\n")); DEBUG_PRINTP (ACPI_ERROR, ("Entry %p was not found in allocation list\n", Address)); AcpiUtReleaseMutex (ACPI_MTX_MEMORY); @@ -614,11 +617,11 @@ AcpiUtDumpCurrentAllocations ( return_VOID; } -#endif /* #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS */ + /******************************************************************************* * - * FUNCTION: _UtAllocate + * FUNCTION: AcpiUtAllocate * * PARAMETERS: Size - Size of the allocation * Component - Component type of caller @@ -632,7 +635,7 @@ AcpiUtDumpCurrentAllocations ( ******************************************************************************/ void * -_UtAllocate ( +AcpiUtAllocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, @@ -641,7 +644,7 @@ _UtAllocate ( void *Address = NULL; - FUNCTION_TRACE_U32 ("_UtAllocate", Size); + FUNCTION_TRACE_U32 ("AcpiUtAllocate", Size); /* Check for an inadvertent size of zero bytes */ @@ -664,7 +667,6 @@ _UtAllocate ( return_PTR (NULL); } -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS if (ACPI_FAILURE (AcpiUtAddElementToAllocList (Address, Size, MEM_MALLOC, Component, Module, Line))) @@ -674,7 +676,6 @@ _UtAllocate ( } DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p Size %X\n", Address, Size)); -#endif return_PTR (Address); } @@ -682,7 +683,7 @@ _UtAllocate ( /******************************************************************************* * - * FUNCTION: _UtCallocate + * FUNCTION: AcpiUtCallocate * * PARAMETERS: Size - Size of the allocation * Component - Component type of caller @@ -696,7 +697,7 @@ _UtAllocate ( ******************************************************************************/ void * -_UtCallocate ( +AcpiUtCallocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, @@ -705,7 +706,7 @@ _UtCallocate ( void *Address = NULL; - FUNCTION_TRACE_U32 ("_UtCallocate", Size); + FUNCTION_TRACE_U32 ("AcpiUtCallocate", Size); /* Check for an inadvertent size of zero bytes */ @@ -728,7 +729,6 @@ _UtCallocate ( return_PTR (NULL); } -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS if (ACPI_FAILURE (AcpiUtAddElementToAllocList (Address, Size, MEM_CALLOC, Component,Module, Line))) @@ -736,7 +736,6 @@ _UtCallocate ( AcpiOsFree (Address); return_PTR (NULL); } -#endif DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p Size %X\n", Address, Size)); @@ -746,7 +745,7 @@ _UtCallocate ( /******************************************************************************* * - * FUNCTION: _UtFree + * FUNCTION: AcpiUtFree * * PARAMETERS: Address - Address of the memory to deallocate * Component - Component type of caller @@ -760,27 +759,24 @@ _UtCallocate ( ******************************************************************************/ void -_UtFree ( +AcpiUtFree ( void *Address, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line) { - FUNCTION_TRACE_PTR ("_UtFree", Address); + FUNCTION_TRACE_PTR ("AcpiUtFree", Address); if (NULL == Address) { _REPORT_ERROR (Module, Line, Component, - ("_UtFree: Trying to delete a NULL address\n")); + ("AcpiUtFree: Trying to delete a NULL address\n")); return_VOID; } -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS AcpiUtDeleteElementFromAllocList (Address, Component, Module, Line); -#endif - AcpiOsFree (Address); DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p freed\n", Address)); @@ -788,4 +784,5 @@ _UtFree ( return_VOID; } +#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utclib.c index 5b5b0e0..9de98de 100644 --- a/sys/contrib/dev/acpica/utclib.c +++ b/sys/contrib/dev/acpica/utclib.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 38 $ + * $Revision: 39 $ * *****************************************************************************/ @@ -344,7 +344,7 @@ AcpiUtStrcat ( for (String = DstString; *String++; ) { ; } - /* Concatinate the string */ + /* Concatenate the string */ for (--String; (*String++ = *SrcString++); ) { ; } @@ -384,7 +384,7 @@ AcpiUtStrncat ( for (String = DstString; *String++; ) { ; } - /* Concatinate the string */ + /* Concatenate the string */ for (--String; (*String++ = *SrcString++) && --Count; ) { ; } diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c index 4e5ef80..35e1d00 100644 --- a/sys/contrib/dev/acpica/utcopy.c +++ b/sys/contrib/dev/acpica/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 74 $ + * $Revision: 76 $ * *****************************************************************************/ @@ -527,6 +527,9 @@ AcpiUtCopyEsimpleToIsimple ( InternalObject->Common.Type = (UINT8) ExternalObject->Type; + /* + * Simple types supported are: String, Buffer, Integer + */ switch (ExternalObject->Type) { @@ -545,15 +548,15 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_INTEGER: - /* - * Number is included in the object itself - */ + InternalObject->Integer.Value = ExternalObject->Integer.Value; break; - default: - return_ACPI_STATUS (AE_CTRL_RETURN_VALUE); + /* + * Whatever other type -- it is not supported + */ + return_ACPI_STATUS (AE_SUPPORT); break; } @@ -815,7 +818,7 @@ AcpiUtCopyIpackageToIpackage ( * Create the object array and walk the source package tree */ - DestObj->Package.Elements = AcpiUtCallocate ((SourceObj->Package.Count + 1) * + DestObj->Package.Elements = ACPI_MEM_CALLOCATE ((SourceObj->Package.Count + 1) * sizeof (void *)); DestObj->Package.NextElement = DestObj->Package.Elements; diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index 0a27da2..6f3e301 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: 72 $ + * $Revision: 73 $ * *****************************************************************************/ @@ -342,11 +342,8 @@ FunctionStatusExit ( { DebugPrint (ModuleName, LineNumber, ComponentId, - TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, %s\n", - AcpiGbl_NestingLevel, - FunctionName, - AcpiUtFormatException (Status)); + TRACE_FUNCTIONS, " %2.2ld Exiting Function: %s, %s\n", + AcpiGbl_NestingLevel, FunctionName, AcpiFormatException (Status)); AcpiGbl_NestingLevel--; } diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c index 8a7409a..46a42d9 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: 71 $ + * $Revision: 72 $ * ******************************************************************************/ @@ -285,7 +285,7 @@ AcpiUtDeleteInternalObj ( { DEBUG_PRINTP (ACPI_INFO, ("Deleting Obj Ptr %p \n", ObjPointer)); - AcpiUtFree (ObjPointer); + ACPI_MEM_FREE (ObjPointer); } } @@ -358,7 +358,7 @@ AcpiUtDeleteInternalObjectList ( /* Free the combined parameter pointer list and object array */ - AcpiUtFree (ObjList); + ACPI_MEM_FREE (ObjList); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c index 3dc815f..d805e73 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: 27 $ + * $Revision: 28 $ * *****************************************************************************/ @@ -169,7 +169,7 @@ AcpiUtEvaluateNumericObject ( { DEBUG_PRINTP (ACPI_ERROR, ("%s on %4.4s failed with status %s\n", ObjectName, &DeviceNode->Name, - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); } return_ACPI_STATUS (Status); @@ -254,7 +254,7 @@ AcpiUtExecute_HID ( else { DEBUG_PRINTP (ACPI_ERROR, ("_HID on %4.4s failed %s\n", - &DeviceNode->Name, AcpiUtFormatException (Status))); + &DeviceNode->Name, AcpiFormatException (Status))); } return_ACPI_STATUS (Status); @@ -351,7 +351,7 @@ AcpiUtExecute_UID ( { DEBUG_PRINTP (ACPI_ERROR, ("_UID on %4.4s failed %s\n", - &DeviceNode->Name, AcpiUtFormatException (Status))); + &DeviceNode->Name, AcpiFormatException (Status))); } return (Status); @@ -450,7 +450,7 @@ AcpiUtExecute_STA ( { DEBUG_PRINTP (ACPI_ERROR, ("_STA on %4.4s failed %s\n", &DeviceNode->Name, - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); } else /* success */ diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index a9b8d0f..505f64f 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: 123 $ + * $Revision: 125 $ * *****************************************************************************/ @@ -128,6 +128,81 @@ MODULE_NAME ("utglobal") + +/****************************************************************************** + * + * FUNCTION: AcpiFormatException + * + * PARAMETERS: Status - The ACPI_STATUS code to be formatted + * + * RETURN: A string containing the exception text + * + * DESCRIPTION: This function translates an ACPI exception into an ASCII string. + * + ******************************************************************************/ + +const char * +AcpiFormatException ( + ACPI_STATUS Status) +{ + char *Exception = "UNKNOWN_STATUS_CODE"; + ACPI_STATUS SubStatus; + + + SubStatus = (Status & ~AE_CODE_MASK); + + + switch (Status & AE_CODE_MASK) + { + case AE_CODE_ENVIRONMENTAL: + + if (SubStatus <= AE_CODE_ENV_MAX) + { + Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; + } + break; + + case AE_CODE_PROGRAMMER: + + if (SubStatus <= AE_CODE_PGM_MAX) + { + Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; + } + break; + + case AE_CODE_ACPI_TABLES: + + if (SubStatus <= AE_CODE_TBL_MAX) + { + Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; + } + break; + + case AE_CODE_AML: + + if (SubStatus <= AE_CODE_AML_MAX) + { + Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; + } + break; + + case AE_CODE_CONTROL: + + if (SubStatus <= AE_CODE_CTRL_MAX) + { + Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; + } + break; + + default: + break; + } + + + return ((const char *) Exception); +} + + /****************************************************************************** * * Static global variable initialization. @@ -523,80 +598,6 @@ AcpiUtValidObjectType ( } -/***************************************************************************** - * - * FUNCTION: AcpiUtFormatException - * - * PARAMETERS: Status - Acpi status to be formatted - * - * RETURN: Formatted status string - * - * DESCRIPTION: Convert an ACPI exception to a string - * - ****************************************************************************/ - -NATIVE_CHAR * -AcpiUtFormatException ( - ACPI_STATUS Status) -{ - NATIVE_CHAR *Exception = "UNKNOWN_STATUS"; - ACPI_STATUS SubStatus; - - - SubStatus = (Status & ~AE_CODE_MASK); - - - switch (Status & AE_CODE_MASK) - { - case AE_CODE_ENVIRONMENTAL: - - if (SubStatus <= AE_CODE_ENV_MAX) - { - Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; - } - break; - - case AE_CODE_PROGRAMMER: - - if (SubStatus <= AE_CODE_PGM_MAX) - { - Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; - } - break; - - case AE_CODE_ACPI_TABLES: - - if (SubStatus <= AE_CODE_TBL_MAX) - { - Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; - } - break; - - case AE_CODE_AML: - - if (SubStatus <= AE_CODE_AML_MAX) - { - Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; - } - break; - - case AE_CODE_CONTROL: - - if (SubStatus <= AE_CODE_CTRL_MAX) - { - Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; - } - break; - - default: - break; - } - - - return (Exception); -} - - /**************************************************************************** * * FUNCTION: AcpiUtAllocateOwnerId diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c index 4a96268..54dbd47 100644 --- a/sys/contrib/dev/acpica/utinit.c +++ b/sys/contrib/dev/acpica/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 96 $ + * $Revision: 98 $ * *****************************************************************************/ @@ -278,12 +278,12 @@ AcpiUtTerminate (void) if (AcpiGbl_Gpe0EnableRegisterSave) { - AcpiUtFree (AcpiGbl_Gpe0EnableRegisterSave); + ACPI_MEM_FREE (AcpiGbl_Gpe0EnableRegisterSave); } if (AcpiGbl_Gpe1EnableRegisterSave) { - AcpiUtFree (AcpiGbl_Gpe1EnableRegisterSave); + ACPI_MEM_FREE (AcpiGbl_Gpe1EnableRegisterSave); } @@ -349,7 +349,8 @@ AcpiUtSubsystemShutdown (void) AcpiPsDeleteParseCache (); /* Debug only - display leftover memory allocation, if any */ -#ifdef ENABLE_DEBUGGER + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpCurrentAllocations (ACPI_UINT32_MAX, NULL); #endif diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c index f5d4b42..d1f43c8 100644 --- a/sys/contrib/dev/acpica/utmisc.c +++ b/sys/contrib/dev/acpica/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 42 $ + * $Revision: 44 $ * ******************************************************************************/ @@ -452,7 +452,7 @@ AcpiUtAcquireMutex ( { DEBUG_PRINTP (ACPI_ERROR, ("Thread %X could not acquire Mutex [%s] %s\n", ThisThreadId, AcpiUtGetMutexName (MutexId), - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); } return (Status); @@ -541,7 +541,7 @@ AcpiUtReleaseMutex ( { DEBUG_PRINTP (ACPI_ERROR, ("Thread %X could not release Mutex [%s] %s\n", ThisThreadId, AcpiUtGetMutexName (MutexId), - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); } else { @@ -743,7 +743,7 @@ AcpiUtCreateGenericState (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - State = AcpiUtCallocate (sizeof (ACPI_GENERIC_STATE)); + State = ACPI_MEM_CALLOCATE (sizeof (ACPI_GENERIC_STATE)); } /* Initialize */ @@ -915,7 +915,7 @@ AcpiUtDeleteGenericState ( if (AcpiGbl_GenericStateCacheDepth >= MAX_STATE_CACHE_DEPTH) { - AcpiUtFree (State); + ACPI_MEM_FREE (State); } /* Otherwise put this object back into the cache */ @@ -972,7 +972,8 @@ AcpiUtDeleteGenericStateCache ( /* Delete one cached state object */ Next = AcpiGbl_GenericStateCache->Common.Next; - AcpiUtFree (AcpiGbl_GenericStateCache); + ACPI_MEM_FREE (AcpiGbl_GenericStateCache); + AcpiGbl_GenericStateCache = Next; AcpiGbl_GenericStateCacheDepth--; } diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index 98f866b..41cb761 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: 46 $ + * $Revision: 49 $ * *****************************************************************************/ @@ -182,7 +182,6 @@ _UtCreateInternalObject ( /* Any per-type initialization should go here */ - return_PTR (Object); } @@ -312,8 +311,7 @@ _UtAllocateObjectDesc ( /* Attempt to allocate new descriptor */ - Object = _UtCallocate (sizeof (ACPI_OPERAND_OBJECT), ComponentId, - ModuleName, LineNumber); + Object = ACPI_MEM_CALLOCATE (sizeof (ACPI_OPERAND_OBJECT)); if (!Object) { /* Allocation failed */ @@ -389,7 +387,7 @@ AcpiUtDeleteObjectDesc ( */ DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - AcpiUtFree (Object); + ACPI_MEM_FREE (Object); return_VOID; } @@ -450,7 +448,7 @@ AcpiUtDeleteObjectCache ( */ DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - AcpiUtFree (AcpiGbl_ObjectCache); + ACPI_MEM_FREE (AcpiGbl_ObjectCache); AcpiGbl_ObjectCache = Next; AcpiGbl_ObjectCacheDepth--; } diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c index 1e74682..3f6fce0 100644 --- a/sys/contrib/dev/acpica/utxface.c +++ b/sys/contrib/dev/acpica/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 72 $ + * $Revision: 76 $ * *****************************************************************************/ @@ -124,6 +124,7 @@ #include "acinterp.h" #include "amlcode.h" #include "acdebug.h" +#include "acexcep.h" #define _COMPONENT ACPI_UTILITIES @@ -162,7 +163,7 @@ AcpiInitializeSubsystem ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("OSD failed to initialize, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -172,7 +173,7 @@ AcpiInitializeSubsystem ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("Global mutex creation failure, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -185,7 +186,7 @@ AcpiInitializeSubsystem ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("Namespace initialization failure, %s\n", - AcpiUtFormatException (Status))); + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -330,6 +331,7 @@ AcpiEnableSubsystem ( } } + AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; return_ACPI_STATUS (Status); } @@ -390,6 +392,34 @@ AcpiTerminate (void) } +/***************************************************************************** + * + * FUNCTION: AcpiSubsystemStatus + * + * PARAMETERS: None + * + * RETURN: Status of the ACPI subsystem + * + * DESCRIPTION: Other drivers that use the ACPI subsystem should call this + * before making any other calls, to ensure the subsystem initial- + * ized successfully. + * + ****************************************************************************/ + +ACPI_STATUS +AcpiSubsystemStatus (void) +{ + if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK) + { + return (AE_OK); + } + else + { + return (AE_ERROR); + } +} + + /****************************************************************************** * * FUNCTION: AcpiGetSystemInfo @@ -497,126 +527,3 @@ AcpiGetSystemInfo ( } -/****************************************************************************** - * - * FUNCTION: AcpiFormatException - * - * PARAMETERS: OutBuffer - a pointer to a buffer to receive the - * exception name - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function translates an ACPI exception into an ASCII string. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiFormatException ( - ACPI_STATUS Exception, - ACPI_BUFFER *OutBuffer) -{ - UINT32 Length; - NATIVE_CHAR *FormattedException; - - - FUNCTION_TRACE ("AcpiFormatException"); - - - /* - * Must have a valid buffer - */ - if ((!OutBuffer) || - (!OutBuffer->Pointer)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - - /* Convert the exception code (Handles bad exception codes) */ - - FormattedException = AcpiUtFormatException (Exception); - - /* - * Get length of string and check if it will fit in caller's buffer - */ - - Length = STRLEN (FormattedException); - if (OutBuffer->Length < Length) - { - OutBuffer->Length = Length; - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - - /* Copy the string, all done */ - - STRCPY (OutBuffer->Pointer, FormattedException); - - return_ACPI_STATUS (AE_OK); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiAllocate - * - * PARAMETERS: Size - Size of the allocation - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: The subsystem's equivalent of malloc. - * External front-end to the Ut* memory manager - * - ****************************************************************************/ - -void * -AcpiAllocate ( - UINT32 Size) -{ - - return (AcpiUtAllocate (Size)); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCallocate - * - * PARAMETERS: Size - Size of the allocation - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: The subsystem's equivalent of calloc. - * External front-end to the Ut* memory manager - * - ****************************************************************************/ - -void * -AcpiCallocate ( - UINT32 Size) -{ - - return (AcpiUtCallocate (Size)); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiFree - * - * PARAMETERS: Address - Address of the memory to deallocate - * - * RETURN: None - * - * DESCRIPTION: Frees the memory at Address - * External front-end to the Ut* memory manager - * - ****************************************************************************/ - -void -AcpiFree ( - void *Address) -{ - - AcpiUtFree (Address); -} |