patch-2.4.10 linux/drivers/acpi/include/acmacros.h

Next file: linux/drivers/acpi/include/acnamesp.h
Previous file: linux/drivers/acpi/include/aclocal.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/acpi/include/acmacros.h linux/drivers/acpi/include/acmacros.h
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Name: acmacros.h - C macros for the entire subsystem.
- *       $Revision: 72 $
+ *       $Revision: 94 $
  *
  *****************************************************************************/
 
@@ -26,18 +26,11 @@
 #ifndef __ACMACROS_H__
 #define __ACMACROS_H__
 
+
 /*
  * Data manipulation macros
  */
 
-#ifndef LODWORD
-#define LODWORD(l)                      ((u32)(UINT64)(l))
-#endif
-
-#ifndef HIDWORD
-#define HIDWORD(l)                      ((u32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF))
-#endif
-
 #ifndef LOWORD
 #define LOWORD(l)                       ((u16)(NATIVE_UINT)(l))
 #endif
@@ -76,18 +69,53 @@
  * 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)
 
 #else
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+/*
+ * acpi_integer is 32-bits, no 64-bit support on this platform
+ */
+#ifndef LODWORD
+#define LODWORD(l)                      ((u32)(l))
+#endif
+
+#ifndef HIDWORD
+#define HIDWORD(l)                      (0)
+#endif
+
+#define ACPI_GET_ADDRESS(a)             (a)
+#define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
+#define ACPI_VALID_ADDRESS(a)           (a)
+
+#else
+
 /*
- * Full 64-bit address on 32-bit and 64-bit platforms
+ * Full 64-bit address/integer on both 32-bit and 64-bit platforms
  */
+#ifndef LODWORD
+#define LODWORD(l)                      ((u32)(UINT64)(l))
+#endif
+
+#ifndef HIDWORD
+#define HIDWORD(l)                      ((u32)(((*(uint64_struct *)(&l))).hi))
+#endif
+
 #define ACPI_GET_ADDRESS(a)             (a)
 #define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
 #define ACPI_VALID_ADDRESS(a)           (a)
 #endif
+#endif
 
  /*
   * Extract a byte of data using a pointer.  Any more than a byte and we
@@ -178,7 +206,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)))
 
@@ -208,49 +235,45 @@
  * 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)       (~(((u32)(-1)) << ((u32) (position))))
 #define MASK_BITS_BELOW(position)       (((u32)(-1)) << ((u32) (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)            (u32) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
-#define ACPI_PCI_DEVICE(a)              (u32) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
-
-#ifndef _IA16
-#define ACPI_PCI_REGISTER(a)            (u32) (((a) & ACPI_PCI_REGISTER_MASK))
-#define ACPI_PCI_DEVFUN(a)              (u32) ((ACPI_PCI_DEVICE(a) << 16) | ACPI_PCI_FUNCTION(a))
+#define ACPI_PCI_FUNCTION(a)            (u16) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16))
+#define ACPI_PCI_DEVICE(a)              (u16) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32))
+#define ACPI_PCI_REGISTER(a)            (u16) (((a) & ACPI_PCI_REGISTER_MASK))
 
 #else
-#define ACPI_PCI_REGISTER(a)            (u32) (((a) & 0x0000FFFF))
-#define ACPI_PCI_DEVFUN(a)              (u32) ((((a) & 0xFFFF0000) >> 16))
+
+/* No support for GAS and PCI IDs in 16-bit mode  */
+
+#define ACPI_PCI_FUNCTION(a)            (u16) ((a) & 0xFFFF0000)
+#define ACPI_PCI_DEVICE(a)              (u16) ((a) & 0x0000FFFF)
+#define ACPI_PCI_REGISTER(a)            (u16) ((a) & 0x0000FFFF)
 
 #endif
 
 /*
- * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts,
- * such as on ap_obj_stack, where a pointer to an ACPI_OPERAND_OBJECT can also
+ * An acpi_handle (which is actually an acpi_namespace_node *) can appear in some contexts,
+ * such as on ap_obj_stack, where a pointer to an acpi_operand_object can also
  * appear.  This macro is used to distinguish them.
  *
  * The Data_type field is the first field in both structures.
  */
-
-#define VALID_DESCRIPTOR_TYPE(d,t)      (((ACPI_NAMESPACE_NODE *)d)->data_type == t)
+#define VALID_DESCRIPTOR_TYPE(d,t)      (((acpi_namespace_node *)d)->data_type == t)
 
 
 /* Macro to test the object type */
 
-#define IS_THIS_OBJECT_TYPE(d,t)        (((ACPI_OPERAND_OBJECT  *)d)->common.type == (u8)t)
+#define IS_THIS_OBJECT_TYPE(d,t)        (((acpi_operand_object  *)d)->common.type == (u8)t)
 
 /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
 
