diff options
Diffstat (limited to 'drivers/acpi/include')
28 files changed, 1406 insertions, 718 deletions
diff --git a/drivers/acpi/include/accommon.h b/drivers/acpi/include/accommon.h index e914ffeb2..37e13b228 100644 --- a/drivers/acpi/include/accommon.h +++ b/drivers/acpi/include/accommon.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 74 $ + * $Revision: 82 $ * *****************************************************************************/ @@ -43,7 +43,7 @@ void acpi_cm_init_globals ( - ACPI_INIT_DATA *init_data); + void); void acpi_cm_terminate ( @@ -51,7 +51,7 @@ acpi_cm_terminate ( /* - * Acpi_cm_init - miscellaneous initialization and shutdown + * Cm_init - miscellaneous initialization and shutdown */ ACPI_STATUS @@ -62,10 +62,16 @@ ACPI_STATUS acpi_cm_subsystem_shutdown ( void); +ACPI_STATUS +acpi_cm_validate_fadt ( + void); + /* - * Acpi_cm_global - Global data structures and procedures + * Cm_global - Global data structures and procedures */ +#ifdef ACPI_DEBUG + NATIVE_CHAR * acpi_cm_get_mutex_name ( u32 mutex_id); @@ -74,6 +80,13 @@ NATIVE_CHAR * acpi_cm_get_type_name ( u32 type); +NATIVE_CHAR * +acpi_cm_get_region_name ( + u8 space_id); + +#endif + + u8 acpi_cm_valid_object_type ( u32 type); @@ -84,7 +97,7 @@ acpi_cm_allocate_owner_id ( /* - * Acpi_cm_clib - Local implementations of C library functions + * Cm_clib - Local implementations of C library functions */ NATIVE_UINT @@ -161,7 +174,7 @@ acpi_cm_to_lower ( /* - * Acpi_cm_copy - Object construction and conversion interfaces + * Cm_copy - Object construction and conversion interfaces */ ACPI_STATUS @@ -204,7 +217,7 @@ acpi_cm_build_copy_internal_package_object ( /* - * Acpi_cm_create - Object creation + * Cm_create - Object creation */ ACPI_STATUS @@ -221,7 +234,7 @@ _cm_create_internal_object ( /* - * Acpi_cm_debug - Debug interfaces + * Cm_debug - Debug interfaces */ u32 @@ -315,22 +328,19 @@ void _report_info ( NATIVE_CHAR *module_name, u32 line_number, - u32 component_id, - NATIVE_CHAR *message); + u32 component_id); void _report_error ( NATIVE_CHAR *module_name, u32 line_number, - u32 component_id, - NATIVE_CHAR *message); + u32 component_id); void _report_warning ( NATIVE_CHAR *module_name, u32 line_number, - u32 component_id, - NATIVE_CHAR *message); + u32 component_id); void acpi_cm_dump_buffer ( @@ -341,7 +351,7 @@ acpi_cm_dump_buffer ( /* - * Acpi_cm_delete - Object deletion + * Cm_delete - Object deletion */ void @@ -362,7 +372,7 @@ acpi_cm_delete_internal_object_list ( /* - * Acpi_cm_eval - object evaluation + * Cm_eval - object evaluation */ /* Method name strings */ @@ -378,9 +388,9 @@ acpi_cm_delete_internal_object_list ( ACPI_STATUS acpi_cm_evaluate_numeric_object ( - NATIVE_CHAR *method_name, + NATIVE_CHAR *object_name, ACPI_NAMESPACE_NODE *device_node, - u32 *address); + ACPI_INTEGER *address); ACPI_STATUS acpi_cm_execute_HID ( @@ -399,7 +409,7 @@ acpi_cm_execute_UID ( /* - * Acpi_cm_error - exception interfaces + * Cm_error - exception interfaces */ NATIVE_CHAR * @@ -408,7 +418,7 @@ acpi_cm_format_exception ( /* - * Acpi_cm_mutex - mutual exclusion interfaces + * Cm_mutex - mutual exclusion interfaces */ ACPI_STATUS @@ -437,7 +447,7 @@ acpi_cm_release_mutex ( /* - * Acpi_cm_object - internal object create/delete/cache routines + * Cm_object - internal object create/delete/cache routines */ void * @@ -459,7 +469,7 @@ acpi_cm_valid_internal_object ( /* - * Acpi_cm_ref_cnt - Object reference count management + * Cm_ref_cnt - Object reference count management */ void @@ -471,7 +481,7 @@ acpi_cm_remove_reference ( ACPI_OPERAND_OBJECT *object); /* - * Acpi_cm_size - Object size routines + * Cm_size - Object size routines */ ACPI_STATUS @@ -491,7 +501,7 @@ acpi_cm_get_object_size( /* - * Acpi_cm_state - Generic state creation/cache routines + * Cm_state - Generic state creation/cache routines */ void @@ -536,7 +546,7 @@ acpi_cm_delete_object_cache ( void); /* - * Acpi_cmutils + * Cmutils */ u8 @@ -547,6 +557,10 @@ u8 acpi_cm_valid_acpi_character ( NATIVE_CHAR character); +ACPI_STATUS +acpi_cm_resolve_package_references ( + ACPI_OPERAND_OBJECT *obj_desc); + /* * Memory allocation functions and related macros. diff --git a/drivers/acpi/include/acconfig.h b/drivers/acpi/include/acconfig.h index 5e1427950..2b210339b 100644 --- a/drivers/acpi/include/acconfig.h +++ b/drivers/acpi/include/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 42 $ + * $Revision: 48 $ * *****************************************************************************/ @@ -55,29 +55,6 @@ #define ACPI_CA_VERSION __DATE__ -/* Name of host operating system (returned by the _OS_ namespace object) */ - -#ifdef _LINUX -#define ACPI_OS_NAME "Linux" -#else -#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" -#endif - - -/* - * How and when control methods will be parsed - * The default action is to parse all methods at table load time to verify them, but delete the parse trees - * to conserve memory. Methods are parsed just in time before execution and the parse tree is deleted - * when execution completes. - */ -#define METHOD_PARSE_AT_INIT 0x0 /* Parse at table init, never delete the method parse tree */ -#define METHOD_PARSE_JUST_IN_TIME 0x1 /* Parse only when a method is invoked */ -#define METHOD_DELETE_AT_COMPLETION 0x2 /* Delete parse tree on method completion */ - -/* Default parsing configuration */ - -#define METHOD_PARSE_CONFIGURATION (METHOD_PARSE_JUST_IN_TIME | METHOD_DELETE_AT_COMPLETION) - /* Maximum objects in the various object caches */ @@ -87,15 +64,6 @@ #define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ #define MAX_WALK_CACHE_DEPTH 2 /* Objects for parse tree walks (method execution) */ -/* - * Name_space Table size - * - * All tables are the same size to simplify the implementation. - * Tables may be extended by allocating additional tables that - * are in turn linked together to form a chain of tables. - */ - -#define NS_TABLE_SIZE 4 /* String size constants */ @@ -164,14 +132,14 @@ /* Names within the namespace are 4 bytes long */ #define ACPI_NAME_SIZE 4 -#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 s8 for separator */ +#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 s8 for separator */ #define PATH_SEPARATOR '.' /* Constants used in searching for the RSDP in low memory */ -#define LO_RSDP_WINDOW_BASE (void *) 0 -#define HI_RSDP_WINDOW_BASE (void *) 0xE0000 +#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */ +#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ #define LO_RSDP_WINDOW_SIZE 0x400 #define HI_RSDP_WINDOW_SIZE 0x20000 #define RSDP_SCAN_STEP 16 diff --git a/drivers/acpi/include/acdebug.h b/drivers/acpi/include/acdebug.h index 02efd62e8..2bc9e7165 100644 --- a/drivers/acpi/include/acdebug.h +++ b/drivers/acpi/include/acdebug.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 35 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -205,6 +205,7 @@ acpi_db_find_references ( void acpi_db_display_op ( + ACPI_WALK_STATE *walk_state, ACPI_PARSE_OBJECT *origin, u32 num_opcodes); @@ -218,8 +219,13 @@ acpi_db_display_path ( void acpi_db_display_opcode ( + ACPI_WALK_STATE *walk_state, ACPI_PARSE_OBJECT *op); +void +acpi_db_decode_internal_object ( + ACPI_OPERAND_OBJECT *obj_desc); + /* * dbdisply - debug display commands diff --git a/drivers/acpi/include/acdispat.h b/drivers/acpi/include/acdispat.h index d87bb47fd..599e46c36 100644 --- a/drivers/acpi/include/acdispat.h +++ b/drivers/acpi/include/acdispat.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 29 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -61,7 +61,11 @@ acpi_ds_obj_stack_pop_object ( ACPI_WALK_STATE *walk_state); -/* dsregion - Op region support */ +/* dsopcode - support for late evaluation */ + +ACPI_STATUS +acpi_ds_get_field_unit_arguments ( + ACPI_OPERAND_OBJECT *obj_desc); ACPI_STATUS acpi_ds_get_region_arguments ( @@ -84,6 +88,13 @@ acpi_ds_exec_end_control_op ( /* dsexec - Parser/Interpreter interface, method execution callbacks */ + +ACPI_STATUS +acpi_ds_get_predicate_value ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + u32 has_result_obj); + ACPI_STATUS acpi_ds_exec_begin_op ( u16 opcode, @@ -145,6 +156,18 @@ acpi_ds_load2_end_op ( ACPI_WALK_STATE *state, ACPI_PARSE_OBJECT *op); +ACPI_STATUS +acpi_ds_load3_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_load3_end_op ( + ACPI_WALK_STATE *state, + ACPI_PARSE_OBJECT *op); + /* dsmthdat - method data (locals/args) */ @@ -284,6 +307,11 @@ acpi_ds_create_node ( /* dsregn - Parser/Interpreter interface - Op Region parsing */ ACPI_STATUS +acpi_ds_eval_field_unit_operands ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS acpi_ds_eval_region_operands ( ACPI_WALK_STATE *walk_state, ACPI_PARSE_OBJECT *op); @@ -297,7 +325,8 @@ acpi_ds_initialize_region ( u8 acpi_ds_is_result_used ( - ACPI_PARSE_OBJECT *op); + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state); void acpi_ds_delete_result_if_not_used ( @@ -308,7 +337,8 @@ acpi_ds_delete_result_if_not_used ( ACPI_STATUS acpi_ds_create_operand ( ACPI_WALK_STATE *walk_state, - ACPI_PARSE_OBJECT *arg); + ACPI_PARSE_OBJECT *arg, + u32 args_remaining); ACPI_STATUS acpi_ds_create_operands ( @@ -377,12 +407,10 @@ acpi_ds_pop_walk_state ( ACPI_STATUS acpi_ds_result_stack_pop ( - ACPI_OPERAND_OBJECT **object, ACPI_WALK_STATE *walk_state); ACPI_STATUS acpi_ds_result_stack_push ( - void *object, ACPI_WALK_STATE *walk_state); ACPI_STATUS @@ -397,5 +425,31 @@ void acpi_ds_delete_walk_state_cache ( void); +ACPI_STATUS +acpi_ds_result_insert ( + void *object, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_result_remove ( + ACPI_OPERAND_OBJECT **object, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_result_pop ( + ACPI_OPERAND_OBJECT **object, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_result_push ( + ACPI_OPERAND_OBJECT *object, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_result_pop_from_bottom ( + ACPI_OPERAND_OBJECT **object, + ACPI_WALK_STATE *walk_state); #endif /* _ACDISPAT_H_ */ diff --git a/drivers/acpi/include/acenv.h b/drivers/acpi/include/acenv.h index 30c347b5f..f867a348f 100644 --- a/drivers/acpi/include/acenv.h +++ b/drivers/acpi/include/acenv.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acenv.h - Generation environment specific items - * $Revision: 53 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -28,6 +28,35 @@ /* + * Configuration for ACPI Utilities + */ + +#ifdef _ACPI_DUMP_APP +#define ACPI_DEBUG +#define ACPI_APPLICATION +#define ENABLE_DEBUGGER +#define ACPI_USE_SYSTEM_CLIBRARY +#define PARSER_ONLY +#endif + +#ifdef _ACPI_EXEC_APP +#undef DEBUGGER_THREADING +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED +#define ACPI_DEBUG +#define ACPI_APPLICATION +#define ENABLE_DEBUGGER +#define ACPI_USE_SYSTEM_CLIBRARY +#endif + +#ifdef _ACPI_ASL_COMPILER +#define ACPI_DEBUG +#define ACPI_APPLICATION +#define ENABLE_DEBUGGER +#define ACPI_USE_SYSTEM_CLIBRARY +#endif + + +/* * Environment configuration. The purpose of this file is to interface to the * local generation environment. * @@ -64,50 +93,35 @@ * */ - -/* - * Environment-specific configuration - */ +/*! [Begin] no source code translation */ #ifdef _LINUX +#include "aclinux.h" -#include <linux/string.h> -#include <linux/kernel.h> -#include <linux/ctype.h> -#include <asm/system.h> -#include <asm/atomic.h> - -/* Use native Linux string library */ - -#define ACPI_USE_SYSTEM_CLIBRARY - -/* Special functions */ - -#define strtoul simple_strtoul +#elif _AED_EFI +#include "acefi.h" -/* Linux clib doesn't to strupr, but we do. */ -char * -strupr(char *str); +#elif WIN32 +#include "acwin.h" -#else - -#ifdef _AED_EFI - -#include <efi.h> -#include <efistdarg.h> -#include <efilib.h> +#elif __FreeBSD__ +#include "acfreebsd.h" #else - /* All other environments */ #define ACPI_USE_STANDARD_HEADERS -#endif +/* Name of host operating system (returned by the _OS_ namespace object) */ + +#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" + #endif +/*! [End] no source code translation !*/ + /****************************************************************************** * * C library configuration @@ -218,132 +232,13 @@ typedef char *va_list; /* * Handle platform- and compiler-specific assembly language differences. + * These should already have been defined by the platform includes above. * * Notes: * 1) Interrupt 3 is used to break into a debugger * 2) Interrupts are turned off during ACPI register setup */ - -#ifdef __GNUC__ - - -#ifdef __ia64__ - -/* Single threaded */ -#define ACPI_APPLICATION - -#define ACPI_ASM_MACROS -#define causeinterrupt(level) -#define BREAKPOINT3 -#define disable() __cli() -#define enable() __sti() -#define wbinvd() - -/*! [Begin] no source code translation */ -#include <asm/pal.h> - -/* PAL_HALT[_LIGHT] */ -#define halt() ia64_pal_halt_light() - -/* PAL_HALT */ -#define safe_halt() ia64_pal_halt(1) - -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - __asm__ volatile ("1: ld4 r29=%1\n" \ - ";;\n" \ - "mov ar.ccv=r29\n" \ - "mov r2=r29\n" \ - "shr.u r30=r29,1\n" \ - "and r29=-4,r29\n" \ - ";;\n" \ - "add r29=2,r29\n" \ - "and r30=1,r30\n" \ - ";;\n" \ - "add r29=r29,r30\n" \ - ";;\n" \ - "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ - ";;\n" \ - "cmp.eq p6,p7=r2,r30\n" \ - "(p7) br.dpnt.few 1b\n" \ - "cmp.gt p8,p9=3,r29\n" \ - ";;\n" \ - "(p8) mov %0=-1\n" \ - "(p9) mov %0=r0\n" \ - :"=r"(Acq):"m" __atomic_fool_gcc((GLptr)):"r2","r29","r30","memory"); \ - } while (0) - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - __asm__ volatile ("1: ld4 r29=%1\n" \ - ";;\n" \ - "mov ar.ccv=r29\n" \ - "mov r2=r29\n" \ - "and r29=-4,r29\n" \ - ";;\n" \ - "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ - ";;\n" \ - "cmp.eq p6,p7=r2,r30\n" \ - "(p7) br.dpnt.few 1b\n" \ - "and %0=1,r2\n" \ - ";;\n" \ - :"=r"(Acq):"m" __atomic_fool_gcc((GLptr)):"r2","r29","r30","memory"); \ - } while (0) -/*! [End] no source code translation !*/ - -#else /* DO IA32 */ - -#define ACPI_ASM_MACROS -#define causeinterrupt(level) -#define BREAKPOINT3 -#define disable() __cli() -#define enable() __sti() -#define halt() __asm__ __volatile__ ("sti; hlt":::"memory") -#define wbinvd() - -/*! [Begin] no source code translation - * - * A brief explanation as GNU inline assembly is a bit hairy - * %0 is the output parameter in EAX ("=a") - * %1 and %2 are the input parameters in ECX ("c") - * and an immediate value ("i") respectively - * All actual register references are preceded with "%%" as in "%%edx" - * Immediate values in the assembly are preceded by "$" as in "$0x1" - * The final asm parameter are the operation altered non-output registers. - */ -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - int dummy; \ - asm("1: movl (%1),%%eax;" \ - "movl %%eax,%%edx;" \ - "andl %2,%%edx;" \ - "btsl $0x1,%%edx;" \ - "adcl $0x0,%%edx;" \ - "lock; cmpxchgl %%edx,(%1);" \ - "jnz 1b;" \ - "cmpb $0x3,%%dl;" \ - "sbbl %%eax,%%eax" \ - :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \ - } while(0) - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - int dummy; \ - asm("1: movl (%1),%%eax;" \ - "movl %%eax,%%edx;" \ - "andl %2,%%edx;" \ - "lock; cmpxchgl %%edx,(%1);" \ - "jnz 1b;" \ - "andl $0x1,%%eax" \ - :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \ - } while(0) -/*! [End] no source code translation !*/ - -#endif /* IA 32 */ -#endif /* __GNUC__ */ - - /* Unrecognized compiler, use defaults */ #ifndef ACPI_ASM_MACROS @@ -370,4 +265,14 @@ typedef char *va_list; #endif +/****************************************************************************** + * + * Compiler-specific + * + *****************************************************************************/ + +/* this has been moved to compiler-specific headers, which are included from the + platform header. */ + + #endif /* __ACENV_H__ */ diff --git a/drivers/acpi/include/acevents.h b/drivers/acpi/include/acevents.h index 890297825..3e76370bf 100644 --- a/drivers/acpi/include/acevents.h +++ b/drivers/acpi/include/acevents.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 56 $ + * $Revision: 62 $ * *****************************************************************************/ @@ -27,6 +27,11 @@ #define __ACEVENTS_H__ +ACPI_STATUS +acpi_ev_initialize ( + void); + + /* * Acpi_evfixed - Fixed event handling */ @@ -104,7 +109,7 @@ ACPI_STATUS acpi_ev_address_space_dispatch ( ACPI_OPERAND_OBJECT *region_obj, u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value); @@ -118,7 +123,8 @@ acpi_ev_addr_handler_helper ( void acpi_ev_disassociate_region_from_handler( - ACPI_OPERAND_OBJECT *region_obj); + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_is_locked); ACPI_STATUS diff --git a/drivers/acpi/include/acexcep.h b/drivers/acpi/include/acexcep.h index 1b02ba16a..1629a0934 100644 --- a/drivers/acpi/include/acexcep.h +++ b/drivers/acpi/include/acexcep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 35 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -89,6 +89,7 @@ #define AE_BAD_SIGNATURE (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES) #define AE_BAD_HEADER (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES) #define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES) +#define AE_BAD_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES) #define AE_CODE_TBL_MAX 0x0003 @@ -114,8 +115,9 @@ #define AE_AML_BAD_NAME (ACPI_STATUS) (0x000F | AE_CODE_AML) #define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML) #define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML) +#define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x0011 +#define AE_CODE_AML_MAX 0x0012 /* * Internal exceptions used for control @@ -177,6 +179,7 @@ static NATIVE_CHAR *acpi_gbl_exception_names_tbl[] = "AE_BAD_SIGNATURE", "AE_BAD_HEADER", "AE_BAD_CHECKSUM", + "AE_BAD_VALUE", }; static NATIVE_CHAR *acpi_gbl_exception_names_aml[] = @@ -198,6 +201,7 @@ static NATIVE_CHAR *acpi_gbl_exception_names_aml[] = "AE_AML_BAD_NAME", "AE_AML_NAME_NOT_FOUND", "AE_AML_INTERNAL", + "AE_AML_INVALID_SPACE_ID", }; static NATIVE_CHAR *acpi_gbl_exception_names_ctrl[] = diff --git a/drivers/acpi/include/acgcc.h b/drivers/acpi/include/acgcc.h new file mode 100644 index 000000000..5992f493d --- /dev/null +++ b/drivers/acpi/include/acgcc.h @@ -0,0 +1,149 @@ +/****************************************************************************** + * + * Name: acgcc.h - GCC specific defines, etc. + * $Revision: 2 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __ACGCC_H__ +#define __ACGCC_H__ + +#define COMPILER_DEPENDENT_UINT64 unsigned long long + + +#ifdef __ia64__ +#define _IA64 + +/* Single threaded */ +#define ACPI_APPLICATION + +#define ACPI_ASM_MACROS +#define causeinterrupt(level) +#define BREAKPOINT3 +#define disable() __cli() +#define enable() __sti() +#define wbinvd() + +/*! [Begin] no source code translation */ + +#include <asm/pal.h> + +#define halt() ia64_pal_halt_light() /* PAL_HALT[_LIGHT] */ +#define safe_halt() ia64_pal_halt(1) /* PAL_HALT */ + + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + __asm__ volatile ("1: ld4 r29=%1\n" \ + ";;\n" \ + "mov ar.ccv=r29\n" \ + "mov r2=r29\n" \ + "shr.u r30=r29,1\n" \ + "and r29=-4,r29\n" \ + ";;\n" \ + "add r29=2,r29\n" \ + "and r30=1,r30\n" \ + ";;\n" \ + "add r29=r29,r30\n" \ + ";;\n" \ + "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ + ";;\n" \ + "cmp.eq p6,p7=r2,r30\n" \ + "(p7) br.dpnt.few 1b\n" \ + "cmp.gt p8,p9=3,r29\n" \ + ";;\n" \ + "(p8) mov %0=-1\n" \ + "(p9) mov %0=r0\n" \ + :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \ + } while (0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + __asm__ volatile ("1: ld4 r29=%1\n" \ + ";;\n" \ + "mov ar.ccv=r29\n" \ + "mov r2=r29\n" \ + "and r29=-4,r29\n" \ + ";;\n" \ + "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ + ";;\n" \ + "cmp.eq p6,p7=r2,r30\n" \ + "(p7) br.dpnt.few 1b\n" \ + "and %0=1,r2\n" \ + ";;\n" \ + :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \ + } while (0) +/*! [End] no source code translation !*/ + + +#else /* DO IA32 */ + + +#define ACPI_ASM_MACROS +#define causeinterrupt(level) +#define BREAKPOINT3 +#define disable() __cli() +#define enable() __sti() +#define halt() __asm__ __volatile__ ("sti; hlt":::"memory") +#define wbinvd() + +/*! [Begin] no source code translation + * + * A brief explanation as GNU inline assembly is a bit hairy + * %0 is the output parameter in EAX ("=a") + * %1 and %2 are the input parameters in ECX ("c") + * and an immediate value ("i") respectively + * All actual register references are preceded with "%%" as in "%%edx" + * Immediate values in the assembly are preceded by "$" as in "$0x1" + * The final asm parameter are the operation altered non-output registers. + */ +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + int dummy; \ + asm("1: movl (%1),%%eax;" \ + "movl %%eax,%%edx;" \ + "andl %2,%%edx;" \ + "btsl $0x1,%%edx;" \ + "adcl $0x0,%%edx;" \ + "lock; cmpxchgl %%edx,(%1);" \ + "jnz 1b;" \ + "cmpb $0x3,%%dl;" \ + "sbbl %%eax,%%eax" \ + :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \ + } while(0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + int dummy; \ + asm("1: movl (%1),%%eax;" \ + "movl %%eax,%%edx;" \ + "andl %2,%%edx;" \ + "lock; cmpxchgl %%edx,(%1);" \ + "jnz 1b;" \ + "andl $0x1,%%eax" \ + :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \ + } while(0) + +/*! [End] no source code translation !*/ + +#endif /* IA 32 */ + +#endif /* __ACGCC_H__ */ diff --git a/drivers/acpi/include/acglobal.h b/drivers/acpi/include/acglobal.h index 15e617e32..248f72c9d 100644 --- a/drivers/acpi/include/acglobal.h +++ b/drivers/acpi/include/acglobal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 84 $ + * $Revision: 92 $ * *****************************************************************************/ @@ -74,13 +74,12 @@ extern u32 acpi_gbl_nesting_level; * of each in the system. Each global points to the actual table. * */ -ACPI_EXTERN ROOT_SYSTEM_DESCRIPTOR_POINTER *acpi_gbl_RSDP; -ACPI_EXTERN ROOT_SYSTEM_DESCRIPTION_TABLE *acpi_gbl_RSDT; -ACPI_EXTERN FIRMWARE_ACPI_CONTROL_STRUCTURE *acpi_gbl_FACS; -ACPI_EXTERN FIXED_ACPI_DESCRIPTION_TABLE *acpi_gbl_FACP; -ACPI_EXTERN APIC_TABLE *acpi_gbl_APIC; -ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_DSDT; -ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_SBST; +ACPI_EXTERN RSDP_DESCRIPTOR *acpi_gbl_RSDP; +ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; +ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; +ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_DSDT; +ACPI_EXTERN ACPI_COMMON_FACS *acpi_gbl_FACS; + /* * Since there may be multiple SSDTs and PSDTS, a single pointer is not * sufficient; Therefore, there isn't one! @@ -99,7 +98,6 @@ extern ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES * (The table maps local handles to the real OS handles) */ ACPI_EXTERN ACPI_MUTEX_INFO acpi_gbl_acpi_mutex_info [NUM_MTX]; -extern ACPI_INIT_DATA acpi_gbl_acpi_init_data; /***************************************************************************** @@ -164,6 +162,7 @@ ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; extern u8 acpi_gbl_shutdown; extern u32 acpi_gbl_system_flags; extern u32 acpi_gbl_startup_flags; +extern u8 acpi_gbl_decode_to8bit[]; /***************************************************************************** @@ -198,23 +197,8 @@ ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_tail_alloc_ptr; ****************************************************************************/ -ACPI_EXTERN u32 acpi_gbl_when_to_parse_methods; ACPI_EXTERN ACPI_WALK_LIST *acpi_gbl_current_walk_list; -/* Base of AML block, and pointer to current location in it */ - -ACPI_EXTERN u8 *acpi_gbl_Pcode_base; -ACPI_EXTERN u8 *acpi_gbl_Pcode; - -/* - * Length of AML block, and remaining length of current package. - */ -ACPI_EXTERN u32 acpi_gbl_Pcode_block_len; -ACPI_EXTERN u32 acpi_gbl_Pcode_len; - -ACPI_EXTERN u32 acpi_gbl_buf_seq; /* Counts allocated Buffer descriptors */ -ACPI_EXTERN u32 acpi_gbl_node_err; /* Indicate if inc_error should be called */ - /* * Handle to the last method found - used during pass1 of load */ @@ -240,10 +224,6 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; ACPI_EXTERN ACPI_PARSE_OBJECT *acpi_gbl_parsed_namespace_root; -extern ACPI_OPCODE_INFO acpi_gbl_aml_op_info[]; -extern u8 acpi_gbl_aml_op_info_index[256]; - - /***************************************************************************** * * Hardware globals @@ -290,9 +270,10 @@ ACPI_EXTERN u32 acpi_gbl_event_count[NUM_FIXED_EVENTS]; * ****************************************************************************/ +#ifdef ENABLE_DEBUGGER ACPI_EXTERN u8 acpi_gbl_method_executing; ACPI_EXTERN u8 acpi_gbl_db_terminate_threads; - +#endif /* Memory allocation metrics - Debug Only! */ diff --git a/drivers/acpi/include/achware.h b/drivers/acpi/include/achware.h index e537d6549..1a206e8d2 100644 --- a/drivers/acpi/include/achware.h +++ b/drivers/acpi/include/achware.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 41 $ + * $Revision: 48 $ * *****************************************************************************/ @@ -31,15 +31,15 @@ ACPI_STATUS -acpi_hw_initialize( +acpi_hw_initialize ( void); ACPI_STATUS -acpi_hw_shutdown( +acpi_hw_shutdown ( void); ACPI_STATUS -acpi_hw_initialize_system_info( +acpi_hw_initialize_system_info ( void); ACPI_STATUS @@ -56,11 +56,37 @@ acpi_hw_get_mode_capabilities ( /* Register I/O Prototypes */ + u32 -acpi_hw_register_access ( +acpi_hw_register_bit_access ( NATIVE_UINT read_write, u8 use_lock, - u32 register_id, ... /* DWORD Value */); + u32 register_id, + ... /* DWORD Write Value */); + +u32 +acpi_hw_register_read ( + u8 use_lock, + u32 register_id); + +void +acpi_hw_register_write ( + u8 use_lock, + u32 register_id, + u32 value); + +u32 +acpi_hw_low_level_read ( + u32 width, + ACPI_GAS *reg, + u32 offset); + +void +acpi_hw_low_level_write ( + u32 width, + u32 value, + ACPI_GAS *reg, + u32 offset); void acpi_hw_clear_acpi_status ( @@ -125,6 +151,16 @@ ACPI_STATUS acpi_hw_get_cx_info ( u32 cx_states[]); +ACPI_STATUS +acpi_hw_get_cx_handler ( + u32 cx_state, + ACPI_C_STATE_HANDLER *handler); + +ACPI_STATUS +acpi_hw_set_cx_handler ( + u32 cx_state, + ACPI_C_STATE_HANDLER handler); + /* Throttling Prototypes */ @@ -165,5 +201,9 @@ u32 acpi_hw_pmt_resolution ( void); +ACPI_STATUS +acpi_get_timer ( + u32 *out_ticks); + #endif /* __ACHWARE_H__ */ diff --git a/drivers/acpi/include/acinterp.h b/drivers/acpi/include/acinterp.h index 70bfc5682..c8c967492 100644 --- a/drivers/acpi/include/acinterp.h +++ b/drivers/acpi/include/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 79 $ + * $Revision: 86 $ * *****************************************************************************/ @@ -120,7 +120,9 @@ acpi_aml_access_named_field ( ACPI_STATUS acpi_aml_exec_create_field ( - u16 opcode, + u8 *aml_ptr, + u32 aml_length, + ACPI_NAMESPACE_NODE *node, ACPI_WALK_STATE *walk_state); ACPI_STATUS @@ -160,7 +162,7 @@ ACPI_STATUS acpi_aml_exec_create_region ( u8 *aml_ptr, u32 acpi_aml_length, - u32 region_space, + u8 region_space, ACPI_WALK_STATE *walk_state); ACPI_STATUS @@ -324,7 +326,8 @@ acpi_aml_resolve_to_value ( ACPI_STATUS acpi_aml_resolve_node_to_value ( - ACPI_NAMESPACE_NODE **stack_ptr); + ACPI_NAMESPACE_NODE **stack_ptr, + ACPI_WALK_STATE *walk_state); ACPI_STATUS acpi_aml_resolve_object_to_value ( @@ -440,6 +443,11 @@ void acpi_aml_exit_interpreter ( void); +void +acpi_aml_truncate_for32bit_table ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + u8 acpi_aml_validate_object_type ( ACPI_OBJECT_TYPE type); @@ -453,12 +461,8 @@ acpi_aml_release_global_lock ( u8 locked); u32 -acpi_aml_buf_seq ( - void); - -u32 acpi_aml_digits_needed ( - u32 value, + ACPI_INTEGER value, u32 base); ACPI_STATUS @@ -467,6 +471,11 @@ acpi_aml_eisa_id_to_string ( NATIVE_CHAR *out_string); ACPI_STATUS +acpi_aml_unsigned_integer_to_string ( + ACPI_INTEGER value, + NATIVE_CHAR *out_string); + +ACPI_STATUS acpi_aml_build_copy_internal_package_object ( ACPI_OPERAND_OBJECT *source_obj, ACPI_OPERAND_OBJECT *dest_obj, @@ -480,7 +489,7 @@ acpi_aml_build_copy_internal_package_object ( ACPI_STATUS acpi_aml_system_memory_space_handler ( u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value, void *handler_context, @@ -489,7 +498,7 @@ acpi_aml_system_memory_space_handler ( ACPI_STATUS acpi_aml_system_io_space_handler ( u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value, void *handler_context, @@ -498,7 +507,7 @@ acpi_aml_system_io_space_handler ( ACPI_STATUS acpi_aml_pci_config_space_handler ( u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value, void *handler_context, @@ -507,7 +516,7 @@ acpi_aml_pci_config_space_handler ( ACPI_STATUS acpi_aml_embedded_controller_space_handler ( u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value, void *handler_context, @@ -516,7 +525,7 @@ acpi_aml_embedded_controller_space_handler ( ACPI_STATUS acpi_aml_sm_bus_space_handler ( u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value, void *handler_context, diff --git a/drivers/acpi/include/aclinux.h b/drivers/acpi/include/aclinux.h new file mode 100644 index 000000000..673d5f96b --- /dev/null +++ b/drivers/acpi/include/aclinux.h @@ -0,0 +1,50 @@ +/****************************************************************************** + * + * Name: aclinux.h - OS specific defines, etc. + * $Revision: 6 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __ACLINUX_H__ +#define __ACLINUX_H__ + + +#define ACPI_OS_NAME "Linux" + +#include <linux/string.h> +#include <linux/kernel.h> +#include <linux/ctype.h> +#include <asm/system.h> +#include <asm/atomic.h> + +/* Linux uses GCC */ + +#include "acgcc.h" + +#undef DEBUGGER_THREADING +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED + +/* Linux ia32 can't do int64 well */ +#ifndef _IA64 +#define ACPI_NO_INTEGER64_SUPPORT +#endif + +#endif /* __ACLINUX_H__ */ diff --git a/drivers/acpi/include/aclocal.h b/drivers/acpi/include/aclocal.h index c2f052f60..a647026f1 100644 --- a/drivers/acpi/include/aclocal.h +++ b/drivers/acpi/include/aclocal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 77 $ + * $Revision: 95 $ * *****************************************************************************/ @@ -125,7 +125,7 @@ typedef u16 ACPI_OWNER_ID; /* TBD: [Restructure] get rid of the need for this! */ -#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0xD1D1 +#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0x8000 /***************************************************************************** * @@ -157,8 +157,8 @@ typedef struct acpi_node { u8 data_type; u8 type; /* Type associated with this name */ - u32 name; /* ACPI Name, always 4 chars per ACPI spec */ u16 owner_id; + u32 name; /* ACPI Name, always 4 chars per ACPI spec */ void *object; /* Pointer to attached ACPI object (optional) */ @@ -175,8 +175,13 @@ typedef struct acpi_node /* Node flags */ -#define ANOBJ_AML_ATTACHMENT 0x1 -#define ANOBJ_END_OF_PEER_LIST 0x2 +#define ANOBJ_AML_ATTACHMENT 0x01 +#define ANOBJ_END_OF_PEER_LIST 0x02 +#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ +#define ANOBJ_METHOD_ARG 0x08 +#define ANOBJ_METHOD_LOCAL 0x10 +#define ANOBJ_METHOD_NO_RETVAL 0x20 +#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 /* @@ -190,6 +195,7 @@ typedef struct acpi_table_desc ACPI_TABLE_HEADER *pointer; void *base_pointer; u8 *aml_pointer; + UINT64 physical_address; u32 aml_length; u32 length; u32 count; @@ -399,6 +405,22 @@ typedef struct acpi_pscope_state } ACPI_PSCOPE_STATE; +/* + * Result values - used to accumulate the results of nested + * AML arguments + */ +typedef struct acpi_result_values +{ + ACPI_STATE_COMMON + union acpi_operand_obj *obj_desc [OBJ_NUM_OPERANDS]; + u8 num_results; + u8 last_insert; + +} ACPI_RESULT_VALUES; + + +/* Generic state is union of structs above */ + typedef union acpi_gen_state { ACPI_COMMON_STATE common; @@ -406,6 +428,7 @@ typedef union acpi_gen_state ACPI_UPDATE_STATE update; ACPI_SCOPE_STATE scope; ACPI_PSCOPE_STATE parse_scope; + ACPI_RESULT_VALUES results; } ACPI_GENERIC_STATE; @@ -453,8 +476,7 @@ typedef struct acpi_opcode_info u32 parse_args; /* Grammar/Parse time arguments */ u32 runtime_args; /* Interpret time arguments */ - DEBUG_ONLY_MEMBERS ( - NATIVE_CHAR *name) /* op name (debug only) */ + DEBUG_ONLY_MEMBERS (NATIVE_CHAR *name) /* op name (debug only) */ } ACPI_OPCODE_INFO; @@ -481,7 +503,7 @@ typedef union acpi_parse_val DEBUG_ONLY_MEMBERS (\ NATIVE_CHAR op_name[16]) /* op name (debug only) */\ /* NON-DEBUG members below: */\ - ACPI_NAMESPACE_NODE *node;/* for use by interpreter */\ + ACPI_NAMESPACE_NODE *node; /* for use by interpreter */\ ACPI_PARSE_VALUE value; /* Value or args associated with the opcode */\ @@ -543,8 +565,9 @@ typedef struct acpi_parse_state #define NEXT_OP_DOWNWARD 1 #define NEXT_OP_UPWARD 2 -#define WALK_METHOD 1 #define WALK_NON_METHOD 0 +#define WALK_METHOD 1 +#define WALK_METHOD_RESTART 2 typedef struct acpi_walk_state { @@ -553,17 +576,17 @@ typedef struct acpi_walk_state u8 last_predicate; /* Result of last predicate */ u8 next_op_info; /* Info about Next_op */ u8 num_operands; /* Stack pointer for Operands[] array */ - u8 num_results; /* Stack pointer for Results[] array */ u8 current_result; /* */ struct acpi_walk_state *next; /* Next Walk_state in list */ - ACPI_PARSE_OBJECT *origin; /* Start of walk */ + ACPI_PARSE_OBJECT *origin; /* Start of walk [Obsolete] */ /* TBD: Obsolete with removal of WALK procedure ? */ ACPI_PARSE_OBJECT *prev_op; /* Last op that was processed */ ACPI_PARSE_OBJECT *next_op; /* next op to be processed */ + ACPI_GENERIC_STATE *results; /* Stack of accumulated results */ ACPI_GENERIC_STATE *control_state; /* List of control states (nested IFs) */ ACPI_GENERIC_STATE *scope_info; /* Stack of nested scopes */ ACPI_PARSE_STATE *parser_state; /* Current state of parser */ @@ -577,7 +600,6 @@ typedef struct acpi_walk_state ACPI_PARSE_OBJECT *method_call_op; /* Method_call Op if running a method */ struct acpi_node *method_call_node; /* Called method Node*/ union acpi_operand_obj *operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ - union acpi_operand_obj *results[OBJ_NUM_OPERANDS]; /* Accumulated results */ struct acpi_node arguments[MTH_NUM_ARGS]; /* Control method arguments */ struct acpi_node local_variables[MTH_NUM_LOCALS]; /* Control method locals */ u32 parse_flags; @@ -607,13 +629,30 @@ typedef struct acpi_walk_list /* Info used by Acpi_ps_init_objects */ -typedef struct init_walk_info +typedef struct acpi_init_walk_info { - u32 method_count; - u32 op_region_count; + u16 method_count; + u16 op_region_count; + u16 field_count; + u16 op_region_init; + u16 field_init; + u16 object_count; ACPI_TABLE_DESC *table_desc; -} INIT_WALK_INFO; +} ACPI_INIT_WALK_INFO; + + +/* Info used by TBD */ + +typedef struct acpi_device_walk_info +{ + u32 flags; + u16 device_count; + u16 num_STA; + u16 num_INI; + ACPI_TABLE_DESC *table_desc; + +} ACPI_DEVICE_WALK_INFO; /* TBD: [Restructure] Merge with struct above */ @@ -625,6 +664,14 @@ typedef struct acpi_walk_info } ACPI_WALK_INFO; +typedef struct acpi_get_devices_info +{ + WALK_CALLBACK user_function; + void *context; + NATIVE_CHAR *hid; + +} ACPI_GET_DEVICES_INFO; + /***************************************************************************** * @@ -633,16 +680,23 @@ typedef struct acpi_walk_info ****************************************************************************/ +/* 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 +#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 +#define MAX_CX_STATE_LATENCY 0xFFFFFFFF +#define MAX_CX_STATES 4 + /* * The #define's and enum below establish an abstract way of identifying what @@ -650,66 +704,85 @@ typedef struct acpi_walk_info * values as they are used in switch statements and offset calculations. */ -#define REGISTER_BLOCK_MASK 0xFF00 -#define BIT_IN_REGISTER_MASK 0x00FF -#define PM1_EVT 0x0100 -#define PM1_CONTROL 0x0200 -#define PM2_CONTROL 0x0300 -#define PM_TIMER 0x0400 -#define PROCESSOR_BLOCK 0x0500 -#define GPE0_STS_BLOCK 0x0600 -#define GPE0_EN_BLOCK 0x0700 -#define GPE1_STS_BLOCK 0x0800 -#define GPE1_EN_BLOCK 0x0900 +#define REGISTER_BLOCK_MASK 0xFF00 /* Register Block Id */ +#define BIT_IN_REGISTER_MASK 0x00FF /* Bit Id in the Register Block Id */ +#define BYTE_IN_REGISTER_MASK 0x00FF /* Register Offset in the Register Block */ -enum -{ - /* PM1 status register ids */ - - TMR_STS = (PM1_EVT | 0x01), - BM_STS, - GBL_STS, - PWRBTN_STS, - SLPBTN_STS, - RTC_STS, - WAK_STS, +#define REGISTER_BLOCK_ID(reg_id) (reg_id & REGISTER_BLOCK_MASK) +#define REGISTER_BIT_ID(reg_id) (reg_id & BIT_IN_REGISTER_MASK) +#define REGISTER_OFFSET(reg_id) (reg_id & BYTE_IN_REGISTER_MASK) - /* PM1 enable register ids */ +/* + * Access Rule + * To access a Register Bit: + * -> Use Bit Name (= Register Block Id | Bit Id) defined in the enum. + * + * To access a Register: + * -> Use Register Id (= Register Block Id | Register Offset) + */ - TMR_EN, - /* need to skip 1 enable number since there's no bus master enable register */ - GBL_EN = (PM1_EVT | 0x0A), - PWRBTN_EN, - SLPBTN_EN, - RTC_EN, - /* PM1 control register ids */ +/* + * Register Block Id + */ +#define PM1_STS 0x0100 +#define PM1_EN 0x0200 +#define PM1_CONTROL 0x0300 +#define PM2_CONTROL 0x0400 +#define PM_TIMER 0x0500 +#define PROCESSOR_BLOCK 0x0600 +#define GPE0_STS_BLOCK 0x0700 +#define GPE0_EN_BLOCK 0x0800 +#define GPE1_STS_BLOCK 0x0900 +#define GPE1_EN_BLOCK 0x0A00 +#define SMI_CMD_BLOCK 0x0B00 - SCI_EN = (PM1_CONTROL | 0x01), - BM_RLD, - GBL_RLS, - SLP_TYPE_A, - SLP_TYPE_B, - SLP_EN, +/* + * Address space bitmasks for mmio or io spaces + */ - /* PM2 control register ids */ +#define SMI_CMD_ADDRESS_SPACE 0x01 +#define PM1_BLK_ADDRESS_SPACE 0x02 +#define PM2_CNT_BLK_ADDRESS_SPACE 0x04 +#define PM_TMR_BLK_ADDRESS_SPACE 0x08 +#define GPE0_BLK_ADDRESS_SPACE 0x10 +#define GPE1_BLK_ADDRESS_SPACE 0x20 - ARB_DIS = (PM2_CONTROL | 0x01), +/* + * Control bit definitions + */ +#define TMR_STS (PM1_STS | 0x01) +#define BM_STS (PM1_STS | 0x02) +#define GBL_STS (PM1_STS | 0x03) +#define PWRBTN_STS (PM1_STS | 0x04) +#define SLPBTN_STS (PM1_STS | 0x05) +#define RTC_STS (PM1_STS | 0x06) +#define WAK_STS (PM1_STS | 0x07) - /* PM Timer register ids */ +#define TMR_EN (PM1_EN | 0x01) + /* no BM_EN */ +#define GBL_EN (PM1_EN | 0x03) +#define PWRBTN_EN (PM1_EN | 0x04) +#define SLPBTN_EN (PM1_EN | 0x05) +#define RTC_EN (PM1_EN | 0x06) +#define WAK_EN (PM1_EN | 0x07) - TMR_VAL = (PM_TIMER | 0x01), +#define SCI_EN (PM1_CONTROL | 0x01) +#define BM_RLD (PM1_CONTROL | 0x02) +#define GBL_RLS (PM1_CONTROL | 0x03) +#define SLP_TYPE_A (PM1_CONTROL | 0x04) +#define SLP_TYPE_B (PM1_CONTROL | 0x05) +#define SLP_EN (PM1_CONTROL | 0x06) - GPE0_STS = (GPE0_STS_BLOCK | 0x01), - GPE0_EN = (GPE0_EN_BLOCK | 0x01), +#define ARB_DIS (PM2_CONTROL | 0x01) - GPE1_STS = (GPE1_STS_BLOCK | 0x01), - GPE1_EN = (GPE0_EN_BLOCK | 0x01), +#define TMR_VAL (PM_TIMER | 0x01) - /* Last register value is one less than LAST_REG */ +#define GPE0_STS (GPE0_STS_BLOCK | 0x01) +#define GPE0_EN (GPE0_EN_BLOCK | 0x01) - LAST_REG -}; +#define GPE1_STS (GPE1_STS_BLOCK | 0x01) +#define GPE1_EN (GPE1_EN_BLOCK | 0x01) #define TMR_STS_MASK 0x0001 @@ -720,8 +793,9 @@ enum #define RTC_STS_MASK 0x0400 #define WAK_STS_MASK 0x8000 -#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK | PWRBTN_STS_MASK | \ - SLPBTN_STS_MASK | RTC_STS_MASK | WAK_STS_MASK) +#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \ + | PWRBTN_STS_MASK | SLPBTN_STS_MASK \ + | RTC_STS_MASK | WAK_STS_MASK) #define TMR_EN_MASK 0x0001 #define GBL_EN_MASK 0x0020 @@ -736,6 +810,7 @@ enum #define SLP_EN_MASK 0x2000 #define ARB_DIS_MASK 0x0001 +#define TMR_VAL_MASK 0xFFFFFFFF #define GPE0_STS_MASK #define GPE0_EN_MASK @@ -747,16 +822,6 @@ enum #define ACPI_READ 1 #define ACPI_WRITE 2 -#define LOW_BYTE 0x00FF -#define ONE_BYTE 0x08 - -#ifndef SET - #define SET 1 -#endif -#ifndef CLEAR - #define CLEAR 0 -#endif - /* Plug and play */ @@ -796,24 +861,11 @@ enum /* MUST HAVES */ - -typedef enum -{ - DWORD_DEVICE_ID, - STRING_PTR_DEVICE_ID, - STRING_DEVICE_ID - -} DEVICE_ID_TYPE; +#define DEVICE_ID_LENGTH 0x09 typedef struct { - DEVICE_ID_TYPE type; - union - { - u32 number; - NATIVE_CHAR *string_ptr; - NATIVE_CHAR buffer[9]; - } data; + NATIVE_CHAR buffer[DEVICE_ID_LENGTH]; } DEVICE_ID; diff --git a/drivers/acpi/include/acmacros.h b/drivers/acpi/include/acmacros.h index a1e58d1d3..19cfa0591 100644 --- a/drivers/acpi/include/acmacros.h +++ b/drivers/acpi/include/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 48 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -63,6 +63,15 @@ #define HI_LIMIT(b) ((u8) (((b) & 0x00FF0000) >> 16)) +#ifdef _IA16 +#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 +#define ACPI_GET_ADDRESS(a) (a) +#define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) +#define ACPI_VALID_ADDRESS(a) (a) +#endif /* * Extract a byte of data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below @@ -128,6 +137,11 @@ #define MUL_16(a) _MUL(a,4) #define MOD_16(a) _MOD(a,16) +/* + * Divide and Modulo + */ +#define ACPI_DIVIDE(n,d) ((n) / (d)) +#define ACPI_MODULO(n,d) ((n) % (d)) /* * Rounding macros (Power of two boundaries only) @@ -137,17 +151,42 @@ #define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1))) #define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4) +#define ROUND_DOWN_TO_64_BITS(a) ROUND_DOWN(a,8) #define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) #define ROUND_UP_TO_32_bITS(a) ROUND_UP(a,4) +#define ROUND_UP_TO_64_bITS(a) ROUND_UP(a,8) #define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) +#define ROUND_PTR_UP_TO_4(a,b) ((b *)(((NATIVE_UINT)(a) + 3) & ~3)) +#define ROUND_PTR_UP_TO_8(a,b) ((b *)(((NATIVE_UINT)(a) + 7) & ~7)) + +#define ROUND_UP_TO_1_k(a) (((a) + 1023) >> 10) #ifdef DEBUG_ASSERT #undef DEBUG_ASSERT #endif +/* Macros for GAS addressing */ + +#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)) + +#else +#define ACPI_PCI_REGISTER(a) (u32) (((a) & 0x0000FFFF)) +#define ACPI_PCI_DEVFUN(a) (u32) ((((a) & 0xFFFF0000) >> 16)) + +#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 @@ -216,14 +255,16 @@ #define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) #define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) -#define GET_CURRENT_ARG_TYPE(list) (list & 0x1F) -#define INCREMENT_ARG_LIST(list) (list >>= ARG_TYPE_WIDTH) +#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) +#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) /* * Reporting macros that are never compiled out */ +#define PARAM_LIST(pl) pl + /* * Error reporting. These versions add callers module and line#. Since * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only @@ -232,23 +273,32 @@ #ifdef ACPI_DEBUG -#define REPORT_INFO(a) _report_info(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define REPORT_ERROR(a) _report_error(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define REPORT_WARNING(a) _report_warning(_THIS_MODULE,__LINE__,_COMPONENT,a) +#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);} #else -#define REPORT_INFO(a) _report_info("",__LINE__,_COMPONENT,a) -#define REPORT_ERROR(a) _report_error("",__LINE__,_COMPONENT,a) -#define REPORT_WARNING(a) _report_warning("",__LINE__,_COMPONENT,a) +#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);} #endif /* Error reporting. These versions pass thru the module and line# */ -#define _REPORT_INFO(a,b,c,d) _report_info(a,b,c,d) -#define _REPORT_ERROR(a,b,c,d) _report_error(a,b,c,d) -#define _REPORT_WARNING(a,b,c,d) _report_warning(a,b,c,d) +#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 */ @@ -269,7 +319,7 @@ */ #define FUNCTION_TRACE(a) char * _proc_name = a;\ - function_trace(_THIS_MODULE,__LINE__,_COMPONENT,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;\ @@ -291,7 +341,7 @@ /* Conditional execution */ -#define DEBUG_EXEC(a) a; +#define DEBUG_EXEC(a) a #define NORMAL_EXEC(a) #define DEBUG_DEFINE(a) a; @@ -329,8 +379,6 @@ * */ -#define PARAM_LIST(pl) pl - #define TEST_DEBUG_SWITCH(lvl) if (((lvl) & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)) #define DEBUG_PRINT(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ @@ -398,7 +446,7 @@ * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not. */ #ifdef ENABLE_DEBUGGER -#define DEBUGGER_EXEC(a) a; +#define DEBUGGER_EXEC(a) a #else #define DEBUGGER_EXEC(a) #endif @@ -412,7 +460,7 @@ #undef DEBUG_ONLY_MEMBERS #define DEBUG_ONLY_MEMBERS(a) #undef OP_INFO_ENTRY -#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs} +#define OP_INFO_ENTRY(flags,name,Pargs,Iargs) {flags,Pargs,Iargs} #endif @@ -432,4 +480,5 @@ #endif + #endif /* ACMACROS_H */ diff --git a/drivers/acpi/include/acnamesp.h b/drivers/acpi/include/acnamesp.h index 696a554ce..e010a8118 100644 --- a/drivers/acpi/include/acnamesp.h +++ b/drivers/acpi/include/acnamesp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 94 $ + * $Revision: 100 $ * *****************************************************************************/ @@ -56,12 +56,43 @@ #define NS_SEARCH_PARENT 0x01 #define NS_DONT_OPEN_SCOPE 0x02 #define NS_NO_PEER_SEARCH 0x04 +#define NS_ERROR_IF_FOUND 0x08 #define NS_WALK_UNLOCK TRUE #define NS_WALK_NO_UNLOCK FALSE ACPI_STATUS +acpi_ns_load_namespace ( + void); + +ACPI_STATUS +acpi_ns_initialize_objects ( + void); + +ACPI_STATUS +acpi_ns_initialize_devices ( + u32 flags); + + +/* Namespace init - nsxfinit */ + +ACPI_STATUS +acpi_ns_init_one_device ( + ACPI_HANDLE obj_handle, + u32 nesting_level, + void *context, + void **return_value); + +ACPI_STATUS +acpi_ns_init_one_object ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + + +ACPI_STATUS acpi_ns_walk_namespace ( OBJECT_TYPE_INTERNAL type, ACPI_HANDLE start_object, @@ -87,6 +118,11 @@ acpi_ns_delete_namespace_by_owner ( /* Namespace loading - nsload */ ACPI_STATUS +acpi_ns_one_complete_parse ( + u32 pass_number, + ACPI_TABLE_DESC *table_desc); + +ACPI_STATUS acpi_ns_parse_table ( ACPI_TABLE_DESC *table_desc, ACPI_NAMESPACE_NODE *scope); @@ -320,10 +356,6 @@ acpi_ns_search_node ( OBJECT_TYPE_INTERNAL type, ACPI_NAMESPACE_NODE **ret_node); -ACPI_NAMESPACE_NODE * -acpi_ns_create_node ( - u32 acpi_name); - void acpi_ns_install_node ( ACPI_WALK_STATE *walk_state, diff --git a/drivers/acpi/include/acobject.h b/drivers/acpi/include/acobject.h index aeb8f201a..c801ff117 100644 --- a/drivers/acpi/include/acobject.h +++ b/drivers/acpi/include/acobject.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 71 $ + * $Revision: 75 $ * *****************************************************************************/ @@ -58,7 +58,7 @@ */ -#define ACPI_OBJECT_COMMON_HEADER /* Two 32-bit fields, one pointer, 8-bit flag */\ +#define ACPI_OBJECT_COMMON_HEADER /* 32-bits plus 8-bit flag */\ u8 data_type; /* To differentiate various internal objs */\ u8 type; /* ACPI_OBJECT_TYPE */\ u16 reference_count; /* For object deletion management */\ @@ -74,7 +74,7 @@ /* * Common bitfield for the field objects */ -#define ACPI_COMMON_FIELD_INFO /* Three 32-bit values */\ +#define ACPI_COMMON_FIELD_INFO /* Three 32-bit values plus 8*/\ u8 granularity;\ u16 length; \ u32 offset; /* Byte offset within containing object */\ @@ -111,7 +111,7 @@ typedef struct /* NUMBER - has value */ { ACPI_OBJECT_COMMON_HEADER - u32 value; + ACPI_INTEGER value; } ACPI_OBJECT_NUMBER; @@ -155,8 +155,9 @@ typedef struct /* FIELD UNIT */ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 sequence; /* Container's sequence number */ + union acpi_operand_obj *extra; /* Pointer to executable AML (in field definition) */ + ACPI_NAMESPACE_NODE *node; /* containing object */ union acpi_operand_obj *container; /* Containing object (Buffer) */ } ACPI_OBJECT_FIELD_UNIT; @@ -218,16 +219,10 @@ typedef struct /* REGION */ u8 space_id; u32 length; - u32 address; - void *region_context; /* Region Specific data (Handler->Context - optional things like PCI _ADR) */ - - /* TBD: [Restructure] This field can go away when Pass3 is implemented */ - union acpi_operand_obj *method; /* Associated control method */ - + ACPI_PHYSICAL_ADDRESS address; + union acpi_operand_obj *extra; /* Pointer to executable AML (in region definition) */ union acpi_operand_obj *addr_handler; /* Handler for system notifies */ - ACPI_NAMESPACE_NODE *REGmethod; /* _REG method for this region (if any) */ ACPI_NAMESPACE_NODE *node; /* containing object */ union acpi_operand_obj *next; @@ -372,6 +367,27 @@ typedef struct /* Reference - Local object type */ } ACPI_OBJECT_REFERENCE; +/* + * Extra object is used as additional storage for types that + * have AML code in their declarations (Term_args) that must be + * evaluated at run time. + * + * Currently: Region and Field_unit types + */ + +typedef struct /* EXTRA */ +{ + ACPI_OBJECT_COMMON_HEADER + u8 byte_fill1; + u16 word_fill1; + u32 pcode_length; + u8 *pcode; + ACPI_NAMESPACE_NODE *method_REG; /* _REG method for this region (if any) */ + void *region_context; /* Region-specific data */ + +} ACPI_OBJECT_EXTRA; + + /****************************************************************************** * * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above @@ -401,6 +417,7 @@ typedef union acpi_operand_obj ACPI_OBJECT_REFERENCE reference; ACPI_OBJECT_NOTIFY_HANDLER notify_handler; ACPI_OBJECT_ADDR_HANDLER addr_handler; + ACPI_OBJECT_EXTRA extra; } ACPI_OPERAND_OBJECT; diff --git a/drivers/acpi/include/acoutput.h b/drivers/acpi/include/acoutput.h index c9983c8f7..664a5f8a8 100644 --- a/drivers/acpi/include/acoutput.h +++ b/drivers/acpi/include/acoutput.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 63 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -60,6 +60,8 @@ #define DEBUGGER 0x00100000 #define ALL_COMPONENTS 0x001FFFFF +#define COMPONENT_DEFAULT (ALL_COMPONENTS) + /* Exception level -- used in the global "Debug_level" */ @@ -104,12 +106,12 @@ #define VERBOSE_TABLES 0x40000000 #define VERBOSE_EVENTS 0x80000000 -#define VERBOSE_ALL 0x70000000 +#define VERBOSE_ALL 0xF0000000 /* Defaults for Debug_level, debug and normal */ -#define DEBUG_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT | TRACE_TABLES | TRACE_IO) +#define DEBUG_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT) #define NORMAL_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT) #define DEBUG_ALL (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL) diff --git a/drivers/acpi/include/acparser.h b/drivers/acpi/include/acparser.h index 0f3271d6f..d657749da 100644 --- a/drivers/acpi/include/acparser.h +++ b/drivers/acpi/include/acparser.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 46 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -188,7 +188,8 @@ void acpi_ps_pop_scope ( ACPI_PARSE_STATE *parser_state, ACPI_PARSE_OBJECT **op, - u32 *arg_list); + u32 *arg_list, + u32 *arg_count); ACPI_STATUS acpi_ps_push_scope ( diff --git a/drivers/acpi/include/acpiosxf.h b/drivers/acpi/include/acpiosxf.h index d589ae93d..2f9eb4c13 100644 --- a/drivers/acpi/include/acpiosxf.h +++ b/drivers/acpi/include/acpiosxf.h @@ -1,9 +1,9 @@ /****************************************************************************** * - * Name: acpiosd.h - All interfaces to the OS-dependent layer. These - * interfaces must be implemented by the OS-dependent - * front-end to the ACPI subsystem. + * Name: acpiosxf.h - All interfaces to the OS-dependent layer. These + * interfaces must be implemented by the OS-dependent + * front-end to the ACPI subsystem. * *****************************************************************************/ @@ -35,10 +35,10 @@ /* Priorities for Acpi_os_queue_for_execution */ -#define OSD_PRIORITY_HIGH 1 -#define OSD_PRIORITY_MED 2 -#define OSD_PRIORITY_LO 3 -#define OSD_PRIORITY_GPE OSD_PRIORITY_HIGH +#define OSD_PRIORITY_GPE 1 +#define OSD_PRIORITY_HIGH 2 +#define OSD_PRIORITY_MED 3 +#define OSD_PRIORITY_LO 4 #define ACPI_NO_UNIT_LIMIT ((u32) -1) #define ACPI_MUTEX_SEM 1 @@ -112,7 +112,7 @@ acpi_os_free ( ACPI_STATUS acpi_os_map_memory ( - void *physical_address, + ACPI_PHYSICAL_ADDRESS physical_address, u32 length, void **logical_address); @@ -189,6 +189,37 @@ acpi_os_out32 ( ACPI_IO_ADDRESS out_port, u32 value); +/* + * Platform/Hardware independent physical memory interfaces + */ + +u8 +acpi_os_mem_in8 ( + ACPI_PHYSICAL_ADDRESS in_addr); + +u16 +acpi_os_mem_in16 ( + ACPI_PHYSICAL_ADDRESS in_addr); + +u32 +acpi_os_mem_in32 ( + ACPI_PHYSICAL_ADDRESS in_addr); + +void +acpi_os_mem_out8 ( + ACPI_PHYSICAL_ADDRESS out_addr, + u8 value); + +void +acpi_os_mem_out16 ( + ACPI_PHYSICAL_ADDRESS out_addr, + u16 value); + +void +acpi_os_mem_out32 ( + ACPI_PHYSICAL_ADDRESS out_addr, + u32 value); + /* * Standard access to PCI configuration space diff --git a/drivers/acpi/include/acpixf.h b/drivers/acpi/include/acpixf.h index ca2afbae5..d70fa75a7 100644 --- a/drivers/acpi/include/acpixf.h +++ b/drivers/acpi/include/acpixf.h @@ -1,7 +1,7 @@ /****************************************************************************** * - * Name: acxface.h - External interfaces to the ACPI subsystem + * Name: acpixf.h - External interfaces to the ACPI subsystem * *****************************************************************************/ @@ -35,8 +35,12 @@ */ ACPI_STATUS -acpi_initialize ( - ACPI_INIT_DATA *init_data); +acpi_initialize_subsystem ( + void); + +ACPI_STATUS +acpi_enable_subsystem ( + u32 flags); ACPI_STATUS acpi_terminate ( @@ -65,8 +69,12 @@ acpi_format_exception ( */ ACPI_STATUS -acpi_load_firmware_tables ( - void); +acpi_find_root_pointer ( + ACPI_PHYSICAL_ADDRESS *rsdp_physical_address); + +ACPI_STATUS +acpi_load_tables ( + ACPI_PHYSICAL_ADDRESS rsdp_physical_address); ACPI_STATUS acpi_load_table ( @@ -94,10 +102,6 @@ acpi_get_table ( */ ACPI_STATUS -acpi_load_namespace ( - void); - -ACPI_STATUS acpi_walk_namespace ( ACPI_OBJECT_TYPE type, ACPI_HANDLE start_object, @@ -107,6 +111,13 @@ acpi_walk_namespace ( void * *return_value); ACPI_STATUS +acpi_get_devices ( + NATIVE_CHAR *HID, + WALK_CALLBACK user_function, + void *context, + void **return_value); + +ACPI_STATUS acpi_get_name ( ACPI_HANDLE handle, u32 name_type, @@ -203,6 +214,14 @@ acpi_install_gpe_handler ( void *context); ACPI_STATUS +acpi_acquire_global_lock ( + void); + +ACPI_STATUS +acpi_release_global_lock ( + void); + +ACPI_STATUS acpi_remove_gpe_handler ( u32 gpe_number, GPE_HANDLER handler); @@ -259,11 +278,11 @@ acpi_get_irq_routing_table ( ACPI_STATUS acpi_set_firmware_waking_vector ( - void *physical_address); + ACPI_PHYSICAL_ADDRESS physical_address); ACPI_STATUS acpi_get_firmware_waking_vector ( - void **physical_address); + ACPI_PHYSICAL_ADDRESS *physical_address); ACPI_STATUS acpi_get_processor_throttling_info ( diff --git a/drivers/acpi/include/actables.h b/drivers/acpi/include/actables.h index abc83c778..4dd724517 100644 --- a/drivers/acpi/include/actables.h +++ b/drivers/acpi/include/actables.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 20 $ + * $Revision: 27 $ * *****************************************************************************/ @@ -37,19 +37,26 @@ acpi_tb_handle_to_object ( u16 table_id, ACPI_TABLE_DESC **table_desc); - /* - * Acpi_tbfac - FACP, FACS utilities + * tbconvrt - Table conversion routines */ ACPI_STATUS -acpi_tb_get_table_facs ( - ACPI_TABLE_HEADER *buffer_ptr, +acpi_tb_convert_to_xsdt ( + ACPI_TABLE_DESC *table_info, + u32 *number_of_tables); + +ACPI_STATUS +acpi_tb_convert_table_fadt ( + void); + +ACPI_STATUS +acpi_tb_build_common_facs ( ACPI_TABLE_DESC *table_info); /* - * Acpi_tbget - Table "get" routines + * tbget - Table "get" routines */ ACPI_STATUS @@ -60,13 +67,22 @@ acpi_tb_get_table_ptr ( ACPI_STATUS acpi_tb_get_table ( - void *physical_address, + ACPI_PHYSICAL_ADDRESS physical_address, + ACPI_TABLE_HEADER *buffer_ptr, + ACPI_TABLE_DESC *table_info); + +ACPI_STATUS +acpi_tb_verify_rsdp ( + ACPI_PHYSICAL_ADDRESS RSDP_physical_address); + +ACPI_STATUS +acpi_tb_get_table_facs ( ACPI_TABLE_HEADER *buffer_ptr, ACPI_TABLE_DESC *table_info); /* - * Acpi_tbgetall - Get all firmware ACPI tables + * tbgetall - Get all firmware ACPI tables */ ACPI_STATUS @@ -76,7 +92,7 @@ acpi_tb_get_all_tables ( /* - * Acpi_tbinstall - Table installation + * tbinstall - Table installation */ ACPI_STATUS @@ -96,7 +112,7 @@ acpi_tb_init_table_descriptor ( /* - * Acpi_tbremove - Table removal and deletion + * tbremove - Table removal and deletion */ void @@ -107,17 +123,21 @@ void acpi_tb_delete_acpi_table ( ACPI_TABLE_TYPE type); -ACPI_TABLE_DESC * +void acpi_tb_delete_single_table ( ACPI_TABLE_DESC *table_desc); +ACPI_TABLE_DESC * +acpi_tb_uninstall_table ( + ACPI_TABLE_DESC *table_desc); + void acpi_tb_free_acpi_tables_of_type ( ACPI_TABLE_DESC *table_info); /* - * Acpi_tbrsd - RSDP, RSDT utilities + * tbrsd - RSDP, RSDT utilities */ ACPI_STATUS @@ -135,7 +155,7 @@ acpi_tb_find_rsdp ( /* - * Acpi_tbutils - common table utilities + * tbutils - common table utilities */ u8 @@ -144,7 +164,7 @@ acpi_tb_system_table_pointer ( ACPI_STATUS acpi_tb_map_acpi_table ( - void *physical_address, + ACPI_PHYSICAL_ADDRESS physical_address, u32 *size, void **logical_address); diff --git a/drivers/acpi/include/actbl.h b/drivers/acpi/include/actbl.h index fd1f6615a..34631e820 100644 --- a/drivers/acpi/include/actbl.h +++ b/drivers/acpi/include/actbl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl.h - Table data structures defined in ACPI specification - * $Revision: 34 $ + * $Revision: 43 $ * *****************************************************************************/ @@ -31,32 +31,47 @@ * Values for description table header signatures */ -#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ -#define APIC_SIG "APIC" /* Multiple APIC Description Table */ -#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ -#define FACP_SIG "FACP" /* Fixed ACPI Description Table */ -#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ -#define PSDT_SIG "PSDT" /* Persistent System Description Table */ -#define RSDT_SIG "RSDT" /* Root System Description Table */ -#define SSDT_SIG "SSDT" /* Secondary System Description Table */ -#define SBST_SIG "SBST" /* Smart Battery Specification Table */ -#define BOOT_SIG "BOOT" /* Boot table */ +#define RSDP_NAME "RSDP" +#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ +#define APIC_SIG "APIC" /* Multiple APIC Description Table */ +#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ +#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ +#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ +#define PSDT_SIG "PSDT" /* Persistent System Description Table */ +#define RSDT_SIG "RSDT" /* Root System Description Table */ +#define XSDT_SIG "XSDT" /* Extended System Description Table */ +#define SSDT_SIG "SSDT" /* Secondary System Description Table */ +#define SBST_SIG "SBST" /* Smart Battery Specification Table */ +#define SPIC_SIG "SPIC" /* iosapic table */ +#define BOOT_SIG "BOOT" /* Boot table */ -#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ +#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ /* values of Mapic.Model */ -#define DUAL_PIC 0 -#define MULTIPLE_APIC 1 +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 /* values of Type in APIC_HEADER */ -#define APIC_PROC 0 -#define APIC_IO 1 +#define APIC_PROC 0 +#define APIC_IO 1 /* + * Common table types. The base code can remain + * constant if the underlying tables are changed + */ +#define RSDT_DESCRIPTOR RSDT_DESCRIPTOR_REV2 +#define XSDT_DESCRIPTOR XSDT_DESCRIPTOR_REV2 +#define FACS_DESCRIPTOR FACS_DESCRIPTOR_REV2 +#define FADT_DESCRIPTOR FADT_DESCRIPTOR_REV2 + + +#pragma pack(1) + +/* * Architecture-independent tables * The architecture dependent tables are in separate files */ @@ -66,10 +81,14 @@ typedef struct /* Root System Descriptor Pointer */ NATIVE_CHAR signature [8]; /* contains "RSD PTR " */ u8 checksum; /* to make sum of struct == 0 */ NATIVE_CHAR oem_id [6]; /* OEM identification */ - u8 reserved; /* reserved - must be zero */ - u32 rsdt_physical_address; /* physical address of RSDT */ + 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 */ + UINT64 xsdt_physical_address; /* 64-bit physical address of XSDT */ + u8 extended_checksum; /* Checksum of entire table */ + NATIVE_CHAR reserved [3]; /* reserved field must be 0 */ -} ROOT_SYSTEM_DESCRIPTOR_POINTER; +} RSDP_DESCRIPTOR; typedef struct /* ACPI common table header */ @@ -88,6 +107,15 @@ typedef struct /* ACPI common table header */ } ACPI_TABLE_HEADER; +typedef struct /* Common FACS for internal use */ +{ + u32 *global_lock; + UINT64 *firmware_waking_vector; + u8 vector_width; + +} ACPI_COMMON_FACS; + + typedef struct /* APIC Table */ { ACPI_TABLE_HEADER header; /* table header */ @@ -146,6 +174,9 @@ typedef struct /* Smart Battery Description Table */ } SMART_BATTERY_DESCRIPTION_TABLE; +#pragma pack() + + /* * ACPI Table information. We save the table address, length, * and type of memory allocation (mapped or allocated) for each @@ -175,16 +206,12 @@ typedef struct _acpi_table_support } ACPI_TABLE_SUPPORT; - /* * Get the architecture-specific tables */ -#ifdef IA64 -#include "actbl64.h" -#else -#include "actbl32.h" -#endif - +#include "actbl1.h" /* Acpi 1.0 table defintions */ +#include "actbl71.h" /* Acpi 0.71 IA-64 Extension table defintions */ +#include "actbl2.h" /* Acpi 2.0 table definitions */ #endif /* __ACTBL_H__ */ diff --git a/drivers/acpi/include/actbl32.h b/drivers/acpi/include/actbl1.h index 3c602293f..019ba1680 100644 --- a/drivers/acpi/include/actbl32.h +++ b/drivers/acpi/include/actbl1.h @@ -1,7 +1,7 @@ /****************************************************************************** * - * Name: actbl32.h - ACPI tables specific to IA32 - * $Revision: 11 $ + * Name: actbl1.h - ACPI 1.0 tables + * $Revision: 15 $ * *****************************************************************************/ @@ -23,22 +23,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __ACTBL32_H__ -#define __ACTBL32_H__ +#ifndef __ACTBL1_H__ +#define __ACTBL1_H__ +#pragma pack(1) -/* IA32 Root System Description Table */ - +/*************************************/ +/* ACPI Specification Rev 1.0 for */ +/* the Root System Description Table */ +/*************************************/ typedef struct { ACPI_TABLE_HEADER header; /* Table header */ - void *table_offset_entry [1]; /* Array of pointers to other */ - /* tables' headers */ -} ROOT_SYSTEM_DESCRIPTION_TABLE; - + u32 table_offset_entry [1]; /* Array of pointers to other */ + /* ACPI tables */ +} RSDT_DESCRIPTOR_REV1; -/* IA32 Firmware ACPI Control Structure */ +/***************************************/ +/* ACPI Specification Rev 1.0 for */ +/* the Firmware ACPI Control Structure */ +/***************************************/ typedef struct { NATIVE_CHAR signature[4]; /* signature "FACS" */ @@ -50,32 +55,34 @@ typedef struct u32 reserved1 : 31; /* must be 0 */ u8 resverved3 [40]; /* reserved - must be zero */ -} FIRMWARE_ACPI_CONTROL_STRUCTURE; - +} FACS_DESCRIPTOR_REV1; -/* IA32 Fixed ACPI Description Table */ +/************************************/ +/* ACPI Specification Rev 1.0 for */ +/* the Fixed ACPI Description Table */ +/************************************/ typedef struct { ACPI_TABLE_HEADER header; /* table header */ - ACPI_TBLPTR firmware_ctrl; /* Physical address of FACS */ - ACPI_TBLPTR dsdt; /* Physical address of DSDT */ + u32 firmware_ctrl; /* Physical address of FACS */ + u32 dsdt; /* Physical address of DSDT */ u8 model; /* System Interrupt Model */ u8 reserved1; /* reserved */ u16 sci_int; /* System vector of SCI interrupt */ - ACPI_IO_ADDRESS smi_cmd; /* Port address of SMI command port */ + 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 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */ u8 reserved2; /* reserved - must be zero */ - ACPI_IO_ADDRESS pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */ - ACPI_IO_ADDRESS pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */ - ACPI_IO_ADDRESS pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ - ACPI_IO_ADDRESS pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ - ACPI_IO_ADDRESS pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ - ACPI_IO_ADDRESS pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - ACPI_IO_ADDRESS gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */ - ACPI_IO_ADDRESS gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */ + 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 */ + u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + u32 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */ + u32 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */ u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ @@ -107,9 +114,10 @@ typedef struct u32 tmr_val_ext : 1; /* tmr_val is 32 bits */ u32 reserved5 : 23; /* reserved - must be zero */ -} FIXED_ACPI_DESCRIPTION_TABLE; +} FADT_DESCRIPTOR_REV1; +#pragma pack() -#endif /* __ACTBL32_H__ */ +#endif /* __ACTBL1_H__ */ diff --git a/drivers/acpi/include/actbl2.h b/drivers/acpi/include/actbl2.h new file mode 100644 index 000000000..e3ccf2188 --- /dev/null +++ b/drivers/acpi/include/actbl2.h @@ -0,0 +1,189 @@ +/****************************************************************************** + * + * Name: actbl2.h - ACPI Specification Revision 2.0 Tables + * $Revision: 19 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __ACTBL2_H__ +#define __ACTBL2_H__ + +/**************************************/ +/* Prefered Power Management Profiles */ +/**************************************/ +#define PM_UNSPECIFIED 0 +#define PM_DESKTOP 1 +#define PM_MOBILE 2 +#define PM_WORKSTATION 3 +#define PM_ENTERPRISE_SERVER 4 +#define PM_SOHO_SERVER 5 +#define PM_APPLIANCE_PC 6 + +/*********************************************/ +/* ACPI Boot Arch Flags, See spec Table 5-10 */ +/*********************************************/ +#define BAF_LEGACY_DEVICES 0x0001 +#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 + +#define FADT2_REVISION_ID 3 + +#pragma pack(1) + +/*************************************/ +/* ACPI Specification Rev 2.0 for */ +/* the Root System Description Table */ +/*************************************/ +typedef struct +{ + ACPI_TABLE_HEADER header; /* Table header */ + u32 table_offset_entry [1]; /* Array of pointers to */ + /* other tables' headers */ +} RSDT_DESCRIPTOR_REV2; + + +/********************************************/ +/* ACPI Specification Rev 2.0 for the */ +/* Extended System Description Table (XSDT) */ +/********************************************/ +typedef struct +{ + ACPI_TABLE_HEADER header; /* Table header */ + UINT64 table_offset_entry [1]; /* Array of pointers to */ + /* other tables' headers */ +} XSDT_DESCRIPTOR_REV2; + +/***************************************/ +/* ACPI Specification Rev 2.0 for */ +/* the Firmware ACPI Control Structure */ +/***************************************/ +typedef struct +{ + NATIVE_CHAR signature[4]; /* signature "FACS" */ + 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 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ + u32 S4_bios_f : 1; /* Indicates if S4_bIOS support is present */ + u32 reserved1 : 31; /* must be 0 */ + UINT64 Xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */ + u8 version; /* Version of this table */ + u8 reserved3 [31]; /* reserved - must be zero */ + +} FACS_DESCRIPTOR_REV2; + + +/***************************************/ +/* ACPI Specification Rev 2.0 for */ +/* the Generic Address Structure (GAS) */ +/***************************************/ +typedef struct +{ + u8 address_space_id; /* Address space where struct or register exists. */ + u8 register_bit_width; /* Size in bits of given register */ + u8 register_bit_offset; /* Bit offset within the register */ + u8 reserved; /* Must be 0 */ + UINT64 address; /* 64-bit address of struct or register */ + +} ACPI_GAS; + + +/************************************/ +/* ACPI Specification Rev 2.0 for */ +/* the Fixed ACPI Description Table */ +/************************************/ +typedef struct +{ + ACPI_TABLE_HEADER header; /* table header */ + u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ + u32 V1_dsdt; /* 32-bit physical address of DSDT */ + u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ + u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ + 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 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */ + u8 pstate_cnt; /* processor performance state control*/ + u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */ + u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */ + u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ + u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + u32 V1_gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */ + u32 V1_gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */ + u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ + u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ + u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ + u8 gpe0blk_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 cst_cnt; /* Support for the _CST object and C States change notification.*/ + 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; /* number of flush strides that need to be read */ + u16 flush_stride; /* Processor's memory cache line width, in bytes */ + u8 duty_offset; /* Processor’s duty cycle index in processor's P_CNT reg*/ + u8 duty_width; /* Processor’s duty cycle value bit width in P_CNT register.*/ + 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 */ + u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ + u8 reserved2; /* reserved */ + u32 wb_invd : 1; /* wbinvd instruction works properly */ + u32 wb_invd_flush : 1; /* 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; /* tmr_val is 32 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. */ + u32 reserved6 : 18; /* reserved - must be zero */ + + ACPI_GAS 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 */ + UINT64 Xfirmware_ctrl; /* 64-bit physical address of FACS */ + UINT64 Xdsdt; /* 64-bit physical address of DSDT */ + ACPI_GAS Xpm1a_evt_blk; /* Extended Power Mgt 1a Acpi_event Reg Blk address */ + ACPI_GAS Xpm1b_evt_blk; /* Extended Power Mgt 1b Acpi_event Reg Blk address */ + ACPI_GAS Xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ + ACPI_GAS Xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ + ACPI_GAS Xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ + ACPI_GAS Xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ + ACPI_GAS Xgpe0blk; /* Extended General Purpose Acpi_event 0 Reg Blk address */ + ACPI_GAS Xgpe1_blk; /* Extended General Purpose Acpi_event 1 Reg Blk address */ + +} FADT_DESCRIPTOR_REV2; + + +#pragma pack() + +#endif /* __ACTBL2_H__ */ + diff --git a/drivers/acpi/include/actbl64.h b/drivers/acpi/include/actbl64.h deleted file mode 100644 index fea6d134d..000000000 --- a/drivers/acpi/include/actbl64.h +++ /dev/null @@ -1,115 +0,0 @@ -/****************************************************************************** - * - * Name: actbl64.h - ACPI tables specific to IA64 - * $Revision: 12 $ - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ACTBL64_H__ -#define __ACTBL64_H__ - - -typedef UINT64 IO_ADDRESS; /* Only for clarity in declarations */ - - -/* IA64 Root System Description Table */ - -typedef struct -{ - ACPI_TABLE_HEADER header; /* Table header */ - u32 reserved_pad; /* IA64 alignment, must be 0 */ - void *table_offset_entry [1]; /* Array of pointers to other */ - /* tables' headers */ -} ROOT_SYSTEM_DESCRIPTION_TABLE; - - -/* IA64 Firmware ACPI Control Structure */ - -typedef struct -{ - NATIVE_CHAR signature[4]; /* signature "FACS" */ - u32 length; /* length of structure, in bytes */ - u32 hardware_signature; /* hardware configuration signature */ - u32 reserved4; /* must be 0 */ - UINT64 firmware_waking_vector; /* ACPI OS waking vector */ - UINT64 global_lock; /* Global Lock */ - u32 S4_bios_f : 1; /* Indicates if S4_bIOS support is present */ - u32 reserved1 : 31; /* must be 0 */ - u8 resverved3 [28]; /* reserved - must be zero */ - -} FIRMWARE_ACPI_CONTROL_STRUCTURE; - - -/* IA64 Fixed ACPI Description Table */ - -typedef struct -{ - ACPI_TABLE_HEADER header; /* table header */ - u32 reserved_pad; /* IA64 alignment, must be 0 */ - ACPI_TBLPTR firmware_ctrl; /* Physical address of FACS */ - ACPI_TBLPTR dsdt; /* Physical address of DSDT */ - u8 model; /* System Interrupt Model */ - u8 address_space; /* Address Space Bitmask */ - u16 sci_int; /* System vector of SCI interrupt */ - 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 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */ - u8 reserved2; /* reserved - must be zero */ - UINT64 smi_cmd; /* Port address of SMI command port */ - UINT64 pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */ - UINT64 pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */ - UINT64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ - UINT64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ - UINT64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ - UINT64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - UINT64 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */ - UINT64 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */ - u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ - u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ - u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ - u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ - u8 gpe0blk_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 */ - u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ - u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ - 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 */ - u32 flush_cash : 1; /* PAL_FLUSH_CACHE is correctly supported */ - u32 reserved5 : 1; /* reserved - must be zero */ - 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; /* tmr_val is 32 bits */ - u32 dock_cap : 1; /* Supports Docking */ - u32 reserved6 : 22; /* reserved - must be zero */ - -} FIXED_ACPI_DESCRIPTION_TABLE; - - -#endif /* __ACTBL64_H__ */ - diff --git a/drivers/acpi/include/actbl71.h b/drivers/acpi/include/actbl71.h new file mode 100644 index 000000000..408ec402e --- /dev/null +++ b/drivers/acpi/include/actbl71.h @@ -0,0 +1,144 @@ +/****************************************************************************** + * + * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71 + * This file includes tables specific to this + * specification revision. + * $Revision: 7 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __ACTBL71_H__ +#define __ACTBL71_H__ + +/* 0.71 FADT Address_space data item bitmasks defines */ +/* If the associated bit is zero then it is in memory space else in io space */ +#define SMI_CMD_ADDRESS_SPACE 0x01 +#define PM1_BLK_ADDRESS_SPACE 0x02 +#define PM2_CNT_BLK_ADDRESS_SPACE 0x04 +#define PM_TMR_BLK_ADDRESS_SPACE 0x08 +#define GPE0_BLK_ADDRESS_SPACE 0x10 +#define GPE1_BLK_ADDRESS_SPACE 0x20 + +/* Only for clarity in declarations */ +typedef UINT64 IO_ADDRESS; + +#pragma pack(1) + +typedef struct /* Root System Descriptor Pointer */ +{ + NATIVE_CHAR signature [8]; /* contains "RSD PTR " */ + u8 checksum; /* to make sum of struct == 0 */ + NATIVE_CHAR oem_id [6]; /* OEM identification */ + u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */ + UINT64 rsdt_physical_address; /* 64-bit physical address of RSDT */ +} RSDP_DESCRIPTOR_REV071; + + +/*****************************************/ +/* IA64 Extensions to ACPI Spec Rev 0.71 */ +/* for the Root System Description Table */ +/*****************************************/ +typedef struct +{ + ACPI_TABLE_HEADER header; /* Table header */ + u32 reserved_pad; /* IA64 alignment, must be 0 */ + UINT64 table_offset_entry [1]; /* Array of pointers to other */ + /* tables' headers */ +} RSDT_DESCRIPTOR_REV071; + + +/*******************************************/ +/* IA64 Extensions to ACPI Spec Rev 0.71 */ +/* for the Firmware ACPI Control Structure */ +/*******************************************/ +typedef struct +{ + NATIVE_CHAR signature[4]; /* signature "FACS" */ + u32 length; /* length of structure, in bytes */ + u32 hardware_signature; /* hardware configuration signature */ + u32 reserved4; /* must be 0 */ + UINT64 firmware_waking_vector; /* ACPI OS waking vector */ + UINT64 global_lock; /* Global Lock */ + u32 S4_bios_f : 1; /* Indicates if S4_bIOS support is present */ + u32 reserved1 : 31; /* must be 0 */ + u8 reserved3 [28]; /* reserved - must be zero */ + +} FACS_DESCRIPTOR_REV071; + + +/******************************************/ +/* IA64 Extensions to ACPI Spec Rev 0.71 */ +/* for the Fixed ACPI Description Table */ +/******************************************/ +typedef struct +{ + ACPI_TABLE_HEADER header; /* table header */ + u32 reserved_pad; /* IA64 alignment, must be 0 */ + UINT64 firmware_ctrl; /* 64-bit Physical address of FACS */ + UINT64 dsdt; /* 64-bit Physical address of DSDT */ + u8 model; /* System Interrupt Model */ + u8 address_space; /* Address Space Bitmask */ + u16 sci_int; /* System vector of SCI interrupt */ + 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 S4_bios_req; /* Value to write to SMI CMD to enter S4_bIOS state */ + u8 reserved2; /* reserved - must be zero */ + UINT64 smi_cmd; /* Port address of SMI command port */ + UINT64 pm1a_evt_blk; /* Port address of Power Mgt 1a Acpi_event Reg Blk */ + UINT64 pm1b_evt_blk; /* Port address of Power Mgt 1b Acpi_event Reg Blk */ + UINT64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ + UINT64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + UINT64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + UINT64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + UINT64 gpe0blk; /* Port addr of General Purpose Acpi_event 0 Reg Blk */ + UINT64 gpe1_blk; /* Port addr of General Purpose Acpi_event 1 Reg Blk */ + u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ + u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ + u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ + u8 gpe0blk_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 */ + u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ + u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ + 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 */ + u32 flush_cash : 1; /* PAL_FLUSH_CACHE is correctly supported */ + u32 reserved5 : 1; /* reserved - must be zero */ + 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; /* tmr_val is 32 bits */ + u32 dock_cap : 1; /* Supports Docking */ + u32 reserved6 : 22; /* reserved - must be zero */ + +} FADT_DESCRIPTOR_REV071; + +#pragma pack() + +#endif /* __ACTBL71_H__ */ + diff --git a/drivers/acpi/include/actypes.h b/drivers/acpi/include/actypes.h index e3ac5f299..dfa28a9d9 100644 --- a/drivers/acpi/include/actypes.h +++ b/drivers/acpi/include/actypes.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 131 $ + * $Revision: 159 $ * *****************************************************************************/ @@ -48,9 +48,6 @@ * UCHAR Character. 1 byte unsigned value. */ -#ifdef __ia64__ -#define _IA64 -#endif #ifdef _IA64 /* @@ -62,14 +59,14 @@ typedef unsigned char UCHAR; typedef unsigned short UINT16; typedef int INT32; typedef unsigned int UINT32; -typedef long INT64; -typedef unsigned long UINT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; typedef UINT64 NATIVE_UINT; typedef INT64 NATIVE_INT; typedef NATIVE_UINT ACPI_TBLPTR; typedef UINT64 ACPI_IO_ADDRESS; +typedef UINT64 ACPI_PHYSICAL_ADDRESS; #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 @@ -85,17 +82,32 @@ typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; typedef unsigned int UINT16; typedef long INT32; +typedef int INT16; typedef unsigned long UINT32; +typedef struct +{ + UINT32 Lo; + UINT32 Hi; + +} UINT64; + typedef UINT16 NATIVE_UINT; typedef INT16 NATIVE_INT; typedef UINT32 ACPI_TBLPTR; typedef UINT32 ACPI_IO_ADDRESS; +typedef void *ACPI_PHYSICAL_ADDRESS; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define _HW_ALIGNMENT_SUPPORT +/* + * (16-bit only) internal integers must be 32-bits, so + * 64-bit integers cannot be supported + */ +#define ACPI_NO_INTEGER64_SUPPORT + #else /* @@ -107,18 +119,21 @@ typedef unsigned char UCHAR; typedef unsigned short UINT16; typedef int INT32; typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_UINT64 UINT64; typedef UINT32 NATIVE_UINT; typedef INT32 NATIVE_INT; typedef NATIVE_UINT ACPI_TBLPTR; typedef UINT32 ACPI_IO_ADDRESS; +typedef UINT64 ACPI_PHYSICAL_ADDRESS; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 #define _HW_ALIGNMENT_SUPPORT - #endif + + /* * Miscellaneous common types */ @@ -132,8 +147,10 @@ typedef char NATIVE_CHAR; * Data type ranges */ -#define ACPI_UCHAR_MAX (UCHAR) 0xFF +#define ACPI_UINT8_MAX (UINT8) 0xFF +#define ACPI_UINT16_MAX (UINT16) 0xFFFF #define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF +#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF #ifdef DEFINE_ALTERNATE_TYPES @@ -144,6 +161,7 @@ typedef INT32 s32; typedef UINT8 u8; typedef UINT16 u16; typedef UINT32 u32; +typedef UINT64 u64; #endif /*! [End] no source code translation !*/ @@ -178,11 +196,50 @@ typedef void* ACPI_HANDLE; /* Actually a ptr to an /* + * Acpi integer width. In ACPI version 1, integers are + * 32 bits. In ACPI version 2, integers are 64 bits. + * Note that this pertains to the ACPI integer type only, not + * other integers used in the implementation of the ACPI CA + * subsystem. + */ +#ifdef ACPI_NO_INTEGER64_SUPPORT + +/* 32-bit integers only, no 64-bit support */ + +typedef u32 ACPI_INTEGER; +#define ACPI_INTEGER_MAX ACPI_UINT32_MAX +#define ACPI_INTEGER_BIT_SIZE 32 +#define ACPI_MAX_BCD_VALUE 99999999 +#define ACPI_MAX_BCD_DIGITS 8 + +#else + +/* 64-bit integers */ + +typedef UINT64 ACPI_INTEGER; +#define ACPI_INTEGER_MAX ACPI_UINT64_MAX +#define ACPI_INTEGER_BIT_SIZE 64 +#define ACPI_MAX_BCD_VALUE 9999999999999999 +#define ACPI_MAX_BCD_DIGITS 16 + +#endif + + +/* * Constants with special meanings */ #define ACPI_ROOT_OBJECT (ACPI_HANDLE)(-1) +#define ACPI_FULL_INITIALIZATION 0x00 +#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 +#define ACPI_NO_HARDWARE_INIT 0x02 +#define ACPI_NO_EVENT_INIT 0x04 +#define ACPI_NO_ACPI_ENABLE 0x08 +#define ACPI_NO_DEVICE_INIT 0x10 +#define ACPI_NO_PCI_INIT 0x20 +#define ACPI_NO_OBJECT_INIT 0x40 + /* * Sleep state constants @@ -204,17 +261,14 @@ typedef void* ACPI_HANDLE; /* Actually a ptr to an typedef u32 ACPI_TABLE_TYPE; #define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0 -#define ACPI_TABLE_APIC (ACPI_TABLE_TYPE) 1 -#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 2 -#define ACPI_TABLE_FACP (ACPI_TABLE_TYPE) 3 -#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 4 -#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 5 -#define ACPI_TABLE_RSDT (ACPI_TABLE_TYPE) 6 -#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 7 -#define ACPI_TABLE_SBST (ACPI_TABLE_TYPE) 8 -#define ACPI_TABLE_BOOT (ACPI_TABLE_TYPE) 9 -#define ACPI_TABLE_MAX 9 -#define NUM_ACPI_TABLES 10 +#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1 +#define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2 +#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3 +#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4 +#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5 +#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6 +#define ACPI_TABLE_MAX 6 +#define NUM_ACPI_TABLES (ACPI_TABLE_MAX+1) /* @@ -266,21 +320,22 @@ typedef u8 OBJECT_TYPE_INTERNAL; #define INTERNAL_TYPE_ALIAS 21 /* 0x15 */ #define INTERNAL_TYPE_NOTIFY 22 /* 0x16 */ #define INTERNAL_TYPE_ADDRESS_HANDLER 23 /* 0x17 */ +#define INTERNAL_TYPE_RESOURCE 24 /* 0x18 */ -#define INTERNAL_TYPE_NODE_MAX 23 + +#define INTERNAL_TYPE_NODE_MAX 24 /* These are pseudo-types because there are never any namespace nodes with these types */ -#define INTERNAL_TYPE_DEF_FIELD_DEFN 24 /* 0x18 Name, Byte_const, multiple Field_element */ -#define INTERNAL_TYPE_BANK_FIELD_DEFN 25 /* 0x19 2 Name,DWord_const,Byte_const,multi Field_element */ -#define INTERNAL_TYPE_INDEX_FIELD_DEFN 26 /* 0x1A 2 Name, Byte_const, multiple Field_element */ -#define INTERNAL_TYPE_IF 27 /* 0x1B Op_code, multiple Code */ -#define INTERNAL_TYPE_ELSE 28 /* 0x1C multiple Code */ -#define INTERNAL_TYPE_WHILE 29 /* 0x1D Op_code, multiple Code */ -#define INTERNAL_TYPE_SCOPE 30 /* 0x1E Name, multiple Node */ -#define INTERNAL_TYPE_DEF_ANY 31 /* 0x1F type is Any, suppress search of enclosing scopes */ -#define INTERNAL_TYPE_METHOD_ARGUMENT 32 /* 0x20 */ -#define INTERNAL_TYPE_METHOD_LOCAL_VAR 33 /* 0x21 */ +#define INTERNAL_TYPE_DEF_FIELD_DEFN 25 /* 0x19 Name, Byte_const, multiple Field_element */ +#define INTERNAL_TYPE_BANK_FIELD_DEFN 26 /* 0x1A 2 Name,DWord_const,Byte_const,multi Field_element */ +#define INTERNAL_TYPE_INDEX_FIELD_DEFN 27 /* 0x1B 2 Name, Byte_const, multiple Field_element */ +#define INTERNAL_TYPE_IF 28 /* 0x1C Op_code, multiple Code */ +#define INTERNAL_TYPE_ELSE 29 /* 0x1D multiple Code */ +#define INTERNAL_TYPE_WHILE 30 /* 0x1E Op_code, multiple Code */ +#define INTERNAL_TYPE_SCOPE 31 /* 0x1F Name, multiple Node */ +#define INTERNAL_TYPE_DEF_ANY 32 /* 0x20 type is Any, suppress search of enclosing scopes */ +#define INTERNAL_TYPE_EXTRA 33 /* 0x21 */ #define INTERNAL_TYPE_MAX 33 @@ -339,6 +394,7 @@ typedef u32 ACPI_EVENT_TYPE; */ typedef u32 ACPI_EVENT_STATUS; +#define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x02 @@ -354,13 +410,15 @@ typedef u32 ACPI_EVENT_STATUS; /* Address Space (Operation Region) Types */ -typedef u32 ACPI_ADDRESS_SPACE_TYPE; +typedef u8 ACPI_ADDRESS_SPACE_TYPE; #define ADDRESS_SPACE_SYSTEM_MEMORY (ACPI_ADDRESS_SPACE_TYPE) 0 #define ADDRESS_SPACE_SYSTEM_IO (ACPI_ADDRESS_SPACE_TYPE) 1 #define ADDRESS_SPACE_PCI_CONFIG (ACPI_ADDRESS_SPACE_TYPE) 2 #define ADDRESS_SPACE_EC (ACPI_ADDRESS_SPACE_TYPE) 3 #define ADDRESS_SPACE_SMBUS (ACPI_ADDRESS_SPACE_TYPE) 4 +#define ADDRESS_SPACE_CMOS (ACPI_ADDRESS_SPACE_TYPE) 5 +#define ADDRESS_SPACE_PCI_BAR_TARGET (ACPI_ADDRESS_SPACE_TYPE) 6 /* @@ -373,7 +431,7 @@ typedef union acpi_obj struct { ACPI_OBJECT_TYPE type; - u32 value; /* The actual number */ + ACPI_INTEGER value; /* The actual number */ } number; struct @@ -553,7 +611,7 @@ void (*NOTIFY_HANDLER) ( typedef ACPI_STATUS (*ADDRESS_SPACE_HANDLER) ( u32 function, - u32 address, + ACPI_PHYSICAL_ADDRESS address, u32 bit_width, u32 *value, void *handler_context, @@ -596,11 +654,8 @@ ACPI_STATUS (*WALK_CALLBACK) ( #define ACPI_COMMON_OBJ_INFO \ ACPI_OBJECT_TYPE type; /* ACPI object type */ \ - ACPI_NAME name; /* ACPI object Name */ \ - /* TBD: [Restructure] Do we want or need these next two??*/ \ - ACPI_HANDLE parent; /* Parent object */ \ - ACPI_HANDLE children; /* Linked list of children */ \ - u32 valid /* ????? */ + ACPI_NAME name /* ACPI object Name */ + typedef struct { @@ -612,12 +667,10 @@ typedef struct { ACPI_COMMON_OBJ_INFO; - /* - * TBD: [Restructure]: a HID or a _UID can return either a number or a string - */ + u32 valid; /* Are the next bits legit? */ NATIVE_CHAR hardware_id [9]; /* _HID value if any */ NATIVE_CHAR unique_id[9]; /* _UID value if any */ - u32 address; /* _ADR value if any */ + ACPI_INTEGER address; /* _ADR value if any */ u32 current_status; /* _STA value */ } ACPI_DEVICE_INFO; @@ -634,7 +687,7 @@ typedef struct typedef struct { - u8 *mapped_physical_address; + ACPI_PHYSICAL_ADDRESS mapped_physical_address; u8 *mapped_logical_address; u32 mapped_length; } MEM_HANDLER_CONTEXT; @@ -940,6 +993,8 @@ typedef struct _resource_tag #define RESOURCE_LENGTH 12 #define RESOURCE_LENGTH_NO_DATA 8 +#define NEXT_RESOURCE(res) (RESOURCE*)((u8*) res + res->length) + /* * END: Definitions for Resource Attributes */ @@ -949,7 +1004,7 @@ typedef struct _resource_tag */ typedef struct { - u32 address; + ACPI_INTEGER address; u32 pin; u32 source_index; NATIVE_CHAR source[1]; diff --git a/drivers/acpi/include/amlcode.h b/drivers/acpi/include/amlcode.h index 4c0b1a4b0..9a5cb2c52 100644 --- a/drivers/acpi/include/amlcode.h +++ b/drivers/acpi/include/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: 39 $ + * $Revision: 42 $ * *****************************************************************************/ @@ -42,9 +42,11 @@ #define AML_WORD_OP (u16) 0x0b #define AML_DWORD_OP (u16) 0x0c #define AML_STRING_OP (u16) 0x0d +#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */ #define AML_SCOPE_OP (u16) 0x10 #define AML_BUFFER_OP (u16) 0x11 #define AML_PACKAGE_OP (u16) 0x12 +#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */ #define AML_METHOD_OP (u16) 0x14 #define AML_DUAL_NAME_PREFIX (u16) 0x2e #define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f @@ -90,6 +92,8 @@ #define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81 #define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82 #define AML_DEREF_OF_OP (u16) 0x83 +#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */ +#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */ #define AML_NOTIFY_OP (u16) 0x86 #define AML_SIZE_OF_OP (u16) 0x87 #define AML_INDEX_OP (u16) 0x88 @@ -99,12 +103,21 @@ #define AML_BYTE_FIELD_OP (u16) 0x8c #define AML_BIT_FIELD_OP (u16) 0x8d #define AML_TYPE_OP (u16) 0x8e +#define AML_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ #define AML_LAND_OP (u16) 0x90 #define AML_LOR_OP (u16) 0x91 #define AML_LNOT_OP (u16) 0x92 #define AML_LEQUAL_OP (u16) 0x93 #define AML_LGREATER_OP (u16) 0x94 #define AML_LLESS_OP (u16) 0x95 +#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */ +#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */ +#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */ +#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */ +#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */ +#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */ +#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */ +#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */ #define AML_IF_OP (u16) 0xa0 #define AML_ELSE_OP (u16) 0xa1 #define AML_WHILE_OP (u16) 0xa2 @@ -125,6 +138,7 @@ #define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11 #define AML_COND_REF_OF_OP (u16) 0x5b12 #define AML_CREATE_FIELD_OP (u16) 0x5b13 +#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */ #define AML_LOAD_OP (u16) 0x5b20 #define AML_STALL_OP (u16) 0x5b21 #define AML_SLEEP_OP (u16) 0x5b22 @@ -147,6 +161,7 @@ #define AML_THERMAL_ZONE_OP (u16) 0x5b85 #define AML_INDEX_FIELD_OP (u16) 0x5b86 #define AML_BANK_FIELD_OP (u16) 0x5b87 +#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ /* Bogus opcodes (they are actually two separate opcodes) */ @@ -278,6 +293,21 @@ #define OPTYPE_BOGUS 22 +/* Predefined Operation Region Space_iDs */ + +typedef enum +{ + REGION_MEMORY = 0, + REGION_IO, + REGION_PCI_CONFIG, + REGION_EC, + REGION_SMBUS, + REGION_CMOS, + REGION_PCI_BAR + +} AML_REGION_TYPES; + + /* Comparison operation codes for Match_op operator */ typedef enum @@ -347,23 +377,15 @@ typedef enum /* Array sizes. Used for range checking also */ -#define NUM_REGION_TYPES 5 +#define NUM_REGION_TYPES 7 #define NUM_ACCESS_TYPES 7 #define NUM_UPDATE_RULES 3 #define NUM_MATCH_OPS 7 #define NUM_OPCODES 256 #define NUM_FIELD_NAMES 2 -/* External declarations of the AML tables */ - -extern u8 acpi_gbl_aml [NUM_OPCODES]; -extern u16 acpi_gbl_pfx [NUM_OPCODES]; -extern NATIVE_CHAR *acpi_gbl_region_types [NUM_REGION_TYPES]; -extern NATIVE_CHAR *acpi_gbl_match_ops [NUM_MATCH_OPS]; -extern NATIVE_CHAR *acpi_gbl_access_types [NUM_ACCESS_TYPES]; -extern NATIVE_CHAR *acpi_gbl_update_rules [NUM_UPDATE_RULES]; -extern NATIVE_CHAR *acpi_gbl_FEnames [NUM_FIELD_NAMES]; +#define USER_REGION_BEGIN 0x80 /* * AML tables @@ -371,61 +393,10 @@ extern NATIVE_CHAR *acpi_gbl_FEnames [NUM_FIELD_NAMES]; #ifdef DEFINE_AML_GLOBALS -/* Data used in keeping track of fields */ - -NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] = -{ - "skip", - "?access?" -}; /* FE = Field Element */ - - -/* Region type decoding */ - -NATIVE_CHAR *acpi_gbl_region_types[NUM_REGION_TYPES] = -{ - "System_memory", - "System_iO", - "PCIConfig", - "Embedded_control", - "SMBus" -}; - - -NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] = -{ - "Error", - "MTR", - "MEQ", - "MLE", - "MLT", - "MGE", - "MGT" -}; - - -/* Access type decoding */ - -NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] = -{ - "Any_acc", - "Byte_acc", - "Word_acc", - "DWord_acc", - "Block_acc", - "SMBSend_recv_acc", - "SMBQuick_acc" -}; - - -/* Update rule decoding */ +/* External declarations of the AML tables */ -NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] = -{ - "Preserve", - "Write_as_ones", - "Write_as_zeros" -}; +extern u8 acpi_gbl_aml [NUM_OPCODES]; +extern u16 acpi_gbl_pfx [NUM_OPCODES]; #endif /* DEFINE_AML_GLOBALS */ |