From 6f42ccf2fc50ecee8ea170040627f268430c1648 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 13 May 2005 00:00:00 -0400 Subject: ACPICA from Bob Moore Implemented support for PCI Express root bridges -- added support for device PNP0A08 in the root bridge search within AcpiEvPciConfigRegionSetup. acpi_ev_pci_config_region_setup(). The interpreter now automatically truncates incoming 64-bit constants to 32 bits if currently executing out of a 32-bit ACPI table (Revision < 2). This also affects the iASL compiler constant folding. (Note: as per below, the iASL compiler no longer allows 64-bit constants within 32-bit tables.) Fixed a problem where string and buffer objects with "static" pointers (pointers to initialization data within an ACPI table) were not handled consistently. The internal object copy operation now always copies the data to a newly allocated buffer, regardless of whether the source object is static or not. Fixed a problem with the FromBCD operator where an implicit result conversion was improperly performed while storing the result to the target operand. Since this is an "explicit conversion" operator, the implicit conversion should never be performed on the output. Fixed a problem with the CopyObject operator where a copy to an existing named object did not always completely overwrite the existing object stored at name. Specifically, a buffer-to-buffer copy did not delete the existing buffer. Replaced "interrupt_level" with "interrupt_number" in all GPE interfaces and structs for consistency. Signed-off-by: Len Brown --- include/acpi/acconfig.h | 2 +- include/acpi/acevents.h | 2 +- include/acpi/aclocal.h | 3 ++- include/acpi/acopcode.h | 2 +- include/acpi/acpixf.h | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 2f6ab18..a268c4a 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050408 +#define ACPI_CA_VERSION 0x20050513 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index 61a27c8..301c5cc 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -136,7 +136,7 @@ acpi_ev_create_gpe_block ( struct acpi_generic_address *gpe_block_address, u32 register_count, u8 gpe_block_base_number, - u32 interrupt_level, + u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block); acpi_status diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 030e641..52c6a20 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -365,7 +365,7 @@ struct acpi_gpe_xrupt_info struct acpi_gpe_xrupt_info *previous; struct acpi_gpe_xrupt_info *next; struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ - u32 interrupt_level; /* System interrupt level */ + u32 interrupt_number; /* System interrupt number */ }; @@ -737,6 +737,7 @@ struct acpi_parse_state ****************************************************************************/ #define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" struct acpi_bit_register_info { diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index 118ecba..093f697 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h @@ -246,7 +246,7 @@ #define ARGI_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_IF_OP ARGI_INVALID_OPCODE #define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index f8f619f..9ca212d 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -387,7 +387,7 @@ acpi_install_gpe_block ( acpi_handle gpe_device, struct acpi_generic_address *gpe_block_address, u32 register_count, - u32 interrupt_level); + u32 interrupt_number); acpi_status acpi_remove_gpe_block ( -- cgit v1.1 From 88ac00f5a841dcfc5c682000f4a6add0add8caac Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Thu, 26 May 2005 00:00:00 -0400 Subject: ACPICA 20050526 from Bob Moore Implemented support to execute Type 1 and Type 2 AML opcodes appearing at the module level (not within a control method.) These opcodes are executed exactly once at the time the table is loaded. This type of code was legal up until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in order to provide backwards compatibility with earlier BIOS implementations. This eliminates the "Encountered executable code at module level" warning that was previously generated upon detection of such code. Fixed a problem in the interpreter where an AE_NOT_FOUND exception could inadvertently be generated during the lookup of namespace objects in the second pass parse of ACPI tables and control methods. It appears that this problem could occur during the resolution of forward references to namespace objects. Added the ACPI_MUTEX_DEBUG #ifdef to the acpi_ut_release_mutex function, corresponding to the same the deadlock detection debug code to be compiled out in the normal case, improving mutex performance (and overall subsystem performance) considerably. As suggested by Alexey Starikovskiy. Implemented a handful of miscellaneous fixes for possible memory leaks on error conditions and error handling control paths. These fixes were suggested by FreeBSD and the Coverity Prevent source code analysis tool. Added a check for a null RSDT pointer in acpi_get_firmware_table (tbxfroot.c) to prevent a fault in this error case. Signed-off-by Len Brown --- include/acpi/acconfig.h | 2 +- include/acpi/acstruct.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index a268c4a..6babcb1 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050513 +#define ACPI_CA_VERSION 0x20050526 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index e6b9e36..4e92645 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -78,7 +78,7 @@ struct acpi_walk_state u8 return_used; u16 opcode; /* Current AML opcode */ u8 scope_depth; - u8 reserved1; + u8 pass_number; /* Parse pass during table load */ u32 arg_count; /* push for fixed or var args */ u32 aml_offset; u32 arg_types; -- cgit v1.1 From 73459f73e5d1602c59ebec114fc45185521353c1 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 24 Jun 2005 00:00:00 -0400 Subject: ACPICA 20050617-0624 from Bob Moore ACPICA 20050617: Moved the object cache operations into the OS interface layer (OSL) to allow the host OS to handle these operations if desired (for example, the Linux OSL will invoke the slab allocator). This support is optional; the compile time define ACPI_USE_LOCAL_CACHE may be used to utilize the original cache code in the ACPI CA core. The new OSL interfaces are shown below. See utalloc.c for an example implementation, and acpiosxf.h for the exact interface definitions. Thanks to Alexey Starikovskiy. acpi_os_create_cache acpi_os_delete_cache acpi_os_purge_cache acpi_os_acquire_object acpi_os_release_object Modified the interfaces to acpi_os_acquire_lock and acpi_os_release_lock to return and restore a flags parameter. This fits better with many OS lock models. Note: the current execution state (interrupt handler or not) is no longer passed to these interfaces. If necessary, the OSL must determine this state by itself, a simple and fast operation. Thanks to Alexey Starikovskiy. Fixed a problem in the ACPI table handling where a valid XSDT was assumed present if the revision of the RSDP was 2 or greater. According to the ACPI specification, the XSDT is optional in all cases, and the table manager therefore now checks for both an RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs contain only the RSDT. Fixed an interpreter problem with the Mid() operator in the case of an input string where the resulting output string is of zero length. It now correctly returns a valid, null terminated string object instead of a string object with a null pointer. Fixed a problem with the control method argument handling to allow a store to an Arg object that already contains an object of type Device. The Device object is now correctly overwritten. Previously, an error was returned. ACPICA 20050624: Modified the new OSL cache interfaces to use ACPI_CACHE_T as the type for the host-defined cache object. This allows the OSL implementation to define and type this object in any manner desired, simplifying the OSL implementation. For example, ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be defined in the OS-specific header file for other operating systems as required. Changed the interface to AcpiOsAcquireObject to directly return the requested object as the function return (instead of ACPI_STATUS.) This change was made for performance reasons, since this is the purpose of the interface in the first place. acpi_os_acquire_object is now similar to the acpi_os_allocate interface. Thanks to Alexey Starikovskiy. Modified the initialization sequence in acpi_initialize_subsystem to call the OSL interface acpi_osl_initialize first, before any local initialization. This change was required because the global initialization now calls OSL interfaces. Restructured the code base to split some files because of size and/or because the code logically belonged in a separate file. New files are listed below. utilities/utcache.c /* Local cache interfaces */ utilities/utmutex.c /* Local mutex support */ utilities/utstate.c /* State object support */ parser/psloop.c /* Main AML parse loop */ Signed-off-by: Len Brown --- include/acpi/acconfig.h | 9 +++--- include/acpi/acdebug.h | 6 +++- include/acpi/acdisasm.h | 1 + include/acpi/acdispat.h | 6 ---- include/acpi/acevents.h | 3 +- include/acpi/acglobal.h | 26 ++++++++++++++++- include/acpi/achware.h | 6 ++-- include/acpi/aclocal.h | 24 ++++++---------- include/acpi/acparser.h | 26 +++++++++++++---- include/acpi/acpiosxf.h | 35 ++++++++++++++++++++--- include/acpi/acstruct.h | 3 ++ include/acpi/actypes.h | 5 ++++ include/acpi/acutils.h | 63 ++++++++++++++++------------------------- include/acpi/amlcode.h | 4 +-- include/acpi/platform/acenv.h | 19 +++++++------ include/acpi/platform/aclinux.h | 11 +++++++ 16 files changed, 155 insertions(+), 92 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 6babcb1..dd9b70c 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050526 +#define ACPI_CA_VERSION 0x20050624 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -78,11 +78,10 @@ /* Maximum objects in the various object caches */ -#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ +#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ -#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ -#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ /* * Should the subystem abort the loading of an ACPI table if the diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index 8ba372b..f8fa2227 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -114,6 +114,10 @@ acpi_db_set_method_call_breakpoint ( union acpi_parse_object *op); void +acpi_db_get_bus_info ( + void); + +void acpi_db_disassemble_aml ( char *statements, union acpi_parse_object *op); @@ -327,7 +331,7 @@ acpi_db_set_output_destination ( u32 where); void -acpi_db_dump_object ( +acpi_db_dump_external_object ( union acpi_object *obj_desc, u32 level); diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index dbfa877..fcc2d50 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -90,6 +90,7 @@ struct acpi_op_walk_info { u32 level; u32 bit_offset; + struct acpi_walk_state *walk_state; }; typedef diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 8f5f2f7..fde6aa9 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -450,10 +450,4 @@ acpi_ds_result_pop_from_bottom ( union acpi_operand_object **object, struct acpi_walk_state *walk_state); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ds_delete_walk_state_cache ( - void); -#endif - #endif /* _ACDISPAT_H_ */ diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index 301c5cc..33ae2ca 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -122,8 +122,7 @@ acpi_ev_valid_gpe_event ( acpi_status acpi_ev_walk_gpe_list ( - ACPI_GPE_CALLBACK gpe_walk_callback, - u32 flags); + ACPI_GPE_CALLBACK gpe_walk_callback); acpi_status acpi_ev_delete_gpe_handlers ( diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 4946696..8d5a397a 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -151,6 +151,13 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; */ +/* The root table can be either an RSDT or an XSDT */ + +ACPI_EXTERN u8 acpi_gbl_root_table_type; +#define ACPI_TABLE_TYPE_RSDT 'R' +#define ACPI_TABLE_TYPE_XSDT 'X' + + /* * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: * If we are executing a method that exists in a 32-bit ACPI table, @@ -180,8 +187,23 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; * ****************************************************************************/ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + +/* Lists for tracking memory allocations */ + +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; +#endif + +/* Object caches */ + +ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; + +/* Global handlers */ -ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; @@ -189,6 +211,8 @@ ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; +/* Misc */ + ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; diff --git a/include/acpi/achware.h b/include/acpi/achware.h index 9d63641..cf5de46 100644 --- a/include/acpi/achware.h +++ b/include/acpi/achware.h @@ -143,15 +143,15 @@ acpi_hw_get_gpe_status ( acpi_status acpi_hw_disable_all_gpes ( - u32 flags); + void); acpi_status acpi_hw_enable_all_runtime_gpes ( - u32 flags); + void); acpi_status acpi_hw_enable_all_wakeup_gpes ( - u32 flags); + void); acpi_status acpi_hw_enable_runtime_gpe_block ( diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 52c6a20..58f9ba1 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -953,24 +953,18 @@ struct acpi_debug_mem_block #define ACPI_MEM_LIST_GLOBAL 0 #define ACPI_MEM_LIST_NSNODE 1 - -#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 -#define ACPI_MEM_LIST_STATE 2 -#define ACPI_MEM_LIST_PSNODE 3 -#define ACPI_MEM_LIST_PSNODE_EXT 4 -#define ACPI_MEM_LIST_OPERAND 5 -#define ACPI_MEM_LIST_WALK 6 -#define ACPI_MEM_LIST_MAX 6 -#define ACPI_NUM_MEM_LISTS 7 +#define ACPI_MEM_LIST_MAX 1 +#define ACPI_NUM_MEM_LISTS 2 struct acpi_memory_list { + char *list_name; void *list_head; - u16 link_offset; - u16 max_cache_depth; - u16 cache_depth; u16 object_size; + u16 max_depth; + u16 current_depth; + u16 link_offset; #ifdef ACPI_DBG_TRACK_ALLOCATIONS @@ -979,11 +973,9 @@ struct acpi_memory_list u32 total_allocated; u32 total_freed; u32 current_total_size; - u32 cache_requests; - u32 cache_hits; - char *list_name; + u32 requests; + u32 hits; #endif }; - #endif /* __ACLOCAL_H__ */ diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index 6982765..ba9548f 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -63,6 +63,7 @@ #define ACPI_PARSE_MODE_MASK 0x0030 #define ACPI_PARSE_DEFERRED_OP 0x0100 +#define ACPI_PARSE_DISASSEMBLE 0x0200 /****************************************************************************** @@ -158,6 +159,25 @@ u16 acpi_ps_peek_opcode ( struct acpi_parse_state *state); +acpi_status +acpi_ps_complete_this_op ( + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); + +acpi_status +acpi_ps_next_parse_state ( + struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_status callback_status); + + +/* + * psloop - main parse loop + */ +acpi_status +acpi_ps_parse_loop ( + struct acpi_walk_state *walk_state); + /* * psscope - Scope stack management routines @@ -291,12 +311,6 @@ acpi_ps_set_name( union acpi_parse_object *op, u32 name); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ps_delete_parse_cache ( - void); -#endif - /* * psdump - display parser tree diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index ea489f2..819a53f 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -139,15 +139,14 @@ void acpi_os_delete_lock ( acpi_handle handle); -void +unsigned long acpi_os_acquire_lock ( - acpi_handle handle, - u32 flags); + acpi_handle handle); void acpi_os_release_lock ( acpi_handle handle, - u32 flags); + unsigned long flags); /* @@ -180,6 +179,34 @@ acpi_os_get_physical_address ( #endif + +/* + * Memory/Object Cache + */ +acpi_status +acpi_os_create_cache ( + char *cache_name, + u16 object_size, + u16 max_depth, + acpi_cache_t **return_cache); + +acpi_status +acpi_os_delete_cache ( + acpi_cache_t *cache); + +acpi_status +acpi_os_purge_cache ( + acpi_cache_t *cache); + +void * +acpi_os_acquire_object ( + acpi_cache_t *cache); + +acpi_status +acpi_os_release_object ( + acpi_cache_t *cache, + void *object); + /* * Interrupt handlers */ diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index 4e92645..a2025a8 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -162,6 +162,9 @@ struct acpi_walk_info #define ACPI_DISPLAY_SUMMARY 0 #define ACPI_DISPLAY_OBJECTS 1 +#define ACPI_DISPLAY_MASK 1 + +#define ACPI_DISPLAY_SHORT 2 struct acpi_get_devices_info { diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 3a451dc..8cd774a2 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -243,6 +243,11 @@ struct acpi_pointer #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER +/* Types for the OS interface layer (OSL) */ + +#ifdef ACPI_USE_LOCAL_CACHE +#define acpi_cache_t struct acpi_memory_list +#endif /* * Useful defines diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 192d0be..e9c1584d 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -557,16 +557,6 @@ void acpi_ut_delete_generic_state ( union acpi_generic_state *state); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_state_cache ( - void); - -void -acpi_ut_delete_object_cache ( - void); -#endif - /* * utmath @@ -622,22 +612,6 @@ acpi_ut_strtoul64 ( #define ACPI_ANY_BASE 0 -acpi_status -acpi_ut_mutex_initialize ( - void); - -void -acpi_ut_mutex_terminate ( - void); - -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id); - -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id); - u8 * acpi_ut_get_resource_end_tag ( union acpi_operand_object *obj_desc); @@ -666,22 +640,35 @@ acpi_ut_display_init_pathname ( /* - * utalloc - memory allocation and object caching + * utmutex - mutex support */ -void * -acpi_ut_acquire_from_cache ( - u32 list_id); +acpi_status +acpi_ut_mutex_initialize ( + void); void -acpi_ut_release_to_cache ( - u32 list_id, - void *object); +acpi_ut_mutex_terminate ( + void); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_cache ( - u32 list_id); -#endif +acpi_status +acpi_ut_acquire_mutex ( + acpi_mutex_handle mutex_id); + +acpi_status +acpi_ut_release_mutex ( + acpi_mutex_handle mutex_id); + + +/* + * utalloc - memory allocation and object caching + */ +acpi_status +acpi_ut_create_caches ( + void); + +acpi_status +acpi_ut_delete_caches ( + void); acpi_status acpi_ut_validate_buffer ( diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 55e97ed..50a0889 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -69,7 +69,7 @@ #define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f #define AML_NAME_CHAR_SUBSEQ (u16) 0x30 #define AML_NAME_CHAR_FIRST (u16) 0x41 -#define AML_OP_PREFIX (u16) 0x5b +#define AML_EXTENDED_OP_PREFIX (u16) 0x5b #define AML_ROOT_PREFIX (u16) 0x5c #define AML_PARENT_PREFIX (u16) 0x5e #define AML_LOCAL_OP (u16) 0x60 @@ -146,7 +146,7 @@ /* prefixed opcodes */ -#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */ +#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */ #define AML_MUTEX_OP (u16) 0x5b01 #define AML_EVENT_OP (u16) 0x5b02 diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index adf969e..aa63202e 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -49,35 +49,38 @@ * Configuration for ACPI tools and utilities */ -#ifdef _ACPI_DUMP_APP +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE +#endif + +#ifdef ACPI_DUMP_APP #ifndef MSDOS #define ACPI_DEBUG_OUTPUT #endif #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_NO_METHOD_EXECUTION -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE #endif -#ifdef _ACPI_EXEC_APP +#ifdef ACPI_EXEC_APP #undef DEBUGGER_THREADING #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE #endif -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_CONSTANT_EVAL_ONLY +#endif + +#ifdef ACPI_APPLICATION #define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE +#define ACPI_USE_LOCAL_CACHE #endif /* diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index a3de0db..4fbc0fd 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -62,6 +62,17 @@ #define ACPI_MACHINE_WIDTH BITS_PER_LONG +/* Type(s) for the OSL */ + +#ifdef ACPI_USE_LOCAL_CACHE +#define acpi_cache_t struct acpi_memory_list +#else +#include +#define acpi_cache_t kmem_cache_t +#endif + + + #else /* !__KERNEL__ */ #include -- cgit v1.1 From f9f4601f331aa1226d7a798a01950efbb388f07f Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 8 Jul 2005 00:00:00 -0400 Subject: ACPICA 20050708 from Bob Moore The use of the CPU stack in the debug version of the subsystem has been considerably reduced. Previously, a debug structure was declared in every function that used the debug macros. This structure has been removed in favor of declaring the individual elements as parameters to the debug functions. This reduces the cumulative stack use during nested execution of ACPI function calls at the cost of a small increase in the code size of the debug version of the subsystem. With assistance from Alexey Starikovskiy and Len Brown. Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent headers to define a macro that will return the current function name at runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent header, the function name is saved on the CPU stack (one pointer per function.) This mechanism is used because apparently there exists no standard ANSI-C defined macro that that returns the function name. Alexey Starikovskiy redesigned and reimplemented the "Owner ID" mechanism used to track namespace objects created/deleted by ACPI tables and control method execution. A bitmap is now used to allocate and free the IDs, thus solving the wraparound problem present in the previous implementation. The size of the namespace node descriptor was reduced by 2 bytes as a result. Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield flag definitions within the headers for the predefined ACPI tables. These have been replaced by UINT8_BIT in order to increase the code portability of the subsystem. If the use of UINT8 remains a problem, we may be forced to eliminate bitfields entirely because of a lack of portability. Alexey Starikovksiy enhanced the performance of acpi_ut_update_object_reference. This is a frequently used function and this improvement increases the performance of the entire subsystem. Alexey Starikovskiy fixed several possible memory leaks and the inverse - premature object deletion. Signed-off-by: Len Brown --- include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 2 +- include/acpi/acexcep.h | 6 ++- include/acpi/acglobal.h | 3 +- include/acpi/aclocal.h | 57 +++++++++++----------- include/acpi/acmacros.h | 100 ++++++++++++++++++++++---------------- include/acpi/acnamesp.h | 4 +- include/acpi/acobject.h | 2 +- include/acpi/acoutput.h | 2 +- include/acpi/acstruct.h | 11 ++--- include/acpi/actables.h | 4 ++ include/acpi/actbl.h | 58 ++++++++++++---------- include/acpi/actbl1.h | 52 +++++++++++--------- include/acpi/actbl2.h | 109 ++++++++++++++++++++++++------------------ include/acpi/actypes.h | 18 ++++--- include/acpi/acutils.h | 56 +++++++++++++++------- include/acpi/platform/acgcc.h | 8 +++- 17 files changed, 287 insertions(+), 207 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index dd9b70c..aa3c08c 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050624 +#define ACPI_CA_VERSION 0x20050708 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index fcc2d50..2632543 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -211,7 +211,7 @@ acpi_dm_byte_list ( union acpi_parse_object *op); void -acpi_is_eisa_id ( +acpi_dm_is_eisa_id ( union acpi_parse_object *op); void diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 60d737b..0a6f492 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -95,8 +95,9 @@ #define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) #define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL) #define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL) +#define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL) -#define AE_CODE_ENV_MAX 0x001E +#define AE_CODE_ENV_MAX 0x001F /* @@ -226,7 +227,8 @@ char const *acpi_gbl_exception_names_env[] = "AE_LOGICAL_ADDRESS", "AE_ABORT_METHOD", "AE_SAME_HANDLER", - "AE_WAKE_ONLY_GPE" + "AE_WAKE_ONLY_GPE", + "AE_OWNER_ID_LIMIT" }; char const *acpi_gbl_exception_names_pgm[] = diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 8d5a397a..e3cf16e 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -218,9 +218,8 @@ ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; ACPI_EXTERN u32 acpi_gbl_ps_find_count; +ACPI_EXTERN u32 acpi_gbl_owner_id_mask; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; -ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; -ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; ACPI_EXTERN u16 acpi_gbl_global_lock_handle; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 58f9ba1..4d26356 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -56,6 +56,13 @@ typedef u32 acpi_mutex_handle; #define AML_NUM_OPCODES 0x7F +/* Forward declarations */ + +struct acpi_walk_state ; +struct acpi_obj_mutex; +union acpi_parse_object ; + + /***************************************************************************** * * Mutex typedefs and structs @@ -116,19 +123,24 @@ static char *acpi_gbl_mutex_names[] = #endif +/* Owner IDs are used to track namespace nodes for selective deletion */ + +typedef u8 acpi_owner_id; +#define ACPI_OWNER_ID_MAX 0xFF + +/* This Thread ID means that the mutex is not in use (unlocked) */ + +#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1 + /* Table for the global mutexes */ struct acpi_mutex_info { acpi_mutex mutex; u32 use_count; - u32 owner_id; + u32 thread_id; }; -/* This owner ID means that the mutex is not in use (unlocked) */ - -#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) - /* Lock flag parameter for various interfaces */ @@ -136,13 +148,6 @@ struct acpi_mutex_info #define ACPI_MTX_LOCK 1 -typedef u16 acpi_owner_id; -#define ACPI_OWNER_TYPE_TABLE 0x0 -#define ACPI_OWNER_TYPE_METHOD 0x1 -#define ACPI_FIRST_METHOD_ID 0x0001 -#define ACPI_FIRST_TABLE_ID 0xF000 - - /* Field access granularities */ #define ACPI_FIELD_BYTE_GRANULARITY 1 @@ -185,13 +190,20 @@ struct acpi_namespace_node { u8 descriptor; /* Used to differentiate object descriptor types */ u8 type; /* Type associated with this name */ - u16 owner_id; + u16 reference_count; /* Current count of references and children */ union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ struct acpi_namespace_node *child; /* First child */ struct acpi_namespace_node *peer; /* Next peer*/ - u16 reference_count; /* Current count of references and children */ + u8 owner_id; /* Who created this node */ u8 flags; + + /* Fields used by the ASL compiler only */ + +#ifdef ACPI_ASL_COMPILER + u32 value; + union acpi_parse_object *op; +#endif }; @@ -222,7 +234,7 @@ struct acpi_table_desc u64 physical_address; u32 aml_length; acpi_size length; - acpi_owner_id table_id; + acpi_owner_id owner_id; u8 type; u8 allocation; u8 loaded_into_namespace; @@ -420,13 +432,6 @@ struct acpi_field_info #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 -/* Forward declarations */ - -struct acpi_walk_state ; -struct acpi_obj_mutex; -union acpi_parse_object ; - - #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ u8 data_type; /* To differentiate various internal objs */\ u8 flags; \ @@ -916,14 +921,6 @@ struct acpi_integrity_info * ****************************************************************************/ -struct acpi_debug_print_info -{ - u32 component_id; - char *proc_name; - char *module_name; -}; - - /* Entry for a memory allocation (debug only) */ #define ACPI_MEM_MALLOC 0 diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 09be937..5b100ce 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -437,21 +437,22 @@ #define ACPI_PARAM_LIST(pl) pl /* - * Error reporting. These versions add callers module and line#. Since - * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only - * use it in debug mode. + * Error reporting. These versions add callers module and line#. + * + * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT + * isn't defined, only use it in debug mode. */ #ifdef ACPI_DEBUG_OUTPUT -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); +#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e); -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); +#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e); #else @@ -480,36 +481,56 @@ * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT +#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; -#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; +/* + * Common parameters used for debug output functions: + * line number, function name, module(file) name, component ID + */ +#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT /* - * Function entry tracing. - * The first parameter should be the procedure name as a quoted string. This is declared - * as a local string ("_proc_name) so that it can be also used by the function exit macros below. + * Function entry tracing */ -#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \ - _debug_info.component_id = _COMPONENT; \ - _debug_info.proc_name = a; \ - _debug_info.module_name = _THIS_MODULE; - -#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace(__LINE__,&_debug_info) -#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b) -#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b) -#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b) - -#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() + +/* + * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, + * define it now. This is the case where there the compiler does not support + * a __FUNCTION__ macro or equivalent. We save the function name on the + * local stack. + */ +#ifndef ACPI_GET_FUNCTION_NAME +#define ACPI_GET_FUNCTION_NAME _acpi_function_name +/* + * The Name parameter should be the procedure name as a quoted string. + * This is declared as a local string ("my_function_name") so that it can + * be also used by the function exit macros below. + */ +#define ACPI_FUNCTION_NAME(name) char *_acpi_function_name = name; + +#else +/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ + +#define ACPI_FUNCTION_NAME(name) +#endif + +#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace(ACPI_DEBUG_PARAMETERS) +#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) +#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) +#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) + +#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() /* * Function exit tracing. * WARNING: These macros include a return statement. This is usually considered * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros - * so that "_proc_name" is defined. + * so that "_acpi_function_name" is defined. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -517,10 +538,10 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) +#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) +#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) /* Conditional execution */ @@ -535,7 +556,7 @@ /* Stack and buffer dumping */ #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) -#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) +#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__) #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) @@ -572,7 +593,7 @@ * leaving no executable debug code! */ #define ACPI_MODULE_NAME(name) -#define _THIS_MODULE "" +#define _acpi_module_name "" #define ACPI_DEBUG_EXEC(a) #define ACPI_NORMAL_EXEC(a) a; @@ -648,19 +669,18 @@ /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_FREE(a) acpi_os_free(a) #define ACPI_MEM_TRACKING(a) - #else /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_TRACKING(a) a #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index d1b3ce8..870e254 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -163,7 +163,7 @@ acpi_ns_delete_namespace_subtree ( void acpi_ns_delete_namespace_by_owner ( - u16 table_id); + acpi_owner_id owner_id); void acpi_ns_detach_object ( @@ -219,7 +219,7 @@ acpi_ns_dump_objects ( acpi_object_type type, u8 display_type, u32 max_depth, - u32 ownder_id, + acpi_owner_id owner_id, acpi_handle start_handle); #endif /* ACPI_FUTURE_USAGE */ diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index e079b94..34f9d1f 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -199,7 +199,7 @@ struct acpi_object_method ACPI_INTERNAL_METHOD implementation; u8 concurrency; u8 thread_count; - acpi_owner_id owning_id; + acpi_owner_id owner_id; }; diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 2fbe180..d7e828c 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -136,7 +136,7 @@ /* * Debug level macros that are used in the DEBUG_PRINT macros */ -#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_debug_info +#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS /* Exception level -- used in the global "debug_level" */ diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index a2025a8..f375c17 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -71,7 +71,6 @@ struct acpi_walk_state u8 walk_type; acpi_owner_id owner_id; /* Owner of objects created during the walk */ u8 last_predicate; /* Result of last predicate */ - u8 reserved; /* For alignment */ u8 current_result; /* */ u8 next_op_info; /* Info about next_op */ u8 num_operands; /* Stack pointer for Operands[] array */ @@ -154,17 +153,17 @@ struct acpi_device_walk_info struct acpi_walk_info { u32 debug_level; - u32 owner_id; + acpi_owner_id owner_id; u8 display_type; }; /* Display Types */ -#define ACPI_DISPLAY_SUMMARY 0 -#define ACPI_DISPLAY_OBJECTS 1 -#define ACPI_DISPLAY_MASK 1 +#define ACPI_DISPLAY_SUMMARY (u8) 0 +#define ACPI_DISPLAY_OBJECTS (u8) 1 +#define ACPI_DISPLAY_MASK (u8) 1 -#define ACPI_DISPLAY_SHORT 2 +#define ACPI_DISPLAY_SHORT (u8) 2 struct acpi_get_devices_info { diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 39df92e..97e6f12 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -169,6 +169,10 @@ acpi_status acpi_tb_get_table_rsdt ( void); +acpi_status +acpi_tb_validate_rsdp ( + struct rsdp_descriptor *rsdp); + /* * tbutils - common table utilities diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index b5cdcca..c1e9110 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -86,15 +86,15 @@ */ struct rsdp_descriptor /* Root System Descriptor Pointer */ { - char signature [8]; /* ACPI signature, contains "RSD PTR " */ - u8 checksum; /* To make sum of struct == 0 */ - char oem_id [6]; /* OEM identification */ - u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */ - u32 rsdt_physical_address; /* 32-bit physical address of RSDT */ - u32 length; /* XSDT Length in bytes including hdr */ - u64 xsdt_physical_address; /* 64-bit physical address of XSDT */ - u8 extended_checksum; /* Checksum of entire table */ - char reserved [3]; /* Reserved field must be 0 */ + char signature[8]; /* ACPI signature, contains "RSD PTR " */ + u8 checksum; /* ACPI 1.0 checksum */ + char oem_id[6]; /* OEM identification */ + u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ + u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ + u32 length; /* XSDT Length in bytes, including header */ + u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ + u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ + char reserved[3]; /* Reserved, must be zero */ }; @@ -107,15 +107,15 @@ struct acpi_common_facs /* Common FACS for internal use */ #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ - char signature [4]; /* ACPI signature (4 ASCII characters) */\ - u32 length; /* Length of table, in bytes, including header */\ + char signature[4]; /* ASCII table signature */\ + u32 length; /* Length of table in bytes, including this header */\ u8 revision; /* ACPI Specification minor version # */\ u8 checksum; /* To make sum of entire table == 0 */\ - char oem_id [6]; /* OEM identification */\ - char oem_table_id [8]; /* OEM table identification */\ + char oem_id[6]; /* ASCII OEM identification */\ + char oem_table_id[8]; /* ASCII OEM table identification */\ u32 oem_revision; /* OEM revision number */\ - char asl_compiler_id [4]; /* ASL compiler vendor ID */\ - u32 asl_compiler_revision; /* ASL compiler revision number */ + char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ + u32 asl_compiler_revision; /* ASL compiler version */ struct acpi_table_header /* ACPI common table header */ @@ -139,8 +139,12 @@ struct multiple_apic_table { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ u32 local_apic_address; /* Physical address of local APIC */ - u32 PCATcompat : 1; /* A one indicates system also has dual 8259s */ - u32 reserved1 : 31; + + /* Flags (32 bits) */ + + u8 PCATcompat : 1; /* 00: System also has dual 8259s */ + u8 : 7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ }; /* Values for Type in APIC_HEADER_DEF */ @@ -180,16 +184,18 @@ struct apic_header #define TRIGGER_RESERVED 2 #define TRIGGER_LEVEL 3 -/* Common flag definitions */ +/* Common flag definitions (16 bits each) */ #define MPS_INTI_FLAGS \ - u16 polarity : 2; /* Polarity of APIC I/O input signals */\ - u16 trigger_mode : 2; /* Trigger mode of APIC input signals */\ - u16 reserved1 : 12; /* Reserved, must be zero */ + u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ + u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ + u8 : 4; /* 04-07: Reserved, must be zero */\ + u8 reserved1; /* 08-15: Reserved, must be zero */ #define LOCAL_APIC_FLAGS \ - u32 processor_enabled: 1; /* Processor is usable if set */\ - u32 reserved2 : 31; /* Reserved, must be zero */ + u8 processor_enabled: 1; /* 00: Processor is usable if set */\ + u8 : 7; /* 01-07: Reserved, must be zero */\ + u8 reserved2; /* 08-15: Reserved, must be zero */ /* Sub-structures for MADT */ @@ -238,7 +244,7 @@ struct madt_local_apic_nmi struct madt_address_override { APIC_HEADER_DEF - u16 reserved; /* Reserved - must be zero */ + u16 reserved; /* Reserved, must be zero */ u64 address; /* APIC physical address */ }; @@ -246,7 +252,7 @@ struct madt_io_sapic { APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ - u8 reserved; /* Reserved - must be zero */ + u8 reserved; /* Reserved, must be zero */ u32 interrupt_base; /* Glocal interrupt for SAPIC start */ u64 address; /* SAPIC physical address */ }; @@ -257,7 +263,7 @@ struct madt_local_sapic u8 processor_id; /* ACPI processor id */ u8 local_sapic_id; /* SAPIC ID */ u8 local_sapic_eid; /* SAPIC EID */ - u8 reserved [3]; /* Reserved - must be zero */ + u8 reserved[3]; /* Reserved, must be zero */ LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 33de5f4..93c175a 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -52,8 +52,7 @@ struct rsdt_descriptor_rev1 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry [1]; /* Array of pointers to other */ - /* ACPI tables */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; @@ -62,14 +61,19 @@ struct rsdt_descriptor_rev1 */ struct facs_descriptor_rev1 { - char signature[4]; /* ACPI Signature */ - u32 length; /* Length of structure, in bytes */ + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure in bytes */ u32 hardware_signature; /* Hardware configuration signature */ u32 firmware_waking_vector; /* ACPI OS waking vector */ u32 global_lock; /* Global Lock */ - u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* Must be 0 */ - u8 resverved3 [40]; /* Reserved - must be zero */ + + /* Flags (32 bits) */ + + u8 S4bios_f : 1; /* 00: S4BIOS support is present */ + u8 : 7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u8 reserved2[40]; /* Reserved, must be zero */ }; @@ -82,13 +86,13 @@ struct fadt_descriptor_rev1 u32 firmware_ctrl; /* Physical address of FACS */ u32 dsdt; /* Physical address of DSDT */ u8 model; /* System Interrupt Model */ - u8 reserved1; /* Reserved */ + u8 reserved1; /* Reserved, must be zero */ u16 sci_int; /* System vector of SCI interrupt */ u32 smi_cmd; /* Port address of SMI command port */ u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ - u8 reserved2; /* Reserved - must be zero */ + u8 reserved2; /* Reserved, must be zero */ u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ @@ -104,7 +108,7 @@ struct fadt_descriptor_rev1 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ - u8 reserved3; /* Reserved */ + u8 reserved3; /* Reserved, must be zero */ u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ u16 flush_size; /* Size of area read to flush caches */ @@ -114,19 +118,21 @@ struct fadt_descriptor_rev1 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ u8 century; /* Index to century in RTC CMOS RAM */ - u8 reserved4; /* Reserved */ - u8 reserved4a; /* Reserved */ - u8 reserved4b; /* Reserved */ - u32 wb_invd : 1; /* The wbinvd instruction works properly */ - u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ - u32 proc_c1 : 1; /* All processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */ - u32 reserved5 : 23; /* Reserved - must be zero */ + u8 reserved4[3]; /* Reserved, must be zero */ + + /* Flags (32 bits) */ + + u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1 : 1; /* 02: All processors support C1 state */ + u8 plvl2_up : 1; /* 03: C2 state works on MP system */ + u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext : 1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ + u8 : 7; /* 09-15: Reserved, must be zero */ + u8 reserved5[2]; /* 16-31: Reserved, must be zero */ }; #pragma pack() diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index e1729c9..84ce5ab 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -73,8 +73,7 @@ struct rsdt_descriptor_rev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry [1]; /* Array of pointers to */ - /* ACPI table headers */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; @@ -84,8 +83,7 @@ struct rsdt_descriptor_rev2 struct xsdt_descriptor_rev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u64 table_offset_entry [1]; /* Array of pointers to */ - /* ACPI table headers */ + u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; @@ -94,16 +92,21 @@ struct xsdt_descriptor_rev2 */ struct facs_descriptor_rev2 { - char signature[4]; /* ACPI signature */ + char signature[4]; /* ASCII table signature */ u32 length; /* Length of structure, in bytes */ u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */ + u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ - u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* Must be 0 */ - u64 xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */ + + /* Flags (32 bits) */ + + u8 S4bios_f : 1; /* 00: S4BIOS support is present */ + u8 : 7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ u8 version; /* Version of this table */ - u8 reserved3 [31]; /* Reserved - must be zero */ + u8 reserved3[31]; /* Reserved, must be zero */ }; @@ -165,35 +168,37 @@ struct fadt_descriptor_rev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ FADT_REV2_COMMON - u8 reserved2; /* Reserved */ - u32 wb_invd : 1; /* The wbinvd instruction works properly */ - u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ - u32 proc_c1 : 1; /* All processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits */ - u32 dock_cap : 1; /* Supports Docking */ - u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG */ - u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed */ - u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices */ - u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */ - /* must be executed after writing the SLP_TYPx register */ - /* ACPI 3.0 flag bits */ - - u32 pci_exp_wak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */ - u32 use_platform_clock : 1; /* OSPM should use platform-provided timer */ - u32 S4rtc_sts_valid : 1; /* Contents of RTC_STS valid after S4 wake */ - u32 remote_power_on_capable : 1; /* System is compatible with remote power on */ - u32 force_apic_cluster_model : 1; /* All local APICs must use cluster model */ - u32 force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */ - u32 reserved6 : 12;/* Reserved - must be zero */ + u8 reserved2; /* Reserved, must be zero */ + + /* Flags (32 bits) */ + + u8 wb_invd : 1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush : 1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1 : 1; /* 02: All processors support C1 state */ + u8 plvl2_up : 1; /* 03: C2 state works on MP system */ + u8 pwr_button : 1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button : 1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC : 1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext : 1; /* 08: tmr_val is 32 bits 0=24-bits */ + u8 dock_cap : 1; /* 09: Docking supported */ + u8 reset_reg_sup : 1; /* 10: System reset via the FADT RESET_REG supported */ + u8 sealed_case : 1; /* 11: No internal expansion capabilities and case is sealed */ + u8 headless : 1; /* 12: No local video capabilities or local input devices */ + u8 cpu_sw_sleep : 1; /* 13: Must execute native instruction after writing SLP_TYPx register */ + + u8 pci_exp_wak : 1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ + u8 use_platform_clock : 1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ + u8 S4rtc_sts_valid : 1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ + u8 remote_power_on_capable : 1; /* 17: System is compatible with remote power on (ACPI 3.0) */ + u8 force_apic_cluster_model : 1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ + u8 force_apic_physical_destination_mode : 1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ + u8 : 4; /* 20-23: Reserved, must be zero */ + u8 reserved3; /* 24-31: Reserved, must be zero */ struct acpi_generic_address reset_register; /* Reset register address in GAS format */ u8 reset_value; /* Value to write to the reset_register port to reset the system */ - u8 reserved7[3]; /* These three bytes must be zero */ + u8 reserved4[3]; /* These three bytes must be zero */ u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ u64 Xdsdt; /* 64-bit physical address of DSDT */ struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ @@ -213,11 +218,11 @@ struct fadt_descriptor_rev2_minus { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ FADT_REV2_COMMON - u8 reserved2; /* Reserved */ + u8 reserved2; /* Reserved, must be zero */ u32 flags; struct acpi_generic_address reset_register; /* Reset register address in GAS format */ u8 reset_value; /* Value to write to the reset_register port to reset the system. */ - u8 reserved7[3]; /* These three bytes must be zero */ + u8 reserved7[3]; /* Reserved, must be zero */ }; @@ -242,11 +247,16 @@ struct static_resource_alloc u8 length; u8 proximity_domain_lo; u8 apic_id; - u32 enabled :1; - u32 reserved3 :31; + + /* Flags (32 bits) */ + + u8 enabled :1; /* 00: Use affinity structure */ + u8 :7; /* 01-07: Reserved, must be zero */ + u8 reserved3[3]; /* 08-31: Reserved, must be zero */ + u8 local_sapic_eid; u8 proximity_domain_hi[3]; - u32 reserved4; + u32 reserved4; /* Reserved, must be zero */ }; struct memory_affinity @@ -258,18 +268,23 @@ struct memory_affinity u64 base_address; u64 address_length; u32 reserved4; - u32 enabled :1; - u32 hot_pluggable :1; - u32 non_volatile :1; - u32 reserved5 :29; - u64 reserved6; + + /* Flags (32 bits) */ + + u8 enabled :1; /* 00: Use affinity structure */ + u8 hot_pluggable :1; /* 01: Memory region is hot pluggable */ + u8 non_volatile :1; /* 02: Memory is non-volatile */ + u8 :5; /* 03-07: Reserved, must be zero */ + u8 reserved5[3]; /* 08-31: Reserved, must be zero */ + + u64 reserved6; /* Reserved, must be zero */ }; struct system_resource_affinity { ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ - u64 reserved2; + u64 reserved2; /* Reserved, must be zero */ }; diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 8cd774a2..1895b86 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -205,10 +205,11 @@ typedef u32 acpi_size; /* - * Miscellaneous common types + * This type is used for bitfields in ACPI tables. The only type that is + * even remotely portable is u8. Anything else is not portable, so + * do not add any more bitfield types. */ -typedef u16 UINT16_BIT; -typedef u32 UINT32_BIT; +typedef u8 UINT8_BIT; typedef acpi_native_uint ACPI_PTRDIFF; /* @@ -243,10 +244,13 @@ struct acpi_pointer #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER -/* Types for the OS interface layer (OSL) */ - -#ifdef ACPI_USE_LOCAL_CACHE -#define acpi_cache_t struct acpi_memory_list +/* + * If acpi_cache_t was not defined in the OS-dependent header, + * define it now. This is typically the case where the local cache + * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) + */ +#ifndef acpi_cache_t +#define acpi_cache_t struct acpi_memory_list #endif /* diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index e9c1584d..9c05c10e 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -120,10 +120,6 @@ u8 acpi_ut_valid_object_type ( acpi_object_type type); -acpi_owner_id -acpi_ut_allocate_owner_id ( - u32 id_type); - /* * utinit - miscellaneous initialization and shutdown @@ -306,47 +302,63 @@ acpi_ut_track_stack_ptr ( void acpi_ut_trace ( u32 line_number, - struct acpi_debug_print_info *dbg_info); + char *function_name, + char *module_name, + u32 component_id); void acpi_ut_trace_ptr ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, void *pointer); void acpi_ut_trace_u32 ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u32 integer); void acpi_ut_trace_str ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *string); void acpi_ut_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info); + char *function_name, + char *module_name, + u32 component_id); void acpi_ut_status_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_status status); void acpi_ut_value_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, acpi_integer value); void acpi_ut_ptr_exit ( u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, u8 *ptr); void @@ -378,7 +390,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -386,7 +400,9 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - struct acpi_debug_print_info *dbg_info, + char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -477,8 +493,8 @@ acpi_ut_allocate_object_desc_dbg ( u32 line_number, u32 component_id); -#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t) -#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT) +#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t) +#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT) void acpi_ut_delete_object_desc ( @@ -579,6 +595,14 @@ acpi_ut_short_divide ( * utmisc */ acpi_status +acpi_ut_allocate_owner_id ( + acpi_owner_id *owner_id); + +acpi_status +acpi_ut_release_owner_id ( + acpi_owner_id owner_id); + +acpi_status acpi_ut_walk_package_tree ( union acpi_operand_object *source_object, void *target_object, diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 91fda36..3926412 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -44,13 +44,17 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +/* Function name is used for debug output. Non-ANSI, compiler-dependent */ + +#define ACPI_GET_FUNCTION_NAME __FUNCTION__ + /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. */ -#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) +#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7))) /* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us + * use all the variables (for example, _acpi_module_name). This allows us * to to tell the compiler warning in a per-variable manner that a variable * is unused. */ -- cgit v1.1 From 5d75ab45594c78d2d976a3248ea1ca281c9d7056 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 29 Jul 2005 00:03:55 -0400 Subject: [ACPI] handle const char * __FUNCTION__ in debug code build warning: discards qualifiers from pointer target type when mixing "const char *" and "char *" We should probably update the routines to expect const, but easier for now to shut up the warning with 1 cast. Signed-off-by: Len Brown --- include/acpi/platform/acgcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/acpi') diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 3926412..e410e3b 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -46,7 +46,7 @@ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ -#define ACPI_GET_FUNCTION_NAME __FUNCTION__ +#define ACPI_GET_FUNCTION_NAME (char *) __FUNCTION__ /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. -- cgit v1.1 From 0c9938cc75057c0fca1af55a55dcfc2842436695 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 29 Jul 2005 15:15:00 -0700 Subject: [ACPI] ACPICA 20050729 from Bob Moore Implemented support to ignore an attempt to install/load a particular ACPI table more than once. Apparently there exists BIOS code that repeatedly attempts to load the same SSDT upon certain events. Thanks to Venkatesh Pallipadi. Restructured the main interface to the AML parser in order to correctly handle all exceptional conditions. This will prevent leakage of the OwnerId resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some machines. Thanks to Alexey Starikovskiy. Support for "module level code" has been disabled in this version due to a number of issues that have appeared on various machines. The support can be enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When the issues are fully resolved, the code will be enabled by default again. Modified the internal functions for debug print support to define the FunctionName parameter as a (const char *) for compatibility with compiler built-in macros such as __FUNCTION__, etc. Linted the entire ACPICA source tree for both 32-bit and 64-bit. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- include/acpi/acconfig.h | 2 +- include/acpi/acdispat.h | 4 ++-- include/acpi/acmacros.h | 4 +++- include/acpi/acnames.h | 5 +++++ include/acpi/acnamesp.h | 2 +- include/acpi/acparser.h | 7 +------ include/acpi/acstruct.h | 3 +++ include/acpi/actables.h | 6 +++++- include/acpi/acutils.h | 26 +++++++++++++------------- include/acpi/platform/acenv.h | 18 +++++++++--------- include/acpi/platform/acgcc.h | 2 +- 11 files changed, 44 insertions(+), 35 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index aa3c08c..d62af72 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050708 +#define ACPI_CA_VERSION 0x20050729 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index fde6aa9..90b7d30 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -236,7 +236,7 @@ acpi_ds_method_data_init ( */ acpi_status acpi_ds_parse_method ( - acpi_handle obj_handle); + struct acpi_namespace_node *node); acpi_status acpi_ds_call_control_method ( @@ -391,7 +391,7 @@ acpi_ds_init_aml_walk ( u8 *aml_start, u32 aml_length, struct acpi_parameter_info *info, - u32 pass_number); + u8 pass_number); acpi_status acpi_ds_obj_stack_pop_and_delete ( diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 5b100ce..fcdef0a 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -505,8 +505,10 @@ * The Name parameter should be the procedure name as a quoted string. * This is declared as a local string ("my_function_name") so that it can * be also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __FUNCTION__. */ -#define ACPI_FUNCTION_NAME(name) char *_acpi_function_name = name; +#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; #else /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index deb7cb0..280e9ed 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -78,6 +78,11 @@ #define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_SYSTEM_BUS "_SB_" +/*! [Begin] no source code translation (not handled by acpisrc) */ +#define ACPI_FUNCTION_PREFIX1 'ipcA' +#define ACPI_FUNCTION_PREFIX2 'ipca' +/*! [End] no source code translation !*/ + #endif /* __ACNAMES_H__ */ diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index 870e254..0c9ba70 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -124,7 +124,7 @@ acpi_ns_parse_table ( acpi_status acpi_ns_one_complete_parse ( - u32 pass_number, + u8 pass_number, struct acpi_table_desc *table_desc); diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index ba9548f..f692ad5 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -77,12 +77,7 @@ * psxface - Parser external interfaces */ acpi_status -acpi_psx_load_table ( - u8 *pcode_addr, - u32 pcode_length); - -acpi_status -acpi_psx_execute ( +acpi_ps_execute_method ( struct acpi_parameter_info *info); diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index f375c17..27b22bb 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -153,6 +153,7 @@ struct acpi_device_walk_info struct acpi_walk_info { u32 debug_level; + u32 count; acpi_owner_id owner_id; u8 display_type; }; @@ -209,8 +210,10 @@ union acpi_aml_operands struct acpi_parameter_info { struct acpi_namespace_node *node; + union acpi_operand_object *obj_desc; union acpi_operand_object **parameters; union acpi_operand_object *return_object; + u8 pass_number; u8 parameter_type; u8 return_object_type; }; diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 97e6f12..e6ceb18 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -178,11 +178,15 @@ acpi_tb_validate_rsdp ( * tbutils - common table utilities */ acpi_status +acpi_tb_is_table_installed ( + struct acpi_table_desc *new_table_desc); + +acpi_status acpi_tb_verify_table_checksum ( struct acpi_table_header *table_header); u8 -acpi_tb_checksum ( +acpi_tb_generate_checksum ( void *buffer, u32 length); diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 9c05c10e..0e7b0a3 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -302,14 +302,14 @@ acpi_ut_track_stack_ptr ( void acpi_ut_trace ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id); void acpi_ut_trace_ptr ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, void *pointer); @@ -317,7 +317,7 @@ acpi_ut_trace_ptr ( void acpi_ut_trace_u32 ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u32 integer); @@ -325,7 +325,7 @@ acpi_ut_trace_u32 ( void acpi_ut_trace_str ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *string); @@ -333,14 +333,14 @@ acpi_ut_trace_str ( void acpi_ut_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id); void acpi_ut_status_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_status status); @@ -348,7 +348,7 @@ acpi_ut_status_exit ( void acpi_ut_value_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, acpi_integer value); @@ -356,7 +356,7 @@ acpi_ut_value_exit ( void acpi_ut_ptr_exit ( u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, u8 *ptr); @@ -390,7 +390,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -400,7 +400,7 @@ void ACPI_INTERNAL_VAR_XFACE acpi_ut_debug_print_raw ( u32 requested_debug_level, u32 line_number, - char *function_name, + const char *function_name, char *module_name, u32 component_id, char *format, @@ -598,9 +598,9 @@ acpi_status acpi_ut_allocate_owner_id ( acpi_owner_id *owner_id); -acpi_status +void acpi_ut_release_owner_id ( - acpi_owner_id owner_id); + acpi_owner_id *owner_id); acpi_status acpi_ut_walk_package_tree ( @@ -609,7 +609,7 @@ acpi_ut_walk_package_tree ( acpi_pkg_callback walk_callback, void *context); -char * +void acpi_ut_strupr ( char *src_string); diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index aa63202e..bae1fbe 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -241,15 +241,15 @@ #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) -#define ACPI_TOUPPER toupper -#define ACPI_TOLOWER tolower -#define ACPI_IS_XDIGIT isxdigit -#define ACPI_IS_DIGIT isdigit -#define ACPI_IS_SPACE isspace -#define ACPI_IS_UPPER isupper -#define ACPI_IS_PRINT isprint -#define ACPI_IS_ALPHA isalpha -#define ACPI_IS_ASCII isascii +#define ACPI_TOUPPER(i) toupper((int) (i)) +#define ACPI_TOLOWER(i) tolower((int) (i)) +#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) +#define ACPI_IS_DIGIT(i) isdigit((int) (i)) +#define ACPI_IS_SPACE(i) isspace((int) (i)) +#define ACPI_IS_UPPER(i) isupper((int) (i)) +#define ACPI_IS_PRINT(i) isprint((int) (i)) +#define ACPI_IS_ALPHA(i) isalpha((int) (i)) +#define ACPI_IS_ASCII(i) isascii((int) (i)) #else diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index e410e3b..3926412 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -46,7 +46,7 @@ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ -#define ACPI_GET_FUNCTION_NAME (char *) __FUNCTION__ +#define ACPI_GET_FUNCTION_NAME __FUNCTION__ /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. -- cgit v1.1