@@ -263,10 +286,9 @@
 /*
  * Macro to check if a pointer is within an ACPI table.
  * Parameter (a) is the pointer to check.  Parameter (b) must be defined
- * as a pointer to an ACPI_TABLE_HEADER.  (b+1) then points past the header,
+ * as a pointer to an acpi_table_header.  (b+1) then points past the header,
  * and ((u8 *)b+b->Length) points one byte past the end of the table.
  */
-
 #ifndef _IA16
 #define IS_IN_ACPI_TABLE(a,b)           (((u8 *)(a) >= (u8 *)(b + 1)) &&\
 							   ((u8 *)(a) < ((u8 *)b + b->length)))
@@ -280,11 +302,10 @@
 /*
  * Macros for the master AML opcode table
  */
-
 #ifdef ACPI_DEBUG
-#define OP_INFO_ENTRY(flags,name,Pargs,Iargs)     {flags,Pargs,Iargs,name}
+#define ACPI_OP(name,Pargs,Iargs,flags)     {Pargs,Iargs,flags,name}
 #else
-#define OP_INFO_ENTRY(flags,name,Pargs,Iargs)     {flags,Pargs,Iargs}
+#define ACPI_OP(name,Pargs,Iargs,flags)     {Pargs,Iargs,flags}
 #endif
 
 #define ARG_TYPE_WIDTH                  5
@@ -347,36 +368,32 @@
 
 #ifdef ACPI_DEBUG
 
-#define REPORT_INFO(fp)                 {_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
-											debug_print_raw PARAM_LIST(fp);}
-#define REPORT_ERROR(fp)                {_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
-											debug_print_raw PARAM_LIST(fp);}
-#define REPORT_WARNING(fp)              {_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
-											debug_print_raw PARAM_LIST(fp);}
+#define REPORT_INFO(fp)                 {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+											acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_ERROR(fp)                {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
+											acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_WARNING(fp)              {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
+											acpi_os_printf PARAM_LIST(fp);}
 
 #else
 
-#define REPORT_INFO(fp)                 {_report_info("ACPI",__LINE__,_COMPONENT); \
-											debug_print_raw PARAM_LIST(fp);}
-#define REPORT_ERROR(fp)                {_report_error("ACPI",__LINE__,_COMPONENT); \
-											debug_print_raw PARAM_LIST(fp);}
-#define REPORT_WARNING(fp)              {_report_warning("ACPI",__LINE__,_COMPONENT); \
-											debug_print_raw PARAM_LIST(fp);}
+#define REPORT_INFO(fp)                 {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
+											acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_ERROR(fp)                {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
+											acpi_os_printf PARAM_LIST(fp);}
+#define REPORT_WARNING(fp)              {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
+											acpi_os_printf PARAM_LIST(fp);}
 
 #endif
 
 /* Error reporting.  These versions pass thru the module and line# */
 
-#define _REPORT_INFO(a,b,c,fp)          {_report_info(a,b,c); \
-											debug_print_raw PARAM_LIST(fp);}
-#define _REPORT_ERROR(a,b,c,fp)         {_report_error(a,b,c); \
-											debug_print_raw PARAM_LIST(fp);}
-#define _REPORT_WARNING(a,b,c,fp)       {_report_warning(a,b,c); \
-											debug_print_raw PARAM_LIST(fp);}
-
-/* Buffer dump macros */
-
-#define DUMP_BUFFER(a,b)                acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define _REPORT_INFO(a,b,c,fp)          {acpi_ut_report_info(a,b,c); \
+											acpi_os_printf PARAM_LIST(fp);}
+#define _REPORT_ERROR(a,b,c,fp)         {acpi_ut_report_error(a,b,c); \
+											acpi_os_printf PARAM_LIST(fp);}
+#define _REPORT_WARNING(a,b,c,fp)       {acpi_ut_report_warning(a,b,c); \
+											acpi_os_printf PARAM_LIST(fp);}
 
 /*
  * Debug macros that are conditionally compiled
@@ -392,15 +409,22 @@
  * as a local string ("_Proc_name) so that it can be also used by the function exit macros below.
  */
 
-#define PROC_NAME(a)                    char * _proc_name = a;
-#define FUNCTION_TRACE(a)               char * _proc_name = a;\
-										function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a)
-#define FUNCTION_TRACE_PTR(a,b)         char * _proc_name = a;\
-										function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b)
-#define FUNCTION_TRACE_U32(a,b)         char * _proc_name = a;\
-										function_trace_u32(_THIS_MODULE,__LINE__,_COMPONENT,a,(u32)b)
-#define FUNCTION_TRACE_STR(a,b)         char * _proc_name = a;\
-										function_trace_str(_THIS_MODULE,__LINE__,_COMPONENT,a,(NATIVE_CHAR *)b)
+#define PROC_NAME(a)                    ACPI_DEBUG_PRINT_INFO _dbg;     \
+										_dbg.component_id = _COMPONENT; \
+										_dbg.proc_name   = a;           \
+										_dbg.module_name = _THIS_MODULE;
+
+#define FUNCTION_TRACE(a)               PROC_NAME(a)\
+										acpi_ut_trace(__LINE__,&_dbg)
+#define FUNCTION_TRACE_PTR(a,b)         PROC_NAME(a)\
+										acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
+#define FUNCTION_TRACE_U32(a,b)         PROC_NAME(a)\
+										acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
+#define FUNCTION_TRACE_STR(a,b)         PROC_NAME(a)\
+										acpi_ut_trace_str(__LINE__,&_dbg,(NATIVE_CHAR *)b)
+
+#define FUNCTION_ENTRY()                acpi_ut_track_stack_ptr()
+
 /*
  * Function exit tracing.
  * WARNING: These macros include a return statement.  This is usually considered
@@ -408,10 +432,10 @@
  * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
  * so that "_Proc_name" is defined.
  */
-#define return_VOID                     {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;}
-#define return_ACPI_STATUS(s)           {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);}
-#define return_VALUE(s)                 {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);}
-#define return_PTR(s)                   {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(u8 *)s);return(s);}
+#define return_VOID                     {acpi_ut_exit(__LINE__,&_dbg);return;}
+#define return_ACPI_STATUS(s)           {acpi_ut_status_exit(__LINE__,&_dbg,s);return(s);}
+#define return_VALUE(s)                 {acpi_ut_value_exit(__LINE__,&_dbg,s);return(s);}
+#define return_PTR(s)                   {acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)s);return(s);}
 
 
 /* Conditional execution */
@@ -435,7 +459,9 @@
 #define DUMP_TABLES(a,b)                acpi_ns_dump_tables(a,b)
 #define DUMP_PATHNAME(a,b,c,d)          acpi_ns_dump_pathname(a,b,c,d)
 #define DUMP_RESOURCE_LIST(a)           acpi_rs_dump_resource_list(a)
-#define BREAK_MSG(a)                    acpi_os_breakpoint (a)
+#define DUMP_BUFFER(a,b)                acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define BREAK_MSG(a)                    acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
+
 
 /*
  * Generate INT3 on ACPI_ERROR (Debug only!)
@@ -443,7 +469,7 @@
 
 #define ERROR_BREAK
 #ifdef  ERROR_BREAK
-#define BREAK_ON_ERROR(lvl)             if ((lvl)&ACPI_ERROR) acpi_os_breakpoint("Fatal error encountered\n")
+#define BREAK_ON_ERROR(lvl)              if ((lvl)&ACPI_ERROR) acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
 #else
 #define BREAK_ON_ERROR(lvl)
 #endif
@@ -453,33 +479,10 @@
  * Print iff:
  *    1) Debug print for the current component is enabled
  *    2) Debug error level or trace level for the print statement is enabled
- *
  */
 
-#define TEST_DEBUG_SWITCH(lvl)          if (((lvl) & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))
-
-#define DEBUG_PRINT(lvl,fp)             TEST_DEBUG_SWITCH(lvl) {\
-											debug_print_prefix (_THIS_MODULE,__LINE__);\
-											debug_print_raw PARAM_LIST(fp);\
-											BREAK_ON_ERROR(lvl);}
-
-#define DEBUG_PRINTP(lvl,fp)            TEST_DEBUG_SWITCH(lvl) {\
-											debug_print_prefix (_THIS_MODULE,__LINE__);\
-											debug_print_raw ("%s: ",_proc_name);\
-											debug_print_raw PARAM_LIST(fp);\
-											BREAK_ON_ERROR(lvl);}
-
-#define DEBUG_PRINT_RAW(lvl,fp)         TEST_DEBUG_SWITCH(lvl) {\
-											debug_print_raw PARAM_LIST(fp);}
-
-
-/* Assert macros */
-
-#define ACPI_ASSERT(exp)                if(!(exp)) \
-											acpi_os_dbg_assert(#exp, __FILE__, __LINE__, "Failed Assertion")
-
-#define DEBUG_ASSERT(msg, exp)          if(!(exp)) \
-											acpi_os_dbg_assert(#exp, __FILE__, __LINE__, msg)
+#define ACPI_DEBUG_PRINT(pl)            acpi_ut_debug_print PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)        acpi_ut_debug_print_raw PARAM_LIST(pl)
 
 
 #else
@@ -504,15 +507,16 @@
 #define FUNCTION_EXIT
 #define FUNCTION_STATUS_EXIT(s)
 #define FUNCTION_VALUE_EXIT(s)
+#define FUNCTION_ENTRY()
 #define DUMP_STACK_ENTRY(a)
 #define DUMP_OPERANDS(a,b,c,d,e)
 #define DUMP_ENTRY(a,b)
 #define DUMP_TABLES(a,b)
 #define DUMP_PATHNAME(a,b,c,d)
 #define DUMP_RESOURCE_LIST(a)
-#define DEBUG_PRINT(l,f)
-#define DEBUG_PRINTP(l,f)
-#define DEBUG_PRINT_RAW(l,f)
+#define DUMP_BUFFER(a,b)
+#define ACPI_DEBUG_PRINT(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)
 #define BREAK_MSG(a)
 
 #define return_VOID                     return
@@ -520,9 +524,6 @@
 #define return_VALUE(s)                 return(s)
 #define return_PTR(s)                   return(s)
 
-#define ACPI_ASSERT(exp)
-#define DEBUG_ASSERT(msg, exp)
-
 #endif
 
 /*
@@ -549,19 +550,15 @@
 
 
 #ifdef ACPI_DEBUG
-
 /*
  * 1) Set name to blanks
  * 2) Copy the object name
  */
-
 #define ADD_OBJECT_NAME(a,b)            MEMSET (a->common.name, ' ', sizeof (a->common.name));\
 										STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
-
 #else
 
 #define ADD_OBJECT_NAME(a,b)
-
 #endif
 
 
@@ -569,69 +566,28 @@
  * Memory allocation tracking (DEBUG ONLY)
  */
 
-#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS
+#ifndef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a)            acpi_os_allocate(a)
+#define ACPI_MEM_CALLOCATE(a)           acpi_os_callocate(a)
+#define ACPI_MEM_FREE(a)                acpi_os_free(a)
+#define ACPI_MEM_TRACKING(a)
 
-#define acpi_ut_add_element_to_alloc_list(a,b,c,d,e,f)
-#define acpi_ut_delete_element_from_alloc_list(a,b,c,d)
-#define acpi_ut_dump_current_allocations(a,b)
-#define acpi_ut_dump_allocation_info()
-
-#define DECREMENT_OBJECT_METRICS(a)
-#define INCREMENT_OBJECT_METRICS(a)
-#define INITIALIZE_ALLOCATION_METRICS()
-#define DECREMENT_NAME_TABLE_METRICS(a)
-#define INCREMENT_NAME_TABLE_METRICS(a)
 
 #else
 
-#define INITIALIZE_ALLOCATION_METRICS() \
-	acpi_gbl_current_object_count = 0; \
-	acpi_gbl_current_object_size = 0; \
-	acpi_gbl_running_object_count = 0; \
-	acpi_gbl_running_object_size = 0; \
-	acpi_gbl_max_concurrent_object_count = 0; \
-	acpi_gbl_max_concurrent_object_size = 0; \
-	acpi_gbl_current_alloc_size = 0; \
-	acpi_gbl_current_alloc_count = 0; \
-	acpi_gbl_running_alloc_size = 0; \
-	acpi_gbl_running_alloc_count = 0; \
-	acpi_gbl_max_concurrent_alloc_size = 0; \
-	acpi_gbl_max_concurrent_alloc_count = 0; \
-	acpi_gbl_current_node_count = 0; \
-	acpi_gbl_current_node_size = 0; \
-	acpi_gbl_max_concurrent_node_count = 0
-
-
-#define DECREMENT_OBJECT_METRICS(a) \
-	acpi_gbl_current_object_count--; \
-	acpi_gbl_current_object_size -= a
-
-#define INCREMENT_OBJECT_METRICS(a) \
-	acpi_gbl_current_object_count++; \
-	acpi_gbl_running_object_count++; \
-	if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \
-	{ \
-		acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \
-	} \
-	acpi_gbl_running_object_size += a; \
-	acpi_gbl_current_object_size += a; \
-	if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \
-	{ \
-		acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \
-	}
-
-#define DECREMENT_NAME_TABLE_METRICS(a) \
-	acpi_gbl_current_node_count--; \
-	acpi_gbl_current_node_size -= (a)
-
-#define INCREMENT_NAME_TABLE_METRICS(a) \
-	acpi_gbl_current_node_count++; \
-	acpi_gbl_current_node_size+= (a); \
-	if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \
-	{ \
-		acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \
-	}
-#endif /* ACPI_DEBUG_TRACK_ALLOCATIONS */
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a)                acpi_ut_free(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_TRACKING(a)            a
+
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+
 
+#define ACPI_GET_STACK_POINTER          _asm {mov eax, ebx}
 
 #endif /* ACMACROS_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)