diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:12:20 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:12:20 -0400 |
commit | 165415f700b0c77fa1f8db6198f48582639adf78 (patch) | |
tree | 088e305b0b5b0c6753072e13be1177824c3ed59d /include | |
parent | c324b44c34050cf2a9b58830e11c974806bd85d8 (diff) | |
parent | 2f4ba45a75d6383b4a1201169a808ffea416ffa0 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'include')
317 files changed, 8665 insertions, 9244 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 2f6ab189fc6..427cff1a3f8 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -44,7 +44,6 @@ #ifndef _ACCONFIG_H #define _ACCONFIG_H - /****************************************************************************** * * Configuration options @@ -64,7 +63,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20050408 +#define ACPI_CA_VERSION 0x20050902 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -78,11 +77,10 @@ /* Maximum objects in the various object caches */ -#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ -#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ -#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ -#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ +#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ /* * Should the subystem abort the loading of an ACPI table if the @@ -90,7 +88,6 @@ */ #define ACPI_CHECKSUM_ABORT FALSE - /****************************************************************************** * * Subsystem Constants @@ -104,7 +101,7 @@ /* String size constants */ #define ACPI_MAX_STRING_LENGTH 512 -#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ +#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ /* Maximum count for a semaphore object */ @@ -118,7 +115,6 @@ #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 - /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) @@ -156,15 +152,15 @@ /* Names within the namespace are 4 bytes long */ #define ACPI_NAME_SIZE 4 -#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ +#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ #define ACPI_PATH_SEPARATOR '.' /* Constants used in searching for the RSDP in low memory */ -#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ +#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ #define ACPI_EBDA_PTR_LENGTH 2 #define ACPI_EBDA_WINDOW_SIZE 1024 -#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ +#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ #define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 #define ACPI_RSDP_SCAN_STEP 16 @@ -199,18 +195,15 @@ #define ACPI_NUM_OSI_STRINGS 10 - /****************************************************************************** * * ACPI AML Debugger * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ #define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' - -#endif /* _ACCONFIG_H */ - +#endif /* _ACCONFIG_H */ diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index 8ba372b0f24..70ce3b4d006 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -44,22 +44,17 @@ #ifndef __ACDEBUG_H__ #define __ACDEBUG_H__ - #define ACPI_DEBUG_BUFFER_SIZE 4196 -struct command_info -{ - char *name; /* Command Name */ - u8 min_args; /* Minimum arguments required */ +struct command_info { + char *name; /* Command Name */ + u8 min_args; /* Minimum arguments required */ }; - -struct argument_info -{ - char *name; /* Argument Name */ +struct argument_info { + char *name; /* Argument Name */ }; - #define PARAM_LIST(pl) pl #define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ @@ -68,275 +63,155 @@ struct argument_info #define EX_NO_SINGLE_STEP 1 #define EX_SINGLE_STEP 2 - /* * dbxface - external debugger interfaces */ -acpi_status -acpi_db_initialize ( - void); +acpi_status acpi_db_initialize(void); -void -acpi_db_terminate ( - void); +void acpi_db_terminate(void); acpi_status -acpi_db_single_step ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 op_type); - +acpi_db_single_step(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, u32 op_type); /* * dbcmds - debug commands and output routines */ -acpi_status -acpi_db_disassemble_method ( - char *name); +acpi_status acpi_db_disassemble_method(char *name); -void -acpi_db_display_table_info ( - char *table_arg); +void acpi_db_display_table_info(char *table_arg); -void -acpi_db_unload_acpi_table ( - char *table_arg, - char *instance_arg); +void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg); void -acpi_db_set_method_breakpoint ( - char *location, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_db_set_method_breakpoint(char *location, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); -void -acpi_db_set_method_call_breakpoint ( - union acpi_parse_object *op); +void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op); -void -acpi_db_disassemble_aml ( - char *statements, - union acpi_parse_object *op); +void acpi_db_get_bus_info(void); -void -acpi_db_dump_namespace ( - char *start_arg, - char *depth_arg); +void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op); -void -acpi_db_dump_namespace_by_owner ( - char *owner_arg, - char *depth_arg); +void acpi_db_dump_namespace(char *start_arg, char *depth_arg); -void -acpi_db_send_notify ( - char *name, - u32 value); +void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); -void -acpi_db_set_method_data ( - char *type_arg, - char *index_arg, - char *value_arg); +void acpi_db_send_notify(char *name, u32 value); -acpi_status -acpi_db_display_objects ( - char *obj_type_arg, - char *display_count_arg); +void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); acpi_status -acpi_db_find_name_in_namespace ( - char *name_arg); +acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); -void -acpi_db_set_scope ( - char *name); +acpi_status acpi_db_find_name_in_namespace(char *name_arg); -acpi_status -acpi_db_sleep ( - char *object_arg); +void acpi_db_set_scope(char *name); -void -acpi_db_find_references ( - char *object_arg); +acpi_status acpi_db_sleep(char *object_arg); -void -acpi_db_display_locks ( - void); +void acpi_db_find_references(char *object_arg); -void -acpi_db_display_resources ( - char *object_arg); +void acpi_db_display_locks(void); -void -acpi_db_display_gpes ( - void); +void acpi_db_display_resources(char *object_arg); -void -acpi_db_check_integrity ( - void); +void acpi_db_display_gpes(void); -void -acpi_db_generate_gpe ( - char *gpe_arg, - char *block_arg); +void acpi_db_check_integrity(void); +void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); /* * dbdisply - debug display commands */ -void -acpi_db_display_method_info ( - union acpi_parse_object *op); +void acpi_db_display_method_info(union acpi_parse_object *op); -void -acpi_db_decode_and_display_object ( - char *target, - char *output_type); +void acpi_db_decode_and_display_object(char *target, char *output_type); void -acpi_db_display_result_object ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_db_display_result_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); -acpi_status -acpi_db_display_all_methods ( - char *display_count_arg); +acpi_status acpi_db_display_all_methods(char *display_count_arg); -void -acpi_db_display_arguments ( - void); +void acpi_db_display_arguments(void); -void -acpi_db_display_locals ( - void); +void acpi_db_display_locals(void); -void -acpi_db_display_results ( - void); +void acpi_db_display_results(void); -void -acpi_db_display_calling_tree ( - void); +void acpi_db_display_calling_tree(void); -void -acpi_db_display_object_type ( - char *object_arg); +void acpi_db_display_object_type(char *object_arg); void -acpi_db_display_argument_object ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); - +acpi_db_display_argument_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); /* * dbexec - debugger control method execution */ -void -acpi_db_execute ( - char *name, - char **args, - u32 flags); +void acpi_db_execute(char *name, char **args, u32 flags); void -acpi_db_create_execution_threads ( - char *num_threads_arg, - char *num_loops_arg, - char *method_name_arg); - +acpi_db_create_execution_threads(char *num_threads_arg, + char *num_loops_arg, char *method_name_arg); /* * dbfileio - Debugger file I/O commands */ acpi_object_type -acpi_db_match_argument ( - char *user_argument, - struct argument_info *arguments); +acpi_db_match_argument(char *user_argument, struct argument_info *arguments); -void -acpi_db_close_debug_file ( - void); +void acpi_db_close_debug_file(void); -void -acpi_db_open_debug_file ( - char *name); +void acpi_db_open_debug_file(char *name); -acpi_status -acpi_db_load_acpi_table ( - char *filename); +acpi_status acpi_db_load_acpi_table(char *filename); acpi_status -acpi_db_get_table_from_file ( - char *filename, - struct acpi_table_header **table); +acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table); acpi_status -acpi_db_read_table_from_file ( - char *filename, - struct acpi_table_header **table); - +acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table); /* * dbhistry - debugger HISTORY command */ -void -acpi_db_add_to_history ( - char *command_line); +void acpi_db_add_to_history(char *command_line); -void -acpi_db_display_history ( - void); - -char * -acpi_db_get_from_history ( - char *command_num_arg); +void acpi_db_display_history(void); +char *acpi_db_get_from_history(char *command_num_arg); /* * dbinput - user front-end to the AML debugger */ acpi_status -acpi_db_command_dispatch ( - char *input_buffer, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - -void ACPI_SYSTEM_XFACE -acpi_db_execute_thread ( - void *context); +acpi_db_command_dispatch(char *input_buffer, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); +void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); /* * dbstats - Generation and display of ACPI table statistics */ -void -acpi_db_generate_statistics ( - union acpi_parse_object *root, - u8 is_method); - -acpi_status -acpi_db_display_statistics ( - char *type_arg); +void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method); +acpi_status acpi_db_display_statistics(char *type_arg); /* * dbutils - AML debugger utilities */ -void -acpi_db_set_output_destination ( - u32 where); +void acpi_db_set_output_destination(u32 where); -void -acpi_db_dump_object ( - union acpi_object *obj_desc, - u32 level); +void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level); -void -acpi_db_prep_namestring ( - char *name); +void acpi_db_prep_namestring(char *name); -struct acpi_namespace_node * -acpi_db_local_ns_lookup ( - char *name); +struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name); -#endif /* __ACDEBUG_H__ */ +#endif /* __ACDEBUG_H__ */ diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index dbfa877121b..3d96dcb1bb4 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -46,327 +46,219 @@ #include "amlresrc.h" - #define BLOCK_NONE 0 #define BLOCK_PAREN 1 #define BLOCK_BRACE 2 #define BLOCK_COMMA_LIST 4 -struct acpi_external_list -{ - char *path; - struct acpi_external_list *next; +struct acpi_external_list { + char *path; + struct acpi_external_list *next; }; -extern struct acpi_external_list *acpi_gbl_external_list; -extern const char *acpi_gbl_io_decode[2]; -extern const char *acpi_gbl_word_decode[4]; -extern const char *acpi_gbl_consume_decode[2]; -extern const char *acpi_gbl_min_decode[2]; -extern const char *acpi_gbl_max_decode[2]; -extern const char *acpi_gbl_DECdecode[2]; -extern const char *acpi_gbl_RNGdecode[4]; -extern const char *acpi_gbl_MEMdecode[4]; -extern const char *acpi_gbl_RWdecode[2]; -extern const char *acpi_gbl_irq_decode[2]; -extern const char *acpi_gbl_HEdecode[2]; -extern const char *acpi_gbl_LLdecode[2]; -extern const char *acpi_gbl_SHRdecode[2]; -extern const char *acpi_gbl_TYPdecode[4]; -extern const char *acpi_gbl_BMdecode[2]; -extern const char *acpi_gbl_SIZdecode[4]; -extern const char *acpi_gbl_TTPdecode[2]; -extern const char *acpi_gbl_MTPdecode[4]; -extern const char *acpi_gbl_TRSdecode[2]; - - -extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; -extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; -extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; -extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; - - -struct acpi_op_walk_info -{ - u32 level; - u32 bit_offset; +extern struct acpi_external_list *acpi_gbl_external_list; +extern const char *acpi_gbl_io_decode[2]; +extern const char *acpi_gbl_word_decode[4]; +extern const char *acpi_gbl_consume_decode[2]; +extern const char *acpi_gbl_min_decode[2]; +extern const char *acpi_gbl_max_decode[2]; +extern const char *acpi_gbl_DECdecode[2]; +extern const char *acpi_gbl_RNGdecode[4]; +extern const char *acpi_gbl_MEMdecode[4]; +extern const char *acpi_gbl_RWdecode[2]; +extern const char *acpi_gbl_irq_decode[2]; +extern const char *acpi_gbl_HEdecode[2]; +extern const char *acpi_gbl_LLdecode[2]; +extern const char *acpi_gbl_SHRdecode[2]; +extern const char *acpi_gbl_TYPdecode[4]; +extern const char *acpi_gbl_BMdecode[2]; +extern const char *acpi_gbl_SIZdecode[4]; +extern const char *acpi_gbl_TTPdecode[2]; +extern const char *acpi_gbl_MTPdecode[4]; +extern const char *acpi_gbl_TRSdecode[2]; + +extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; +extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; +extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; +extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; + +struct acpi_op_walk_info { + u32 level; + u32 bit_offset; + struct acpi_walk_state *walk_state; }; typedef -acpi_status (*asl_walk_callback) ( - union acpi_parse_object *op, - u32 level, - void *context); - +acpi_status(*asl_walk_callback) (union acpi_parse_object * op, + u32 level, void *context); /* * dmwalk */ void -acpi_dm_disassemble ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *origin, - u32 num_opcodes); - +acpi_dm_disassemble(struct acpi_walk_state *walk_state, + union acpi_parse_object *origin, u32 num_opcodes); /* * dmopcode */ void -acpi_dm_disassemble_one_op ( - struct acpi_walk_state *walk_state, - struct acpi_op_walk_info *info, - union acpi_parse_object *op); +acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state, + struct acpi_op_walk_info *info, + union acpi_parse_object *op); -void -acpi_dm_decode_internal_object ( - union acpi_operand_object *obj_desc); +void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc); -u32 -acpi_dm_list_type ( - union acpi_parse_object *op); +u32 acpi_dm_list_type(union acpi_parse_object *op); -void -acpi_dm_method_flags ( - union acpi_parse_object *op); - -void -acpi_dm_field_flags ( - union acpi_parse_object *op); +void acpi_dm_method_flags(union acpi_parse_object *op); -void -acpi_dm_address_space ( - u8 space_id); +void acpi_dm_field_flags(union acpi_parse_object *op); -void -acpi_dm_region_flags ( - union acpi_parse_object *op); +void acpi_dm_address_space(u8 space_id); -void -acpi_dm_match_op ( - union acpi_parse_object *op); +void acpi_dm_region_flags(union acpi_parse_object *op); -u8 -acpi_dm_comma_if_list_member ( - union acpi_parse_object *op); +void acpi_dm_match_op(union acpi_parse_object *op); -void -acpi_dm_comma_if_field_member ( - union acpi_parse_object *op); +u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op); +void acpi_dm_comma_if_field_member(union acpi_parse_object *op); /* * dmnames */ -u32 -acpi_dm_dump_name ( - char *name); +u32 acpi_dm_dump_name(char *name); acpi_status -acpi_ps_display_object_pathname ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - -void -acpi_dm_namestring ( - char *name); +acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); +void acpi_dm_namestring(char *name); /* * dmobject */ void -acpi_dm_display_internal_object ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_dm_display_internal_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); -void -acpi_dm_display_arguments ( - struct acpi_walk_state *walk_state); +void acpi_dm_display_arguments(struct acpi_walk_state *walk_state); -void -acpi_dm_display_locals ( - struct acpi_walk_state *walk_state); +void acpi_dm_display_locals(struct acpi_walk_state *walk_state); void -acpi_dm_dump_method_info ( - acpi_status status, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - +acpi_dm_dump_method_info(acpi_status status, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); /* * dmbuffer */ -void -acpi_dm_disasm_byte_list ( - u32 level, - u8 *byte_data, - u32 byte_count); +void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count); void -acpi_dm_byte_list ( - struct acpi_op_walk_info *info, - union acpi_parse_object *op); +acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op); -void -acpi_is_eisa_id ( - union acpi_parse_object *op); +void acpi_dm_is_eisa_id(union acpi_parse_object *op); -void -acpi_dm_eisa_id ( - u32 encoded_id); - -u8 -acpi_dm_is_unicode_buffer ( - union acpi_parse_object *op); +void acpi_dm_eisa_id(u32 encoded_id); -u8 -acpi_dm_is_string_buffer ( - union acpi_parse_object *op); +u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op); +u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); /* * dmresrc */ void -acpi_dm_resource_descriptor ( - struct acpi_op_walk_info *info, - u8 *byte_data, - u32 byte_count); +acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, + u8 * byte_data, u32 byte_count); -u8 -acpi_dm_is_resource_descriptor ( - union acpi_parse_object *op); +u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); -void -acpi_dm_indent ( - u32 level); +void acpi_dm_indent(u32 level); -void -acpi_dm_bit_list ( - u16 mask); - -void -acpi_dm_decode_attribute ( - u8 attribute); +void acpi_dm_bit_list(u16 mask); +void acpi_dm_decode_attribute(u8 attribute); /* * dmresrcl */ void -acpi_dm_word_descriptor ( - struct asl_word_address_desc *resource, - u32 length, - u32 level); +acpi_dm_word_descriptor(struct asl_word_address_desc *resource, + u32 length, u32 level); void -acpi_dm_dword_descriptor ( - struct asl_dword_address_desc *resource, - u32 length, - u32 level); +acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource, + u32 length, u32 level); void -acpi_dm_extended_descriptor ( - struct asl_extended_address_desc *resource, - u32 length, - u32 level); +acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource, + u32 length, u32 level); void -acpi_dm_qword_descriptor ( - struct asl_qword_address_desc *resource, - u32 length, - u32 level); +acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource, + u32 length, u32 level); void -acpi_dm_memory24_descriptor ( - struct asl_memory_24_desc *resource, - u32 length, - u32 level); +acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource, + u32 length, u32 level); void -acpi_dm_memory32_descriptor ( - struct asl_memory_32_desc *resource, - u32 length, - u32 level); +acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource, + u32 length, u32 level); void -acpi_dm_fixed_mem32_descriptor ( - struct asl_fixed_memory_32_desc *resource, - u32 length, - u32 level); +acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource, + u32 length, u32 level); void -acpi_dm_generic_register_descriptor ( - struct asl_general_register_desc *resource, - u32 length, - u32 level); +acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource, + u32 length, u32 level); void -acpi_dm_interrupt_descriptor ( - struct asl_extended_xrupt_desc *resource, - u32 length, - u32 level); +acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource, + u32 length, u32 level); void -acpi_dm_vendor_large_descriptor ( - struct asl_large_vendor_desc *resource, - u32 length, - u32 level); - +acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource, + u32 length, u32 level); /* * dmresrcs */ void -acpi_dm_irq_descriptor ( - struct asl_irq_format_desc *resource, - u32 length, - u32 level); +acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource, + u32 length, u32 level); void -acpi_dm_dma_descriptor ( - struct asl_dma_format_desc *resource, - u32 length, - u32 level); +acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource, + u32 length, u32 level); void -acpi_dm_io_descriptor ( - struct asl_io_port_desc *resource, - u32 length, - u32 level); +acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level); void -acpi_dm_fixed_io_descriptor ( - struct asl_fixed_io_port_desc *resource, - u32 length, - u32 level); +acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource, + u32 length, u32 level); void -acpi_dm_start_dependent_descriptor ( - struct asl_start_dependent_desc *resource, - u32 length, - u32 level); +acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource, + u32 length, u32 level); void -acpi_dm_end_dependent_descriptor ( - struct asl_start_dependent_desc *resource, - u32 length, - u32 level); +acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource, + u32 length, u32 level); void -acpi_dm_vendor_small_descriptor ( - struct asl_small_vendor_desc *resource, - u32 length, - u32 level); - +acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource, + u32 length, u32 level); /* * dmutils */ -void -acpi_dm_add_to_external_list ( - char *path); +void acpi_dm_add_to_external_list(char *path); -#endif /* __ACDISASM_H__ */ +#endif /* __ACDISASM_H__ */ diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 8f5f2f71b1d..065f24a77cf 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -41,419 +41,304 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef _ACDISPAT_H_ #define _ACDISPAT_H_ - #define NAMEOF_LOCAL_NTE "__L0" #define NAMEOF_ARG_NTE "__A0" - /* * dsopcode - support for late evaluation */ acpi_status -acpi_ds_get_buffer_field_arguments ( - union acpi_operand_object *obj_desc); - -acpi_status -acpi_ds_get_region_arguments ( - union acpi_operand_object *rgn_desc); +acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc); -acpi_status -acpi_ds_get_buffer_arguments ( - union acpi_operand_object *obj_desc); +acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc); -acpi_status -acpi_ds_get_package_arguments ( - union acpi_operand_object *obj_desc); +acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc); -acpi_status -acpi_ds_eval_buffer_field_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc); acpi_status -acpi_ds_eval_region_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_eval_data_object_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - union acpi_operand_object *obj_desc); +acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_initialize_region ( - acpi_handle obj_handle); +acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + union acpi_operand_object *obj_desc); +acpi_status acpi_ds_initialize_region(acpi_handle obj_handle); /* * dsctrl - Parser/Interpreter interface, control stack routines */ acpi_status -acpi_ds_exec_begin_control_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_exec_end_control_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - +acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); /* * dsexec - Parser/Interpreter interface, method execution callbacks */ acpi_status -acpi_ds_get_predicate_value ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *result_obj); - -acpi_status -acpi_ds_exec_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); +acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, + union acpi_operand_object *result_obj); acpi_status -acpi_ds_exec_end_op ( - struct acpi_walk_state *state); +acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op); +acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state); /* * dsfield - Parser/Interpreter interface for AML fields */ acpi_status -acpi_ds_create_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state); +acpi_ds_create_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_bank_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state); +acpi_ds_create_bank_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_index_field ( - union acpi_parse_object *op, - struct acpi_namespace_node *region_node, - struct acpi_walk_state *walk_state); +acpi_ds_create_index_field(union acpi_parse_object *op, + struct acpi_namespace_node *region_node, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_buffer_field ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state); +acpi_ds_create_buffer_field(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_init_field_objects ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state); - +acpi_ds_init_field_objects(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); /* * dsload - Parser/Interpreter interface, namespace load callbacks */ acpi_status -acpi_ds_load1_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); +acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op); -acpi_status -acpi_ds_load1_end_op ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_load2_begin_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); +acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, + union acpi_parse_object **out_op); -acpi_status -acpi_ds_load2_end_op ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_init_callbacks ( - struct acpi_walk_state *walk_state, - u32 pass_number); - +acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); /* * dsmthdat - method data (locals/args) */ acpi_status -acpi_ds_store_object_to_local ( - u16 opcode, - u32 index, - union acpi_operand_object *src_desc, - struct acpi_walk_state *walk_state); +acpi_ds_store_object_to_local(u16 opcode, + u32 index, + union acpi_operand_object *src_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_method_data_get_entry ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - union acpi_operand_object ***node); +acpi_ds_method_data_get_entry(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + union acpi_operand_object ***node); -void -acpi_ds_method_data_delete_all ( - struct acpi_walk_state *walk_state); +void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state); -u8 -acpi_ds_is_method_value ( - union acpi_operand_object *obj_desc); +u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); acpi_status -acpi_ds_method_data_get_value ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - union acpi_operand_object **dest_desc); +acpi_ds_method_data_get_value(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + union acpi_operand_object **dest_desc); acpi_status -acpi_ds_method_data_init_args ( - union acpi_operand_object **params, - u32 max_param_count, - struct acpi_walk_state *walk_state); +acpi_ds_method_data_init_args(union acpi_operand_object **params, + u32 max_param_count, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_method_data_get_node ( - u16 opcode, - u32 index, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node **node); - -void -acpi_ds_method_data_init ( - struct acpi_walk_state *walk_state); +acpi_ds_method_data_get_node(u16 opcode, + u32 index, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node **node); +void acpi_ds_method_data_init(struct acpi_walk_state *walk_state); /* * dsmethod - Parser/Interpreter interface - control method parsing */ -acpi_status -acpi_ds_parse_method ( - acpi_handle obj_handle); +acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node); acpi_status -acpi_ds_call_control_method ( - struct acpi_thread_state *thread, - struct acpi_walk_state *walk_state, - union acpi_parse_object *op); +acpi_ds_call_control_method(struct acpi_thread_state *thread, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); acpi_status -acpi_ds_restart_control_method ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *return_desc); +acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, + union acpi_operand_object *return_desc); -acpi_status -acpi_ds_terminate_control_method ( - struct acpi_walk_state *walk_state); +void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); acpi_status -acpi_ds_begin_method_execution ( - struct acpi_namespace_node *method_node, - union acpi_operand_object *obj_desc, - struct acpi_namespace_node *calling_method_node); - +acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_namespace_node *calling_method_node); /* * dsinit */ acpi_status -acpi_ds_initialize_objects ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *start_node); - +acpi_ds_initialize_objects(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *start_node); /* * dsobject - Parser/Interpreter interface - object initialization and conversion */ acpi_status -acpi_ds_build_internal_buffer_obj ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 buffer_length, - union acpi_operand_object **obj_desc_ptr); +acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u32 buffer_length, + union acpi_operand_object **obj_desc_ptr); acpi_status -acpi_ds_build_internal_package_obj ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u32 package_length, - union acpi_operand_object **obj_desc); +acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u32 package_length, + union acpi_operand_object **obj_desc); acpi_status -acpi_ds_init_object_from_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - u16 opcode, - union acpi_operand_object **obj_desc); +acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + u16 opcode, union acpi_operand_object **obj_desc); acpi_status -acpi_ds_create_node ( - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *node, - union acpi_parse_object *op); - +acpi_ds_create_node(struct acpi_walk_state *walk_state, + struct acpi_namespace_node *node, + union acpi_parse_object *op); /* * dsutils - Parser/Interpreter interface utility routines */ -void -acpi_ds_clear_implicit_return ( - struct acpi_walk_state *walk_state); +void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state); u8 -acpi_ds_do_implicit_return ( - union acpi_operand_object *return_desc, - struct acpi_walk_state *walk_state, - u8 add_reference); +acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, + struct acpi_walk_state *walk_state, + u8 add_reference); u8 -acpi_ds_is_result_used ( - union acpi_parse_object *op, - struct acpi_walk_state *walk_state); +acpi_ds_is_result_used(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); void -acpi_ds_delete_result_if_not_used ( - union acpi_parse_object *op, - union acpi_operand_object *result_obj, - struct acpi_walk_state *walk_state); +acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, + union acpi_operand_object *result_obj, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_create_operand ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *arg, - u32 args_remaining); +acpi_ds_create_operand(struct acpi_walk_state *walk_state, + union acpi_parse_object *arg, u32 args_remaining); acpi_status -acpi_ds_create_operands ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *first_arg); +acpi_ds_create_operands(struct acpi_walk_state *walk_state, + union acpi_parse_object *first_arg); -acpi_status -acpi_ds_resolve_operands ( - struct acpi_walk_state *walk_state); - -void -acpi_ds_clear_operands ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state); +void acpi_ds_clear_operands(struct acpi_walk_state *walk_state); /* * dswscope - Scope Stack manipulation */ acpi_status -acpi_ds_scope_stack_push ( - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_walk_state *walk_state); +acpi_ds_scope_stack_push(struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_walk_state *walk_state); +acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_scope_stack_pop ( - struct acpi_walk_state *walk_state); - -void -acpi_ds_scope_stack_clear ( - struct acpi_walk_state *walk_state); - +void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state); /* * dswstate - parser WALK_STATE management routines */ acpi_status -acpi_ds_obj_stack_push ( - void *object, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state); acpi_status -acpi_ds_obj_stack_pop ( - u32 pop_count, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state); -struct acpi_walk_state * -acpi_ds_create_walk_state ( - acpi_owner_id owner_id, - union acpi_parse_object *origin, - union acpi_operand_object *mth_desc, - struct acpi_thread_state *thread); +struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, + union acpi_parse_object + *origin, + union acpi_operand_object + *mth_desc, + struct acpi_thread_state + *thread); acpi_status -acpi_ds_init_aml_walk ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - struct acpi_namespace_node *method_node, - u8 *aml_start, - u32 aml_length, - struct acpi_parameter_info *info, - u32 pass_number); +acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + struct acpi_namespace_node *method_node, + u8 * aml_start, + u32 aml_length, + struct acpi_parameter_info *info, u8 pass_number); acpi_status -acpi_ds_obj_stack_pop_and_delete ( - u32 pop_count, - struct acpi_walk_state *walk_state); +acpi_ds_obj_stack_pop_and_delete(u32 pop_count, + struct acpi_walk_state *walk_state); -void -acpi_ds_delete_walk_state ( - struct acpi_walk_state *walk_state); +void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state); -struct acpi_walk_state * -acpi_ds_pop_walk_state ( - struct acpi_thread_state *thread); +struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state + *thread); void -acpi_ds_push_walk_state ( - struct acpi_walk_state *walk_state, - struct acpi_thread_state *thread); +acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, + struct acpi_thread_state *thread); -acpi_status -acpi_ds_result_stack_pop ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_result_stack_push ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state); -acpi_status -acpi_ds_result_stack_clear ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state); -struct acpi_walk_state * -acpi_ds_get_current_walk_state ( - struct acpi_thread_state *thread); +struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state + *thread); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_ds_result_remove ( - union acpi_operand_object **object, - u32 index, - struct acpi_walk_state *walk_state); +acpi_ds_result_remove(union acpi_operand_object **object, + u32 index, struct acpi_walk_state *walk_state); #endif acpi_status -acpi_ds_result_pop ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state); +acpi_ds_result_pop(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_result_push ( - union acpi_operand_object *object, - struct acpi_walk_state *walk_state); +acpi_ds_result_push(union acpi_operand_object *object, + struct acpi_walk_state *walk_state); acpi_status -acpi_ds_result_pop_from_bottom ( - union acpi_operand_object **object, - struct acpi_walk_state *walk_state); - -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ds_delete_walk_state_cache ( - void); -#endif +acpi_ds_result_pop_from_bottom(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); -#endif /* _ACDISPAT_H_ */ +#endif /* _ACDISPAT_H_ */ diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index 61a27c8c507..bfa54600ecd 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -44,250 +44,167 @@ #ifndef __ACEVENTS_H__ #define __ACEVENTS_H__ - /* * evevent */ -acpi_status -acpi_ev_initialize_events ( - void); +acpi_status acpi_ev_initialize_events(void); -acpi_status -acpi_ev_install_xrupt_handlers ( - void); - -u32 -acpi_ev_fixed_event_detect ( - void); +acpi_status acpi_ev_install_xrupt_handlers(void); +u32 acpi_ev_fixed_event_detect(void); /* * evmisc */ -u8 -acpi_ev_is_notify_object ( - struct acpi_namespace_node *node); +u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node); -acpi_status -acpi_ev_acquire_global_lock( - u16 timeout); +acpi_status acpi_ev_acquire_global_lock(u16 timeout); -acpi_status -acpi_ev_release_global_lock( - void); +acpi_status acpi_ev_release_global_lock(void); -acpi_status -acpi_ev_init_global_lock_handler ( - void); +acpi_status acpi_ev_init_global_lock_handler(void); -u32 -acpi_ev_get_gpe_number_index ( - u32 gpe_number); +u32 acpi_ev_get_gpe_number_index(u32 gpe_number); acpi_status -acpi_ev_queue_notify_request ( - struct acpi_namespace_node *node, - u32 notify_value); - +acpi_ev_queue_notify_request(struct acpi_namespace_node *node, + u32 notify_value); /* * evgpe - GPE handling and dispatch */ acpi_status -acpi_ev_update_gpe_enable_masks ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type); +acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, + u8 type); acpi_status -acpi_ev_enable_gpe ( - struct acpi_gpe_event_info *gpe_event_info, - u8 write_to_hardware); +acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, + u8 write_to_hardware); -acpi_status -acpi_ev_disable_gpe ( - struct acpi_gpe_event_info *gpe_event_info); - -struct acpi_gpe_event_info * -acpi_ev_get_gpe_event_info ( - acpi_handle gpe_device, - u32 gpe_number); +acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); +struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, + u32 gpe_number); /* * evgpeblk */ -u8 -acpi_ev_valid_gpe_event ( - struct acpi_gpe_event_info *gpe_event_info); - -acpi_status -acpi_ev_walk_gpe_list ( - ACPI_GPE_CALLBACK gpe_walk_callback, - u32 flags); +u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); -acpi_status -acpi_ev_delete_gpe_handlers ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); +acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); acpi_status -acpi_ev_create_gpe_block ( - struct acpi_namespace_node *gpe_device, - struct acpi_generic_address *gpe_block_address, - u32 register_count, - u8 gpe_block_base_number, - u32 interrupt_level, - struct acpi_gpe_block_info **return_gpe_block); +acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); acpi_status -acpi_ev_delete_gpe_block ( - struct acpi_gpe_block_info *gpe_block); +acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, + u8 gpe_block_base_number, + u32 interrupt_number, + struct acpi_gpe_block_info **return_gpe_block); -u32 -acpi_ev_gpe_dispatch ( - struct acpi_gpe_event_info *gpe_event_info, - u32 gpe_number); +acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); u32 -acpi_ev_gpe_detect ( - struct acpi_gpe_xrupt_info *gpe_xrupt_list); +acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, + u32 gpe_number); -acpi_status -acpi_ev_set_gpe_type ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type); +u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); acpi_status -acpi_ev_check_for_wake_only_gpe ( - struct acpi_gpe_event_info *gpe_event_info); +acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type); acpi_status -acpi_ev_gpe_initialize ( - void); +acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info); +acpi_status acpi_ev_gpe_initialize(void); /* * evregion - Address Space handling */ -acpi_status -acpi_ev_install_region_handlers ( - void); +acpi_status acpi_ev_install_region_handlers(void); -acpi_status -acpi_ev_initialize_op_regions ( - void); +acpi_status acpi_ev_initialize_op_regions(void); acpi_status -acpi_ev_address_space_dispatch ( - union acpi_operand_object *region_obj, - u32 function, - acpi_physical_address address, - u32 bit_width, - void *value); +acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, + u32 function, + acpi_physical_address address, + u32 bit_width, void *value); acpi_status -acpi_ev_attach_region ( - union acpi_operand_object *handler_obj, - union acpi_operand_object *region_obj, - u8 acpi_ns_is_locked); +acpi_ev_attach_region(union acpi_operand_object *handler_obj, + union acpi_operand_object *region_obj, + u8 acpi_ns_is_locked); void -acpi_ev_detach_region ( - union acpi_operand_object *region_obj, - u8 acpi_ns_is_locked); +acpi_ev_detach_region(union acpi_operand_object *region_obj, + u8 acpi_ns_is_locked); acpi_status -acpi_ev_install_space_handler ( - struct acpi_namespace_node *node, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler, - acpi_adr_space_setup setup, - void *context); +acpi_ev_install_space_handler(struct acpi_namespace_node *node, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler, + acpi_adr_space_setup setup, void *context); acpi_status -acpi_ev_execute_reg_methods ( - struct acpi_namespace_node *node, - acpi_adr_space_type space_id); +acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, + acpi_adr_space_type space_id); acpi_status -acpi_ev_execute_reg_method ( - union acpi_operand_object *region_obj, - u32 function); - +acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); /* * evregini - Region initialization and setup */ acpi_status -acpi_ev_system_memory_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_system_memory_region_setup(acpi_handle handle, + u32 function, + void *handler_context, + void **region_context); acpi_status -acpi_ev_io_space_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_io_space_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_pci_config_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_pci_config_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_cmos_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_cmos_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_pci_bar_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_pci_bar_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_default_region_setup ( - acpi_handle handle, - u32 function, - void *handler_context, - void **region_context); +acpi_ev_default_region_setup(acpi_handle handle, + u32 function, + void *handler_context, void **region_context); acpi_status -acpi_ev_initialize_region ( - union acpi_operand_object *region_obj, - u8 acpi_ns_locked); - +acpi_ev_initialize_region(union acpi_operand_object *region_obj, + u8 acpi_ns_locked); /* * evsci - SCI (System Control Interrupt) handling/dispatch */ -u32 ACPI_SYSTEM_XFACE -acpi_ev_gpe_xrupt_handler ( - void *context); - -u32 -acpi_ev_install_sci_handler ( - void); +u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context); -acpi_status -acpi_ev_remove_sci_handler ( - void); +u32 acpi_ev_install_sci_handler(void); -u32 -acpi_ev_initialize_sCI ( - u32 program_sCI); +acpi_status acpi_ev_remove_sci_handler(void); -void -acpi_ev_terminate ( - void); +u32 acpi_ev_initialize_sCI(u32 program_sCI); +void acpi_ev_terminate(void); -#endif /* __ACEVENTS_H__ */ +#endif /* __ACEVENTS_H__ */ diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 60d737b2d70..4f005eb6592 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -44,7 +44,6 @@ #ifndef __ACEXCEP_H__ #define __ACEXCEP_H__ - /* * Exceptions returned by external ACPI interfaces */ @@ -55,11 +54,9 @@ #define AE_CODE_CONTROL 0x4000 #define AE_CODE_MASK 0xF000 - #define ACPI_SUCCESS(a) (!(a)) #define ACPI_FAILURE(a) (a) - #define AE_OK (acpi_status) 0x0000 /* @@ -95,9 +92,9 @@ #define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) #define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL) #define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL) +#define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL) -#define AE_CODE_ENV_MAX 0x001E - +#define AE_CODE_ENV_MAX 0x001F /* * Programmer exceptions @@ -114,7 +111,6 @@ #define AE_CODE_PGM_MAX 0x0009 - /* * Acpi table exceptions */ @@ -127,7 +123,6 @@ #define AE_CODE_TBL_MAX 0x0006 - /* * AML exceptions. These are caused by problems with * the actual AML byte stream @@ -168,7 +163,6 @@ #define AE_CODE_AML_MAX 0x0021 - /* * Internal exceptions used for control */ @@ -186,16 +180,13 @@ #define AE_CODE_CTRL_MAX 0x000B - #ifdef DEFINE_ACPI_GLOBALS - /* * String versions of the exception codes above * These strings must match the corresponding defines exactly */ -char const *acpi_gbl_exception_names_env[] = -{ +char const *acpi_gbl_exception_names_env[] = { "AE_OK", "AE_ERROR", "AE_NO_ACPI_TABLES", @@ -226,11 +217,11 @@ char const *acpi_gbl_exception_names_env[] = "AE_LOGICAL_ADDRESS", "AE_ABORT_METHOD", "AE_SAME_HANDLER", - "AE_WAKE_ONLY_GPE" + "AE_WAKE_ONLY_GPE", + "AE_OWNER_ID_LIMIT" }; -char const *acpi_gbl_exception_names_pgm[] = -{ +char const *acpi_gbl_exception_names_pgm[] = { "AE_BAD_PARAMETER", "AE_BAD_CHARACTER", "AE_BAD_PATHNAME", @@ -242,8 +233,7 @@ char const *acpi_gbl_exception_names_pgm[] = "AE_BAD_DECIMAL_CONSTANT" }; -char const *acpi_gbl_exception_names_tbl[] = -{ +char const *acpi_gbl_exception_names_tbl[] = { "AE_BAD_SIGNATURE", "AE_BAD_HEADER", "AE_BAD_CHECKSUM", @@ -252,8 +242,7 @@ char const *acpi_gbl_exception_names_tbl[] = "AE_INVALID_TABLE_LENGTH" }; -char const *acpi_gbl_exception_names_aml[] = -{ +char const *acpi_gbl_exception_names_aml[] = { "AE_AML_ERROR", "AE_AML_PARSE", "AE_AML_BAD_OPCODE", @@ -289,8 +278,7 @@ char const *acpi_gbl_exception_names_aml[] = "AE_AML_BAD_RESOURCE_LENGTH" }; -char const *acpi_gbl_exception_names_ctrl[] = -{ +char const *acpi_gbl_exception_names_ctrl[] = { "AE_CTRL_RETURN_VALUE", "AE_CTRL_PENDING", "AE_CTRL_TERMINATE", @@ -304,6 +292,6 @@ char const *acpi_gbl_exception_names_ctrl[] = "AE_CTRL_SKIP" }; -#endif /* ACPI GLOBALS */ +#endif /* ACPI GLOBALS */ -#endif /* __ACEXCEP_H__ */ +#endif /* __ACEXCEP_H__ */ diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 4946696088c..e9c2790139e 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -44,7 +44,6 @@ #ifndef __ACGLOBAL_H__ #define __ACGLOBAL_H__ - /* * Ensure that the globals are actually defined and initialized only once. * @@ -63,9 +62,8 @@ * Keep local copies of these FADT-based registers. NOTE: These globals * are first in this file for alignment reasons on 64-bit systems. */ -ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; -ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; - +ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; +ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; /***************************************************************************** * @@ -75,13 +73,12 @@ ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; /* Runtime configuration of debug print levels */ -extern u32 acpi_dbg_level; -extern u32 acpi_dbg_layer; +extern u32 acpi_dbg_level; +extern u32 acpi_dbg_layer; /* Procedure nesting level for debug output */ -extern u32 acpi_gbl_nesting_level; - +extern u32 acpi_gbl_nesting_level; /***************************************************************************** * @@ -98,7 +95,7 @@ extern u32 acpi_gbl_nesting_level; * 3) Allow access to uninitialized locals/args (auto-init to integer 0) * 4) Allow ANY object type to be a source operand for the Store() operator */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE); +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); /* * Automatically serialize ALL control methods? Default is FALSE, meaning @@ -106,22 +103,21 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE) * Only change this if the ASL code is poorly written and cannot handle * reentrancy even though methods are marked "not_serialized". */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_all_methods_serialized, FALSE); +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); /* * Create the predefined _OSI method in the namespace? Default is TRUE * because ACPI CA is fully compatible with other ACPI implementations. * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_create_osi_method, TRUE); +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); /* * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only * be enabled just before going to sleep. */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE); - +ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); /***************************************************************************** * @@ -137,42 +133,46 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE); * These tables are single-table only; meaning that there can be at most one * of each in the system. Each global points to the actual table. */ -ACPI_EXTERN u32 acpi_gbl_table_flags; -ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; -ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; -ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; -ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; -ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; -ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; -ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; +ACPI_EXTERN u32 acpi_gbl_table_flags; +ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; +ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; +ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; +ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; +ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; +ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; +ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; /* * Since there may be multiple SSDTs and PSDTs, a single pointer is not * sufficient; Therefore, there isn't one! */ +/* The root table can be either an RSDT or an XSDT */ + +ACPI_EXTERN u8 acpi_gbl_root_table_type; +#define ACPI_TABLE_TYPE_RSDT 'R' +#define ACPI_TABLE_TYPE_XSDT 'X' /* * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: * If we are executing a method that exists in a 32-bit ACPI table, * use only the lower 32 bits of the (internal) 64-bit Integer. */ -ACPI_EXTERN u8 acpi_gbl_integer_bit_width; -ACPI_EXTERN u8 acpi_gbl_integer_byte_width; -ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; +ACPI_EXTERN u8 acpi_gbl_integer_bit_width; +ACPI_EXTERN u8 acpi_gbl_integer_byte_width; +ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; /* * ACPI Table info arrays */ -extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; -extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; +extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; +extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; /* * Predefined mutex objects. This array contains the * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. * (The table maps local handles to the real OS handles) */ -ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; - +ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; /***************************************************************************** * @@ -180,41 +180,56 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; * ****************************************************************************/ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + +/* Lists for tracking memory allocations */ -ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; -ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; -ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; -ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; -ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; -ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; -ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; - -ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; -ACPI_EXTERN u32 acpi_gbl_original_mode; -ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; -ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; -ACPI_EXTERN u32 acpi_gbl_ps_find_count; -ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; -ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; -ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; -ACPI_EXTERN u16 acpi_gbl_global_lock_handle; -ACPI_EXTERN u8 acpi_gbl_debugger_configuration; -ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; -ACPI_EXTERN u8 acpi_gbl_step_to_next_call; -ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; -ACPI_EXTERN u8 acpi_gbl_global_lock_present; -ACPI_EXTERN u8 acpi_gbl_events_initialized; -ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; - -extern u8 acpi_gbl_shutdown; -extern u32 acpi_gbl_startup_flags; -extern const u8 acpi_gbl_decode_to8bit[8]; -extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; -extern const char *acpi_gbl_highest_dstate_names[4]; -extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; -extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; -extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; +ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; +#endif +/* Object caches */ + +ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; +ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; + +/* Global handlers */ + +ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; +ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; +ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; +ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; +ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; +ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; + +/* Misc */ + +ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; +ACPI_EXTERN u32 acpi_gbl_original_mode; +ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; +ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; +ACPI_EXTERN u32 acpi_gbl_ps_find_count; +ACPI_EXTERN u32 acpi_gbl_owner_id_mask; +ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; +ACPI_EXTERN u16 acpi_gbl_global_lock_handle; +ACPI_EXTERN u8 acpi_gbl_debugger_configuration; +ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; +ACPI_EXTERN u8 acpi_gbl_step_to_next_call; +ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; +ACPI_EXTERN u8 acpi_gbl_global_lock_present; +ACPI_EXTERN u8 acpi_gbl_events_initialized; +ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; + +extern u8 acpi_gbl_shutdown; +extern u32 acpi_gbl_startup_flags; +extern const u8 acpi_gbl_decode_to8bit[8]; +extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; +extern const char *acpi_gbl_highest_dstate_names[4]; +extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; +extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; +extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; /***************************************************************************** * @@ -230,36 +245,34 @@ extern const char *acpi_gbl_valid_osi_strings[ACPI_ #define NUM_PREDEFINED_NAMES 9 #endif -ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; -ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; -ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; +ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; +ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; +ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; -extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; -extern const struct acpi_predefined_names acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; +extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; +extern const struct acpi_predefined_names + acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES]; #ifdef ACPI_DEBUG_OUTPUT -ACPI_EXTERN u32 acpi_gbl_current_node_count; -ACPI_EXTERN u32 acpi_gbl_current_node_size; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; -ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; -ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; -ACPI_EXTERN u32 acpi_gbl_deepest_nesting; +ACPI_EXTERN u32 acpi_gbl_current_node_count; +ACPI_EXTERN u32 acpi_gbl_current_node_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; +ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; +ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; +ACPI_EXTERN u32 acpi_gbl_deepest_nesting; #endif - /***************************************************************************** * * Interpreter globals * ****************************************************************************/ - -ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; +ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; /* Control method single step flag */ -ACPI_EXTERN u8 acpi_gbl_cm_single_step; - +ACPI_EXTERN u8 acpi_gbl_cm_single_step; /***************************************************************************** * @@ -267,8 +280,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; * ****************************************************************************/ -ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; - +ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; /***************************************************************************** * @@ -276,10 +288,10 @@ ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; * ****************************************************************************/ -extern struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; -ACPI_EXTERN u8 acpi_gbl_sleep_type_a; -ACPI_EXTERN u8 acpi_gbl_sleep_type_b; - +extern struct acpi_bit_register_info + acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; +ACPI_EXTERN u8 acpi_gbl_sleep_type_a; +ACPI_EXTERN u8 acpi_gbl_sleep_type_b; /***************************************************************************** * @@ -287,12 +299,14 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b; * ****************************************************************************/ -extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; -ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; -ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; - +extern struct acpi_fixed_event_info + acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN struct acpi_fixed_event_handler + acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; +ACPI_EXTERN struct acpi_gpe_block_info + *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; +ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; /***************************************************************************** * @@ -300,58 +314,55 @@ ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; * ****************************************************************************/ -ACPI_EXTERN u8 acpi_gbl_db_output_flags; +ACPI_EXTERN u8 acpi_gbl_db_output_flags; #ifdef ACPI_DISASSEMBLER -ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; -ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; +ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; +ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; #endif - #ifdef ACPI_DEBUGGER -extern u8 acpi_gbl_method_executing; -extern u8 acpi_gbl_abort_method; -extern u8 acpi_gbl_db_terminate_threads; - -ACPI_EXTERN int optind; -ACPI_EXTERN char *optarg; - -ACPI_EXTERN u8 acpi_gbl_db_opt_tables; -ACPI_EXTERN u8 acpi_gbl_db_opt_stats; -ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; - - -ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN char acpi_gbl_db_line_buf[80]; -ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; -ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; -ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; -ACPI_EXTERN u8 acpi_gbl_db_output_to_file; -ACPI_EXTERN char *acpi_gbl_db_buffer; -ACPI_EXTERN char *acpi_gbl_db_filename; -ACPI_EXTERN u32 acpi_gbl_db_debug_level; -ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; -ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; -ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; +extern u8 acpi_gbl_method_executing; +extern u8 acpi_gbl_abort_method; +extern u8 acpi_gbl_db_terminate_threads; + +ACPI_EXTERN int optind; +ACPI_EXTERN char *optarg; + +ACPI_EXTERN u8 acpi_gbl_db_opt_tables; +ACPI_EXTERN u8 acpi_gbl_db_opt_stats; +ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; + +ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN char acpi_gbl_db_line_buf[80]; +ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; +ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; +ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; +ACPI_EXTERN u8 acpi_gbl_db_output_to_file; +ACPI_EXTERN char *acpi_gbl_db_buffer; +ACPI_EXTERN char *acpi_gbl_db_filename; +ACPI_EXTERN u32 acpi_gbl_db_debug_level; +ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; +ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; +ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; /* * Statistic globals */ -ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; -ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; -ACPI_EXTERN u32 acpi_gbl_num_nodes; -ACPI_EXTERN u32 acpi_gbl_num_objects; - +ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; +ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; +ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; +ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; +ACPI_EXTERN u32 acpi_gbl_num_nodes; +ACPI_EXTERN u32 acpi_gbl_num_objects; -ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; -ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; -ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; -ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; +ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; +ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; +ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; +ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; -#endif /* ACPI_DEBUGGER */ +#endif /* ACPI_DEBUGGER */ -#endif /* __ACGLOBAL_H__ */ +#endif /* __ACGLOBAL_H__ */ diff --git a/include/acpi/achware.h b/include/acpi/achware.h index 9d63641b8e7..3644d7248e7 100644 --- a/include/acpi/achware.h +++ b/include/acpi/achware.h @@ -44,7 +44,6 @@ #ifndef __ACHWARE_H__ #define __ACHWARE_H__ - /* PM Timer ticks per second (HZ) */ #define PM_TIMER_FREQUENCY 3579545 @@ -57,126 +56,78 @@ #define ACPI_SST_SLEEPING 3 #define ACPI_SST_SLEEP_CONTEXT 4 - /* Prototypes */ - /* * hwacpi - high level functions */ -acpi_status -acpi_hw_initialize ( - void); +acpi_status acpi_hw_initialize(void); -acpi_status -acpi_hw_set_mode ( - u32 mode); - -u32 -acpi_hw_get_mode ( - void); +acpi_status acpi_hw_set_mode(u32 mode); +u32 acpi_hw_get_mode(void); /* * hwregs - ACPI Register I/O */ -struct acpi_bit_register_info * -acpi_hw_get_bit_register_info ( - u32 register_id); - -acpi_status -acpi_hw_register_read ( - u8 use_lock, - u32 register_id, - u32 *return_value); +struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); acpi_status -acpi_hw_register_write ( - u8 use_lock, - u32 register_id, - u32 value); +acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value); -acpi_status -acpi_hw_low_level_read ( - u32 width, - u32 *value, - struct acpi_generic_address *reg); +acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value); acpi_status -acpi_hw_low_level_write ( - u32 width, - u32 value, - struct acpi_generic_address *reg); +acpi_hw_low_level_read(u32 width, + u32 * value, struct acpi_generic_address *reg); acpi_status -acpi_hw_clear_acpi_status ( - u32 flags); +acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg); +acpi_status acpi_hw_clear_acpi_status(u32 flags); /* * hwgpe - GPE support */ acpi_status -acpi_hw_write_gpe_enable_reg ( - struct acpi_gpe_event_info *gpe_event_info); +acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); acpi_status -acpi_hw_disable_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); +acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); -acpi_status -acpi_hw_clear_gpe ( - struct acpi_gpe_event_info *gpe_event_info); +acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info); acpi_status -acpi_hw_clear_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); +acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_hw_get_gpe_status ( - struct acpi_gpe_event_info *gpe_event_info, - acpi_event_status *event_status); -#endif /* ACPI_FUTURE_USAGE */ +acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info, + acpi_event_status * event_status); +#endif /* ACPI_FUTURE_USAGE */ -acpi_status -acpi_hw_disable_all_gpes ( - u32 flags); +acpi_status acpi_hw_disable_all_gpes(void); -acpi_status -acpi_hw_enable_all_runtime_gpes ( - u32 flags); +acpi_status acpi_hw_enable_all_runtime_gpes(void); -acpi_status -acpi_hw_enable_all_wakeup_gpes ( - u32 flags); +acpi_status acpi_hw_enable_all_wakeup_gpes(void); acpi_status -acpi_hw_enable_runtime_gpe_block ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); - +acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); #ifdef ACPI_FUTURE_USAGE /* * hwtimer - ACPI Timer prototypes */ -acpi_status -acpi_get_timer_resolution ( - u32 *resolution); +acpi_status acpi_get_timer_resolution(u32 * resolution); -acpi_status -acpi_get_timer ( - u32 *ticks); +acpi_status acpi_get_timer(u32 * ticks); acpi_status -acpi_get_timer_duration ( - u32 start_ticks, - u32 end_ticks, - u32 *time_elapsed); -#endif /* ACPI_FUTURE_USAGE */ - +acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed); +#endif /* ACPI_FUTURE_USAGE */ -#endif /* __ACHWARE_H__ */ +#endif /* __ACHWARE_H__ */ diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 5c7172477a0..2c9c1a1d1b7 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -44,29 +44,22 @@ #ifndef __ACINTERP_H__ #define __ACINTERP_H__ - #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) - /* * exconvrt - object conversion */ acpi_status -acpi_ex_convert_to_integer ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u32 flags); +acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc, u32 flags); acpi_status -acpi_ex_convert_to_buffer ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc); +acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc); acpi_status -acpi_ex_convert_to_string ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u32 type); +acpi_ex_convert_to_string(union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc, u32 type); /* Types for ->String conversion */ @@ -76,587 +69,412 @@ acpi_ex_convert_to_string ( #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 acpi_status -acpi_ex_convert_to_target_type ( - acpi_object_type destination_type, - union acpi_operand_object *source_desc, - union acpi_operand_object **result_desc, - struct acpi_walk_state *walk_state); - +acpi_ex_convert_to_target_type(acpi_object_type destination_type, + union acpi_operand_object *source_desc, + union acpi_operand_object **result_desc, + struct acpi_walk_state *walk_state); /* * exfield - ACPI AML (p-code) execution - field manipulation */ acpi_status -acpi_ex_common_buffer_setup ( - union acpi_operand_object *obj_desc, - u32 buffer_length, - u32 *datum_count); +acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc, + u32 buffer_length, u32 * datum_count); acpi_status -acpi_ex_write_with_update_rule ( - union acpi_operand_object *obj_desc, - acpi_integer mask, - acpi_integer field_value, - u32 field_datum_byte_offset); +acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, + acpi_integer mask, + acpi_integer field_value, + u32 field_datum_byte_offset); void -acpi_ex_get_buffer_datum( - acpi_integer *datum, - void *buffer, - u32 buffer_length, - u32 byte_granularity, - u32 buffer_offset); +acpi_ex_get_buffer_datum(acpi_integer * datum, + void *buffer, + u32 buffer_length, + u32 byte_granularity, u32 buffer_offset); void -acpi_ex_set_buffer_datum ( - acpi_integer merged_datum, - void *buffer, - u32 buffer_length, - u32 byte_granularity, - u32 buffer_offset); +acpi_ex_set_buffer_datum(acpi_integer merged_datum, + void *buffer, + u32 buffer_length, + u32 byte_granularity, u32 buffer_offset); acpi_status -acpi_ex_read_data_from_field ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *obj_desc, - union acpi_operand_object **ret_buffer_desc); +acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, + union acpi_operand_object *obj_desc, + union acpi_operand_object **ret_buffer_desc); acpi_status -acpi_ex_write_data_to_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc); - +acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, + union acpi_operand_object *obj_desc, + union acpi_operand_object **result_desc); /* * exfldio - low level field I/O */ acpi_status -acpi_ex_extract_from_field ( - union acpi_operand_object *obj_desc, - void *buffer, - u32 buffer_length); +acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, + void *buffer, u32 buffer_length); acpi_status -acpi_ex_insert_into_field ( - union acpi_operand_object *obj_desc, - void *buffer, - u32 buffer_length); +acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, + void *buffer, u32 buffer_length); acpi_status -acpi_ex_access_region ( - union acpi_operand_object *obj_desc, - u32 field_datum_byte_offset, - acpi_integer *value, - u32 read_write); - +acpi_ex_access_region(union acpi_operand_object *obj_desc, + u32 field_datum_byte_offset, + acpi_integer * value, u32 read_write); /* * exmisc - misc support routines */ acpi_status -acpi_ex_get_object_reference ( - union acpi_operand_object *obj_desc, - union acpi_operand_object **return_desc, - struct acpi_walk_state *walk_state); +acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, + union acpi_operand_object **return_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_concat_template ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *obj_desc2, - union acpi_operand_object **actual_return_desc, - struct acpi_walk_state *walk_state); +acpi_ex_concat_template(union acpi_operand_object *obj_desc, + union acpi_operand_object *obj_desc2, + union acpi_operand_object **actual_return_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_do_concatenate ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *obj_desc2, - union acpi_operand_object **actual_return_desc, - struct acpi_walk_state *walk_state); +acpi_ex_do_concatenate(union acpi_operand_object *obj_desc, + union acpi_operand_object *obj_desc2, + union acpi_operand_object **actual_return_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_do_logical_numeric_op ( - u16 opcode, - acpi_integer integer0, - acpi_integer integer1, - u8 *logical_result); +acpi_ex_do_logical_numeric_op(u16 opcode, + acpi_integer integer0, + acpi_integer integer1, u8 * logical_result); acpi_status -acpi_ex_do_logical_op ( - u16 opcode, - union acpi_operand_object *operand0, - union acpi_operand_object *operand1, - u8 *logical_result); +acpi_ex_do_logical_op(u16 opcode, + union acpi_operand_object *operand0, + union acpi_operand_object *operand1, u8 * logical_result); acpi_integer -acpi_ex_do_math_op ( - u16 opcode, - acpi_integer operand0, - acpi_integer operand1); +acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1); -acpi_status -acpi_ex_create_mutex ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_processor ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_power_resource ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state); acpi_status -acpi_ex_create_region ( - u8 *aml_start, - u32 aml_length, - u8 region_space, - struct acpi_walk_state *walk_state); +acpi_ex_create_region(u8 * aml_start, + u32 aml_length, + u8 region_space, struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_table_region ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_event ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_create_alias ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state); acpi_status -acpi_ex_create_method ( - u8 *aml_start, - u32 aml_length, - struct acpi_walk_state *walk_state); - +acpi_ex_create_method(u8 * aml_start, + u32 aml_length, struct acpi_walk_state *walk_state); /* * exconfig - dynamic table load/unload */ acpi_status -acpi_ex_load_op ( - union acpi_operand_object *obj_desc, - union acpi_operand_object *target, - struct acpi_walk_state *walk_state); +acpi_ex_load_op(union acpi_operand_object *obj_desc, + union acpi_operand_object *target, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_load_table_op ( - struct acpi_walk_state *walk_state, - union acpi_operand_object **return_desc); - -acpi_status -acpi_ex_unload_table ( - union acpi_operand_object *ddb_handle); +acpi_ex_load_table_op(struct acpi_walk_state *walk_state, + union acpi_operand_object **return_desc); +acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle); /* * exmutex - mutex support */ acpi_status -acpi_ex_acquire_mutex ( - union acpi_operand_object *time_desc, - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_release_mutex ( - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +acpi_ex_release_mutex(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); -void -acpi_ex_release_all_mutexes ( - struct acpi_thread_state *thread); - -void -acpi_ex_unlink_mutex ( - union acpi_operand_object *obj_desc); +void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread); +void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc); /* * exprep - ACPI AML execution - prep utilities */ acpi_status -acpi_ex_prep_common_field_object ( - union acpi_operand_object *obj_desc, - u8 field_flags, - u8 field_attribute, - u32 field_bit_position, - u32 field_bit_length); - -acpi_status -acpi_ex_prep_field_value ( - struct acpi_create_field_info *info); +acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, + u8 field_flags, + u8 field_attribute, + u32 field_bit_position, u32 field_bit_length); +acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info); /* * exsystem - Interface to OS services */ acpi_status -acpi_ex_system_do_notify_op ( - union acpi_operand_object *value, - union acpi_operand_object *obj_desc); +acpi_ex_system_do_notify_op(union acpi_operand_object *value, + union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_do_suspend( - acpi_integer time); +acpi_status acpi_ex_system_do_suspend(acpi_integer time); -acpi_status -acpi_ex_system_do_stall ( - u32 time); +acpi_status acpi_ex_system_do_stall(u32 time); acpi_status -acpi_ex_system_acquire_mutex( - union acpi_operand_object *time, - union acpi_operand_object *obj_desc); +acpi_ex_system_acquire_mutex(union acpi_operand_object *time, + union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_release_mutex( - union acpi_operand_object *obj_desc); +acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_signal_event( - union acpi_operand_object *obj_desc); +acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc); acpi_status -acpi_ex_system_wait_event( - union acpi_operand_object *time, - union acpi_operand_object *obj_desc); +acpi_ex_system_wait_event(union acpi_operand_object *time, + union acpi_operand_object *obj_desc); -acpi_status -acpi_ex_system_reset_event( - union acpi_operand_object *obj_desc); - -acpi_status -acpi_ex_system_wait_semaphore ( - acpi_handle semaphore, - u16 timeout); +acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc); +acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout); /* * exoparg1 - ACPI AML execution, 1 operand */ -acpi_status -acpi_ex_opcode_0A_0T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_0T_0R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_0T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_1T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_1A_1T_0R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state); /* * exoparg2 - ACPI AML execution, 2 operands */ -acpi_status -acpi_ex_opcode_2A_0T_0R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_2A_0T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_opcode_2A_1T_1R ( - struct acpi_walk_state *walk_state); - -acpi_status -acpi_ex_opcode_2A_2T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state); /* * exoparg3 - ACPI AML execution, 3 operands */ -acpi_status -acpi_ex_opcode_3A_0T_0R ( - struct acpi_walk_state *walk_state); - -acpi_status -acpi_ex_opcode_3A_1T_1R ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state); +acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state); /* * exoparg6 - ACPI AML execution, 6 operands */ -acpi_status -acpi_ex_opcode_6A_0T_1R ( - struct acpi_walk_state *walk_state); - +acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state); /* * exresolv - Object resolution and get value functions */ acpi_status -acpi_ex_resolve_to_value ( - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state); +acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_resolve_multiple ( - struct acpi_walk_state *walk_state, - union acpi_operand_object *operand, - acpi_object_type *return_type, - union acpi_operand_object **return_desc); - +acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, + union acpi_operand_object *operand, + acpi_object_type * return_type, + union acpi_operand_object **return_desc); /* * exresnte - resolve namespace node */ acpi_status -acpi_ex_resolve_node_to_value ( - struct acpi_namespace_node **stack_ptr, - struct acpi_walk_state *walk_state); - +acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr, + struct acpi_walk_state *walk_state); /* * exresop - resolve operand to value */ acpi_status -acpi_ex_resolve_operands ( - u16 opcode, - union acpi_operand_object **stack_ptr, - struct acpi_walk_state *walk_state); - +acpi_ex_resolve_operands(u16 opcode, + union acpi_operand_object **stack_ptr, + struct acpi_walk_state *walk_state); /* * exdump - Interpreter debug output routines */ -void -acpi_ex_dump_operand ( - union acpi_operand_object *obj_desc, - u32 depth); +void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth); void -acpi_ex_dump_operands ( - union acpi_operand_object **operands, - acpi_interpreter_mode interpreter_mode, - char *ident, - u32 num_levels, - char *note, - char *module_name, - u32 line_number); +acpi_ex_dump_operands(union acpi_operand_object **operands, + acpi_interpreter_mode interpreter_mode, + char *ident, + u32 num_levels, + char *note, char *module_name, u32 line_number); #ifdef ACPI_FUTURE_USAGE void -acpi_ex_dump_object_descriptor ( - union acpi_operand_object *object, - u32 flags); - -void -acpi_ex_dump_node ( - struct acpi_namespace_node *node, - u32 flags); -#endif /* ACPI_FUTURE_USAGE */ +acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); +void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags); +#endif /* ACPI_FUTURE_USAGE */ /* * exnames - AML namestring support */ acpi_status -acpi_ex_get_name_string ( - acpi_object_type data_type, - u8 *in_aml_address, - char **out_name_string, - u32 *out_name_length); - +acpi_ex_get_name_string(acpi_object_type data_type, + u8 * in_aml_address, + char **out_name_string, u32 * out_name_length); /* * exstore - Object store support */ acpi_status -acpi_ex_store ( - union acpi_operand_object *val_desc, - union acpi_operand_object *dest_desc, - struct acpi_walk_state *walk_state); +acpi_ex_store(union acpi_operand_object *val_desc, + union acpi_operand_object *dest_desc, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_store_object_to_node ( - union acpi_operand_object *source_desc, - struct acpi_namespace_node *node, - struct acpi_walk_state *walk_state, - u8 implicit_conversion); +acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, + struct acpi_namespace_node *node, + struct acpi_walk_state *walk_state, + u8 implicit_conversion); #define ACPI_IMPLICIT_CONVERSION TRUE #define ACPI_NO_IMPLICIT_CONVERSION FALSE - /* * exstoren - resolve/store object */ acpi_status -acpi_ex_resolve_object ( - union acpi_operand_object **source_desc_ptr, - acpi_object_type target_type, - struct acpi_walk_state *walk_state); +acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, + acpi_object_type target_type, + struct acpi_walk_state *walk_state); acpi_status -acpi_ex_store_object_to_object ( - union acpi_operand_object *source_desc, - union acpi_operand_object *dest_desc, - union acpi_operand_object **new_desc, - struct acpi_walk_state *walk_state); - +acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, + union acpi_operand_object *dest_desc, + union acpi_operand_object **new_desc, + struct acpi_walk_state *walk_state); /* * exstorob - store object - buffer/string */ acpi_status -acpi_ex_store_buffer_to_buffer ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); +acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); acpi_status -acpi_ex_store_string_to_string ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); - +acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); /* * excopy - object copy */ acpi_status -acpi_ex_copy_integer_to_index_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); +acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); acpi_status -acpi_ex_copy_integer_to_bank_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); +acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); acpi_status -acpi_ex_copy_data_to_named_field ( - union acpi_operand_object *source_desc, - struct acpi_namespace_node *node); +acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc, + struct acpi_namespace_node *node); acpi_status -acpi_ex_copy_integer_to_buffer_field ( - union acpi_operand_object *source_desc, - union acpi_operand_object *target_desc); - +acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc, + union acpi_operand_object *target_desc); /* * exutils - interpreter/scanner utilities */ -acpi_status -acpi_ex_enter_interpreter ( - void); +acpi_status acpi_ex_enter_interpreter(void); -void -acpi_ex_exit_interpreter ( - void); +void acpi_ex_exit_interpreter(void); -void -acpi_ex_truncate_for32bit_table ( - union acpi_operand_object *obj_desc); +void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); -u8 -acpi_ex_acquire_global_lock ( - u32 rule); +u8 acpi_ex_acquire_global_lock(u32 rule); -void -acpi_ex_release_global_lock ( - u8 locked); +void acpi_ex_release_global_lock(u8 locked); -void -acpi_ex_eisa_id_to_string ( - u32 numeric_id, - char *out_string); - -void -acpi_ex_unsigned_integer_to_string ( - acpi_integer value, - char *out_string); +void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); +void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string); /* * exregion - default op_region handlers */ acpi_status -acpi_ex_system_memory_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_system_io_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_pci_config_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_cmos_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_pci_bar_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_embedded_controller_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -acpi_status -acpi_ex_sm_bus_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - - -acpi_status -acpi_ex_data_table_space_handler ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); - -#endif /* __INTERP_H__ */ +acpi_ex_system_memory_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, + void *region_context); + +acpi_status +acpi_ex_system_io_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_pci_config_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_cmos_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_pci_bar_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_embedded_controller_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, + void *region_context); + +acpi_status +acpi_ex_sm_bus_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +acpi_status +acpi_ex_data_table_space_handler(u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, void *region_context); + +#endif /* __INTERP_H__ */ diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 030e641115c..9fba0fddda9 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -44,17 +44,20 @@ #ifndef __ACLOCAL_H__ #define __ACLOCAL_H__ +#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ -#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ - -typedef void * acpi_mutex; -typedef u32 acpi_mutex_handle; - +typedef void *acpi_mutex; +typedef u32 acpi_mutex_handle; /* Total number of aml opcodes defined */ #define AML_NUM_OPCODES 0x7F +/* Forward declarations */ + +struct acpi_walk_state; +struct acpi_obj_mutex; +union acpi_parse_object; /***************************************************************************** * @@ -62,7 +65,6 @@ typedef u32 acpi_mutex_handle; * ****************************************************************************/ - /* * Predefined handles for the mutex objects used within the subsystem * All mutex objects are automatically created by acpi_ut_mutex_initialize. @@ -89,14 +91,12 @@ typedef u32 acpi_mutex_handle; #define MAX_MUTEX 12 #define NUM_MUTEX MAX_MUTEX+1 - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #ifdef DEFINE_ACPI_GLOBALS /* Names for the mutexes used in the subsystem */ -static char *acpi_gbl_mutex_names[] = -{ +static char *acpi_gbl_mutex_names[] = { "ACPI_MTX_Execute", "ACPI_MTX_Interpreter", "ACPI_MTX_Parser", @@ -115,34 +115,28 @@ static char *acpi_gbl_mutex_names[] = #endif #endif +/* Owner IDs are used to track namespace nodes for selective deletion */ -/* Table for the global mutexes */ +typedef u8 acpi_owner_id; +#define ACPI_OWNER_ID_MAX 0xFF -struct acpi_mutex_info -{ - acpi_mutex mutex; - u32 use_count; - u32 owner_id; -}; +/* This Thread ID means that the mutex is not in use (unlocked) */ -/* This owner ID means that the mutex is not in use (unlocked) */ +#define ACPI_MUTEX_NOT_ACQUIRED (u32) -1 -#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1) +/* Table for the global mutexes */ +struct acpi_mutex_info { + acpi_mutex mutex; + u32 use_count; + u32 thread_id; +}; /* Lock flag parameter for various interfaces */ #define ACPI_MTX_DO_NOT_LOCK 0 #define ACPI_MTX_LOCK 1 - -typedef u16 acpi_owner_id; -#define ACPI_OWNER_TYPE_TABLE 0x0 -#define ACPI_OWNER_TYPE_METHOD 0x1 -#define ACPI_FIRST_METHOD_ID 0x0001 -#define ACPI_FIRST_TABLE_ID 0xF000 - - /* Field access granularities */ #define ACPI_FIELD_BYTE_GRANULARITY 1 @@ -150,7 +144,6 @@ typedef u16 acpi_owner_id; #define ACPI_FIELD_DWORD_GRANULARITY 4 #define ACPI_FIELD_QWORD_GRANULARITY 8 - /***************************************************************************** * * Namespace typedefs and structs @@ -159,15 +152,12 @@ typedef u16 acpi_owner_id; /* Operational modes of the AML interpreter/scanner */ -typedef enum -{ - ACPI_IMODE_LOAD_PASS1 = 0x01, - ACPI_IMODE_LOAD_PASS2 = 0x02, - ACPI_IMODE_EXECUTE = 0x0E - +typedef enum { + ACPI_IMODE_LOAD_PASS1 = 0x01, + ACPI_IMODE_LOAD_PASS2 = 0x02, + ACPI_IMODE_EXECUTE = 0x0E } acpi_interpreter_mode; - /* * The Node describes a named object that appears in the AML * An acpi_node is used to store Nodes. @@ -175,34 +165,37 @@ typedef enum * data_type is used to differentiate between internal descriptors, and MUST * be the first byte in this structure. */ -union acpi_name_union -{ - u32 integer; - char ascii[4]; -}; - -struct acpi_namespace_node -{ - u8 descriptor; /* Used to differentiate object descriptor types */ - u8 type; /* Type associated with this name */ - u16 owner_id; - union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ - union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ - struct acpi_namespace_node *child; /* First child */ - struct acpi_namespace_node *peer; /* Next peer*/ - u16 reference_count; /* Current count of references and children */ - u8 flags; +union acpi_name_union { + u32 integer; + char ascii[4]; +}; + +struct acpi_namespace_node { + u8 descriptor; /* Used to differentiate object descriptor types */ + u8 type; /* Type associated with this name */ + u16 reference_count; /* Current count of references and children */ + union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ + union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ + struct acpi_namespace_node *child; /* First child */ + struct acpi_namespace_node *peer; /* Next peer */ + u8 owner_id; /* Who created this node */ + u8 flags; + + /* Fields used by the ASL compiler only */ + +#ifdef ACPI_ASL_COMPILER + u32 value; + union acpi_parse_object *op; +#endif }; - #define ACPI_ENTRY_NOT_FOUND NULL - /* Node flags */ #define ANOBJ_RESERVED 0x01 #define ANOBJ_END_OF_PEER_LIST 0x02 -#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ +#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 @@ -212,91 +205,77 @@ struct acpi_namespace_node /* * ACPI Table Descriptor. One per ACPI table */ -struct acpi_table_desc -{ - struct acpi_table_desc *prev; - struct acpi_table_desc *next; - struct acpi_table_desc *installed_desc; - struct acpi_table_header *pointer; - u8 *aml_start; - u64 physical_address; - u32 aml_length; - acpi_size length; - acpi_owner_id table_id; - u8 type; - u8 allocation; - u8 loaded_into_namespace; +struct acpi_table_desc { + struct acpi_table_desc *prev; + struct acpi_table_desc *next; + struct acpi_table_desc *installed_desc; + struct acpi_table_header *pointer; + u8 *aml_start; + u64 physical_address; + u32 aml_length; + acpi_size length; + acpi_owner_id owner_id; + u8 type; + u8 allocation; + u8 loaded_into_namespace; }; -struct acpi_table_list -{ - struct acpi_table_desc *next; - u32 count; +struct acpi_table_list { + struct acpi_table_desc *next; + u32 count; }; - -struct acpi_find_context -{ - char *search_for; - acpi_handle *list; - u32 *count; +struct acpi_find_context { + char *search_for; + acpi_handle *list; + u32 *count; }; - -struct acpi_ns_search_data -{ - struct acpi_namespace_node *node; +struct acpi_ns_search_data { + struct acpi_namespace_node *node; }; - /* * Predefined Namespace items */ -struct acpi_predefined_names -{ - char *name; - u8 type; - char *val; +struct acpi_predefined_names { + char *name; + u8 type; + char *val; }; - /* Object types used during package copies */ - #define ACPI_COPY_TYPE_SIMPLE 0 #define ACPI_COPY_TYPE_PACKAGE 1 /* Info structure used to convert external<->internal namestrings */ -struct acpi_namestring_info -{ - char *external_name; - char *next_external_char; - char *internal_name; - u32 length; - u32 num_segments; - u32 num_carats; - u8 fully_qualified; +struct acpi_namestring_info { + char *external_name; + char *next_external_char; + char *internal_name; + u32 length; + u32 num_segments; + u32 num_carats; + u8 fully_qualified; }; - /* Field creation info */ -struct acpi_create_field_info -{ - struct acpi_namespace_node *region_node; - struct acpi_namespace_node *field_node; - struct acpi_namespace_node *register_node; - struct acpi_namespace_node *data_register_node; - u32 bank_value; - u32 field_bit_position; - u32 field_bit_length; - u8 field_flags; - u8 attribute; - u8 field_type; +struct acpi_create_field_info { + struct acpi_namespace_node *region_node; + struct acpi_namespace_node *field_node; + struct acpi_namespace_node *register_node; + struct acpi_namespace_node *data_register_node; + u32 bank_value; + u32 field_bit_position; + u32 field_bit_length; + u8 field_flags; + u8 attribute; + u8 field_type; }; - /***************************************************************************** * * Event typedefs and structs @@ -305,108 +284,95 @@ struct acpi_create_field_info /* Dispatch info for each GPE -- either a method or handler, cannot be both */ -struct acpi_handler_info -{ - acpi_event_handler address; /* Address of handler, if any */ - void *context; /* Context to be passed to handler */ - struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ +struct acpi_handler_info { + acpi_event_handler address; /* Address of handler, if any */ + void *context; /* Context to be passed to handler */ + struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ }; -union acpi_gpe_dispatch_info -{ - struct acpi_namespace_node *method_node; /* Method node for this GPE level */ - struct acpi_handler_info *handler; +union acpi_gpe_dispatch_info { + struct acpi_namespace_node *method_node; /* Method node for this GPE level */ + struct acpi_handler_info *handler; }; /* * Information about a GPE, one per each GPE in an array. * NOTE: Important to keep this struct as small as possible. */ -struct acpi_gpe_event_info -{ - union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ - struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ - u8 flags; /* Misc info about this GPE */ - u8 register_bit; /* This GPE bit within the register */ +struct acpi_gpe_event_info { + union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ + struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ + u8 flags; /* Misc info about this GPE */ + u8 register_bit; /* This GPE bit within the register */ }; /* Information about a GPE register pair, one per each status/enable pair in an array */ -struct acpi_gpe_register_info -{ - struct acpi_generic_address status_address; /* Address of status reg */ - struct acpi_generic_address enable_address; /* Address of enable reg */ - u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ - u8 enable_for_run; /* GPEs to keep enabled when running */ - u8 base_gpe_number; /* Base GPE number for this register */ +struct acpi_gpe_register_info { + struct acpi_generic_address status_address; /* Address of status reg */ + struct acpi_generic_address enable_address; /* Address of enable reg */ + u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ + u8 enable_for_run; /* GPEs to keep enabled when running */ + u8 base_gpe_number; /* Base GPE number for this register */ }; /* * Information about a GPE register block, one per each installed block -- * GPE0, GPE1, and one per each installed GPE Block Device. */ -struct acpi_gpe_block_info -{ - struct acpi_namespace_node *node; - struct acpi_gpe_block_info *previous; - struct acpi_gpe_block_info *next; - struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ - struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ - struct acpi_gpe_event_info *event_info; /* One for each GPE */ - struct acpi_generic_address block_address; /* Base address of the block */ - u32 register_count; /* Number of register pairs in block */ - u8 block_base_number;/* Base GPE number for this block */ +struct acpi_gpe_block_info { + struct acpi_namespace_node *node; + struct acpi_gpe_block_info *previous; + struct acpi_gpe_block_info *next; + struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ + struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ + struct acpi_gpe_event_info *event_info; /* One for each GPE */ + struct acpi_generic_address block_address; /* Base address of the block */ + u32 register_count; /* Number of register pairs in block */ + u8 block_base_number; /* Base GPE number for this block */ }; /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ -struct acpi_gpe_xrupt_info -{ - struct acpi_gpe_xrupt_info *previous; - struct acpi_gpe_xrupt_info *next; - struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ - u32 interrupt_level; /* System interrupt level */ +struct acpi_gpe_xrupt_info { + struct acpi_gpe_xrupt_info *previous; + struct acpi_gpe_xrupt_info *next; + struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ + u32 interrupt_number; /* System interrupt number */ }; - -struct acpi_gpe_walk_info -{ - struct acpi_namespace_node *gpe_device; - struct acpi_gpe_block_info *gpe_block; +struct acpi_gpe_walk_info { + struct acpi_namespace_node *gpe_device; + struct acpi_gpe_block_info *gpe_block; }; - -typedef acpi_status (*ACPI_GPE_CALLBACK) ( - struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block); - +typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * + gpe_xrupt_info, + struct acpi_gpe_block_info * + gpe_block); /* Information about each particular fixed event */ -struct acpi_fixed_event_handler -{ - acpi_event_handler handler; /* Address of handler. */ - void *context; /* Context to be passed to handler */ +struct acpi_fixed_event_handler { + acpi_event_handler handler; /* Address of handler. */ + void *context; /* Context to be passed to handler */ }; -struct acpi_fixed_event_info -{ - u8 status_register_id; - u8 enable_register_id; - u16 status_bit_mask; - u16 enable_bit_mask; +struct acpi_fixed_event_info { + u8 status_register_id; + u8 enable_register_id; + u16 status_bit_mask; + u16 enable_bit_mask; }; /* Information used during field processing */ -struct acpi_field_info -{ - u8 skip_field; - u8 field_flag; - u32 pkg_length; +struct acpi_field_info { + u8 skip_field; + u8 field_flag; + u32 pkg_length; }; - /***************************************************************************** * * Generic "state" object for stacks @@ -419,14 +385,6 @@ struct acpi_field_info #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 - -/* Forward declarations */ - -struct acpi_walk_state ; -struct acpi_obj_mutex; -union acpi_parse_object ; - - #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ u8 data_type; /* To differentiate various internal objs */\ u8 flags; \ @@ -435,147 +393,112 @@ union acpi_parse_object ; u16 reserved; \ void *next; \ -struct acpi_common_state -{ - ACPI_STATE_COMMON -}; - +struct acpi_common_state { +ACPI_STATE_COMMON}; /* * Update state - used to traverse complex objects such as packages */ -struct acpi_update_state -{ - ACPI_STATE_COMMON - union acpi_operand_object *object; +struct acpi_update_state { + ACPI_STATE_COMMON union acpi_operand_object *object; }; - /* * Pkg state - used to traverse nested package structures */ -struct acpi_pkg_state -{ - ACPI_STATE_COMMON - union acpi_operand_object *source_object; - union acpi_operand_object *dest_object; - struct acpi_walk_state *walk_state; - void *this_target_obj; - u32 num_packages; - u16 index; +struct acpi_pkg_state { + ACPI_STATE_COMMON union acpi_operand_object *source_object; + union acpi_operand_object *dest_object; + struct acpi_walk_state *walk_state; + void *this_target_obj; + u32 num_packages; + u16 index; }; - /* * Control state - one per if/else and while constructs. * Allows nesting of these constructs */ -struct acpi_control_state -{ - ACPI_STATE_COMMON - union acpi_parse_object *predicate_op; - u8 *aml_predicate_start; /* Start of if/while predicate */ - u8 *package_end; /* End of if/while block */ - u16 opcode; +struct acpi_control_state { + ACPI_STATE_COMMON union acpi_parse_object *predicate_op; + u8 *aml_predicate_start; /* Start of if/while predicate */ + u8 *package_end; /* End of if/while block */ + u16 opcode; }; - /* * Scope state - current scope during namespace lookups */ -struct acpi_scope_state -{ - ACPI_STATE_COMMON - struct acpi_namespace_node *node; +struct acpi_scope_state { + ACPI_STATE_COMMON struct acpi_namespace_node *node; }; - -struct acpi_pscope_state -{ - ACPI_STATE_COMMON - union acpi_parse_object *op; /* Current op being parsed */ - u8 *arg_end; /* Current argument end */ - u8 *pkg_end; /* Current package end */ - u32 arg_list; /* Next argument to parse */ - u32 arg_count; /* Number of fixed arguments */ +struct acpi_pscope_state { + ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ + u8 *arg_end; /* Current argument end */ + u8 *pkg_end; /* Current package end */ + u32 arg_list; /* Next argument to parse */ + u32 arg_count; /* Number of fixed arguments */ }; - /* * Thread state - one per thread across multiple walk states. Multiple walk * states are created when there are nested control methods executing. */ -struct acpi_thread_state -{ - ACPI_STATE_COMMON - struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ - union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ - u32 thread_id; /* Running thread ID */ - u8 current_sync_level; /* Mutex Sync (nested acquire) level */ +struct acpi_thread_state { + ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ + union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ + u32 thread_id; /* Running thread ID */ + u8 current_sync_level; /* Mutex Sync (nested acquire) level */ }; - /* * Result values - used to accumulate the results of nested * AML arguments */ -struct acpi_result_values -{ +struct acpi_result_values { ACPI_STATE_COMMON - union acpi_operand_object *obj_desc [ACPI_OBJ_NUM_OPERANDS]; - u8 num_results; - u8 last_insert; + union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; + u8 num_results; + u8 last_insert; }; - -typedef -acpi_status (*acpi_parse_downwards) ( - struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op); - typedef -acpi_status (*acpi_parse_upwards) ( - struct acpi_walk_state *walk_state); +acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state, + union acpi_parse_object ** out_op); +typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); /* * Notify info - used to pass info to the deferred notify * handler/dispatcher. */ -struct acpi_notify_info -{ - ACPI_STATE_COMMON - struct acpi_namespace_node *node; - union acpi_operand_object *handler_obj; +struct acpi_notify_info { + ACPI_STATE_COMMON struct acpi_namespace_node *node; + union acpi_operand_object *handler_obj; }; - /* Generic state is union of structs above */ -union acpi_generic_state -{ - struct acpi_common_state common; - struct acpi_control_state control; - struct acpi_update_state update; - struct acpi_scope_state scope; - struct acpi_pscope_state parse_scope; - struct acpi_pkg_state pkg; - struct acpi_thread_state thread; - struct acpi_result_values results; - struct acpi_notify_info notify; +union acpi_generic_state { + struct acpi_common_state common; + struct acpi_control_state control; + struct acpi_update_state update; + struct acpi_scope_state scope; + struct acpi_pscope_state parse_scope; + struct acpi_pkg_state pkg; + struct acpi_thread_state thread; + struct acpi_result_values results; + struct acpi_notify_info notify; }; - /***************************************************************************** * * Interpreter typedefs and structs * ****************************************************************************/ -typedef -acpi_status (*ACPI_EXECUTE_OP) ( - struct acpi_walk_state *walk_state); - +typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); /***************************************************************************** * @@ -586,28 +509,26 @@ acpi_status (*ACPI_EXECUTE_OP) ( /* * AML opcode, name, and argument layout */ -struct acpi_opcode_info -{ +struct acpi_opcode_info { #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) - char *name; /* Opcode name (disassembler/debug only) */ + char *name; /* Opcode name (disassembler/debug only) */ #endif - u32 parse_args; /* Grammar/Parse time arguments */ - u32 runtime_args; /* Interpret time arguments */ - u32 flags; /* Misc flags */ - u8 object_type; /* Corresponding internal object type */ - u8 class; /* Opcode class */ - u8 type; /* Opcode type */ + u32 parse_args; /* Grammar/Parse time arguments */ + u32 runtime_args; /* Interpret time arguments */ + u32 flags; /* Misc flags */ + u8 object_type; /* Corresponding internal object type */ + u8 class; /* Opcode class */ + u8 type; /* Opcode type */ }; -union acpi_parse_value -{ - acpi_integer integer; /* Integer constant (Up to 64 bits) */ - struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ - u32 size; /* bytelist or field size */ - char *string; /* NULL terminated string */ - u8 *buffer; /* buffer or string */ - char *name; /* NULL terminated string */ - union acpi_parse_object *arg; /* arguments and contained ops */ +union acpi_parse_value { + acpi_integer integer; /* Integer constant (Up to 64 bits) */ + struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ + u32 size; /* bytelist or field size */ + char *string; /* NULL terminated string */ + u8 *buffer; /* buffer or string */ + char *name; /* NULL terminated string */ + union acpi_parse_object *arg; /* arguments and contained ops */ }; #define ACPI_PARSE_COMMON \ @@ -636,84 +557,72 @@ union acpi_parse_value /* * generic operation (for example: If, While, Store) */ -struct acpi_parse_obj_common -{ - ACPI_PARSE_COMMON -}; - +struct acpi_parse_obj_common { +ACPI_PARSE_COMMON}; /* * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), * and bytelists. */ -struct acpi_parse_obj_named -{ - ACPI_PARSE_COMMON - u8 *path; - u8 *data; /* AML body or bytelist data */ - u32 length; /* AML length */ - u32 name; /* 4-byte name or zero if no name */ +struct acpi_parse_obj_named { + ACPI_PARSE_COMMON u8 * path; + u8 *data; /* AML body or bytelist data */ + u32 length; /* AML length */ + u32 name; /* 4-byte name or zero if no name */ }; - /* The parse node is the fundamental element of the parse tree */ -struct acpi_parse_obj_asl -{ - ACPI_PARSE_COMMON - union acpi_parse_object *child; - union acpi_parse_object *parent_method; - char *filename; - char *external_name; - char *namepath; - char name_seg[4]; - u32 extra_value; - u32 column; - u32 line_number; - u32 logical_line_number; - u32 logical_byte_offset; - u32 end_line; - u32 end_logical_line; - u32 acpi_btype; - u32 aml_length; - u32 aml_subtree_length; - u32 final_aml_length; - u32 final_aml_offset; - u32 compile_flags; - u16 parse_opcode; - u8 aml_opcode_length; - u8 aml_pkg_len_bytes; - u8 extra; - char parse_op_name[12]; -}; - -union acpi_parse_object -{ - struct acpi_parse_obj_common common; - struct acpi_parse_obj_named named; - struct acpi_parse_obj_asl asl; +struct acpi_parse_obj_asl { + ACPI_PARSE_COMMON union acpi_parse_object *child; + union acpi_parse_object *parent_method; + char *filename; + char *external_name; + char *namepath; + char name_seg[4]; + u32 extra_value; + u32 column; + u32 line_number; + u32 logical_line_number; + u32 logical_byte_offset; + u32 end_line; + u32 end_logical_line; + u32 acpi_btype; + u32 aml_length; + u32 aml_subtree_length; + u32 final_aml_length; + u32 final_aml_offset; + u32 compile_flags; + u16 parse_opcode; + u8 aml_opcode_length; + u8 aml_pkg_len_bytes; + u8 extra; + char parse_op_name[12]; +}; + +union acpi_parse_object { + struct acpi_parse_obj_common common; + struct acpi_parse_obj_named named; + struct acpi_parse_obj_asl asl; }; - /* * Parse state - one state per parser invocation and each control * method. */ -struct acpi_parse_state -{ - u32 aml_size; - u8 *aml_start; /* First AML byte */ - u8 *aml; /* Next AML byte */ - u8 *aml_end; /* (last + 1) AML byte */ - u8 *pkg_start; /* Current package begin */ - u8 *pkg_end; /* Current package end */ - union acpi_parse_object *start_op; /* Root of parse tree */ - struct acpi_namespace_node *start_node; - union acpi_generic_state *scope; /* Current scope */ - union acpi_parse_object *start_scope; +struct acpi_parse_state { + u32 aml_size; + u8 *aml_start; /* First AML byte */ + u8 *aml; /* Next AML byte */ + u8 *aml_end; /* (last + 1) AML byte */ + u8 *pkg_start; /* Current package begin */ + u8 *pkg_end; /* Current package end */ + union acpi_parse_object *start_op; /* Root of parse tree */ + struct acpi_namespace_node *start_node; + union acpi_generic_state *scope; /* Current scope */ + union acpi_parse_object *start_scope; }; - /* Parse object flags */ #define ACPI_PARSEOP_GENERIC 0x01 @@ -729,7 +638,6 @@ struct acpi_parse_state #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 #define ACPI_PARSEOP_SPECIAL 0x10 - /***************************************************************************** * * Hardware (ACPI registers) and PNP @@ -737,15 +645,14 @@ struct acpi_parse_state ****************************************************************************/ #define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" -struct acpi_bit_register_info -{ - u8 parent_register; - u8 bit_position; - u16 access_bit_mask; +struct acpi_bit_register_info { + u8 parent_register; + u8 bit_position; + u16 access_bit_mask; }; - /* * Register IDs * These are the full ACPI registers @@ -760,7 +667,6 @@ struct acpi_bit_register_info #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 - /* Masks used to access the bit_registers */ #define ACPI_BITMASK_TIMER_STATUS 0x0001 @@ -769,7 +675,7 @@ struct acpi_bit_register_info #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 -#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ +#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ #define ACPI_BITMASK_WAKE_STATUS 0x8000 #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ @@ -785,7 +691,7 @@ struct acpi_bit_register_info #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 -#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ +#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ #define ACPI_BITMASK_SCI_ENABLE 0x0001 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 @@ -795,7 +701,6 @@ struct acpi_bit_register_info #define ACPI_BITMASK_ARB_DISABLE 0x0001 - /* Raw bit position of each bit_register */ #define ACPI_BITPOSITION_TIMER_STATUS 0x00 @@ -804,7 +709,7 @@ struct acpi_bit_register_info #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A -#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ +#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ #define ACPI_BITPOSITION_WAKE_STATUS 0x0F #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 @@ -812,7 +717,7 @@ struct acpi_bit_register_info #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A -#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ +#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ #define ACPI_BITPOSITION_SCI_ENABLE 0x00 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 @@ -822,7 +727,6 @@ struct acpi_bit_register_info #define ACPI_BITPOSITION_ARB_DISABLE 0x00 - /***************************************************************************** * * Resource descriptors @@ -841,8 +745,7 @@ struct acpi_bit_register_info #define ACPI_RDESC_TYPE_SMALL 0x00 #define ACPI_RDESC_TYPE_MASK 0x80 -#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ - +#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ /* * Small resource descriptor types @@ -871,7 +774,6 @@ struct acpi_bit_register_info #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B - /***************************************************************************** * * Miscellaneous @@ -880,49 +782,36 @@ struct acpi_bit_register_info #define ACPI_ASCII_ZERO 0x30 - /***************************************************************************** * * Debugger * ****************************************************************************/ -struct acpi_db_method_info -{ - acpi_handle thread_gate; - char *name; - char **args; - u32 flags; - u32 num_loops; - char pathname[128]; +struct acpi_db_method_info { + acpi_handle thread_gate; + char *name; + char **args; + u32 flags; + u32 num_loops; + char pathname[128]; }; -struct acpi_integrity_info -{ - u32 nodes; - u32 objects; +struct acpi_integrity_info { + u32 nodes; + u32 objects; }; - #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 #define ACPI_DB_CONSOLE_OUTPUT 0x02 #define ACPI_DB_DUPLICATE_OUTPUT 0x03 - /***************************************************************************** * * Debug * ****************************************************************************/ -struct acpi_debug_print_info -{ - u32 component_id; - char *proc_name; - char *module_name; -}; - - /* Entry for a memory allocation (debug only) */ #define ACPI_MEM_MALLOC 0 @@ -938,51 +827,36 @@ struct acpi_debug_print_info char module[ACPI_MAX_MODULE_NAME]; \ u8 alloc_type; -struct acpi_debug_mem_header -{ - ACPI_COMMON_DEBUG_MEM_HEADER -}; +struct acpi_debug_mem_header { +ACPI_COMMON_DEBUG_MEM_HEADER}; -struct acpi_debug_mem_block -{ - ACPI_COMMON_DEBUG_MEM_HEADER - u64 user_space; +struct acpi_debug_mem_block { + ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space; }; - #define ACPI_MEM_LIST_GLOBAL 0 #define ACPI_MEM_LIST_NSNODE 1 +#define ACPI_MEM_LIST_MAX 1 +#define ACPI_NUM_MEM_LISTS 2 -#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2 -#define ACPI_MEM_LIST_STATE 2 -#define ACPI_MEM_LIST_PSNODE 3 -#define ACPI_MEM_LIST_PSNODE_EXT 4 -#define ACPI_MEM_LIST_OPERAND 5 -#define ACPI_MEM_LIST_WALK 6 -#define ACPI_MEM_LIST_MAX 6 -#define ACPI_NUM_MEM_LISTS 7 - - -struct acpi_memory_list -{ - void *list_head; - u16 link_offset; - u16 max_cache_depth; - u16 cache_depth; - u16 object_size; +struct acpi_memory_list { + char *list_name; + void *list_head; + u16 object_size; + u16 max_depth; + u16 current_depth; + u16 link_offset; #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* Statistics for debug memory tracking only */ - u32 total_allocated; - u32 total_freed; - u32 current_total_size; - u32 cache_requests; - u32 cache_hits; - char *list_name; + u32 total_allocated; + u32 total_freed; + u32 current_total_size; + u32 requests; + u32 hits; #endif }; - -#endif /* __ACLOCAL_H__ */ +#endif /* __ACLOCAL_H__ */ diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 09be937d2c3..702cc4e57f5 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -44,7 +44,6 @@ #ifndef __ACMACROS_H__ #define __ACMACROS_H__ - /* * Data manipulation macros */ @@ -57,7 +56,6 @@ #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) - #if ACPI_MACHINE_WIDTH == 16 /* @@ -168,7 +166,7 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ @@ -183,9 +181,9 @@ /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ @@ -219,14 +217,14 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) #define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) #else @@ -238,14 +236,14 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) #define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) #endif @@ -266,7 +264,7 @@ /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ @@ -277,8 +275,8 @@ /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ #define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ @@ -305,7 +303,6 @@ #error unknown ACPI_MACHINE_WIDTH #endif - /* * Fast power-of-two math macros for non-optimized compilers */ @@ -329,7 +326,6 @@ #define ACPI_MUL_16(a) _ACPI_MUL(a,4) #define ACPI_MOD_16(a) _ACPI_MOD(a,16) - /* * Rounding macros (Power of two boundaries only) */ @@ -344,7 +340,6 @@ #define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) - #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) @@ -365,7 +360,6 @@ #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) - /* Bitfields within ACPI registers */ #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) @@ -381,7 +375,6 @@ #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) - /* Macro to test the object type */ #define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) @@ -430,28 +423,28 @@ #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 ACPI_PARAM_LIST(pl) pl /* - * Error reporting. These versions add callers module and line#. Since - * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only - * use it in debug mode. + * Error reporting. These versions add callers module and line#. + * + * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT + * isn't defined, only use it in debug mode. */ #ifdef ACPI_DEBUG_OUTPUT -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ +#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); +#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e); -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); +#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e); #else @@ -480,36 +473,58 @@ * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT +#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; -#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; +/* + * Common parameters used for debug output functions: + * line number, function name, module(file) name, component ID + */ +#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT /* - * Function entry tracing. - * The first parameter should be the procedure name as a quoted string. This is declared - * as a local string ("_proc_name) so that it can be also used by the function exit macros below. + * Function entry tracing + */ + +/* + * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, + * define it now. This is the case where there the compiler does not support + * a __FUNCTION__ macro or equivalent. We save the function name on the + * local stack. + */ +#ifndef ACPI_GET_FUNCTION_NAME +#define ACPI_GET_FUNCTION_NAME _acpi_function_name +/* + * The Name parameter should be the procedure name as a quoted string. + * This is declared as a local string ("my_function_name") so that it can + * be also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __FUNCTION__. */ -#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \ - _debug_info.component_id = _COMPONENT; \ - _debug_info.proc_name = a; \ - _debug_info.module_name = _THIS_MODULE; - -#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace(__LINE__,&_debug_info) -#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b) -#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b) -#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ - acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b) - -#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() +#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; + +#else +/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ + +#define ACPI_FUNCTION_NAME(name) +#endif + +#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace(ACPI_DEBUG_PARAMETERS) +#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) +#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) +#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) + +#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() /* * Function exit tracing. * WARNING: These macros include a return statement. This is usually considered * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros - * so that "_proc_name" is defined. + * so that "_acpi_function_name" is defined. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -517,10 +532,10 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) +#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) +#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) /* Conditional execution */ @@ -531,12 +546,10 @@ #define ACPI_DEBUG_ONLY_MEMBERS(a) a; #define _VERBOSE_STRUCTURES - /* Stack and buffer dumping */ #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) -#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) - +#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__) #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) @@ -544,7 +557,6 @@ #define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) #define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a)) - /* * Generate INT3 on ACPI_ERROR (Debug only!) */ @@ -565,14 +577,13 @@ #define ACPI_DEBUG_PRINT(pl) acpi_ut_debug_print ACPI_PARAM_LIST(pl) #define ACPI_DEBUG_PRINT_RAW(pl) acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl) - #else /* * This is the non-debug case -- make everything go away, * leaving no executable debug code! */ #define ACPI_MODULE_NAME(name) -#define _THIS_MODULE "" +#define _acpi_module_name "" #define ACPI_DEBUG_EXEC(a) #define ACPI_NORMAL_EXEC(a) a; @@ -616,7 +627,6 @@ #define ACPI_DEBUGGER_EXEC(a) #endif - /* * For 16-bit code, we want to shrink some things even though * we are using ACPI_DEBUG_OUTPUT to get the debug output @@ -627,7 +637,6 @@ #define ACPI_DEBUG_ONLY_MEMBERS(a) #endif - #ifdef ACPI_DEBUG_OUTPUT /* * 1) Set name to blanks @@ -640,7 +649,6 @@ #define ACPI_ADD_OBJECT_NAME(a,b) #endif - /* * Memory allocation tracking (DEBUG ONLY) */ @@ -648,21 +656,20 @@ /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_FREE(a) acpi_os_free(a) #define ACPI_MEM_TRACKING(a) - #else /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) +#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) #define ACPI_MEM_TRACKING(a) a -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ -#endif /* ACMACROS_H */ +#endif /* ACMACROS_H */ diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index deb7cb06f5f..4f9063f3e95 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -71,14 +71,13 @@ /* Definitions of the predefined namespace names */ -#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ -#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ +#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ + +#define ACPI_PREFIX_MIXED (u32) 0x69706341 /* "Acpi" */ +#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */ #define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_SYSTEM_BUS "_SB_" - -#endif /* __ACNAMES_H__ */ - - +#endif /* __ACNAMES_H__ */ diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index d1b3ce80056..dd3501f7e5d 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -44,7 +44,6 @@ #ifndef __ACNAMESP_H__ #define __ACNAMESP_H__ - /* To search the entire name space, pass this as search_base */ #define ACPI_NS_ALL ((acpi_handle)0) @@ -54,8 +53,8 @@ * and should be one-to-one with values of acpi_object_type */ #define ACPI_NS_NORMAL 0 -#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ -#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ +#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ +#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ @@ -68,357 +67,237 @@ #define ACPI_NS_WALK_UNLOCK TRUE #define ACPI_NS_WALK_NO_UNLOCK FALSE - /* * nsinit - Namespace initialization */ -acpi_status -acpi_ns_initialize_objects ( - void); - -acpi_status -acpi_ns_initialize_devices ( - void); +acpi_status acpi_ns_initialize_objects(void); +acpi_status acpi_ns_initialize_devices(void); /* * nsload - Namespace loading */ -acpi_status -acpi_ns_load_namespace ( - void); +acpi_status acpi_ns_load_namespace(void); acpi_status -acpi_ns_load_table ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *node); - +acpi_ns_load_table(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *node); /* * nswalk - walk the namespace */ acpi_status -acpi_ns_walk_namespace ( - acpi_object_type type, - acpi_handle start_object, - u32 max_depth, - u8 unlock_before_callback, - acpi_walk_callback user_function, - void *context, - void **return_value); - -struct acpi_namespace_node * -acpi_ns_get_next_node ( - acpi_object_type type, - struct acpi_namespace_node *parent, - struct acpi_namespace_node *child); - +acpi_ns_walk_namespace(acpi_object_type type, + acpi_handle start_object, + u32 max_depth, + u8 unlock_before_callback, + acpi_walk_callback user_function, + void *context, void **return_value); + +struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, + struct acpi_namespace_node + *parent, + struct acpi_namespace_node + *child); /* * nsparse - table parsing */ acpi_status -acpi_ns_parse_table ( - struct acpi_table_desc *table_desc, - struct acpi_namespace_node *scope); +acpi_ns_parse_table(struct acpi_table_desc *table_desc, + struct acpi_namespace_node *scope); acpi_status -acpi_ns_one_complete_parse ( - u32 pass_number, - struct acpi_table_desc *table_desc); - +acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc); /* * nsaccess - Top-level namespace access */ -acpi_status -acpi_ns_root_initialize ( - void); +acpi_status acpi_ns_root_initialize(void); acpi_status -acpi_ns_lookup ( - union acpi_generic_state *scope_info, - char *name, - acpi_object_type type, - acpi_interpreter_mode interpreter_mode, - u32 flags, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node **ret_node); - +acpi_ns_lookup(union acpi_generic_state *scope_info, + char *name, + acpi_object_type type, + acpi_interpreter_mode interpreter_mode, + u32 flags, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node **ret_node); /* * nsalloc - Named object allocation/deallocation */ -struct acpi_namespace_node * -acpi_ns_create_node ( - u32 name); - -void -acpi_ns_delete_node ( - struct acpi_namespace_node *node); +struct acpi_namespace_node *acpi_ns_create_node(u32 name); -void -acpi_ns_delete_namespace_subtree ( - struct acpi_namespace_node *parent_handle); +void acpi_ns_delete_node(struct acpi_namespace_node *node); void -acpi_ns_delete_namespace_by_owner ( - u16 table_id); +acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); -void -acpi_ns_detach_object ( - struct acpi_namespace_node *node); +void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id); -void -acpi_ns_delete_children ( - struct acpi_namespace_node *parent); +void acpi_ns_detach_object(struct acpi_namespace_node *node); -int -acpi_ns_compare_names ( - char *name1, - char *name2); +void acpi_ns_delete_children(struct acpi_namespace_node *parent); +int acpi_ns_compare_names(char *name1, char *name2); /* * nsdump - Namespace dump/print utilities */ #ifdef ACPI_FUTURE_USAGE -void -acpi_ns_dump_tables ( - acpi_handle search_base, - u32 max_depth); -#endif /* ACPI_FUTURE_USAGE */ +void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth); +#endif /* ACPI_FUTURE_USAGE */ -void -acpi_ns_dump_entry ( - acpi_handle handle, - u32 debug_level); +void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level); void -acpi_ns_dump_pathname ( - acpi_handle handle, - char *msg, - u32 level, - u32 component); +acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component); -void -acpi_ns_print_pathname ( - u32 num_segments, - char *pathname); +void acpi_ns_print_pathname(u32 num_segments, char *pathname); acpi_status -acpi_ns_dump_one_object ( - acpi_handle obj_handle, - u32 level, - void *context, - void **return_value); +acpi_ns_dump_one_object(acpi_handle obj_handle, + u32 level, void *context, void **return_value); #ifdef ACPI_FUTURE_USAGE void -acpi_ns_dump_objects ( - acpi_object_type type, - u8 display_type, - u32 max_depth, - u32 ownder_id, - acpi_handle start_handle); -#endif /* ACPI_FUTURE_USAGE */ - +acpi_ns_dump_objects(acpi_object_type type, + u8 display_type, + u32 max_depth, + acpi_owner_id owner_id, acpi_handle start_handle); +#endif /* ACPI_FUTURE_USAGE */ /* * nseval - Namespace evaluation functions */ -acpi_status -acpi_ns_evaluate_by_handle ( - struct acpi_parameter_info *info); +acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); acpi_status -acpi_ns_evaluate_by_name ( - char *pathname, - struct acpi_parameter_info *info); +acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info); acpi_status -acpi_ns_evaluate_relative ( - char *pathname, - struct acpi_parameter_info *info); - +acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info); /* * nsnames - Name and Scope manipulation */ -u32 -acpi_ns_opens_scope ( - acpi_object_type type); +u32 acpi_ns_opens_scope(acpi_object_type type); -char * -acpi_ns_get_external_pathname ( - struct acpi_namespace_node *node); +char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); -char * -acpi_ns_name_of_current_scope ( - struct acpi_walk_state *walk_state); +char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); acpi_status -acpi_ns_handle_to_pathname ( - acpi_handle target_handle, - struct acpi_buffer *buffer); +acpi_ns_handle_to_pathname(acpi_handle target_handle, + struct acpi_buffer *buffer); u8 -acpi_ns_pattern_match ( - struct acpi_namespace_node *obj_node, - char *search_for); +acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); acpi_status -acpi_ns_get_node_by_path ( - char *external_pathname, - struct acpi_namespace_node *in_prefix_node, - u32 flags, - struct acpi_namespace_node **out_node); - -acpi_size -acpi_ns_get_pathname_length ( - struct acpi_namespace_node *node); +acpi_ns_get_node_by_path(char *external_pathname, + struct acpi_namespace_node *in_prefix_node, + u32 flags, struct acpi_namespace_node **out_node); +acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); /* * nsobject - Object management for namespace nodes */ acpi_status -acpi_ns_attach_object ( - struct acpi_namespace_node *node, - union acpi_operand_object *object, - acpi_object_type type); +acpi_ns_attach_object(struct acpi_namespace_node *node, + union acpi_operand_object *object, acpi_object_type type); -union acpi_operand_object * -acpi_ns_get_attached_object ( - struct acpi_namespace_node *node); +union acpi_operand_object *acpi_ns_get_attached_object(struct + acpi_namespace_node + *node); -union acpi_operand_object * -acpi_ns_get_secondary_object ( - union acpi_operand_object *obj_desc); +union acpi_operand_object *acpi_ns_get_secondary_object(union + acpi_operand_object + *obj_desc); acpi_status -acpi_ns_attach_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler, - void *data); +acpi_ns_attach_data(struct acpi_namespace_node *node, + acpi_object_handler handler, void *data); acpi_status -acpi_ns_detach_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler); +acpi_ns_detach_data(struct acpi_namespace_node *node, + acpi_object_handler handler); acpi_status -acpi_ns_get_attached_data ( - struct acpi_namespace_node *node, - acpi_object_handler handler, - void **data); - +acpi_ns_get_attached_data(struct acpi_namespace_node *node, + acpi_object_handler handler, void **data); /* * nssearch - Namespace searching and entry */ acpi_status -acpi_ns_search_and_enter ( - u32 entry_name, - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *node, - acpi_interpreter_mode interpreter_mode, - acpi_object_type type, - u32 flags, - struct acpi_namespace_node **ret_node); +acpi_ns_search_and_enter(u32 entry_name, + struct acpi_walk_state *walk_state, + struct acpi_namespace_node *node, + acpi_interpreter_mode interpreter_mode, + acpi_object_type type, + u32 flags, struct acpi_namespace_node **ret_node); acpi_status -acpi_ns_search_node ( - u32 entry_name, - struct acpi_namespace_node *node, - acpi_object_type type, - struct acpi_namespace_node **ret_node); +acpi_ns_search_node(u32 entry_name, + struct acpi_namespace_node *node, + acpi_object_type type, + struct acpi_namespace_node **ret_node); void -acpi_ns_install_node ( - struct acpi_walk_state *walk_state, - struct acpi_namespace_node *parent_node, - struct acpi_namespace_node *node, - acpi_object_type type); - +acpi_ns_install_node(struct acpi_walk_state *walk_state, + struct acpi_namespace_node *parent_node, + struct acpi_namespace_node *node, acpi_object_type type); /* * nsutils - Utility functions */ -u8 -acpi_ns_valid_root_prefix ( - char prefix); +u8 acpi_ns_valid_root_prefix(char prefix); -acpi_object_type -acpi_ns_get_type ( - struct acpi_namespace_node *node); +acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); -u32 -acpi_ns_local ( - acpi_object_type type); +u32 acpi_ns_local(acpi_object_type type); void -acpi_ns_report_error ( - char *module_name, - u32 line_number, - u32 component_id, - char *internal_name, - acpi_status lookup_status); +acpi_ns_report_error(char *module_name, + u32 line_number, + u32 component_id, + char *internal_name, acpi_status lookup_status); void -acpi_ns_report_method_error ( - char *module_name, - u32 line_number, - u32 component_id, - char *message, - struct acpi_namespace_node *node, - char *path, - acpi_status lookup_status); +acpi_ns_report_method_error(char *module_name, + u32 line_number, + u32 component_id, + char *message, + struct acpi_namespace_node *node, + char *path, acpi_status lookup_status); -void -acpi_ns_print_node_pathname ( - struct acpi_namespace_node *node, - char *msg); +void acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *msg); -acpi_status -acpi_ns_build_internal_name ( - struct acpi_namestring_info *info); +acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); -void -acpi_ns_get_internal_name_length ( - struct acpi_namestring_info *info); +void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info); -acpi_status -acpi_ns_internalize_name ( - char *dotted_name, - char **converted_name); +acpi_status acpi_ns_internalize_name(char *dotted_name, char **converted_name); acpi_status -acpi_ns_externalize_name ( - u32 internal_name_length, - char *internal_name, - u32 *converted_name_length, - char **converted_name); +acpi_ns_externalize_name(u32 internal_name_length, + char *internal_name, + u32 * converted_name_length, char **converted_name); -struct acpi_namespace_node * -acpi_ns_map_handle_to_node ( - acpi_handle handle); +struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle); -acpi_handle -acpi_ns_convert_entry_to_handle( - struct acpi_namespace_node *node); - -void -acpi_ns_terminate ( - void); +acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node); -struct acpi_namespace_node * -acpi_ns_get_parent_node ( - struct acpi_namespace_node *node); +void acpi_ns_terminate(void); +struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node + *node); -struct acpi_namespace_node * -acpi_ns_get_next_valid_node ( - struct acpi_namespace_node *node); +struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct + acpi_namespace_node + *node); -#endif /* __ACNAMESP_H__ */ +#endif /* __ACNAMESP_H__ */ diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index e079b94e4fc..4a326ba6d48 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -45,7 +45,6 @@ #ifndef _ACOBJECT_H #define _ACOBJECT_H - /* * The union acpi_operand_object is used to pass AML operands from the dispatcher * to the interpreter, and to keep track of the various handlers such as @@ -81,7 +80,6 @@ #define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SINGLE_DATUM 0x20 - /* * Common bitfield for the field objects * "Field Datum" -- a datum from the actual field object @@ -96,8 +94,7 @@ u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ u8 access_bit_width; /* Read/Write size in bits (8-64) */\ u32 value; /* Value to store into the Bank or Index register */\ - struct acpi_namespace_node *node; /* Link back to parent node */ - + struct acpi_namespace_node *node; /* Link back to parent node */ /* * Fields common to both Strings and Buffers @@ -105,15 +102,13 @@ #define ACPI_COMMON_BUFFER_INFO \ u32 length; - /* * Common fields for objects that support ASL notifications */ #define ACPI_COMMON_NOTIFY_INFO \ union acpi_operand_object *system_notify; /* Handler for system notifies */\ union acpi_operand_object *device_notify; /* Handler for driver notifies */\ - union acpi_operand_object *handler; /* Handler for Address space */ - + union acpi_operand_object *handler; /* Handler for Address space */ /****************************************************************************** * @@ -121,161 +116,110 @@ * *****************************************************************************/ -struct acpi_object_common -{ - ACPI_OBJECT_COMMON_HEADER -}; +struct acpi_object_common { +ACPI_OBJECT_COMMON_HEADER}; - -struct acpi_object_integer -{ - ACPI_OBJECT_COMMON_HEADER - acpi_integer value; +struct acpi_object_integer { + ACPI_OBJECT_COMMON_HEADER acpi_integer value; }; - /* * Note: The String and Buffer object must be identical through the Pointer * element. There is code that depends on this. */ -struct acpi_object_string /* Null terminated, ASCII characters only */ -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_BUFFER_INFO - char *pointer; /* String in AML stream or allocated string */ +struct acpi_object_string { /* Null terminated, ASCII characters only */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ }; - -struct acpi_object_buffer -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_BUFFER_INFO - u8 *pointer; /* Buffer in AML stream or allocated buffer */ - struct acpi_namespace_node *node; /* Link back to parent node */ - u8 *aml_start; - u32 aml_length; +struct acpi_object_buffer { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ + struct acpi_namespace_node *node; /* Link back to parent node */ + u8 *aml_start; + u32 aml_length; }; - -struct acpi_object_package -{ - ACPI_OBJECT_COMMON_HEADER - - u32 count; /* # of elements in package */ - u32 aml_length; - u8 *aml_start; - struct acpi_namespace_node *node; /* Link back to parent node */ - union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ +struct acpi_object_package { + ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ + u32 aml_length; + u8 *aml_start; + struct acpi_namespace_node *node; /* Link back to parent node */ + union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ }; - /****************************************************************************** * * Complex data types * *****************************************************************************/ -struct acpi_object_event -{ - ACPI_OBJECT_COMMON_HEADER - void *semaphore; +struct acpi_object_event { + ACPI_OBJECT_COMMON_HEADER void *semaphore; }; - #define ACPI_INFINITE_CONCURRENCY 0xFF typedef -acpi_status (*ACPI_INTERNAL_METHOD) ( - struct acpi_walk_state *walk_state); - -struct acpi_object_method -{ - ACPI_OBJECT_COMMON_HEADER - u8 method_flags; - u8 param_count; - u32 aml_length; - void *semaphore; - u8 *aml_start; - ACPI_INTERNAL_METHOD implementation; - u8 concurrency; - u8 thread_count; - acpi_owner_id owning_id; +acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); + +struct acpi_object_method { + ACPI_OBJECT_COMMON_HEADER u8 method_flags; + u8 param_count; + u32 aml_length; + void *semaphore; + u8 *aml_start; + ACPI_INTERNAL_METHOD implementation; + u8 concurrency; + u8 thread_count; + acpi_owner_id owner_id; }; - -struct acpi_object_mutex -{ - ACPI_OBJECT_COMMON_HEADER - u8 sync_level; /* 0-15, specified in Mutex() call */ - u16 acquisition_depth; /* Allow multiple Acquires, same thread */ - struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ - void *semaphore; /* Actual OS synchronization object */ - union acpi_operand_object *prev; /* Link for list of acquired mutexes */ - union acpi_operand_object *next; /* Link for list of acquired mutexes */ - struct acpi_namespace_node *node; /* Containing namespace node */ - u8 original_sync_level; /* Owner's original sync level (0-15) */ +struct acpi_object_mutex { + ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ + u16 acquisition_depth; /* Allow multiple Acquires, same thread */ + struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ + void *semaphore; /* Actual OS synchronization object */ + union acpi_operand_object *prev; /* Link for list of acquired mutexes */ + union acpi_operand_object *next; /* Link for list of acquired mutexes */ + struct acpi_namespace_node *node; /* Containing namespace node */ + u8 original_sync_level; /* Owner's original sync level (0-15) */ }; - -struct acpi_object_region -{ - ACPI_OBJECT_COMMON_HEADER - - u8 space_id; - union acpi_operand_object *handler; /* Handler for region access */ - struct acpi_namespace_node *node; /* Containing namespace node */ - union acpi_operand_object *next; - u32 length; - acpi_physical_address address; +struct acpi_object_region { + ACPI_OBJECT_COMMON_HEADER u8 space_id; + union acpi_operand_object *handler; /* Handler for region access */ + struct acpi_namespace_node *node; /* Containing namespace node */ + union acpi_operand_object *next; + u32 length; + acpi_physical_address address; }; - /****************************************************************************** * * Objects that can be notified. All share a common notify_info area. * *****************************************************************************/ -struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO -}; - - -struct acpi_object_device -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO - struct acpi_gpe_block_info *gpe_block; -}; - +struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ +ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; -struct acpi_object_power_resource -{ +struct acpi_object_device { ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO - u32 system_level; - u32 resource_order; + ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block; }; - -struct acpi_object_processor -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO - u32 proc_id; - u32 length; - acpi_io_address address; +struct acpi_object_power_resource { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level; + u32 resource_order; }; - -struct acpi_object_thermal_zone -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_NOTIFY_INFO +struct acpi_object_processor { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; + u32 length; + acpi_io_address address; }; +struct acpi_object_thermal_zone { +ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; /****************************************************************************** * @@ -283,90 +227,63 @@ struct acpi_object_thermal_zone * *****************************************************************************/ -struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *region_obj; /* Containing Operation Region object */ - /* (REGION/BANK fields only) */ +struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ + /* (REGION/BANK fields only) */ }; - -struct acpi_object_region_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *region_obj; /* Containing op_region object */ +struct acpi_object_region_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ }; - -struct acpi_object_bank_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *region_obj; /* Containing op_region object */ - union acpi_operand_object *bank_obj; /* bank_select Register object */ +struct acpi_object_bank_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ + union acpi_operand_object *bank_obj; /* bank_select Register object */ }; - -struct acpi_object_index_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - - /* - * No "region_obj" pointer needed since the Index and Data registers - * are each field definitions unto themselves. - */ - union acpi_operand_object *index_obj; /* Index register */ - union acpi_operand_object *data_obj; /* Data register */ +struct acpi_object_index_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO + /* + * No "region_obj" pointer needed since the Index and Data registers + * are each field definitions unto themselves. + */ + union acpi_operand_object *index_obj; /* Index register */ + union acpi_operand_object *data_obj; /* Data register */ }; - /* The buffer_field is different in that it is part of a Buffer, not an op_region */ -struct acpi_object_buffer_field -{ - ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - union acpi_operand_object *buffer_obj; /* Containing Buffer object */ +struct acpi_object_buffer_field { + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */ }; - /****************************************************************************** * * Objects for handlers * *****************************************************************************/ -struct acpi_object_notify_handler -{ - ACPI_OBJECT_COMMON_HEADER - struct acpi_namespace_node *node; /* Parent device */ - acpi_notify_handler handler; - void *context; +struct acpi_object_notify_handler { + ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ + acpi_notify_handler handler; + void *context; }; - /* Flags for address handler */ #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 - -struct acpi_object_addr_handler -{ - ACPI_OBJECT_COMMON_HEADER - u8 space_id; - u16 hflags; - acpi_adr_space_handler handler; - struct acpi_namespace_node *node; /* Parent device */ - void *context; - acpi_adr_space_setup setup; - union acpi_operand_object *region_list; /* regions using this handler */ - union acpi_operand_object *next; +struct acpi_object_addr_handler { + ACPI_OBJECT_COMMON_HEADER u8 space_id; + u16 hflags; + acpi_adr_space_handler handler; + struct acpi_namespace_node *node; /* Parent device */ + void *context; + acpi_adr_space_setup setup; + union acpi_operand_object *region_list; /* regions using this handler */ + union acpi_operand_object *next; }; - /****************************************************************************** * * Special internal objects @@ -377,18 +294,15 @@ struct acpi_object_addr_handler * The Reference object type is used for these opcodes: * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op */ -struct acpi_object_reference -{ - ACPI_OBJECT_COMMON_HEADER - u8 target_type; /* Used for index_op */ - u16 opcode; - u32 offset; /* Used for arg_op, local_op, and index_op */ - void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ - struct acpi_namespace_node *node; - union acpi_operand_object **where; +struct acpi_object_reference { + ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ + u16 opcode; + u32 offset; /* Used for arg_op, local_op, and index_op */ + void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ + struct acpi_namespace_node *node; + union acpi_operand_object **where; }; - /* * Extra object is used as additional storage for types that * have AML code in their declarations (term_args) that must be @@ -396,73 +310,62 @@ struct acpi_object_reference * * Currently: Region and field_unit types */ -struct acpi_object_extra -{ - ACPI_OBJECT_COMMON_HEADER - u8 byte_fill1; - u16 word_fill1; - u32 aml_length; - u8 *aml_start; - struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ - void *region_context; /* Region-specific data */ +struct acpi_object_extra { + ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; + u16 word_fill1; + u32 aml_length; + u8 *aml_start; + struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ + void *region_context; /* Region-specific data */ }; - /* Additional data that can be attached to namespace nodes */ -struct acpi_object_data -{ - ACPI_OBJECT_COMMON_HEADER - acpi_object_handler handler; - void *pointer; +struct acpi_object_data { + ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler; + void *pointer; }; - /* Structure used when objects are cached for reuse */ -struct acpi_object_cache_list -{ - ACPI_OBJECT_COMMON_HEADER - union acpi_operand_object *next; /* Link for object cache and internal lists*/ +struct acpi_object_cache_list { + ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */ }; - /****************************************************************************** * * union acpi_operand_object Descriptor - a giant union of all of the above * *****************************************************************************/ -union acpi_operand_object -{ - struct acpi_object_common common; - struct acpi_object_integer integer; - struct acpi_object_string string; - struct acpi_object_buffer buffer; - struct acpi_object_package package; - struct acpi_object_event event; - struct acpi_object_method method; - struct acpi_object_mutex mutex; - struct acpi_object_region region; - struct acpi_object_notify_common common_notify; - struct acpi_object_device device; - struct acpi_object_power_resource power_resource; - struct acpi_object_processor processor; - struct acpi_object_thermal_zone thermal_zone; - struct acpi_object_field_common common_field; - struct acpi_object_region_field field; - struct acpi_object_buffer_field buffer_field; - struct acpi_object_bank_field bank_field; - struct acpi_object_index_field index_field; - struct acpi_object_notify_handler notify; - struct acpi_object_addr_handler address_space; - struct acpi_object_reference reference; - struct acpi_object_extra extra; - struct acpi_object_data data; - struct acpi_object_cache_list cache; +union acpi_operand_object { + struct acpi_object_common common; + struct acpi_object_integer integer; + struct acpi_object_string string; + struct acpi_object_buffer buffer; + struct acpi_object_package package; + struct acpi_object_event event; + struct acpi_object_method method; + struct acpi_object_mutex mutex; + struct acpi_object_region region; + struct acpi_object_notify_common common_notify; + struct acpi_object_device device; + struct acpi_object_power_resource power_resource; + struct acpi_object_processor processor; + struct acpi_object_thermal_zone thermal_zone; + struct acpi_object_field_common common_field; + struct acpi_object_region_field field; + struct acpi_object_buffer_field buffer_field; + struct acpi_object_bank_field bank_field; + struct acpi_object_index_field index_field; + struct acpi_object_notify_handler notify; + struct acpi_object_addr_handler address_space; + struct acpi_object_reference reference; + struct acpi_object_extra extra; + struct acpi_object_data data; + struct acpi_object_cache_list cache; }; - /****************************************************************************** * * union acpi_descriptor - objects that share a common descriptor identifier @@ -471,7 +374,7 @@ union acpi_operand_object /* Object descriptor types */ -#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ +#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ #define ACPI_DESC_TYPE_STATE 0x02 #define ACPI_DESC_TYPE_STATE_UPDATE 0x03 #define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 @@ -488,14 +391,11 @@ union acpi_operand_object #define ACPI_DESC_TYPE_NAMED 0x0F #define ACPI_DESC_TYPE_MAX 0x0F - -union acpi_descriptor -{ - u8 descriptor_id; /* To differentiate various internal objs */\ - union acpi_operand_object object; - struct acpi_namespace_node node; - union acpi_parse_object op; +union acpi_descriptor { + u8 descriptor_id; /* To differentiate various internal objs */ + union acpi_operand_object object; + struct acpi_namespace_node node; + union acpi_parse_object op; }; - -#endif /* _ACOBJECT_H */ +#endif /* _ACOBJECT_H */ diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index 118ecba4cf0..64da4299219 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h @@ -62,7 +62,6 @@ #define _NAM 0x6C #define _PFX 0x6D - /* * All AML opcodes and the parse-time arguments for each. Used by the AML * parser Each list is compressed into a 32-bit number and stored in the @@ -191,7 +190,6 @@ #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) #define ARGP_ZERO_OP ARG_NONE - /* * All AML opcodes and the runtime arguments for each. Used by the AML * interpreter Each list is compressed into a 32-bit number and stored @@ -246,7 +244,7 @@ #define ARGI_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_IF_OP ARGI_INVALID_OPCODE #define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE @@ -322,4 +320,4 @@ #define ARGI_WORD_OP ARGI_INVALID_OPCODE #define ARGI_ZERO_OP ARG_NONE -#endif /* __ACOPCODE_H__ */ +#endif /* __ACOPCODE_H__ */ diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 2fbe180fee6..68d7edf0f69 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -73,12 +73,10 @@ #define ACPI_ALL_COMPONENTS 0x00003FFF #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) - /* Component IDs reserved for ACPI drivers */ #define ACPI_ALL_DRIVERS 0xFFFF0000 - /* * Raw debug output levels, do not use these in the DEBUG_PRINT macros */ @@ -132,11 +130,10 @@ #define ACPI_LV_VERBOSE 0xF0000000 - /* * Debug level macros that are used in the DEBUG_PRINT macros */ -#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_debug_info +#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS /* Exception level -- used in the global "debug_level" */ @@ -147,7 +144,6 @@ #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) - /* Trace level -- also used in the global "debug_level" */ #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) @@ -174,12 +170,10 @@ #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) - /* Defaults for debug_level, debug and normal */ #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) - -#endif /* __ACOUTPUT_H__ */ +#endif /* __ACOUTPUT_H__ */ diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index 69827657181..d352d40de1f 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -41,18 +41,15 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef __ACPARSER_H__ #define __ACPARSER_H__ - #define OP_HAS_RETURN_VALUE 1 /* variable # arguments */ #define ACPI_VAR_ARGS ACPI_UINT32_MAX - #define ACPI_PARSE_DELETE_TREE 0x0001 #define ACPI_PARSE_NO_TREE_DELETE 0x0000 #define ACPI_PARSE_TREE_MASK 0x0001 @@ -63,7 +60,7 @@ #define ACPI_PARSE_MODE_MASK 0x0030 #define ACPI_PARSE_DEFERRED_OP 0x0100 - +#define ACPI_PARSE_DISASSEMBLE 0x0200 /****************************************************************************** * @@ -71,251 +68,165 @@ * *****************************************************************************/ - /* * psxface - Parser external interfaces */ -acpi_status -acpi_psx_load_table ( - u8 *pcode_addr, - u32 pcode_length); - -acpi_status -acpi_psx_execute ( - struct acpi_parameter_info *info); - +acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); /* * psargs - Parse AML opcode arguments */ -u8 * -acpi_ps_get_next_package_end ( - struct acpi_parse_state *parser_state); +u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state); -char * -acpi_ps_get_next_namestring ( - struct acpi_parse_state *parser_state); +char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state); void -acpi_ps_get_next_simple_arg ( - struct acpi_parse_state *parser_state, - u32 arg_type, - union acpi_parse_object *arg); +acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, + u32 arg_type, union acpi_parse_object *arg); acpi_status -acpi_ps_get_next_namepath ( - struct acpi_walk_state *walk_state, - struct acpi_parse_state *parser_state, - union acpi_parse_object *arg, - u8 method_call); +acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, + struct acpi_parse_state *parser_state, + union acpi_parse_object *arg, u8 method_call); acpi_status -acpi_ps_get_next_arg ( - struct acpi_walk_state *walk_state, - struct acpi_parse_state *parser_state, - u32 arg_type, - union acpi_parse_object **return_arg); - +acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, + struct acpi_parse_state *parser_state, + u32 arg_type, union acpi_parse_object **return_arg); /* * psfind */ -union acpi_parse_object * -acpi_ps_find_name ( - union acpi_parse_object *scope, - u32 name, - u32 opcode); - -union acpi_parse_object* -acpi_ps_get_parent ( - union acpi_parse_object *op); +union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope, + u32 name, u32 opcode); +union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op); /* * psopcode - AML Opcode information */ -const struct acpi_opcode_info * -acpi_ps_get_opcode_info ( - u16 opcode); - -char * -acpi_ps_get_opcode_name ( - u16 opcode); +const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); +char *acpi_ps_get_opcode_name(u16 opcode); /* * psparse - top level parsing routines */ -acpi_status -acpi_ps_parse_aml ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state); -u32 -acpi_ps_get_opcode_size ( - u32 opcode); +u32 acpi_ps_get_opcode_size(u32 opcode); -u16 -acpi_ps_peek_opcode ( - struct acpi_parse_state *state); +u16 acpi_ps_peek_opcode(struct acpi_parse_state *state); +acpi_status +acpi_ps_complete_this_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); + +acpi_status +acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_status callback_status); + +/* + * psloop - main parse loop + */ +acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state); /* * psscope - Scope stack management routines */ acpi_status -acpi_ps_init_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object *root); +acpi_ps_init_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object *root); -union acpi_parse_object * -acpi_ps_get_parent_scope ( - struct acpi_parse_state *state); +union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state + *state); -u8 -acpi_ps_has_completed_scope ( - struct acpi_parse_state *parser_state); +u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state); void -acpi_ps_pop_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object **op, - u32 *arg_list, - u32 *arg_count); +acpi_ps_pop_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object **op, + u32 * arg_list, u32 * arg_count); acpi_status -acpi_ps_push_scope ( - struct acpi_parse_state *parser_state, - union acpi_parse_object *op, - u32 remaining_args, - u32 arg_count); - -void -acpi_ps_cleanup_scope ( - struct acpi_parse_state *state); +acpi_ps_push_scope(struct acpi_parse_state *parser_state, + union acpi_parse_object *op, + u32 remaining_args, u32 arg_count); +void acpi_ps_cleanup_scope(struct acpi_parse_state *state); /* * pstree - parse tree manipulation routines */ void -acpi_ps_append_arg( - union acpi_parse_object *op, - union acpi_parse_object *arg); - -union acpi_parse_object* -acpi_ps_find ( - union acpi_parse_object *scope, - char *path, - u16 opcode, - u32 create); - -union acpi_parse_object * -acpi_ps_get_arg( - union acpi_parse_object *op, - u32 argn); +acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg); -#ifdef ACPI_FUTURE_USAGE -union acpi_parse_object * -acpi_ps_get_depth_next ( - union acpi_parse_object *origin, - union acpi_parse_object *op); -#endif /* ACPI_FUTURE_USAGE */ +union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope, + char *path, u16 opcode, u32 create); +union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn); + +#ifdef ACPI_FUTURE_USAGE +union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, + union acpi_parse_object *op); +#endif /* ACPI_FUTURE_USAGE */ /* * pswalk - parse tree walk routines */ acpi_status -acpi_ps_walk_parsed_aml ( - union acpi_parse_object *start_op, - union acpi_parse_object *end_op, - union acpi_operand_object *mth_desc, - struct acpi_namespace_node *start_node, - union acpi_operand_object **params, - union acpi_operand_object **caller_return_desc, - acpi_owner_id owner_id, - acpi_parse_downwards descending_callback, - acpi_parse_upwards ascending_callback); - -acpi_status -acpi_ps_get_next_walk_op ( - struct acpi_walk_state *walk_state, - union acpi_parse_object *op, - acpi_parse_upwards ascending_callback); +acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op, + union acpi_parse_object *end_op, + union acpi_operand_object *mth_desc, + struct acpi_namespace_node *start_node, + union acpi_operand_object **params, + union acpi_operand_object **caller_return_desc, + acpi_owner_id owner_id, + acpi_parse_downwards descending_callback, + acpi_parse_upwards ascending_callback); acpi_status -acpi_ps_delete_completed_op ( - struct acpi_walk_state *walk_state); +acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state, + union acpi_parse_object *op, + acpi_parse_upwards ascending_callback); -void -acpi_ps_delete_parse_tree ( - union acpi_parse_object *root); +acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state); +void acpi_ps_delete_parse_tree(union acpi_parse_object *root); /* * psutils - parser utilities */ -union acpi_parse_object * -acpi_ps_create_scope_op ( - void); +union acpi_parse_object *acpi_ps_create_scope_op(void); -void -acpi_ps_init_op ( - union acpi_parse_object *op, - u16 opcode); +void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode); -union acpi_parse_object * -acpi_ps_alloc_op ( - u16 opcode); +union acpi_parse_object *acpi_ps_alloc_op(u16 opcode); -void -acpi_ps_free_op ( - union acpi_parse_object *op); +void acpi_ps_free_op(union acpi_parse_object *op); -u8 -acpi_ps_is_leading_char ( - u32 c); +u8 acpi_ps_is_leading_char(u32 c); -u8 -acpi_ps_is_prefix_char ( - u32 c); +u8 acpi_ps_is_prefix_char(u32 c); #ifdef ACPI_FUTURE_USAGE -u32 -acpi_ps_get_name( - union acpi_parse_object *op); -#endif /* ACPI_FUTURE_USAGE */ - -void -acpi_ps_set_name( - union acpi_parse_object *op, - u32 name); - -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ps_delete_parse_cache ( - void); -#endif +u32 acpi_ps_get_name(union acpi_parse_object *op); +#endif /* ACPI_FUTURE_USAGE */ +void acpi_ps_set_name(union acpi_parse_object *op, u32 name); /* * psdump - display parser tree */ u32 -acpi_ps_sprint_path ( - char *buffer_start, - u32 buffer_size, - union acpi_parse_object *op); +acpi_ps_sprint_path(char *buffer_start, + u32 buffer_size, union acpi_parse_object *op); u32 -acpi_ps_sprint_op ( - char *buffer_start, - u32 buffer_size, - union acpi_parse_object *op); - -void -acpi_ps_show ( - union acpi_parse_object *op); +acpi_ps_sprint_op(char *buffer_start, + u32 buffer_size, union acpi_parse_object *op); +void acpi_ps_show(union acpi_parse_object *op); -#endif /* __ACPARSER_H__ */ +#endif /* __ACPARSER_H__ */ diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index a69d7894204..ccf34f9dac6 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h @@ -49,22 +49,21 @@ * We put them here because we don't want to duplicate them * in the rest of the source code again and again. */ -#include "acnames.h" /* Global ACPI names and strings */ -#include "acconfig.h" /* Configuration constants */ -#include "platform/acenv.h" /* Target environment specific items */ -#include "actypes.h" /* Fundamental common data types */ -#include "acexcep.h" /* ACPI exception codes */ -#include "acmacros.h" /* C macros */ -#include "actbl.h" /* ACPI table definitions */ -#include "aclocal.h" /* Internal data types */ -#include "acoutput.h" /* Error output and Debug macros */ -#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/ -#include "acpixf.h" /* ACPI core subsystem external interfaces */ -#include "acobject.h" /* ACPI internal object */ -#include "acstruct.h" /* Common structures */ -#include "acglobal.h" /* All global variables */ -#include "achware.h" /* Hardware defines and interfaces */ -#include "acutils.h" /* Utility interfaces */ +#include "acnames.h" /* Global ACPI names and strings */ +#include "acconfig.h" /* Configuration constants */ +#include "platform/acenv.h" /* Target environment specific items */ +#include "actypes.h" /* Fundamental common data types */ +#include "acexcep.h" /* ACPI exception codes */ +#include "acmacros.h" /* C macros */ +#include "actbl.h" /* ACPI table definitions */ +#include "aclocal.h" /* Internal data types */ +#include "acoutput.h" /* Error output and Debug macros */ +#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer */ +#include "acpixf.h" /* ACPI core subsystem external interfaces */ +#include "acobject.h" /* ACPI internal object */ +#include "acstruct.h" /* Common structures */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "acutils.h" /* Utility interfaces */ - -#endif /* __ACPI_H__ */ +#endif /* __ACPI_H__ */ diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 8d0e1290bc7..0b54e9a4a8a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -35,48 +35,41 @@ /* TBD: Make dynamic */ #define ACPI_MAX_HANDLES 10 struct acpi_handle_list { - u32 count; - acpi_handle handles[ACPI_MAX_HANDLES]; + u32 count; + acpi_handle handles[ACPI_MAX_HANDLES]; }; - /* acpi_utils.h */ acpi_status -acpi_extract_package ( - union acpi_object *package, - struct acpi_buffer *format, - struct acpi_buffer *buffer); +acpi_extract_package(union acpi_object *package, + struct acpi_buffer *format, struct acpi_buffer *buffer); acpi_status -acpi_evaluate_integer ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *arguments, - unsigned long *data); +acpi_evaluate_integer(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *arguments, unsigned long *data); acpi_status -acpi_evaluate_reference ( - acpi_handle handle, - acpi_string pathname, - struct acpi_object_list *arguments, - struct acpi_handle_list *list); - +acpi_evaluate_reference(acpi_handle handle, + acpi_string pathname, + struct acpi_object_list *arguments, + struct acpi_handle_list *list); -#ifdef CONFIG_ACPI_BUS +#ifdef CONFIG_ACPI #include <linux/proc_fs.h> #define ACPI_BUS_FILE_ROOT "acpi" -extern struct proc_dir_entry *acpi_root_dir; -extern FADT_DESCRIPTOR acpi_fadt; +extern struct proc_dir_entry *acpi_root_dir; +extern FADT_DESCRIPTOR acpi_fadt; enum acpi_bus_removal_type { - ACPI_BUS_REMOVAL_NORMAL = 0, + ACPI_BUS_REMOVAL_NORMAL = 0, ACPI_BUS_REMOVAL_EJECT, ACPI_BUS_REMOVAL_SUPRISE, ACPI_BUS_REMOVAL_TYPE_COUNT }; enum acpi_bus_device_type { - ACPI_BUS_TYPE_DEVICE = 0, + ACPI_BUS_TYPE_DEVICE = 0, ACPI_BUS_TYPE_POWER, ACPI_BUS_TYPE_PROCESSOR, ACPI_BUS_TYPE_THERMAL, @@ -89,61 +82,60 @@ enum acpi_bus_device_type { struct acpi_driver; struct acpi_device; - /* * ACPI Driver * ----------- */ -typedef int (*acpi_op_add) (struct acpi_device *device); -typedef int (*acpi_op_remove) (struct acpi_device *device, int type); -typedef int (*acpi_op_lock) (struct acpi_device *device, int type); -typedef int (*acpi_op_start) (struct acpi_device *device); -typedef int (*acpi_op_stop) (struct acpi_device *device, int type); -typedef int (*acpi_op_suspend) (struct acpi_device *device, int state); -typedef int (*acpi_op_resume) (struct acpi_device *device, int state); -typedef int (*acpi_op_scan) (struct acpi_device *device); -typedef int (*acpi_op_bind) (struct acpi_device *device); -typedef int (*acpi_op_unbind) (struct acpi_device *device); -typedef int (*acpi_op_match) (struct acpi_device *device, - struct acpi_driver *driver); +typedef int (*acpi_op_add) (struct acpi_device * device); +typedef int (*acpi_op_remove) (struct acpi_device * device, int type); +typedef int (*acpi_op_lock) (struct acpi_device * device, int type); +typedef int (*acpi_op_start) (struct acpi_device * device); +typedef int (*acpi_op_stop) (struct acpi_device * device, int type); +typedef int (*acpi_op_suspend) (struct acpi_device * device, int state); +typedef int (*acpi_op_resume) (struct acpi_device * device, int state); +typedef int (*acpi_op_scan) (struct acpi_device * device); +typedef int (*acpi_op_bind) (struct acpi_device * device); +typedef int (*acpi_op_unbind) (struct acpi_device * device); +typedef int (*acpi_op_match) (struct acpi_device * device, + struct acpi_driver * driver); struct acpi_bus_ops { - u32 acpi_op_add:1; - u32 acpi_op_remove:1; - u32 acpi_op_lock:1; - u32 acpi_op_start:1; - u32 acpi_op_stop:1; - u32 acpi_op_suspend:1; - u32 acpi_op_resume:1; - u32 acpi_op_scan:1; - u32 acpi_op_bind:1; - u32 acpi_op_unbind:1; - u32 acpi_op_match:1; - u32 reserved:21; + u32 acpi_op_add:1; + u32 acpi_op_remove:1; + u32 acpi_op_lock:1; + u32 acpi_op_start:1; + u32 acpi_op_stop:1; + u32 acpi_op_suspend:1; + u32 acpi_op_resume:1; + u32 acpi_op_scan:1; + u32 acpi_op_bind:1; + u32 acpi_op_unbind:1; + u32 acpi_op_match:1; + u32 reserved:21; }; struct acpi_device_ops { - acpi_op_add add; - acpi_op_remove remove; - acpi_op_lock lock; - acpi_op_start start; - acpi_op_stop stop; - acpi_op_suspend suspend; - acpi_op_resume resume; - acpi_op_scan scan; - acpi_op_bind bind; - acpi_op_unbind unbind; - acpi_op_match match; + acpi_op_add add; + acpi_op_remove remove; + acpi_op_lock lock; + acpi_op_start start; + acpi_op_stop stop; + acpi_op_suspend suspend; + acpi_op_resume resume; + acpi_op_scan scan; + acpi_op_bind bind; + acpi_op_unbind unbind; + acpi_op_match match; }; struct acpi_driver { - struct list_head node; - char name[80]; - char class[80]; - atomic_t references; - char *ids; /* Supported Hardware IDs */ - struct acpi_device_ops ops; + struct list_head node; + char name[80]; + char class[80]; + atomic_t references; + char *ids; /* Supported Hardware IDs */ + struct acpi_device_ops ops; }; /* @@ -154,60 +146,57 @@ struct acpi_driver { /* Status (_STA) */ struct acpi_device_status { - u32 present:1; - u32 enabled:1; - u32 show_in_ui:1; - u32 functional:1; - u32 battery_present:1; - u32 reserved:27; + u32 present:1; + u32 enabled:1; + u32 show_in_ui:1; + u32 functional:1; + u32 battery_present:1; + u32 reserved:27; }; - /* Flags */ struct acpi_device_flags { - u32 dynamic_status:1; - u32 hardware_id:1; - u32 compatible_ids:1; - u32 bus_address:1; - u32 unique_id:1; - u32 removable:1; - u32 ejectable:1; - u32 lockable:1; - u32 suprise_removal_ok:1; - u32 power_manageable:1; - u32 performance_manageable:1; - u32 wake_capable:1; /* Wakeup(_PRW) supported? */ - u32 reserved:20; + u32 dynamic_status:1; + u32 hardware_id:1; + u32 compatible_ids:1; + u32 bus_address:1; + u32 unique_id:1; + u32 removable:1; + u32 ejectable:1; + u32 lockable:1; + u32 suprise_removal_ok:1; + u32 power_manageable:1; + u32 performance_manageable:1; + u32 wake_capable:1; /* Wakeup(_PRW) supported? */ + u32 reserved:20; }; - /* File System */ struct acpi_device_dir { - struct proc_dir_entry *entry; + struct proc_dir_entry *entry; }; #define acpi_device_dir(d) ((d)->dir.entry) - /* Plug and Play */ -typedef char acpi_bus_id[5]; -typedef unsigned long acpi_bus_address; -typedef char acpi_hardware_id[9]; -typedef char acpi_unique_id[9]; -typedef char acpi_device_name[40]; -typedef char acpi_device_class[20]; +typedef char acpi_bus_id[5]; +typedef unsigned long acpi_bus_address; +typedef char acpi_hardware_id[9]; +typedef char acpi_unique_id[9]; +typedef char acpi_device_name[40]; +typedef char acpi_device_class[20]; struct acpi_device_pnp { - acpi_bus_id bus_id; /* Object name */ - acpi_bus_address bus_address; /* _ADR */ - acpi_hardware_id hardware_id; /* _HID */ - struct acpi_compatible_id_list *cid_list; /* _CIDs */ - acpi_unique_id unique_id; /* _UID */ - acpi_device_name device_name; /* Driver-determined */ - acpi_device_class device_class; /* " */ + acpi_bus_id bus_id; /* Object name */ + acpi_bus_address bus_address; /* _ADR */ + acpi_hardware_id hardware_id; /* _HID */ + struct acpi_compatible_id_list *cid_list; /* _CIDs */ + acpi_unique_id unique_id; /* _UID */ + acpi_device_name device_name; /* Driver-determined */ + acpi_device_class device_class; /* " */ }; #define acpi_device_bid(d) ((d)->pnp.bus_id) @@ -217,114 +206,111 @@ struct acpi_device_pnp { #define acpi_device_name(d) ((d)->pnp.device_name) #define acpi_device_class(d) ((d)->pnp.device_class) - /* Power Management */ struct acpi_device_power_flags { - u32 explicit_get:1; /* _PSC present? */ - u32 power_resources:1; /* Power resources */ - u32 inrush_current:1; /* Serialize Dx->D0 */ - u32 power_removed:1; /* Optimize Dx->D0 */ - u32 reserved:28; + u32 explicit_get:1; /* _PSC present? */ + u32 power_resources:1; /* Power resources */ + u32 inrush_current:1; /* Serialize Dx->D0 */ + u32 power_removed:1; /* Optimize Dx->D0 */ + u32 reserved:28; }; struct acpi_device_power_state { struct { - u8 valid:1; - u8 explicit_set:1; /* _PSx present? */ - u8 reserved:6; - } flags; - int power; /* % Power (compared to D0) */ - int latency; /* Dx->D0 time (microseconds) */ - struct acpi_handle_list resources; /* Power resources referenced */ + u8 valid:1; + u8 explicit_set:1; /* _PSx present? */ + u8 reserved:6; + } flags; + int power; /* % Power (compared to D0) */ + int latency; /* Dx->D0 time (microseconds) */ + struct acpi_handle_list resources; /* Power resources referenced */ }; struct acpi_device_power { - int state; /* Current state */ + int state; /* Current state */ struct acpi_device_power_flags flags; - struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ + struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ }; - /* Performance Management */ struct acpi_device_perf_flags { - u8 reserved:8; + u8 reserved:8; }; struct acpi_device_perf_state { struct { - u8 valid:1; - u8 reserved:7; - } flags; - u8 power; /* % Power (compared to P0) */ - u8 performance; /* % Performance ( " ) */ - int latency; /* Px->P0 time (microseconds) */ + u8 valid:1; + u8 reserved:7; + } flags; + u8 power; /* % Power (compared to P0) */ + u8 performance; /* % Performance ( " ) */ + int latency; /* Px->P0 time (microseconds) */ }; struct acpi_device_perf { - int state; + int state; struct acpi_device_perf_flags flags; - int state_count; + int state_count; struct acpi_device_perf_state *states; }; /* Wakeup Management */ struct acpi_device_wakeup_flags { - u8 valid:1; /* Can successfully enable wakeup? */ - u8 run_wake:1; /* Run-Wake GPE devices */ + u8 valid:1; /* Can successfully enable wakeup? */ + u8 run_wake:1; /* Run-Wake GPE devices */ }; struct acpi_device_wakeup_state { - u8 enabled:1; - u8 active:1; + u8 enabled:1; + u8 active:1; }; struct acpi_device_wakeup { - acpi_handle gpe_device; - acpi_integer gpe_number;; - acpi_integer sleep_state; - struct acpi_handle_list resources; - struct acpi_device_wakeup_state state; - struct acpi_device_wakeup_flags flags; + acpi_handle gpe_device; + acpi_integer gpe_number;; + acpi_integer sleep_state; + struct acpi_handle_list resources; + struct acpi_device_wakeup_state state; + struct acpi_device_wakeup_flags flags; }; /* Device */ struct acpi_device { - acpi_handle handle; - struct acpi_device *parent; - struct list_head children; - struct list_head node; - struct list_head wakeup_list; - struct list_head g_list; + acpi_handle handle; + struct acpi_device *parent; + struct list_head children; + struct list_head node; + struct list_head wakeup_list; + struct list_head g_list; struct acpi_device_status status; struct acpi_device_flags flags; - struct acpi_device_pnp pnp; + struct acpi_device_pnp pnp; struct acpi_device_power power; struct acpi_device_wakeup wakeup; - struct acpi_device_perf performance; - struct acpi_device_dir dir; - struct acpi_device_ops ops; - struct acpi_driver *driver; - void *driver_data; - struct kobject kobj; + struct acpi_device_perf performance; + struct acpi_device_dir dir; + struct acpi_device_ops ops; + struct acpi_driver *driver; + void *driver_data; + struct kobject kobj; }; #define acpi_driver_data(d) ((d)->driver_data) - /* * Events * ------ */ struct acpi_bus_event { - struct list_head node; - acpi_device_class device_class; - acpi_bus_id bus_id; - u32 type; - u32 data; + struct list_head node; + acpi_device_class device_class; + acpi_bus_id bus_id; + u32 type; + u32 data; }; extern struct subsystem acpi_subsys; @@ -335,34 +321,32 @@ extern struct subsystem acpi_subsys; int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); -int acpi_bus_get_status (struct acpi_device *device); -int acpi_bus_get_power (acpi_handle handle, int *state); -int acpi_bus_set_power (acpi_handle handle, int state); -int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data); -int acpi_bus_receive_event (struct acpi_bus_event *event); -int acpi_bus_register_driver (struct acpi_driver *driver); -int acpi_bus_unregister_driver (struct acpi_driver *driver); -int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, - acpi_handle handle, int type); -int acpi_bus_start (struct acpi_device *device); - - -int acpi_match_ids (struct acpi_device *device, char *ids); +int acpi_bus_get_status(struct acpi_device *device); +int acpi_bus_get_power(acpi_handle handle, int *state); +int acpi_bus_set_power(acpi_handle handle, int state); +int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); +int acpi_bus_receive_event(struct acpi_bus_event *event); +int acpi_bus_register_driver(struct acpi_driver *driver); +int acpi_bus_unregister_driver(struct acpi_driver *driver); +int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, + acpi_handle handle, int type); +int acpi_bus_start(struct acpi_device *device); + +int acpi_match_ids(struct acpi_device *device, char *ids); int acpi_create_dir(struct acpi_device *); void acpi_remove_dir(struct acpi_device *); - /* * Bind physical devices with ACPI devices */ #include <linux/device.h> struct acpi_bus_type { - struct list_head list; - struct bus_type *bus; - /* For general devices under the bus*/ - int (*find_device)(struct device *, acpi_handle*); + struct list_head list; + struct bus_type *bus; + /* For general devices under the bus */ + int (*find_device) (struct device *, acpi_handle *); /* For bridges, such as PCI root bridge, IDE controller */ - int (*find_bridge)(struct device *, acpi_handle *); + int (*find_bridge) (struct device *, acpi_handle *); }; int register_acpi_bus_type(struct acpi_bus_type *); int unregister_acpi_bus_type(struct acpi_bus_type *); @@ -372,6 +356,6 @@ acpi_handle acpi_get_child(acpi_handle, acpi_integer); acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) -#endif /*CONFIG_ACPI_BUS*/ +#endif /* CONFIG_ACPI */ #endif /*__ACPI_BUS_H__*/ diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 579fe191b7e..c1b4e1f882e 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -29,7 +29,6 @@ #include <linux/acpi.h> #include <acpi/acpi_bus.h> - #define ACPI_MAX_STRING 80 #define ACPI_BUS_COMPONENT 0x00010000 @@ -44,60 +43,55 @@ #define ACPI_BUTTON_HID_POWERF "ACPI_FPB" #define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" - /* -------------------------------------------------------------------------- PCI -------------------------------------------------------------------------- */ -#ifdef CONFIG_ACPI_PCI - #define ACPI_PCI_COMPONENT 0x00400000 /* ACPI PCI Interrupt Link (pci_link.c) */ -int acpi_irq_penalty_init (void); -int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level, - int *active_high_low, char **name); +int acpi_irq_penalty_init(void); +int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, + int *active_high_low, char **name); int acpi_pci_link_free_irq(acpi_handle handle); /* ACPI PCI Interrupt Routing (pci_irq.c) */ -int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus); -void acpi_pci_irq_del_prt (int segment, int bus); +int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); +void acpi_pci_irq_del_prt(int segment, int bus); /* ACPI PCI Device Binding (pci_bind.c) */ struct pci_bus; -acpi_status acpi_get_pci_id (acpi_handle handle, struct acpi_pci_id *id); -int acpi_pci_bind (struct acpi_device *device); -int acpi_pci_unbind (struct acpi_device *device); -int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus); +acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id); +int acpi_pci_bind(struct acpi_device *device); +int acpi_pci_unbind(struct acpi_device *device); +int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id, + struct pci_bus *bus); /* Arch-defined function to add a bus to the system */ -struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus); - -#endif /*CONFIG_ACPI_PCI*/ - +struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, + int bus); /* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */ #ifdef CONFIG_ACPI_POWER -int acpi_enable_wakeup_device_power (struct acpi_device *dev); -int acpi_disable_wakeup_device_power (struct acpi_device *dev); -int acpi_power_get_inferred_state (struct acpi_device *device); -int acpi_power_transition (struct acpi_device *device, int state); +int acpi_enable_wakeup_device_power(struct acpi_device *dev); +int acpi_disable_wakeup_device_power(struct acpi_device *dev); +int acpi_power_get_inferred_state(struct acpi_device *device); +int acpi_power_transition(struct acpi_device *device, int state); #endif - /* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */ #ifdef CONFIG_ACPI_EC -int acpi_ec_ecdt_probe (void); +int acpi_ec_ecdt_probe(void); #endif /* -------------------------------------------------------------------------- diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index ea489f23521..98e0b8cd14e 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -7,7 +7,6 @@ * *****************************************************************************/ - /* * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. @@ -51,7 +50,6 @@ #include "platform/acenv.h" #include "actypes.h" - /* Priorities for acpi_os_queue_for_execution */ #define OSD_PRIORITY_GPE 1 @@ -62,200 +60,136 @@ #define ACPI_NO_UNIT_LIMIT ((u32) -1) #define ACPI_MUTEX_SEM 1 - /* Functions for acpi_os_signal */ #define ACPI_SIGNAL_FATAL 0 #define ACPI_SIGNAL_BREAKPOINT 1 -struct acpi_signal_fatal_info -{ - u32 type; - u32 code; - u32 argument; +struct acpi_signal_fatal_info { + u32 type; + u32 code; + u32 argument; }; - /* * OSL Initialization and shutdown primitives */ -acpi_status -acpi_os_initialize ( - void); - -acpi_status -acpi_os_terminate ( - void); +acpi_status acpi_os_initialize(void); +acpi_status acpi_os_terminate(void); /* * ACPI Table interfaces */ -acpi_status -acpi_os_get_root_pointer ( - u32 flags, - struct acpi_pointer *address); +acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *address); acpi_status -acpi_os_predefined_override ( - const struct acpi_predefined_names *init_val, - acpi_string *new_val); +acpi_os_predefined_override(const struct acpi_predefined_names *init_val, + acpi_string * new_val); acpi_status -acpi_os_table_override ( - struct acpi_table_header *existing_table, - struct acpi_table_header **new_table); - +acpi_os_table_override(struct acpi_table_header *existing_table, + struct acpi_table_header **new_table); /* * Synchronization primitives */ acpi_status -acpi_os_create_semaphore ( - u32 max_units, - u32 initial_units, - acpi_handle *out_handle); - -acpi_status -acpi_os_delete_semaphore ( - acpi_handle handle); +acpi_os_create_semaphore(u32 max_units, + u32 initial_units, acpi_handle * out_handle); -acpi_status -acpi_os_wait_semaphore ( - acpi_handle handle, - u32 units, - u16 timeout); +acpi_status acpi_os_delete_semaphore(acpi_handle handle); -acpi_status -acpi_os_signal_semaphore ( - acpi_handle handle, - u32 units); +acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout); -acpi_status -acpi_os_create_lock ( - acpi_handle *out_handle); +acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units); -void -acpi_os_delete_lock ( - acpi_handle handle); +acpi_status acpi_os_create_lock(acpi_handle * out_handle); -void -acpi_os_acquire_lock ( - acpi_handle handle, - u32 flags); +void acpi_os_delete_lock(acpi_handle handle); -void -acpi_os_release_lock ( - acpi_handle handle, - u32 flags); +unsigned long acpi_os_acquire_lock(acpi_handle handle); +void acpi_os_release_lock(acpi_handle handle, unsigned long flags); /* * Memory allocation and mapping */ -void * -acpi_os_allocate ( - acpi_size size); +void *acpi_os_allocate(acpi_size size); -void -acpi_os_free ( - void * memory); +void acpi_os_free(void *memory); acpi_status -acpi_os_map_memory ( - acpi_physical_address physical_address, - acpi_size size, - void __iomem **logical_address); +acpi_os_map_memory(acpi_physical_address physical_address, + acpi_size size, void __iomem ** logical_address); -void -acpi_os_unmap_memory ( - void __iomem *logical_address, - acpi_size size); +void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_os_get_physical_address ( - void *logical_address, - acpi_physical_address *physical_address); +acpi_os_get_physical_address(void *logical_address, + acpi_physical_address * physical_address); #endif +/* + * Memory/Object Cache + */ +acpi_status +acpi_os_create_cache(char *cache_name, + u16 object_size, + u16 max_depth, acpi_cache_t ** return_cache); + +acpi_status acpi_os_delete_cache(acpi_cache_t * cache); + +acpi_status acpi_os_purge_cache(acpi_cache_t * cache); + +void *acpi_os_acquire_object(acpi_cache_t * cache); + +acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object); /* * Interrupt handlers */ acpi_status -acpi_os_install_interrupt_handler ( - u32 gsi, - acpi_osd_handler service_routine, - void *context); +acpi_os_install_interrupt_handler(u32 gsi, + acpi_osd_handler service_routine, + void *context); acpi_status -acpi_os_remove_interrupt_handler ( - u32 gsi, - acpi_osd_handler service_routine); - +acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); /* * Threads and Scheduling */ -u32 -acpi_os_get_thread_id ( - void); +u32 acpi_os_get_thread_id(void); acpi_status -acpi_os_queue_for_execution ( - u32 priority, - acpi_osd_exec_callback function, - void *context); +acpi_os_queue_for_execution(u32 priority, + acpi_osd_exec_callback function, void *context); -void -acpi_os_wait_events_complete( - void * context); +void acpi_os_wait_events_complete(void *context); -void -acpi_os_wait_events_complete ( - void *context); +void acpi_os_wait_events_complete(void *context); -void -acpi_os_sleep ( - acpi_integer milliseconds); - -void -acpi_os_stall ( - u32 microseconds); +void acpi_os_sleep(acpi_integer milliseconds); +void acpi_os_stall(u32 microseconds); /* * Platform and hardware-independent I/O interfaces */ -acpi_status -acpi_os_read_port ( - acpi_io_address address, - u32 *value, - u32 width); - -acpi_status -acpi_os_write_port ( - acpi_io_address address, - u32 value, - u32 width); +acpi_status acpi_os_read_port(acpi_io_address address, u32 * value, u32 width); +acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width); /* * Platform and hardware-independent physical memory interfaces */ acpi_status -acpi_os_read_memory ( - acpi_physical_address address, - u32 *value, - u32 width); +acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width); acpi_status -acpi_os_write_memory ( - acpi_physical_address address, - u32 value, - u32 width); - +acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); /* * Platform and hardware-independent PCI configuration space access @@ -263,111 +197,69 @@ acpi_os_write_memory ( * certain compilers complain. */ acpi_status -acpi_os_read_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - void *value, - u32 width); +acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, + u32 reg, void *value, u32 width); acpi_status -acpi_os_write_pci_configuration ( - struct acpi_pci_id *pci_id, - u32 reg, - acpi_integer value, - u32 width); +acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, + u32 reg, acpi_integer value, u32 width); /* * Interim function needed for PCI IRQ routing */ void -acpi_os_derive_pci_id( - acpi_handle rhandle, - acpi_handle chandle, - struct acpi_pci_id **pci_id); +acpi_os_derive_pci_id(acpi_handle rhandle, + acpi_handle chandle, struct acpi_pci_id **pci_id); /* * Miscellaneous */ -u8 -acpi_os_readable ( - void *pointer, - acpi_size length); +u8 acpi_os_readable(void *pointer, acpi_size length); #ifdef ACPI_FUTURE_USAGE -u8 -acpi_os_writable ( - void *pointer, - acpi_size length); +u8 acpi_os_writable(void *pointer, acpi_size length); #endif -u64 -acpi_os_get_timer ( - void); +u64 acpi_os_get_timer(void); -acpi_status -acpi_os_signal ( - u32 function, - void *info); +acpi_status acpi_os_signal(u32 function, void *info); /* * Debug print routines */ -void ACPI_INTERNAL_VAR_XFACE -acpi_os_printf ( - const char *format, - ...); - -void -acpi_os_vprintf ( - const char *format, - va_list args); +void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...); -void -acpi_os_redirect_output ( - void *destination); +void acpi_os_vprintf(const char *format, va_list args); +void acpi_os_redirect_output(void *destination); #ifdef ACPI_FUTURE_USAGE /* * Debug input */ -u32 -acpi_os_get_line ( - char *buffer); +u32 acpi_os_get_line(char *buffer); #endif - /* * Directory manipulation */ -void * -acpi_os_open_directory ( - char *pathname, - char *wildcard_spec, - char requested_file_type); +void *acpi_os_open_directory(char *pathname, + char *wildcard_spec, char requested_file_type); /* requeste_file_type values */ #define REQUEST_FILE_ONLY 0 #define REQUEST_DIR_ONLY 1 +char *acpi_os_get_next_filename(void *dir_handle); -char * -acpi_os_get_next_filename ( - void *dir_handle); - -void -acpi_os_close_directory ( - void *dir_handle); +void acpi_os_close_directory(void *dir_handle); /* * Debug */ void -acpi_os_dbg_assert( - void *failed_assertion, - void *file_name, - u32 line_number, - char *message); +acpi_os_dbg_assert(void *failed_assertion, + void *file_name, u32 line_number, char *message); -#endif /* __ACPIOSXF_H__ */ +#endif /* __ACPIOSXF_H__ */ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index f8f619f8e4f..2a9dbc13b0f 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -42,447 +42,283 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef __ACXFACE_H__ #define __ACXFACE_H__ #include "actypes.h" #include "actbl.h" - /* * Global interfaces */ -acpi_status -acpi_initialize_subsystem ( - void); +acpi_status acpi_initialize_subsystem(void); -acpi_status -acpi_enable_subsystem ( - u32 flags); +acpi_status acpi_enable_subsystem(u32 flags); -acpi_status -acpi_initialize_objects ( - u32 flags); +acpi_status acpi_initialize_objects(u32 flags); -acpi_status -acpi_terminate ( - void); +acpi_status acpi_terminate(void); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_subsystem_status ( - void); +acpi_status acpi_subsystem_status(void); #endif -acpi_status -acpi_enable ( - void); +acpi_status acpi_enable(void); -acpi_status -acpi_disable ( - void); +acpi_status acpi_disable(void); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_get_system_info ( - struct acpi_buffer *ret_buffer); +acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); #endif -const char * -acpi_format_exception ( - acpi_status exception); +const char *acpi_format_exception(acpi_status exception); -acpi_status -acpi_purge_cached_objects ( - void); +acpi_status acpi_purge_cached_objects(void); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_install_initialization_handler ( - acpi_init_handler handler, - u32 function); +acpi_install_initialization_handler(acpi_init_handler handler, u32 function); #endif /* * ACPI Memory managment */ -void * -acpi_allocate ( - u32 size); - -void * -acpi_callocate ( - u32 size); +void *acpi_allocate(u32 size); -void -acpi_free ( - void *address); +void *acpi_callocate(u32 size); +void acpi_free(void *address); /* * ACPI table manipulation interfaces */ acpi_status -acpi_find_root_pointer ( - u32 flags, - struct acpi_pointer *rsdp_address); +acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address); -acpi_status -acpi_load_tables ( - void); +acpi_status acpi_load_tables(void); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_load_table ( - struct acpi_table_header *table_ptr); +acpi_status acpi_load_table(struct acpi_table_header *table_ptr); -acpi_status -acpi_unload_table ( - acpi_table_type table_type); +acpi_status acpi_unload_table(acpi_table_type table_type); acpi_status -acpi_get_table_header ( - acpi_table_type table_type, - u32 instance, - struct acpi_table_header *out_table_header); -#endif /* ACPI_FUTURE_USAGE */ +acpi_get_table_header(acpi_table_type table_type, + u32 instance, struct acpi_table_header *out_table_header); +#endif /* ACPI_FUTURE_USAGE */ acpi_status -acpi_get_table ( - acpi_table_type table_type, - u32 instance, - struct acpi_buffer *ret_buffer); +acpi_get_table(acpi_table_type table_type, + u32 instance, struct acpi_buffer *ret_buffer); acpi_status -acpi_get_firmware_table ( - acpi_string signature, - u32 instance, - u32 flags, - struct acpi_table_header **table_pointer); - +acpi_get_firmware_table(acpi_string signature, + u32 instance, + u32 flags, struct acpi_table_header **table_pointer); /* * Namespace and name interfaces */ acpi_status -acpi_walk_namespace ( - acpi_object_type type, - acpi_handle start_object, - u32 max_depth, - acpi_walk_callback user_function, - void *context, - void **return_value); +acpi_walk_namespace(acpi_object_type type, + acpi_handle start_object, + u32 max_depth, + acpi_walk_callback user_function, + void *context, void **return_value); acpi_status -acpi_get_devices ( - char *HID, - acpi_walk_callback user_function, - void *context, - void **return_value); +acpi_get_devices(char *HID, + acpi_walk_callback user_function, + void *context, void **return_value); acpi_status -acpi_get_name ( - acpi_handle handle, - u32 name_type, - struct acpi_buffer *ret_path_ptr); +acpi_get_name(acpi_handle handle, + u32 name_type, struct acpi_buffer *ret_path_ptr); acpi_status -acpi_get_handle ( - acpi_handle parent, - acpi_string pathname, - acpi_handle *ret_handle); +acpi_get_handle(acpi_handle parent, + acpi_string pathname, acpi_handle * ret_handle); acpi_status -acpi_attach_data ( - acpi_handle obj_handle, - acpi_object_handler handler, - void *data); +acpi_attach_data(acpi_handle obj_handle, + acpi_object_handler handler, void *data); acpi_status -acpi_detach_data ( - acpi_handle obj_handle, - acpi_object_handler handler); +acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler); acpi_status -acpi_get_data ( - acpi_handle obj_handle, - acpi_object_handler handler, - void **data); - +acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); /* * Object manipulation and enumeration */ acpi_status -acpi_evaluate_object ( - acpi_handle object, - acpi_string pathname, - struct acpi_object_list *parameter_objects, - struct acpi_buffer *return_object_buffer); +acpi_evaluate_object(acpi_handle object, + acpi_string pathname, + struct acpi_object_list *parameter_objects, + struct acpi_buffer *return_object_buffer); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_evaluate_object_typed ( - acpi_handle object, - acpi_string pathname, - struct acpi_object_list *external_params, - struct acpi_buffer *return_buffer, - acpi_object_type return_type); +acpi_evaluate_object_typed(acpi_handle object, + acpi_string pathname, + struct acpi_object_list *external_params, + struct acpi_buffer *return_buffer, + acpi_object_type return_type); #endif acpi_status -acpi_get_object_info ( - acpi_handle handle, - struct acpi_buffer *return_buffer); +acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); acpi_status -acpi_get_next_object ( - acpi_object_type type, - acpi_handle parent, - acpi_handle child, - acpi_handle *out_handle); +acpi_get_next_object(acpi_object_type type, + acpi_handle parent, + acpi_handle child, acpi_handle * out_handle); -acpi_status -acpi_get_type ( - acpi_handle object, - acpi_object_type *out_type); - -acpi_status -acpi_get_parent ( - acpi_handle object, - acpi_handle *out_handle); +acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); +acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); /* * Event handler interfaces */ acpi_status -acpi_install_fixed_event_handler ( - u32 acpi_event, - acpi_event_handler handler, - void *context); +acpi_install_fixed_event_handler(u32 acpi_event, + acpi_event_handler handler, void *context); acpi_status -acpi_remove_fixed_event_handler ( - u32 acpi_event, - acpi_event_handler handler); +acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler); acpi_status -acpi_install_notify_handler ( - acpi_handle device, - u32 handler_type, - acpi_notify_handler handler, - void *context); +acpi_install_notify_handler(acpi_handle device, + u32 handler_type, + acpi_notify_handler handler, void *context); acpi_status -acpi_remove_notify_handler ( - acpi_handle device, - u32 handler_type, - acpi_notify_handler handler); +acpi_remove_notify_handler(acpi_handle device, + u32 handler_type, acpi_notify_handler handler); acpi_status -acpi_install_address_space_handler ( - acpi_handle device, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler, - acpi_adr_space_setup setup, - void *context); +acpi_install_address_space_handler(acpi_handle device, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler, + acpi_adr_space_setup setup, void *context); acpi_status -acpi_remove_address_space_handler ( - acpi_handle device, - acpi_adr_space_type space_id, - acpi_adr_space_handler handler); +acpi_remove_address_space_handler(acpi_handle device, + acpi_adr_space_type space_id, + acpi_adr_space_handler handler); acpi_status -acpi_install_gpe_handler ( - acpi_handle gpe_device, - u32 gpe_number, - u32 type, - acpi_event_handler address, - void *context); +acpi_install_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, + u32 type, acpi_event_handler address, void *context); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_install_exception_handler ( - acpi_exception_handler handler); +acpi_status acpi_install_exception_handler(acpi_exception_handler handler); #endif - /* * Event interfaces */ -acpi_status -acpi_acquire_global_lock ( - u16 timeout, - u32 *handle); +acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); -acpi_status -acpi_release_global_lock ( - u32 handle); +acpi_status acpi_release_global_lock(u32 handle); acpi_status -acpi_remove_gpe_handler ( - acpi_handle gpe_device, - u32 gpe_number, - acpi_event_handler address); +acpi_remove_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, acpi_event_handler address); -acpi_status -acpi_enable_event ( - u32 event, - u32 flags); +acpi_status acpi_enable_event(u32 event, u32 flags); -acpi_status -acpi_disable_event ( - u32 event, - u32 flags); +acpi_status acpi_disable_event(u32 event, u32 flags); -acpi_status -acpi_clear_event ( - u32 event); +acpi_status acpi_clear_event(u32 event); #ifdef ACPI_FUTURE_USAGE -acpi_status -acpi_get_event_status ( - u32 event, - acpi_event_status *event_status); -#endif /* ACPI_FUTURE_USAGE */ +acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); +#endif /* ACPI_FUTURE_USAGE */ -acpi_status -acpi_set_gpe_type ( - acpi_handle gpe_device, - u32 gpe_number, - u8 type); +acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); -acpi_status -acpi_enable_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags); +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); -acpi_status -acpi_disable_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags); +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); -acpi_status -acpi_clear_gpe ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags); +acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_gpe_status ( - acpi_handle gpe_device, - u32 gpe_number, - u32 flags, - acpi_event_status *event_status); -#endif /* ACPI_FUTURE_USAGE */ +acpi_get_gpe_status(acpi_handle gpe_device, + u32 gpe_number, + u32 flags, acpi_event_status * event_status); +#endif /* ACPI_FUTURE_USAGE */ acpi_status -acpi_install_gpe_block ( - acpi_handle gpe_device, - struct acpi_generic_address *gpe_block_address, - u32 register_count, - u32 interrupt_level); - -acpi_status -acpi_remove_gpe_block ( - acpi_handle gpe_device); +acpi_install_gpe_block(acpi_handle gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, u32 interrupt_number); +acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); /* * Resource interfaces */ typedef -acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( - struct acpi_resource *resource, - void *context); - +acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, + void *context); acpi_status -acpi_get_current_resources( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer); +acpi_get_current_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_possible_resources( - acpi_handle device_handle, - struct acpi_buffer *ret_buffer); +acpi_get_possible_resources(acpi_handle device_handle, + struct acpi_buffer *ret_buffer); #endif acpi_status -acpi_walk_resources ( - acpi_handle device_handle, - char *path, - ACPI_WALK_RESOURCE_CALLBACK user_function, - void *context); +acpi_walk_resources(acpi_handle device_handle, + char *path, + ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); acpi_status -acpi_set_current_resources ( - acpi_handle device_handle, - struct acpi_buffer *in_buffer); +acpi_set_current_resources(acpi_handle device_handle, + struct acpi_buffer *in_buffer); acpi_status -acpi_get_irq_routing_table ( - acpi_handle bus_device_handle, - struct acpi_buffer *ret_buffer); +acpi_get_irq_routing_table(acpi_handle bus_device_handle, + struct acpi_buffer *ret_buffer); acpi_status -acpi_resource_to_address64 ( - struct acpi_resource *resource, - struct acpi_resource_address64 *out); +acpi_resource_to_address64(struct acpi_resource *resource, + struct acpi_resource_address64 *out); /* * Hardware (ACPI device) interfaces */ -acpi_status -acpi_get_register ( - u32 register_id, - u32 *return_value, - u32 flags); +acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags); -acpi_status -acpi_set_register ( - u32 register_id, - u32 value, - u32 flags); +acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags); acpi_status -acpi_set_firmware_waking_vector ( - acpi_physical_address physical_address); +acpi_set_firmware_waking_vector(acpi_physical_address physical_address); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_get_firmware_waking_vector ( - acpi_physical_address *physical_address); +acpi_get_firmware_waking_vector(acpi_physical_address * physical_address); #endif acpi_status -acpi_get_sleep_type_data ( - u8 sleep_state, - u8 *slp_typ_a, - u8 *slp_typ_b); +acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); -acpi_status -acpi_enter_sleep_state_prep ( - u8 sleep_state); +acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); -acpi_status asmlinkage -acpi_enter_sleep_state ( - u8 sleep_state); +acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state); -acpi_status asmlinkage -acpi_enter_sleep_state_s4bios ( - void); - -acpi_status -acpi_leave_sleep_state ( - u8 sleep_state); +acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); +acpi_status acpi_leave_sleep_state(u8 sleep_state); -#endif /* __ACXFACE_H__ */ +#endif /* __ACXFACE_H__ */ diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ed679264c12..38e798b05d0 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -44,303 +44,216 @@ #ifndef __ACRESRC_H__ #define __ACRESRC_H__ - /* * Function prototypes called from Acpi* APIs */ acpi_status -acpi_rs_get_prt_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); - +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_get_crs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); +acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_rs_get_prs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); -#endif /* ACPI_FUTURE_USAGE */ +acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); +#endif /* ACPI_FUTURE_USAGE */ acpi_status -acpi_rs_get_method_data ( - acpi_handle handle, - char *path, - struct acpi_buffer *ret_buffer); +acpi_rs_get_method_data(acpi_handle handle, + char *path, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_set_srs_method_data ( - acpi_handle handle, - struct acpi_buffer *ret_buffer); +acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_create_resource_list ( - union acpi_operand_object *byte_stream_buffer, - struct acpi_buffer *output_buffer); +acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, + struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_byte_stream ( - struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer); +acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_pci_routing_table ( - union acpi_operand_object *package_object, - struct acpi_buffer *output_buffer); - +acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, + struct acpi_buffer *output_buffer); /* * rsdump */ #ifdef ACPI_FUTURE_USAGE -void -acpi_rs_dump_resource_list ( - struct acpi_resource *resource); - -void -acpi_rs_dump_irq_list ( - u8 *route_table); -#endif /* ACPI_FUTURE_USAGE */ +void acpi_rs_dump_resource_list(struct acpi_resource *resource); +void acpi_rs_dump_irq_list(u8 * route_table); +#endif /* ACPI_FUTURE_USAGE */ /* * rscalc */ acpi_status -acpi_rs_get_byte_stream_start ( - u8 *byte_stream_buffer, - u8 **byte_stream_start, - u32 *size); +acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, + u8 ** byte_stream_start, u32 * size); acpi_status -acpi_rs_get_list_length ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - acpi_size *size_needed); +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, acpi_size * size_needed); acpi_status -acpi_rs_get_byte_stream_length ( - struct acpi_resource *linked_list_buffer, - acpi_size *size_needed); +acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, + acpi_size * size_needed); acpi_status -acpi_rs_get_pci_routing_table_length ( - union acpi_operand_object *package_object, - acpi_size *buffer_size_needed); +acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, + acpi_size * buffer_size_needed); acpi_status -acpi_rs_byte_stream_to_list ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u8 *output_buffer); +acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, u8 * output_buffer); acpi_status -acpi_rs_list_to_byte_stream ( - struct acpi_resource *linked_list, - acpi_size byte_stream_size_needed, - u8 *output_buffer); +acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, + acpi_size byte_stream_size_needed, + u8 * output_buffer); acpi_status -acpi_rs_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_fixed_io_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_fixed_io_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_dma_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_dma_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_dma_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_dma_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_address16_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_address16_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address16_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_address16_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_address32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_address32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_address32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_address64_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_address64_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_address64_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_address64_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_start_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_end_depend_fns_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_start_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, + acpi_size * bytes_consumed); acpi_status -acpi_rs_end_depend_fns_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_memory24_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_memory24_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_memory24_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_memory24_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_memory32_range_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_fixed_memory32_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); acpi_status -acpi_rs_memory32_range_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_fixed_memory32_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_extended_irq_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_extended_irq_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_end_tag_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_end_tag_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_end_tag_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_end_tag_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_vendor_resource ( - u8 *byte_stream_buffer, - acpi_size *bytes_consumed, - u8 **output_buffer, - acpi_size *structure_size); +acpi_rs_vendor_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); acpi_status -acpi_rs_vendor_stream ( - struct acpi_resource *linked_list, - u8 **output_buffer, - acpi_size *bytes_consumed); +acpi_rs_vendor_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -u8 -acpi_rs_get_resource_type ( - u8 resource_start_byte); +u8 acpi_rs_get_resource_type(u8 resource_start_byte); -#endif /* __ACRESRC_H__ */ +#endif /* __ACRESRC_H__ */ diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index e6b9e36a2ed..99d23533980 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -44,14 +44,12 @@ #ifndef __ACSTRUCT_H__ #define __ACSTRUCT_H__ - /***************************************************************************** * * Tree walking typedefs and structs * ****************************************************************************/ - /* * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through * the tree (for whatever reason), and for control method execution. @@ -65,152 +63,142 @@ #define ACPI_WALK_CONST_REQUIRED 3 #define ACPI_WALK_CONST_OPTIONAL 4 -struct acpi_walk_state -{ - u8 data_type; /* To differentiate various internal objs MUST BE FIRST!*/\ - u8 walk_type; - acpi_owner_id owner_id; /* Owner of objects created during the walk */ - u8 last_predicate; /* Result of last predicate */ - u8 reserved; /* For alignment */ - u8 current_result; /* */ - u8 next_op_info; /* Info about next_op */ - u8 num_operands; /* Stack pointer for Operands[] array */ - u8 return_used; - u16 opcode; /* Current AML opcode */ - u8 scope_depth; - u8 reserved1; - u32 arg_count; /* push for fixed or var args */ - u32 aml_offset; - u32 arg_types; - u32 method_breakpoint; /* For single stepping */ - u32 user_breakpoint; /* User AML breakpoint */ - u32 parse_flags; - u32 prev_arg_types; - - u8 *aml_last_while; - struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ - union acpi_operand_object **caller_return_desc; - union acpi_generic_state *control_state; /* List of control states (nested IFs) */ - struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ - struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ - union acpi_operand_object *implicit_return_obj; - struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ - struct acpi_namespace_node *method_call_node; /* Called method Node*/ - union acpi_parse_object *method_call_op; /* method_call Op if running a method */ - union acpi_operand_object *method_desc; /* Method descriptor if running a method */ - struct acpi_namespace_node *method_node; /* Method node if running a method. */ - union acpi_parse_object *op; /* Current parser op */ - union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ - const struct acpi_opcode_info *op_info; /* Info on current opcode */ - union acpi_parse_object *origin; /* Start of walk [Obsolete] */ - union acpi_operand_object **params; - struct acpi_parse_state parser_state; /* Current state of parser */ - union acpi_operand_object *result_obj; - union acpi_generic_state *results; /* Stack of accumulated results */ - union acpi_operand_object *return_desc; /* Return object, if any */ - union acpi_generic_state *scope_info; /* Stack of nested scopes */ - - union acpi_parse_object *prev_op; /* Last op that was processed */ - union acpi_parse_object *next_op; /* next op to be processed */ - acpi_parse_downwards descending_callback; - acpi_parse_upwards ascending_callback; - struct acpi_thread_state *thread; - struct acpi_walk_state *next; /* Next walk_state in list */ +struct acpi_walk_state { + u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ + u8 walk_type; + acpi_owner_id owner_id; /* Owner of objects created during the walk */ + u8 last_predicate; /* Result of last predicate */ + u8 current_result; /* */ + u8 next_op_info; /* Info about next_op */ + u8 num_operands; /* Stack pointer for Operands[] array */ + u8 return_used; + u16 opcode; /* Current AML opcode */ + u8 scope_depth; + u8 pass_number; /* Parse pass during table load */ + u32 arg_count; /* push for fixed or var args */ + u32 aml_offset; + u32 arg_types; + u32 method_breakpoint; /* For single stepping */ + u32 user_breakpoint; /* User AML breakpoint */ + u32 parse_flags; + u32 prev_arg_types; + + u8 *aml_last_while; + struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ + union acpi_operand_object **caller_return_desc; + union acpi_generic_state *control_state; /* List of control states (nested IFs) */ + struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ + struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ + union acpi_operand_object *implicit_return_obj; + struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ + struct acpi_namespace_node *method_call_node; /* Called method Node */ + union acpi_parse_object *method_call_op; /* method_call Op if running a method */ + union acpi_operand_object *method_desc; /* Method descriptor if running a method */ + struct acpi_namespace_node *method_node; /* Method node if running a method. */ + union acpi_parse_object *op; /* Current parser op */ + union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ + const struct acpi_opcode_info *op_info; /* Info on current opcode */ + union acpi_parse_object *origin; /* Start of walk [Obsolete] */ + union acpi_operand_object **params; + struct acpi_parse_state parser_state; /* Current state of parser */ + union acpi_operand_object *result_obj; + union acpi_generic_state *results; /* Stack of accumulated results */ + union acpi_operand_object *return_desc; /* Return object, if any */ + union acpi_generic_state *scope_info; /* Stack of nested scopes */ + + union acpi_parse_object *prev_op; /* Last op that was processed */ + union acpi_parse_object *next_op; /* next op to be processed */ + acpi_parse_downwards descending_callback; + acpi_parse_upwards ascending_callback; + struct acpi_thread_state *thread; + struct acpi_walk_state *next; /* Next walk_state in list */ }; - /* Info used by acpi_ps_init_objects */ -struct acpi_init_walk_info -{ - u16 method_count; - u16 device_count; - u16 op_region_count; - u16 field_count; - u16 buffer_count; - u16 package_count; - u16 op_region_init; - u16 field_init; - u16 buffer_init; - u16 package_init; - u16 object_count; - struct acpi_table_desc *table_desc; +struct acpi_init_walk_info { + u16 method_count; + u16 device_count; + u16 op_region_count; + u16 field_count; + u16 buffer_count; + u16 package_count; + u16 op_region_init; + u16 field_init; + u16 buffer_init; + u16 package_init; + u16 object_count; + struct acpi_table_desc *table_desc; }; - /* Info used by acpi_ns_initialize_devices */ -struct acpi_device_walk_info -{ - u16 device_count; - u16 num_STA; - u16 num_INI; - struct acpi_table_desc *table_desc; +struct acpi_device_walk_info { + u16 device_count; + u16 num_STA; + u16 num_INI; + struct acpi_table_desc *table_desc; }; - /* TBD: [Restructure] Merge with struct above */ -struct acpi_walk_info -{ - u32 debug_level; - u32 owner_id; - u8 display_type; +struct acpi_walk_info { + u32 debug_level; + u32 count; + acpi_owner_id owner_id; + u8 display_type; }; /* Display Types */ -#define ACPI_DISPLAY_SUMMARY 0 -#define ACPI_DISPLAY_OBJECTS 1 +#define ACPI_DISPLAY_SUMMARY (u8) 0 +#define ACPI_DISPLAY_OBJECTS (u8) 1 +#define ACPI_DISPLAY_MASK (u8) 1 -struct acpi_get_devices_info -{ - acpi_walk_callback user_function; - void *context; - char *hid; -}; +#define ACPI_DISPLAY_SHORT (u8) 2 +struct acpi_get_devices_info { + acpi_walk_callback user_function; + void *context; + char *hid; +}; -union acpi_aml_operands -{ - union acpi_operand_object *operands[7]; +union acpi_aml_operands { + union acpi_operand_object *operands[7]; - struct - { - struct acpi_object_integer *type; - struct acpi_object_integer *code; - struct acpi_object_integer *argument; + struct { + struct acpi_object_integer *type; + struct acpi_object_integer *code; + struct acpi_object_integer *argument; } fatal; - struct - { - union acpi_operand_object *source; - struct acpi_object_integer *index; - union acpi_operand_object *target; + struct { + union acpi_operand_object *source; + struct acpi_object_integer *index; + union acpi_operand_object *target; } index; - struct - { - union acpi_operand_object *source; - struct acpi_object_integer *index; - struct acpi_object_integer *length; - union acpi_operand_object *target; + struct { + union acpi_operand_object *source; + struct acpi_object_integer *index; + struct acpi_object_integer *length; + union acpi_operand_object *target; } mid; }; - /* Internal method parameter list */ -struct acpi_parameter_info -{ - struct acpi_namespace_node *node; - union acpi_operand_object **parameters; - union acpi_operand_object *return_object; - u8 parameter_type; - u8 return_object_type; +struct acpi_parameter_info { + struct acpi_namespace_node *node; + union acpi_operand_object *obj_desc; + union acpi_operand_object **parameters; + union acpi_operand_object *return_object; + u8 pass_number; + u8 parameter_type; + u8 return_object_type; }; /* Types for parameter_type above */ @@ -218,5 +206,4 @@ struct acpi_parameter_info #define ACPI_PARAM_ARGS 0 #define ACPI_PARAM_GPE 1 - #endif diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 39df92e21a0..f92c1858b80 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -44,146 +44,101 @@ #ifndef __ACTABLES_H__ #define __ACTABLES_H__ - /* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */ #define SIZE_IN_HEADER 0 - /* * tbconvrt - Table conversion routines */ -acpi_status -acpi_tb_convert_to_xsdt ( - struct acpi_table_desc *table_info); +acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info); -acpi_status -acpi_tb_convert_table_fadt ( - void); +acpi_status acpi_tb_convert_table_fadt(void); -acpi_status -acpi_tb_build_common_facs ( - struct acpi_table_desc *table_info); +acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info); u32 -acpi_tb_get_table_count ( - struct rsdp_descriptor *RSDP, - struct acpi_table_header *RSDT); - +acpi_tb_get_table_count(struct rsdp_descriptor *RSDP, + struct acpi_table_header *RSDT); /* * tbget - Table "get" routines */ acpi_status -acpi_tb_get_table ( - struct acpi_pointer *address, - struct acpi_table_desc *table_info); - -acpi_status -acpi_tb_get_table_header ( - struct acpi_pointer *address, - struct acpi_table_header *return_header); +acpi_tb_get_table(struct acpi_pointer *address, + struct acpi_table_desc *table_info); acpi_status -acpi_tb_get_table_body ( - struct acpi_pointer *address, - struct acpi_table_header *header, - struct acpi_table_desc *table_info); +acpi_tb_get_table_header(struct acpi_pointer *address, + struct acpi_table_header *return_header); acpi_status -acpi_tb_get_table_ptr ( - acpi_table_type table_type, - u32 instance, - struct acpi_table_header **table_ptr_loc); +acpi_tb_get_table_body(struct acpi_pointer *address, + struct acpi_table_header *header, + struct acpi_table_desc *table_info); acpi_status -acpi_tb_verify_rsdp ( - struct acpi_pointer *address); +acpi_tb_get_table_ptr(acpi_table_type table_type, + u32 instance, struct acpi_table_header **table_ptr_loc); -void -acpi_tb_get_rsdt_address ( - struct acpi_pointer *out_address); +acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address); -acpi_status -acpi_tb_validate_rsdt ( - struct acpi_table_header *table_ptr); +void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address); +acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr); /* * tbgetall - get multiple required tables */ -acpi_status -acpi_tb_get_required_tables ( - void); - +acpi_status acpi_tb_get_required_tables(void); /* * tbinstall - Table installation */ -acpi_status -acpi_tb_install_table ( - struct acpi_table_desc *table_info); +acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info); acpi_status -acpi_tb_recognize_table ( - struct acpi_table_desc *table_info, - u8 search_type); +acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type); acpi_status -acpi_tb_init_table_descriptor ( - acpi_table_type table_type, - struct acpi_table_desc *table_info); - +acpi_tb_init_table_descriptor(acpi_table_type table_type, + struct acpi_table_desc *table_info); /* * tbremove - Table removal and deletion */ -void -acpi_tb_delete_all_tables ( - void); - -void -acpi_tb_delete_tables_by_type ( - acpi_table_type type); +void acpi_tb_delete_all_tables(void); -void -acpi_tb_delete_single_table ( - struct acpi_table_desc *table_desc); +void acpi_tb_delete_tables_by_type(acpi_table_type type); -struct acpi_table_desc * -acpi_tb_uninstall_table ( - struct acpi_table_desc *table_desc); +void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc); +struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc + *table_desc); /* * tbxfroot - RSDP, RSDT utilities */ acpi_status -acpi_tb_find_table ( - char *signature, - char *oem_id, - char *oem_table_id, - struct acpi_table_header **table_ptr); +acpi_tb_find_table(char *signature, + char *oem_id, + char *oem_table_id, struct acpi_table_header **table_ptr); -acpi_status -acpi_tb_get_table_rsdt ( - void); +acpi_status acpi_tb_get_table_rsdt(void); +acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp); /* * tbutils - common table utilities */ +acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); + acpi_status -acpi_tb_verify_table_checksum ( - struct acpi_table_header *table_header); +acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); -u8 -acpi_tb_checksum ( - void *buffer, - u32 length); +u8 acpi_tb_generate_checksum(void *buffer, u32 length); acpi_status -acpi_tb_validate_table_header ( - struct acpi_table_header *table_header); +acpi_tb_validate_table_header(struct acpi_table_header *table_header); -#endif /* __ACTABLES_H__ */ +#endif /* __ACTABLES_H__ */ diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index b5cdcca444c..a46f406e1c9 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -44,27 +44,24 @@ #ifndef __ACTBL_H__ #define __ACTBL_H__ - /* * Values for description table header signatures */ #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 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 */ /* * Common table types. The base code can remain @@ -75,7 +72,6 @@ #define FACS_DESCRIPTOR struct facs_descriptor_rev2 #define FADT_DESCRIPTOR struct fadt_descriptor_rev2 - #pragma pack(1) /* @@ -84,45 +80,37 @@ * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) * are in separate files. */ -struct rsdp_descriptor /* Root System Descriptor Pointer */ -{ - char signature [8]; /* ACPI signature, contains "RSD PTR " */ - u8 checksum; /* To make sum of struct == 0 */ - char oem_id [6]; /* OEM identification */ - u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */ - u32 rsdt_physical_address; /* 32-bit physical address of RSDT */ - u32 length; /* XSDT Length in bytes including hdr */ - u64 xsdt_physical_address; /* 64-bit physical address of XSDT */ - u8 extended_checksum; /* Checksum of entire table */ - char reserved [3]; /* Reserved field must be 0 */ +struct rsdp_descriptor { /* Root System Descriptor Pointer */ + char signature[8]; /* ACPI signature, contains "RSD PTR " */ + u8 checksum; /* ACPI 1.0 checksum */ + char oem_id[6]; /* OEM identification */ + u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ + u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ + u32 length; /* XSDT Length in bytes, including header */ + u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ + u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ + char reserved[3]; /* Reserved, must be zero */ }; - -struct acpi_common_facs /* Common FACS for internal use */ -{ - u32 *global_lock; - u64 *firmware_waking_vector; - u8 vector_width; +struct acpi_common_facs { /* Common FACS for internal use */ + u32 *global_lock; + u64 *firmware_waking_vector; + u8 vector_width; }; - #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ - char signature [4]; /* ACPI signature (4 ASCII characters) */\ - u32 length; /* Length of table, in bytes, including header */\ + char signature[4]; /* ASCII table signature */\ + u32 length; /* Length of table in bytes, including this header */\ u8 revision; /* ACPI Specification minor version # */\ u8 checksum; /* To make sum of entire table == 0 */\ - char oem_id [6]; /* OEM identification */\ - char oem_table_id [8]; /* OEM table identification */\ + char oem_id[6]; /* ASCII OEM identification */\ + char oem_table_id[8]; /* ASCII OEM table identification */\ u32 oem_revision; /* OEM revision number */\ - char asl_compiler_id [4]; /* ASL compiler vendor ID */\ - u32 asl_compiler_revision; /* ASL compiler revision number */ - - -struct acpi_table_header /* ACPI common table header */ -{ - ACPI_TABLE_HEADER_DEF -}; + char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ + u32 asl_compiler_revision; /* ASL compiler version */ +struct acpi_table_header { /* ACPI common table header */ +ACPI_TABLE_HEADER_DEF}; /* * MADT values and structures @@ -135,12 +123,15 @@ struct acpi_table_header /* ACPI common table header */ /* Master MADT */ -struct multiple_apic_table -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 local_apic_address; /* Physical address of local APIC */ - u32 PCATcompat : 1; /* A one indicates system also has dual 8259s */ - u32 reserved1 : 31; +struct multiple_apic_table { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 local_apic_address; /* Physical address of local APIC */ + + /* Flags (32 bits) */ + + u8 PCATcompat:1; /* 00: System also has dual 8259s */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ }; /* Values for Type in APIC_HEADER_DEF */ @@ -154,7 +145,7 @@ struct multiple_apic_table #define APIC_IO_SAPIC 6 #define APIC_LOCAL_SAPIC 7 #define APIC_XRUPT_SOURCE 8 -#define APIC_RESERVED 9 /* 9 and greater are reserved */ +#define APIC_RESERVED 9 /* 9 and greater are reserved */ /* * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) @@ -163,10 +154,8 @@ struct multiple_apic_table u8 type; \ u8 length; -struct apic_header -{ - APIC_HEADER_DEF -}; +struct apic_header { +APIC_HEADER_DEF}; /* Values for MPS INTI flags */ @@ -180,117 +169,90 @@ struct apic_header #define TRIGGER_RESERVED 2 #define TRIGGER_LEVEL 3 -/* Common flag definitions */ +/* Common flag definitions (16 bits each) */ #define MPS_INTI_FLAGS \ - u16 polarity : 2; /* Polarity of APIC I/O input signals */\ - u16 trigger_mode : 2; /* Trigger mode of APIC input signals */\ - u16 reserved1 : 12; /* Reserved, must be zero */ + u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ + u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ + u8 : 4; /* 04-07: Reserved, must be zero */\ + u8 reserved1; /* 08-15: Reserved, must be zero */ #define LOCAL_APIC_FLAGS \ - u32 processor_enabled: 1; /* Processor is usable if set */\ - u32 reserved2 : 31; /* Reserved, must be zero */ + u8 processor_enabled: 1; /* 00: Processor is usable if set */\ + u8 : 7; /* 01-07: Reserved, must be zero */\ + u8 reserved2; /* 08-15: Reserved, must be zero */ /* Sub-structures for MADT */ -struct madt_processor_apic -{ - APIC_HEADER_DEF - u8 processor_id; /* ACPI processor id */ - u8 local_apic_id; /* Processor's local APIC id */ - LOCAL_APIC_FLAGS -}; - -struct madt_io_apic -{ - APIC_HEADER_DEF - u8 io_apic_id; /* I/O APIC ID */ - u8 reserved; /* Reserved - must be zero */ - u32 address; /* APIC physical address */ - u32 interrupt; /* Global system interrupt where INTI - * lines start */ +struct madt_processor_apic { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + u8 local_apic_id; /* Processor's local APIC id */ + LOCAL_APIC_FLAGS}; + +struct madt_io_apic { + APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ + u8 reserved; /* Reserved - must be zero */ + u32 address; /* APIC physical address */ + u32 interrupt; /* Global system interrupt where INTI + * lines start */ }; -struct madt_interrupt_override -{ - APIC_HEADER_DEF - u8 bus; /* 0 - ISA */ - u8 source; /* Interrupt source (IRQ) */ - u32 interrupt; /* Global system interrupt */ - MPS_INTI_FLAGS -}; +struct madt_interrupt_override { + APIC_HEADER_DEF u8 bus; /* 0 - ISA */ + u8 source; /* Interrupt source (IRQ) */ + u32 interrupt; /* Global system interrupt */ + MPS_INTI_FLAGS}; -struct madt_nmi_source -{ - APIC_HEADER_DEF - MPS_INTI_FLAGS - u32 interrupt; /* Global system interrupt */ +struct madt_nmi_source { + APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ }; -struct madt_local_apic_nmi -{ - APIC_HEADER_DEF - u8 processor_id; /* ACPI processor id */ - MPS_INTI_FLAGS - u8 lint; /* LINTn to which NMI is connected */ +struct madt_local_apic_nmi { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ }; -struct madt_address_override -{ - APIC_HEADER_DEF - u16 reserved; /* Reserved - must be zero */ - u64 address; /* APIC physical address */ +struct madt_address_override { + APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ + u64 address; /* APIC physical address */ }; -struct madt_io_sapic -{ - APIC_HEADER_DEF - u8 io_sapic_id; /* I/O SAPIC ID */ - u8 reserved; /* Reserved - must be zero */ - u32 interrupt_base; /* Glocal interrupt for SAPIC start */ - u64 address; /* SAPIC physical address */ +struct madt_io_sapic { + APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ + u8 reserved; /* Reserved, must be zero */ + u32 interrupt_base; /* Glocal interrupt for SAPIC start */ + u64 address; /* SAPIC physical address */ }; -struct madt_local_sapic -{ - APIC_HEADER_DEF - u8 processor_id; /* ACPI processor id */ - u8 local_sapic_id; /* SAPIC ID */ - u8 local_sapic_eid; /* SAPIC EID */ - u8 reserved [3]; /* Reserved - must be zero */ - LOCAL_APIC_FLAGS - u32 processor_uID; /* Numeric UID - ACPI 3.0 */ - char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ +struct madt_local_sapic { + APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ + u8 local_sapic_id; /* SAPIC ID */ + u8 local_sapic_eid; /* SAPIC EID */ + u8 reserved[3]; /* Reserved, must be zero */ + LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ + char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ }; -struct madt_interrupt_source -{ - APIC_HEADER_DEF - MPS_INTI_FLAGS - u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ - u8 processor_id; /* Processor ID */ - u8 processor_eid; /* Processor EID */ - u8 io_sapic_vector; /* Vector value for PMI interrupts */ - u32 interrupt; /* Global system interrupt */ - u32 flags; /* Interrupt Source Flags */ +struct madt_interrupt_source { + APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ + u8 processor_id; /* Processor ID */ + u8 processor_eid; /* Processor EID */ + u8 io_sapic_vector; /* Vector value for PMI interrupts */ + u32 interrupt; /* Global system interrupt */ + u32 flags; /* Interrupt Source Flags */ }; - /* * Smart Battery */ -struct smart_battery_table -{ - ACPI_TABLE_HEADER_DEF - u32 warning_level; - u32 low_level; - u32 critical_level; +struct smart_battery_table { + ACPI_TABLE_HEADER_DEF u32 warning_level; + u32 low_level; + u32 critical_level; }; - #pragma pack() - /* * ACPI Table information. We save the table address, length, * and type of memory allocation (mapped or allocated) for each @@ -314,39 +276,35 @@ struct smart_battery_table /* Data about each known table type */ -struct acpi_table_support -{ - char *name; - char *signature; - void **global_ptr; - u8 sig_length; - u8 flags; +struct acpi_table_support { + char *name; + char *signature; + void **global_ptr; + u8 sig_length; + u8 flags; }; - /* * Get the ACPI version-specific tables */ -#include "actbl1.h" /* Acpi 1.0 table definitions */ -#include "actbl2.h" /* Acpi 2.0 table definitions */ +#include "actbl1.h" /* Acpi 1.0 table definitions */ +#include "actbl2.h" /* Acpi 2.0 table definitions */ -extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, - * needed for certain workarounds */ +extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, + * needed for certain workarounds */ #pragma pack(1) /* * High performance timer */ -struct hpet_table -{ - ACPI_TABLE_HEADER_DEF - u32 hardware_id; - struct acpi_generic_address base_address; - u8 hpet_number; - u16 clock_tick; - u8 attributes; +struct hpet_table { + ACPI_TABLE_HEADER_DEF u32 hardware_id; + struct acpi_generic_address base_address; + u8 hpet_number; + u16 clock_tick; + u8 attributes; }; #pragma pack() -#endif /* __ACTBL_H__ */ +#endif /* __ACTBL_H__ */ diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 33de5f4d2cc..67312c3a915 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -49,88 +49,87 @@ /* * ACPI 1.0 Root System Description Table (RSDT) */ -struct rsdt_descriptor_rev1 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry [1]; /* Array of pointers to other */ - /* ACPI tables */ +struct rsdt_descriptor_rev1 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; - /* * ACPI 1.0 Firmware ACPI Control Structure (FACS) */ -struct facs_descriptor_rev1 -{ - char signature[4]; /* ACPI Signature */ - u32 length; /* Length of structure, in bytes */ - u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* ACPI OS waking vector */ - u32 global_lock; /* Global Lock */ - u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* Must be 0 */ - u8 resverved3 [40]; /* Reserved - must be zero */ -}; +struct facs_descriptor_rev1 { + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure in bytes */ + u32 hardware_signature; /* Hardware configuration signature */ + u32 firmware_waking_vector; /* ACPI OS waking vector */ + u32 global_lock; /* Global Lock */ + + /* Flags (32 bits) */ + u8 S4bios_f:1; /* 00: S4BIOS support is present */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u8 reserved2[40]; /* Reserved, must be zero */ +}; /* * ACPI 1.0 Fixed ACPI Description Table (FADT) */ -struct fadt_descriptor_rev1 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - 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 */ - u32 smi_cmd; /* Port address of SMI command port */ - u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ - u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ - u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ - u8 reserved2; /* Reserved - must be zero */ - 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 gpe0_blk; /* 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 */ - u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ - u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ - u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ - u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ - u8 reserved3; /* Reserved */ - u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ - u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ - u16 flush_size; /* Size of area read to flush caches */ - u16 flush_stride; /* Stride used in flushing caches */ - u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ - u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ - u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ - u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ - u8 century; /* Index to century in RTC CMOS RAM */ - u8 reserved4; /* Reserved */ - u8 reserved4a; /* Reserved */ - u8 reserved4b; /* Reserved */ - u32 wb_invd : 1; /* The wbinvd instruction works properly */ - u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ - u32 proc_c1 : 1; /* All processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */ - u32 reserved5 : 23; /* Reserved - must be zero */ -}; +struct fadt_descriptor_rev1 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 firmware_ctrl; /* Physical address of FACS */ + u32 dsdt; /* Physical address of DSDT */ + u8 model; /* System Interrupt Model */ + u8 reserved1; /* Reserved, must be zero */ + u16 sci_int; /* System vector of SCI interrupt */ + u32 smi_cmd; /* Port address of SMI command port */ + u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ + u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ + u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ + u8 reserved2; /* Reserved, must be zero */ + 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 gpe0_blk; /* 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 */ + u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ + u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ + u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ + u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ + u8 reserved3; /* Reserved, must be zero */ + u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ + u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ + u16 flush_size; /* Size of area read to flush caches */ + u16 flush_stride; /* Stride used in flushing caches */ + u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ + u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ + 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[3]; /* Reserved, must be zero */ -#pragma pack() + /* Flags (32 bits) */ -#endif /* __ACTBL1_H__ */ + u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1:1; /* 02: All processors support C1 state */ + u8 plvl2_up:1; /* 03: C2 state works on MP system */ + u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ + u8:7; /* 09-15: Reserved, must be zero */ + u8 reserved5[2]; /* 16-31: Reserved, must be zero */ +}; +#pragma pack() +#endif /* __ACTBL1_H__ */ diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index e1729c967e0..50305ce2681 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -64,62 +64,56 @@ #define FADT2_REVISION_ID 3 #define FADT2_MINUS_REVISION_ID 2 - #pragma pack(1) /* * ACPI 2.0 Root System Description Table (RSDT) */ -struct rsdt_descriptor_rev2 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u32 table_offset_entry [1]; /* Array of pointers to */ - /* ACPI table headers */ +struct rsdt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; - /* * ACPI 2.0 Extended System Description Table (XSDT) */ -struct xsdt_descriptor_rev2 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - u64 table_offset_entry [1]; /* Array of pointers to */ - /* ACPI table headers */ +struct xsdt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ }; - /* * ACPI 2.0 Firmware ACPI Control Structure (FACS) */ -struct facs_descriptor_rev2 -{ - char signature[4]; /* ACPI signature */ - u32 length; /* Length of structure, in bytes */ - u32 hardware_signature; /* Hardware configuration signature */ - u32 firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */ - u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ - u32 S4bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* Must be 0 */ - u64 xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */ - u8 version; /* Version of this table */ - u8 reserved3 [31]; /* Reserved - must be zero */ +struct facs_descriptor_rev2 { + char signature[4]; /* ASCII table signature */ + u32 length; /* Length of structure, in bytes */ + u32 hardware_signature; /* Hardware configuration signature */ + u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ + u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ + + /* Flags (32 bits) */ + + u8 S4bios_f:1; /* 00: S4BIOS support is present */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved1[3]; /* 08-31: Reserved, must be zero */ + + u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ + u8 version; /* Version of this table */ + u8 reserved3[31]; /* Reserved, must be zero */ }; - /* * ACPI 2.0+ Generic Address Structure (GAS) */ -struct acpi_generic_address -{ - 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 access_width; /* Minimum Access size (ACPI 3.0) */ - u64 address; /* 64-bit address of struct or register */ +struct acpi_generic_address { + 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 access_width; /* Minimum Access size (ACPI 3.0) */ + u64 address; /* 64-bit address of struct or register */ }; - #define FADT_REV2_COMMON \ u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ @@ -161,129 +155,123 @@ struct acpi_generic_address /* * ACPI 2.0+ Fixed ACPI Description Table (FADT) */ -struct fadt_descriptor_rev2 -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - FADT_REV2_COMMON - u8 reserved2; /* Reserved */ - u32 wb_invd : 1; /* The wbinvd instruction works properly */ - u32 wb_invd_flush : 1; /* The wbinvd flushes but does not invalidate */ - u32 proc_c1 : 1; /* All processors support C1 state */ - u32 plvl2_up : 1; /* C2 state works on MP system */ - u32 pwr_button : 1; /* Power button is handled as a generic feature */ - u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ - u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - u32 tmr_val_ext : 1; /* Indicates tmr_val is 32 bits 0=24-bits */ - u32 dock_cap : 1; /* Supports Docking */ - u32 reset_reg_sup : 1; /* Indicates system supports system reset via the FADT RESET_REG */ - u32 sealed_case : 1; /* Indicates system has no internal expansion capabilities and case is sealed */ - u32 headless : 1; /* Indicates system does not have local video capabilities or local input devices */ - u32 cpu_sw_sleep : 1; /* Indicates to OSPM that a processor native instruction */ - /* must be executed after writing the SLP_TYPx register */ - /* ACPI 3.0 flag bits */ - - u32 pci_exp_wak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */ - u32 use_platform_clock : 1; /* OSPM should use platform-provided timer */ - u32 S4rtc_sts_valid : 1; /* Contents of RTC_STS valid after S4 wake */ - u32 remote_power_on_capable : 1; /* System is compatible with remote power on */ - u32 force_apic_cluster_model : 1; /* All local APICs must use cluster model */ - u32 force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */ - u32 reserved6 : 12;/* Reserved - must be zero */ - - struct acpi_generic_address reset_register; /* Reset register address in GAS format */ - u8 reset_value; /* Value to write to the reset_register port to reset the system */ - u8 reserved7[3]; /* These three bytes must be zero */ - u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ - u64 Xdsdt; /* 64-bit physical address of DSDT */ - struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ - struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ - struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ - struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ - struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ - struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ - struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ - struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ +struct fadt_descriptor_rev2 { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ + + /* Flags (32 bits) */ + + u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ + u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ + u8 proc_c1:1; /* 02: All processors support C1 state */ + u8 plvl2_up:1; /* 03: C2 state works on MP system */ + u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ + u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ + u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ + u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ + u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ + u8 dock_cap:1; /* 09: Docking supported */ + u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ + u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ + u8 headless:1; /* 12: No local video capabilities or local input devices */ + u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ + + u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ + u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ + u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ + u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ + u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ + u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ + u8:4; /* 20-23: Reserved, must be zero */ + u8 reserved3; /* 24-31: Reserved, must be zero */ + + struct acpi_generic_address reset_register; /* Reset register address in GAS format */ + u8 reset_value; /* Value to write to the reset_register port to reset the system */ + u8 reserved4[3]; /* These three bytes must be zero */ + u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ + u64 Xdsdt; /* 64-bit physical address of DSDT */ + struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ + struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ + struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ + struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ + struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ + struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ + struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ + struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ }; - /* "Down-revved" ACPI 2.0 FADT descriptor */ -struct fadt_descriptor_rev2_minus -{ - ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - FADT_REV2_COMMON - u8 reserved2; /* Reserved */ - u32 flags; - struct acpi_generic_address reset_register; /* Reset register address in GAS format */ - u8 reset_value; /* Value to write to the reset_register port to reset the system. */ - u8 reserved7[3]; /* These three bytes must be zero */ +struct fadt_descriptor_rev2_minus { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ + u32 flags; + struct acpi_generic_address reset_register; /* Reset register address in GAS format */ + u8 reset_value; /* Value to write to the reset_register port to reset the system. */ + u8 reserved7[3]; /* Reserved, must be zero */ }; - /* ECDT - Embedded Controller Boot Resources Table */ -struct ec_boot_resources -{ - ACPI_TABLE_HEADER_DEF - struct acpi_generic_address ec_control; /* Address of EC command/status register */ - struct acpi_generic_address ec_data; /* Address of EC data register */ - u32 uid; /* Unique ID - must be same as the EC _UID method */ - u8 gpe_bit; /* The GPE for the EC */ - u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ +struct ec_boot_resources { + ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ + struct acpi_generic_address ec_data; /* Address of EC data register */ + u32 uid; /* Unique ID - must be same as the EC _UID method */ + u8 gpe_bit; /* The GPE for the EC */ + u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ }; - /* SRAT - System Resource Affinity Table */ -struct static_resource_alloc -{ - u8 type; - u8 length; - u8 proximity_domain_lo; - u8 apic_id; - u32 enabled :1; - u32 reserved3 :31; - u8 local_sapic_eid; - u8 proximity_domain_hi[3]; - u32 reserved4; -}; +struct static_resource_alloc { + u8 type; + u8 length; + u8 proximity_domain_lo; + u8 apic_id; -struct memory_affinity -{ - u8 type; - u8 length; - u32 proximity_domain; - u16 reserved3; - u64 base_address; - u64 address_length; - u32 reserved4; - u32 enabled :1; - u32 hot_pluggable :1; - u32 non_volatile :1; - u32 reserved5 :29; - u64 reserved6; + /* Flags (32 bits) */ + + u8 enabled:1; /* 00: Use affinity structure */ + u8:7; /* 01-07: Reserved, must be zero */ + u8 reserved3[3]; /* 08-31: Reserved, must be zero */ + + u8 local_sapic_eid; + u8 proximity_domain_hi[3]; + u32 reserved4; /* Reserved, must be zero */ }; -struct system_resource_affinity -{ - ACPI_TABLE_HEADER_DEF - u32 reserved1; /* Must be value '1' */ - u64 reserved2; +struct memory_affinity { + u8 type; + u8 length; + u32 proximity_domain; + u16 reserved3; + u64 base_address; + u64 address_length; + u32 reserved4; + + /* Flags (32 bits) */ + + u8 enabled:1; /* 00: Use affinity structure */ + u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ + u8 non_volatile:1; /* 02: Memory is non-volatile */ + u8:5; /* 03-07: Reserved, must be zero */ + u8 reserved5[3]; /* 08-31: Reserved, must be zero */ + + u64 reserved6; /* Reserved, must be zero */ }; +struct system_resource_affinity { + ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ + u64 reserved2; /* Reserved, must be zero */ +}; /* SLIT - System Locality Distance Information Table */ -struct system_locality_info -{ - ACPI_TABLE_HEADER_DEF - u64 locality_count; - u8 entry[1][1]; +struct system_locality_info { + ACPI_TABLE_HEADER_DEF u64 locality_count; + u8 entry[1][1]; }; - #pragma pack() -#endif /* __ACTBL2_H__ */ - +#endif /* __ACTBL2_H__ */ diff --git a/include/acpi/actbl71.h b/include/acpi/actbl71.h index 7b4fb44261f..10ac05bb36b 100644 --- a/include/acpi/actbl71.h +++ b/include/acpi/actbl71.h @@ -27,7 +27,6 @@ #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 */ @@ -40,105 +39,96 @@ /* Only for clarity in declarations */ -typedef u64 IO_ADDRESS; - +typedef u64 IO_ADDRESS; #pragma pack(1) -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 */ - u64 rsdt_physical_address; /* 64-bit physical address of RSDT */ +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 */ + u64 rsdt_physical_address; /* 64-bit physical address of RSDT */ }; - /*****************************************/ /* IA64 Extensions to ACPI Spec Rev 0.71 */ /* for the Root System Description Table */ /*****************************************/ -struct -{ - struct acpi_table_header header; /* Table header */ - u32 reserved_pad; /* IA64 alignment, must be 0 */ - u64 table_offset_entry [1]; /* Array of pointers to other */ - /* tables' headers */ +struct { + struct acpi_table_header header; /* Table header */ + u32 reserved_pad; /* IA64 alignment, must be 0 */ + u64 table_offset_entry[1]; /* Array of pointers to other */ + /* tables' headers */ }; - /*******************************************/ /* IA64 Extensions to ACPI Spec Rev 0.71 */ /* for the Firmware ACPI Control Structure */ /*******************************************/ -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 */ - u64 firmware_waking_vector; /* ACPI OS waking vector */ - u64 global_lock; /* Global Lock */ - u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ - u32 reserved1 : 31; /* must be 0 */ - u8 reserved3 [28]; /* reserved - must be zero */ +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 */ + u64 firmware_waking_vector; /* ACPI OS waking vector */ + u64 global_lock; /* Global Lock */ + u32 S4bios_f:1; /* Indicates if S4BIOS support is present */ + u32 reserved1:31; /* must be 0 */ + u8 reserved3[28]; /* reserved - must be zero */ }; - /******************************************/ /* IA64 Extensions to ACPI Spec Rev 0.71 */ /* for the Fixed ACPI Description Table */ /******************************************/ -struct -{ - struct acpi_table_header header; /* table header */ - u32 reserved_pad; /* IA64 alignment, must be 0 */ - u64 firmware_ctrl; /* 64-bit Physical address of FACS */ - u64 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 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ - u8 reserved2; /* reserved - must be zero */ - u64 smi_cmd; /* Port address of SMI command port */ - u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ - u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ - u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ - u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ - u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ - u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ - u64 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 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ - u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ - u8 gpe1_base; /* offset in gpe model where gpe1 events start */ - u8 reserved3; /* reserved */ - 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 */ +struct { + struct acpi_table_header header; /* table header */ + u32 reserved_pad; /* IA64 alignment, must be 0 */ + u64 firmware_ctrl; /* 64-bit Physical address of FACS */ + u64 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 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ + u8 reserved2; /* reserved - must be zero */ + u64 smi_cmd; /* Port address of SMI command port */ + u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ + u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ + u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ + u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ + u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ + u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ + u64 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 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ + u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ + u8 gpe1_base; /* offset in gpe model where gpe1 events start */ + u8 reserved3; /* reserved */ + 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 */ }; #pragma pack() -#endif /* __ACTBL71_H__ */ - +#endif /* __ACTBL71_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 3a451dc48ac..6213b27516e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -46,35 +46,31 @@ /*! [Begin] no source code translation (keep the typedefs) */ - - /* * Data type ranges * Note: These macros are designed to be compiler independent as well as * working around problems that some 32-bit compilers have with 64-bit * constants. */ -#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ -#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ -#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ -#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ +#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ +#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ +#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ +#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ #define ACPI_ASCII_MAX 0x7F - #ifdef DEFINE_ALTERNATE_TYPES /* * Types used only in translated source, defined here to enable * cross-platform compilation only. */ -typedef int s32; -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef COMPILER_DEPENDENT_UINT64 u64; +typedef int s32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef COMPILER_DEPENDENT_UINT64 u64; #endif - /* * Data types - Fixed across all compilation models (16/32/64) * @@ -102,30 +98,29 @@ typedef COMPILER_DEPENDENT_UINT64 u64; /* * 64-bit type definitions */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; -typedef COMPILER_DEPENDENT_INT64 INT64; -typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s64 acpi_native_int; -typedef u64 acpi_native_uint; +typedef s64 acpi_native_int; +typedef u64 acpi_native_uint; -typedef u64 acpi_table_ptr; -typedef u64 acpi_io_address; -typedef u64 acpi_physical_address; -typedef u64 acpi_size; +typedef u64 acpi_table_ptr; +typedef u64 acpi_io_address; +typedef u64 acpi_physical_address; +typedef u64 acpi_size; -#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ -#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ +#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX - #elif ACPI_MACHINE_WIDTH == 16 /*! [Begin] no source code translation (keep the typedefs) */ @@ -133,32 +128,31 @@ typedef u64 acpi_size; /* * 16-bit type definitions */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned int UINT16; -typedef long INT32; -typedef int INT16; -typedef unsigned long UINT32; - -struct -{ - UINT32 Lo; - UINT32 Hi; +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned int UINT16; +typedef long INT32; +typedef int INT16; +typedef unsigned long UINT32; + +struct { + UINT32 Lo; + UINT32 Hi; }; /*! [End] no source code translation !*/ -typedef u16 acpi_native_uint; -typedef s16 acpi_native_int; +typedef u16 acpi_native_uint; +typedef s16 acpi_native_int; -typedef u32 acpi_table_ptr; -typedef u32 acpi_io_address; -typedef char *acpi_physical_address; -typedef u16 acpi_size; +typedef u32 acpi_table_ptr; +typedef u32 acpi_io_address; +typedef char *acpi_physical_address; +typedef u16 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define ACPI_MISALIGNED_TRANSFERS -#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ +#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX @@ -168,7 +162,6 @@ typedef u16 acpi_size; */ #define ACPI_NO_INTEGER64_SUPPORT - #elif ACPI_MACHINE_WIDTH == 32 /*! [Begin] no source code translation (keep the typedefs) */ @@ -176,23 +169,23 @@ typedef u16 acpi_size; /* * 32-bit type definitions (default) */ -typedef unsigned char UINT8; -typedef unsigned char BOOLEAN; -typedef unsigned short UINT16; -typedef int INT32; -typedef unsigned int UINT32; -typedef COMPILER_DEPENDENT_INT64 INT64; -typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s32 acpi_native_int; -typedef u32 acpi_native_uint; +typedef s32 acpi_native_int; +typedef u32 acpi_native_uint; -typedef u64 acpi_table_ptr; -typedef u32 acpi_io_address; -typedef u64 acpi_physical_address; -typedef u32 acpi_size; +typedef u64 acpi_table_ptr; +typedef u32 acpi_io_address; +typedef u64 acpi_physical_address; +typedef u32 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 #define ACPI_MISALIGNED_TRANSFERS @@ -203,29 +196,27 @@ typedef u32 acpi_size; #error unknown ACPI_MACHINE_WIDTH #endif - /* - * Miscellaneous common types + * This type is used for bitfields in ACPI tables. The only type that is + * even remotely portable is u8. Anything else is not portable, so + * do not add any more bitfield types. */ -typedef u16 UINT16_BIT; -typedef u32 UINT32_BIT; -typedef acpi_native_uint ACPI_PTRDIFF; +typedef u8 UINT8_BIT; +typedef acpi_native_uint ACPI_PTRDIFF; /* * Pointer overlays to avoid lots of typecasting for * code that accepts both physical and logical pointers. */ -union acpi_pointers -{ - acpi_physical_address physical; - void *logical; - acpi_table_ptr value; +union acpi_pointers { + acpi_physical_address physical; + void *logical; + acpi_table_ptr value; }; -struct acpi_pointer -{ - u32 pointer_type; - union acpi_pointers pointer; +struct acpi_pointer { + u32 pointer_type; + union acpi_pointers pointer; }; /* pointer_types for above */ @@ -243,6 +234,14 @@ struct acpi_pointer #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER +/* + * If acpi_cache_t was not defined in the OS-dependent header, + * define it now. This is typically the case where the local cache + * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) + */ +#ifndef acpi_cache_t +#define acpi_cache_t struct acpi_memory_list +#endif /* * Useful defines @@ -261,34 +260,29 @@ struct acpi_pointer #define NULL (void *) 0 #endif - /* * Local datatypes */ -typedef u32 acpi_status; /* All ACPI Exceptions */ -typedef u32 acpi_name; /* 4-byte ACPI name */ -typedef char * acpi_string; /* Null terminated ASCII string */ -typedef void * acpi_handle; /* Actually a ptr to an Node */ - -struct uint64_struct -{ - u32 lo; - u32 hi; +typedef u32 acpi_status; /* All ACPI Exceptions */ +typedef u32 acpi_name; /* 4-byte ACPI name */ +typedef char *acpi_string; /* Null terminated ASCII string */ +typedef void *acpi_handle; /* Actually a ptr to an Node */ + +struct uint64_struct { + u32 lo; + u32 hi; }; -union uint64_overlay -{ - u64 full; - struct uint64_struct part; +union uint64_overlay { + u64 full; + struct uint64_struct part; }; -struct uint32_struct -{ - u32 lo; - u32 hi; +struct uint32_struct { + u32 lo; + u32 hi; }; - /* * Acpi integer width. In ACPI version 1, integers are * 32 bits. In ACPI version 2, integers are 64 bits. @@ -300,26 +294,24 @@ struct uint32_struct /* 32-bit integers only, no 64-bit support */ -typedef u32 acpi_integer; +typedef u32 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT32_MAX #define ACPI_INTEGER_BIT_SIZE 32 -#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ - -#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ +#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ #else /* 64-bit integers */ -typedef u64 acpi_integer; +typedef u64 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 -#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ - +#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ #if ACPI_MACHINE_WIDTH == 64 -#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #endif #endif @@ -333,7 +325,6 @@ typedef u64 acpi_integer; */ #define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) - /* * Initialization sequence */ @@ -400,7 +391,7 @@ typedef u64 acpi_integer; /* * Table types. These values are passed to the table related APIs */ -typedef u32 acpi_table_type; +typedef u32 acpi_table_type; #define ACPI_TABLE_RSDP (acpi_table_type) 0 #define ACPI_TABLE_DSDT (acpi_table_type) 1 @@ -421,22 +412,22 @@ typedef u32 acpi_table_type; * NOTE: Types must be kept in sync with the global acpi_ns_properties * and acpi_ns_type_names arrays. */ -typedef u32 acpi_object_type; +typedef u32 acpi_object_type; #define ACPI_TYPE_ANY 0x00 -#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ +#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ #define ACPI_TYPE_STRING 0x02 #define ACPI_TYPE_BUFFER 0x03 -#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ +#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ #define ACPI_TYPE_FIELD_UNIT 0x05 -#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ +#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ #define ACPI_TYPE_EVENT 0x07 -#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ +#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ #define ACPI_TYPE_MUTEX 0x09 #define ACPI_TYPE_REGION 0x0A -#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ -#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ -#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ +#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ +#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ +#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ #define ACPI_TYPE_BUFFER_FIELD 0x0E #define ACPI_TYPE_DDB_HANDLE 0x0F #define ACPI_TYPE_DEBUG_OBJECT 0x10 @@ -453,16 +444,16 @@ typedef u32 acpi_object_type; #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 -#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ +#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ #define ACPI_TYPE_LOCAL_ALIAS 0x15 #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 #define ACPI_TYPE_LOCAL_NOTIFY 0x17 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 #define ACPI_TYPE_LOCAL_RESOURCE 0x19 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A -#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ +#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ -#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ +#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ /* * These are special object types that never appear in @@ -506,7 +497,7 @@ typedef u32 acpi_object_type; #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) -#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF /* @@ -519,7 +510,7 @@ typedef u32 acpi_object_type; /* * Event Types: Fixed & General Purpose */ -typedef u32 acpi_event_type; +typedef u32 acpi_event_type; /* * Fixed events @@ -547,7 +538,7 @@ typedef u32 acpi_event_type; * | +----- Set? * +----------- <Reserved> */ -typedef u32 acpi_event_status; +typedef u32 acpi_event_status; #define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 @@ -564,7 +555,6 @@ typedef u32 acpi_event_status; #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 - /* * GPE info flags - Per GPE * +-+-+-+---+---+-+ @@ -585,22 +575,22 @@ typedef u32 acpi_event_status; #define ACPI_GPE_TYPE_MASK (u8) 0x06 #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 #define ACPI_GPE_TYPE_WAKE (u8) 0x02 -#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ +#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ #define ACPI_GPE_DISPATCH_MASK (u8) 0x18 #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 -#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ +#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 #define ACPI_GPE_RUN_ENABLED (u8) 0x20 -#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ +#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 #define ACPI_GPE_WAKE_ENABLED (u8) 0x40 -#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ +#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ -#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ +#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ #define ACPI_GPE_SYSTEM_MASK (u8) 0x80 #define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 @@ -609,13 +599,12 @@ typedef u32 acpi_event_status; /* * Flags for GPE and Lock interfaces */ -#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ -#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ +#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ +#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ #define ACPI_NOT_ISR 0x1 #define ACPI_ISR 0x0 - /* Notify types */ #define ACPI_SYSTEM_NOTIFY 0x1 @@ -625,10 +614,9 @@ typedef u32 acpi_event_status; #define ACPI_MAX_SYS_NOTIFY 0x7f - /* Address Space (Operation Region) Types */ -typedef u8 acpi_adr_space_type; +typedef u8 acpi_adr_space_type; #define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 #define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 @@ -640,7 +628,6 @@ typedef u8 acpi_adr_space_type; #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 - /* * bit_register IDs * These are bitfields defined within the full ACPI registers @@ -674,74 +661,62 @@ typedef u8 acpi_adr_space_type; #define ACPI_BITREG_MAX 0x15 #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 - /* * External ACPI object definition */ -union acpi_object -{ - acpi_object_type type; /* See definition of acpi_ns_type for values */ - struct - { - acpi_object_type type; - acpi_integer value; /* The actual number */ +union acpi_object { + acpi_object_type type; /* See definition of acpi_ns_type for values */ + struct { + acpi_object_type type; + acpi_integer value; /* The actual number */ } integer; - struct - { - acpi_object_type type; - u32 length; /* # of bytes in string, excluding trailing null */ - char *pointer; /* points to the string value */ + struct { + acpi_object_type type; + u32 length; /* # of bytes in string, excluding trailing null */ + char *pointer; /* points to the string value */ } string; - struct - { - acpi_object_type type; - u32 length; /* # of bytes in buffer */ - u8 *pointer; /* points to the buffer */ + struct { + acpi_object_type type; + u32 length; /* # of bytes in buffer */ + u8 *pointer; /* points to the buffer */ } buffer; - struct - { - acpi_object_type type; - u32 fill1; - acpi_handle handle; /* object reference */ + struct { + acpi_object_type type; + u32 fill1; + acpi_handle handle; /* object reference */ } reference; - struct - { - acpi_object_type type; - u32 count; /* # of elements in package */ - union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ + struct { + acpi_object_type type; + u32 count; /* # of elements in package */ + union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ } package; - struct - { - acpi_object_type type; - u32 proc_id; - acpi_io_address pblk_address; - u32 pblk_length; + struct { + acpi_object_type type; + u32 proc_id; + acpi_io_address pblk_address; + u32 pblk_length; } processor; - struct - { - acpi_object_type type; - u32 system_level; - u32 resource_order; + struct { + acpi_object_type type; + u32 system_level; + u32 resource_order; } power_resource; }; - /* * List of objects, used as a parameter list for control method evaluation */ -struct acpi_object_list -{ - u32 count; - union acpi_object *pointer; +struct acpi_object_list { + u32 count; + union acpi_object *pointer; }; - /* * Miscellaneous common Data Structures used by the interfaces */ @@ -749,13 +724,11 @@ struct acpi_object_list #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) -struct acpi_buffer -{ - acpi_size length; /* Length in bytes of the buffer */ - void *pointer; /* pointer to buffer */ +struct acpi_buffer { + acpi_size length; /* Length in bytes of the buffer */ + void *pointer; /* pointer to buffer */ }; - /* * name_type for acpi_get_name */ @@ -763,7 +736,6 @@ struct acpi_buffer #define ACPI_SINGLE_NAME 1 #define ACPI_NAME_TYPE_MAX 1 - /* * Structure and flags for acpi_get_system_info */ @@ -772,139 +744,106 @@ struct acpi_buffer #define ACPI_SYS_MODE_LEGACY 0x0002 #define ACPI_SYS_MODES_MASK 0x0003 - /* * ACPI Table Info. One per ACPI table _type_ */ -struct acpi_table_info -{ - u32 count; +struct acpi_table_info { + u32 count; }; - /* * System info returned by acpi_get_system_info() */ -struct acpi_system_info -{ - u32 acpi_ca_version; - u32 flags; - u32 timer_resolution; - u32 reserved1; - u32 reserved2; - u32 debug_level; - u32 debug_layer; - u32 num_table_types; - struct acpi_table_info table_info [NUM_ACPI_TABLE_TYPES]; +struct acpi_system_info { + u32 acpi_ca_version; + u32 flags; + u32 timer_resolution; + u32 reserved1; + u32 reserved2; + u32 debug_level; + u32 debug_layer; + u32 num_table_types; + struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; }; - /* * Types specific to the OS service interfaces */ -typedef u32 -(ACPI_SYSTEM_XFACE *acpi_osd_handler) ( - void *context); +typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); typedef void -(ACPI_SYSTEM_XFACE *acpi_osd_exec_callback) ( - void *context); + (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); /* * Various handlers and callback procedures */ -typedef -u32 (*acpi_event_handler) ( - void *context); +typedef u32(*acpi_event_handler) (void *context); typedef -void (*acpi_notify_handler) ( - acpi_handle device, - u32 value, - void *context); +void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); typedef -void (*acpi_object_handler) ( - acpi_handle object, - u32 function, - void *data); +void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); -typedef -acpi_status (*acpi_init_handler) ( - acpi_handle object, - u32 function); +typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); #define ACPI_INIT_DEVICE_INI 1 typedef -acpi_status (*acpi_exception_handler) ( - acpi_status aml_status, - acpi_name name, - u16 opcode, - u32 aml_offset, - void *context); - +acpi_status(*acpi_exception_handler) (acpi_status aml_status, + acpi_name name, + u16 opcode, + u32 aml_offset, void *context); /* Address Spaces (For Operation Regions) */ typedef -acpi_status (*acpi_adr_space_handler) ( - u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer *value, - void *handler_context, - void *region_context); +acpi_status(*acpi_adr_space_handler) (u32 function, + acpi_physical_address address, + u32 bit_width, + acpi_integer * value, + void *handler_context, + void *region_context); #define ACPI_DEFAULT_HANDLER NULL - typedef -acpi_status (*acpi_adr_space_setup) ( - acpi_handle region_handle, - u32 function, - void *handler_context, - void **region_context); +acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, + u32 function, + void *handler_context, + void **region_context); #define ACPI_REGION_ACTIVATE 0 #define ACPI_REGION_DEACTIVATE 1 typedef -acpi_status (*acpi_walk_callback) ( - acpi_handle obj_handle, - u32 nesting_level, - void *context, - void **return_value); - +acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, + u32 nesting_level, + void *context, void **return_value); /* Interrupt handler return values */ #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 - /* Common string version of device HIDs and UIDs */ -struct acpi_device_id -{ - char value[ACPI_DEVICE_ID_LENGTH]; +struct acpi_device_id { + char value[ACPI_DEVICE_ID_LENGTH]; }; /* Common string version of device CIDs */ -struct acpi_compatible_id -{ - char value[ACPI_MAX_CID_LENGTH]; +struct acpi_compatible_id { + char value[ACPI_MAX_CID_LENGTH]; }; -struct acpi_compatible_id_list -{ - u32 count; - u32 size; - struct acpi_compatible_id id[1]; +struct acpi_compatible_id_list { + u32 count; + u32 size; + struct acpi_compatible_id id[1]; }; - /* Structure and flags for acpi_get_object_info */ #define ACPI_VALID_STA 0x0001 @@ -914,55 +853,45 @@ struct acpi_compatible_id_list #define ACPI_VALID_CID 0x0010 #define ACPI_VALID_SXDS 0x0020 - #define ACPI_COMMON_OBJ_INFO \ acpi_object_type type; /* ACPI object type */ \ - acpi_name name /* ACPI object Name */ - + acpi_name name /* ACPI object Name */ -struct acpi_obj_info_header -{ +struct acpi_obj_info_header { ACPI_COMMON_OBJ_INFO; }; - /* Structure returned from Get Object Info */ -struct acpi_device_info -{ +struct acpi_device_info { ACPI_COMMON_OBJ_INFO; - u32 valid; /* Indicates which fields below are valid */ - u32 current_status; /* _STA value */ - acpi_integer address; /* _ADR value if any */ - struct acpi_device_id hardware_id; /* _HID value if any */ - struct acpi_device_id unique_id; /* _UID value if any */ - u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ - struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ + u32 valid; /* Indicates which fields below are valid */ + u32 current_status; /* _STA value */ + acpi_integer address; /* _ADR value if any */ + struct acpi_device_id hardware_id; /* _HID value if any */ + struct acpi_device_id unique_id; /* _UID value if any */ + u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ + struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ }; - /* Context structs for address space handlers */ -struct acpi_pci_id -{ - u16 segment; - u16 bus; - u16 device; - u16 function; +struct acpi_pci_id { + u16 segment; + u16 bus; + u16 device; + u16 function; }; - -struct acpi_mem_space_context -{ - u32 length; - acpi_physical_address address; - acpi_physical_address mapped_physical_address; - u8 *mapped_logical_address; - acpi_size mapped_length; +struct acpi_mem_space_context { + u32 length; + acpi_physical_address address; + acpi_physical_address mapped_physical_address; + u8 *mapped_logical_address; + acpi_size mapped_length; }; - /* * Definitions for Resource Attributes */ @@ -992,8 +921,8 @@ struct acpi_mem_space_context /* * IO Port Descriptor Decode */ -#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ -#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ +#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ +#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ /* * IRQ Attributes @@ -1045,32 +974,28 @@ struct acpi_mem_space_context #define ACPI_PRODUCER (u8) 0x00 #define ACPI_CONSUMER (u8) 0x01 - /* * Structures used to describe device resources */ -struct acpi_resource_irq -{ - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; - u32 interrupts[1]; +struct acpi_resource_irq { + u32 edge_level; + u32 active_high_low; + u32 shared_exclusive; + u32 number_of_interrupts; + u32 interrupts[1]; }; -struct acpi_resource_dma -{ - u32 type; - u32 bus_master; - u32 transfer; - u32 number_of_channels; - u32 channels[1]; +struct acpi_resource_dma { + u32 type; + u32 bus_master; + u32 transfer; + u32 number_of_channels; + u32 channels[1]; }; -struct acpi_resource_start_dpf -{ - u32 compatibility_priority; - u32 performance_robustness; +struct acpi_resource_start_dpf { + u32 compatibility_priority; + u32 performance_robustness; }; /* @@ -1078,149 +1003,127 @@ struct acpi_resource_start_dpf * needed because it has no fields */ -struct acpi_resource_io -{ - u32 io_decode; - u32 min_base_address; - u32 max_base_address; - u32 alignment; - u32 range_length; +struct acpi_resource_io { + u32 io_decode; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_fixed_io -{ - u32 base_address; - u32 range_length; +struct acpi_resource_fixed_io { + u32 base_address; + u32 range_length; }; -struct acpi_resource_vendor -{ - u32 length; - u8 reserved[1]; +struct acpi_resource_vendor { + u32 length; + u8 reserved[1]; }; -struct acpi_resource_end_tag -{ - u8 checksum; +struct acpi_resource_end_tag { + u8 checksum; }; -struct acpi_resource_mem24 -{ - u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; - u32 alignment; - u32 range_length; +struct acpi_resource_mem24 { + u32 read_write_attribute; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_mem32 -{ - u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; - u32 alignment; - u32 range_length; +struct acpi_resource_mem32 { + u32 read_write_attribute; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_fixed_mem32 -{ - u32 read_write_attribute; - u32 range_base_address; - u32 range_length; +struct acpi_resource_fixed_mem32 { + u32 read_write_attribute; + u32 range_base_address; + u32 range_length; }; -struct acpi_memory_attribute -{ - u16 cache_attribute; - u16 read_write_attribute; +struct acpi_memory_attribute { + u16 cache_attribute; + u16 read_write_attribute; }; -struct acpi_io_attribute -{ - u16 range_attribute; - u16 translation_attribute; +struct acpi_io_attribute { + u16 range_attribute; + u16 translation_attribute; }; -struct acpi_bus_attribute -{ - u16 reserved1; - u16 reserved2; +struct acpi_bus_attribute { + u16 reserved1; + u16 reserved2; }; -union acpi_resource_attribute -{ - struct acpi_memory_attribute memory; - struct acpi_io_attribute io; - struct acpi_bus_attribute bus; +union acpi_resource_attribute { + struct acpi_memory_attribute memory; + struct acpi_io_attribute io; + struct acpi_bus_attribute bus; }; -struct acpi_resource_source -{ - u32 index; - u32 string_length; - char *string_ptr; +struct acpi_resource_source { + u32 index; + u32 string_length; + char *string_ptr; }; -struct acpi_resource_address16 -{ - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; - u32 address_length; - struct acpi_resource_source resource_source; -}; +/* Fields common to all address descriptors, 16/32/64 bit */ -struct acpi_resource_address32 -{ - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; +#define ACPI_RESOURCE_ADDRESS_COMMON \ + u32 resource_type; \ + u32 producer_consumer; \ + u32 decode; \ + u32 min_address_fixed; \ + u32 max_address_fixed; \ union acpi_resource_attribute attribute; - u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; - u32 address_length; - struct acpi_resource_source resource_source; + +struct acpi_resource_address { +ACPI_RESOURCE_ADDRESS_COMMON}; + +struct acpi_resource_address16 { + ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; + u32 min_address_range; + u32 max_address_range; + u32 address_translation_offset; + u32 address_length; + struct acpi_resource_source resource_source; }; -struct acpi_resource_address64 -{ - u32 resource_type; - u32 producer_consumer; - u32 decode; - u32 min_address_fixed; - u32 max_address_fixed; - union acpi_resource_attribute attribute; - u64 granularity; - u64 min_address_range; - u64 max_address_range; - u64 address_translation_offset; - u64 address_length; - u64 type_specific_attributes; - struct acpi_resource_source resource_source; +struct acpi_resource_address32 { + ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; + u32 min_address_range; + u32 max_address_range; + u32 address_translation_offset; + u32 address_length; + struct acpi_resource_source resource_source; }; -struct acpi_resource_ext_irq -{ - u32 producer_consumer; - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; - struct acpi_resource_source resource_source; - u32 interrupts[1]; +struct acpi_resource_address64 { + ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; + u64 min_address_range; + u64 max_address_range; + u64 address_translation_offset; + u64 address_length; + u64 type_specific_attributes; + struct acpi_resource_source resource_source; }; +struct acpi_resource_ext_irq { + u32 producer_consumer; + u32 edge_level; + u32 active_high_low; + u32 shared_exclusive; + u32 number_of_interrupts; + struct acpi_resource_source resource_source; + u32 interrupts[1]; +}; /* ACPI_RESOURCE_TYPEs */ @@ -1240,35 +1143,34 @@ struct acpi_resource_ext_irq #define ACPI_RSTYPE_ADDRESS64 13 #define ACPI_RSTYPE_EXT_IRQ 14 -typedef u32 acpi_resource_type; - -union acpi_resource_data -{ - struct acpi_resource_irq irq; - struct acpi_resource_dma dma; - struct acpi_resource_start_dpf start_dpf; - struct acpi_resource_io io; - struct acpi_resource_fixed_io fixed_io; - struct acpi_resource_vendor vendor_specific; - struct acpi_resource_end_tag end_tag; - struct acpi_resource_mem24 memory24; - struct acpi_resource_mem32 memory32; - struct acpi_resource_fixed_mem32 fixed_memory32; - struct acpi_resource_address16 address16; - struct acpi_resource_address32 address32; - struct acpi_resource_address64 address64; - struct acpi_resource_ext_irq extended_irq; +typedef u32 acpi_resource_type; + +union acpi_resource_data { + struct acpi_resource_irq irq; + struct acpi_resource_dma dma; + struct acpi_resource_start_dpf start_dpf; + struct acpi_resource_io io; + struct acpi_resource_fixed_io fixed_io; + struct acpi_resource_vendor vendor_specific; + struct acpi_resource_end_tag end_tag; + struct acpi_resource_mem24 memory24; + struct acpi_resource_mem32 memory32; + struct acpi_resource_fixed_mem32 fixed_memory32; + struct acpi_resource_address address; /* Common 16/32/64 address fields */ + struct acpi_resource_address16 address16; + struct acpi_resource_address32 address32; + struct acpi_resource_address64 address64; + struct acpi_resource_ext_irq extended_irq; }; -struct acpi_resource -{ - acpi_resource_type id; - u32 length; - union acpi_resource_data data; +struct acpi_resource { + acpi_resource_type id; + u32 length; + union acpi_resource_data data; }; #define ACPI_RESOURCE_LENGTH 12 -#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ +#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ #define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) @@ -1284,19 +1186,16 @@ struct acpi_resource * END: of definitions for Resource Attributes */ - -struct acpi_pci_routing_table -{ - u32 length; - u32 pin; - acpi_integer address; /* here for 64-bit alignment */ - u32 source_index; - char source[4]; /* pad to 64 bits so sizeof() works in all cases */ +struct acpi_pci_routing_table { + u32 length; + u32 pin; + acpi_integer address; /* here for 64-bit alignment */ + u32 source_index; + char source[4]; /* pad to 64 bits so sizeof() works in all cases */ }; /* * END: of definitions for PCI Routing tables */ - -#endif /* __ACTYPES_H__ */ +#endif /* __ACTYPES_H__ */ diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 192d0bea388..c1086452696 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -44,20 +44,17 @@ #ifndef _ACUTILS_H #define _ACUTILS_H - typedef -acpi_status (*acpi_pkg_callback) ( - u8 object_type, - union acpi_operand_object *source_object, - union acpi_generic_state *state, - void *context); - -struct acpi_pkg_info -{ - u8 *free_space; - acpi_size length; - u32 object_space; - u32 num_packages; +acpi_status(*acpi_pkg_callback) (u8 object_type, + union acpi_operand_object * source_object, + union acpi_generic_state * state, + void *context); + +struct acpi_pkg_info { + u8 *free_space; + acpi_size length; + u32 object_space; + u32 num_packages; }; #define REF_INCREMENT (u16) 0 @@ -71,167 +68,89 @@ struct acpi_pkg_info #define DB_DWORD_DISPLAY 4 #define DB_QWORD_DISPLAY 8 - /* * utglobal - Global data structures and procedures */ -void -acpi_ut_init_globals ( - void); +void acpi_ut_init_globals(void); #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -char * -acpi_ut_get_mutex_name ( - u32 mutex_id); +char *acpi_ut_get_mutex_name(u32 mutex_id); #endif -char * -acpi_ut_get_type_name ( - acpi_object_type type); - -char * -acpi_ut_get_node_name ( - void *object); - -char * -acpi_ut_get_descriptor_name ( - void *object); +char *acpi_ut_get_type_name(acpi_object_type type); -char * -acpi_ut_get_object_type_name ( - union acpi_operand_object *obj_desc); +char *acpi_ut_get_node_name(void *object); -char * -acpi_ut_get_region_name ( - u8 space_id); +char *acpi_ut_get_descriptor_name(void *object); -char * -acpi_ut_get_event_name ( - u32 event_id); +char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); -char -acpi_ut_hex_to_ascii_char ( - acpi_integer integer, - u32 position); +char *acpi_ut_get_region_name(u8 space_id); -u8 -acpi_ut_valid_object_type ( - acpi_object_type type); +char *acpi_ut_get_event_name(u32 event_id); -acpi_owner_id -acpi_ut_allocate_owner_id ( - u32 id_type); +char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position); +u8 acpi_ut_valid_object_type(acpi_object_type type); /* * utinit - miscellaneous initialization and shutdown */ -acpi_status -acpi_ut_hardware_initialize ( - void); +acpi_status acpi_ut_hardware_initialize(void); -void -acpi_ut_subsystem_shutdown ( - void); - -acpi_status -acpi_ut_validate_fadt ( - void); +void acpi_ut_subsystem_shutdown(void); +acpi_status acpi_ut_validate_fadt(void); /* * utclib - Local implementations of C library functions */ #ifndef ACPI_USE_SYSTEM_CLIBRARY -acpi_size -acpi_ut_strlen ( - const char *string); - -char * -acpi_ut_strcpy ( - char *dst_string, - const char *src_string); - -char * -acpi_ut_strncpy ( - char *dst_string, - const char *src_string, - acpi_size count); - -int -acpi_ut_memcmp ( - const char *buffer1, - const char *buffer2, - acpi_size count); - -int -acpi_ut_strncmp ( - const char *string1, - const char *string2, - acpi_size count); - -int -acpi_ut_strcmp ( - const char *string1, - const char *string2); - -char * -acpi_ut_strcat ( - char *dst_string, - const char *src_string); - -char * -acpi_ut_strncat ( - char *dst_string, - const char *src_string, - acpi_size count); - -u32 -acpi_ut_strtoul ( - const char *string, - char **terminator, - u32 base); - -char * -acpi_ut_strstr ( - char *string1, - char *string2); - -void * -acpi_ut_memcpy ( - void *dest, - const void *src, - acpi_size count); - -void * -acpi_ut_memset ( - void *dest, - acpi_native_uint value, - acpi_size count); - -int -acpi_ut_to_upper ( - int c); - -int -acpi_ut_to_lower ( - int c); +acpi_size acpi_ut_strlen(const char *string); + +char *acpi_ut_strcpy(char *dst_string, const char *src_string); + +char *acpi_ut_strncpy(char *dst_string, + const char *src_string, acpi_size count); + +int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count); + +int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count); + +int acpi_ut_strcmp(const char *string1, const char *string2); + +char *acpi_ut_strcat(char *dst_string, const char *src_string); + +char *acpi_ut_strncat(char *dst_string, + const char *src_string, acpi_size count); + +u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base); + +char *acpi_ut_strstr(char *string1, char *string2); + +void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count); + +void *acpi_ut_memset(void *dest, acpi_native_uint value, acpi_size count); + +int acpi_ut_to_upper(int c); + +int acpi_ut_to_lower(int c); extern const u8 _acpi_ctype[]; -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space */ -#define _ACPI_UP 0x01 /* 'A'-'Z' */ -#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ +#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ +#define _ACPI_XS 0x40 /* extra space */ +#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ +#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ +#define _ACPI_DI 0x04 /* '0'-'9' */ +#define _ACPI_LO 0x02 /* 'a'-'z' */ +#define _ACPI_PU 0x10 /* punctuation */ +#define _ACPI_SP 0x08 /* space */ +#define _ACPI_UP 0x01 /* 'A'-'Z' */ +#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) @@ -242,502 +161,323 @@ extern const u8 _acpi_ctype[]; #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) #define ACPI_IS_ASCII(c) ((c) < 0x80) -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ /* * utcopy - Object construction and conversion interfaces */ acpi_status -acpi_ut_build_simple_object( - union acpi_operand_object *obj, - union acpi_object *user_obj, - u8 *data_space, - u32 *buffer_space_used); +acpi_ut_build_simple_object(union acpi_operand_object *obj, + union acpi_object *user_obj, + u8 * data_space, u32 * buffer_space_used); acpi_status -acpi_ut_build_package_object ( - union acpi_operand_object *obj, - u8 *buffer, - u32 *space_used); +acpi_ut_build_package_object(union acpi_operand_object *obj, + u8 * buffer, u32 * space_used); acpi_status -acpi_ut_copy_iobject_to_eobject ( - union acpi_operand_object *obj, - struct acpi_buffer *ret_buffer); +acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj, + struct acpi_buffer *ret_buffer); acpi_status -acpi_ut_copy_eobject_to_iobject ( - union acpi_object *obj, - union acpi_operand_object **internal_obj); +acpi_ut_copy_eobject_to_iobject(union acpi_object *obj, + union acpi_operand_object **internal_obj); acpi_status -acpi_ut_copy_isimple_to_isimple ( - union acpi_operand_object *source_obj, - union acpi_operand_object *dest_obj); +acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj, + union acpi_operand_object *dest_obj); acpi_status -acpi_ut_copy_iobject_to_iobject ( - union acpi_operand_object *source_desc, - union acpi_operand_object **dest_desc, - struct acpi_walk_state *walk_state); - +acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, + union acpi_operand_object **dest_desc, + struct acpi_walk_state *walk_state); /* * utcreate - Object creation */ acpi_status -acpi_ut_update_object_reference ( - union acpi_operand_object *object, - u16 action); - +acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action); /* * utdebug - Debug interfaces */ -void -acpi_ut_init_stack_ptr_trace ( - void); +void acpi_ut_init_stack_ptr_trace(void); -void -acpi_ut_track_stack_ptr ( - void); +void acpi_ut_track_stack_ptr(void); void -acpi_ut_trace ( - u32 line_number, - struct acpi_debug_print_info *dbg_info); +acpi_ut_trace(u32 line_number, + const char *function_name, char *module_name, u32 component_id); void -acpi_ut_trace_ptr ( - u32 line_number, - struct acpi_debug_print_info *dbg_info, - void *pointer); +acpi_ut_trace_ptr(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, void *pointer); void -acpi_ut_trace_u32 ( - u32 line_number, - struct acpi_debug_print_info *dbg_info, - u32 integer); +acpi_ut_trace_u32(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, u32 integer); void -acpi_ut_trace_str ( - u32 line_number, - struct acpi_debug_print_info *dbg_info, - char *string); +acpi_ut_trace_str(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, char *string); void -acpi_ut_exit ( - u32 line_number, - struct acpi_debug_print_info *dbg_info); +acpi_ut_exit(u32 line_number, + const char *function_name, char *module_name, u32 component_id); void -acpi_ut_status_exit ( - u32 line_number, - struct acpi_debug_print_info *dbg_info, - acpi_status status); +acpi_ut_status_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, acpi_status status); void -acpi_ut_value_exit ( - u32 line_number, - struct acpi_debug_print_info *dbg_info, - acpi_integer value); +acpi_ut_value_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, acpi_integer value); void -acpi_ut_ptr_exit ( - u32 line_number, - struct acpi_debug_print_info *dbg_info, - u8 *ptr); +acpi_ut_ptr_exit(u32 line_number, + const char *function_name, + char *module_name, u32 component_id, u8 * ptr); -void -acpi_ut_report_info ( - char *module_name, - u32 line_number, - u32 component_id); +void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id); -void -acpi_ut_report_error ( - char *module_name, - u32 line_number, - u32 component_id); +void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id); void -acpi_ut_report_warning ( - char *module_name, - u32 line_number, - u32 component_id); +acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id); -void -acpi_ut_dump_buffer ( - u8 *buffer, - u32 count, - u32 display, - u32 component_id); +void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); void ACPI_INTERNAL_VAR_XFACE -acpi_ut_debug_print ( - u32 requested_debug_level, - u32 line_number, - struct acpi_debug_print_info *dbg_info, - char *format, - ...) ACPI_PRINTF_LIKE_FUNC; +acpi_ut_debug_print(u32 requested_debug_level, + u32 line_number, + const char *function_name, + char *module_name, + u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC; void ACPI_INTERNAL_VAR_XFACE -acpi_ut_debug_print_raw ( - u32 requested_debug_level, - u32 line_number, - struct acpi_debug_print_info *dbg_info, - char *format, - ...) ACPI_PRINTF_LIKE_FUNC; - +acpi_ut_debug_print_raw(u32 requested_debug_level, + u32 line_number, + const char *function_name, + char *module_name, + u32 component_id, + char *format, ...) ACPI_PRINTF_LIKE_FUNC; /* * utdelete - Object deletion and reference counts */ -void -acpi_ut_add_reference ( - union acpi_operand_object *object); +void acpi_ut_add_reference(union acpi_operand_object *object); -void -acpi_ut_remove_reference ( - union acpi_operand_object *object); +void acpi_ut_remove_reference(union acpi_operand_object *object); -void -acpi_ut_delete_internal_package_object ( - union acpi_operand_object *object); +void acpi_ut_delete_internal_package_object(union acpi_operand_object *object); -void -acpi_ut_delete_internal_simple_object ( - union acpi_operand_object *object); - -void -acpi_ut_delete_internal_object_list ( - union acpi_operand_object **obj_list); +void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object); +void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list); /* * uteval - object evaluation */ -acpi_status -acpi_ut_osi_implementation ( - struct acpi_walk_state *walk_state); +acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); acpi_status -acpi_ut_evaluate_object ( - struct acpi_namespace_node *prefix_node, - char *path, - u32 expected_return_btypes, - union acpi_operand_object **return_desc); +acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, + char *path, + u32 expected_return_btypes, + union acpi_operand_object **return_desc); acpi_status -acpi_ut_evaluate_numeric_object ( - char *object_name, - struct acpi_namespace_node *device_node, - acpi_integer *address); +acpi_ut_evaluate_numeric_object(char *object_name, + struct acpi_namespace_node *device_node, + acpi_integer * address); acpi_status -acpi_ut_execute_HID ( - struct acpi_namespace_node *device_node, - struct acpi_device_id *hid); +acpi_ut_execute_HID(struct acpi_namespace_node *device_node, + struct acpi_device_id *hid); acpi_status -acpi_ut_execute_CID ( - struct acpi_namespace_node *device_node, - struct acpi_compatible_id_list **return_cid_list); +acpi_ut_execute_CID(struct acpi_namespace_node *device_node, + struct acpi_compatible_id_list **return_cid_list); acpi_status -acpi_ut_execute_STA ( - struct acpi_namespace_node *device_node, - u32 *status_flags); +acpi_ut_execute_STA(struct acpi_namespace_node *device_node, + u32 * status_flags); acpi_status -acpi_ut_execute_UID ( - struct acpi_namespace_node *device_node, - struct acpi_device_id *uid); +acpi_ut_execute_UID(struct acpi_namespace_node *device_node, + struct acpi_device_id *uid); acpi_status -acpi_ut_execute_sxds ( - struct acpi_namespace_node *device_node, - u8 *highest); - +acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); /* * utobject - internal object create/delete/cache routines */ -union acpi_operand_object * -acpi_ut_create_internal_object_dbg ( - char *module_name, - u32 line_number, - u32 component_id, - acpi_object_type type); - -void * -acpi_ut_allocate_object_desc_dbg ( - char *module_name, - u32 line_number, - u32 component_id); - -#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t) -#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT) +union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, + u32 line_number, + u32 component_id, + acpi_object_type + type); -void -acpi_ut_delete_object_desc ( - union acpi_operand_object *object); +void *acpi_ut_allocate_object_desc_dbg(char *module_name, + u32 line_number, u32 component_id); -u8 -acpi_ut_valid_internal_object ( - void *object); +#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t) +#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT) -union acpi_operand_object * -acpi_ut_create_buffer_object ( - acpi_size buffer_size); +void acpi_ut_delete_object_desc(union acpi_operand_object *object); -union acpi_operand_object * -acpi_ut_create_string_object ( - acpi_size string_size); +u8 acpi_ut_valid_internal_object(void *object); -acpi_status -acpi_ut_get_object_size( - union acpi_operand_object *obj, - acpi_size *obj_length); +union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); +union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); + +acpi_status +acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); /* * utstate - Generic state creation/cache routines */ void -acpi_ut_push_generic_state ( - union acpi_generic_state **list_head, - union acpi_generic_state *state); +acpi_ut_push_generic_state(union acpi_generic_state **list_head, + union acpi_generic_state *state); -union acpi_generic_state * -acpi_ut_pop_generic_state ( - union acpi_generic_state **list_head); +union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state + **list_head); +union acpi_generic_state *acpi_ut_create_generic_state(void); -union acpi_generic_state * -acpi_ut_create_generic_state ( - void); +struct acpi_thread_state *acpi_ut_create_thread_state(void); -struct acpi_thread_state * -acpi_ut_create_thread_state ( - void); +union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object + *object, u16 action); -union acpi_generic_state * -acpi_ut_create_update_state ( - union acpi_operand_object *object, - u16 action); - -union acpi_generic_state * -acpi_ut_create_pkg_state ( - void *internal_object, - void *external_object, - u16 index); +union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, + void *external_object, + u16 index); acpi_status -acpi_ut_create_update_state_and_push ( - union acpi_operand_object *object, - u16 action, - union acpi_generic_state **state_list); +acpi_ut_create_update_state_and_push(union acpi_operand_object *object, + u16 action, + union acpi_generic_state **state_list); #ifdef ACPI_FUTURE_USAGE acpi_status -acpi_ut_create_pkg_state_and_push ( - void *internal_object, - void *external_object, - u16 index, - union acpi_generic_state **state_list); -#endif /* ACPI_FUTURE_USAGE */ +acpi_ut_create_pkg_state_and_push(void *internal_object, + void *external_object, + u16 index, + union acpi_generic_state **state_list); +#endif /* ACPI_FUTURE_USAGE */ -union acpi_generic_state * -acpi_ut_create_control_state ( - void); - -void -acpi_ut_delete_generic_state ( - union acpi_generic_state *state); - -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_state_cache ( - void); - -void -acpi_ut_delete_object_cache ( - void); -#endif +union acpi_generic_state *acpi_ut_create_control_state(void); +void acpi_ut_delete_generic_state(union acpi_generic_state *state); /* * utmath */ acpi_status -acpi_ut_divide ( - acpi_integer in_dividend, - acpi_integer in_divisor, - acpi_integer *out_quotient, - acpi_integer *out_remainder); +acpi_ut_divide(acpi_integer in_dividend, + acpi_integer in_divisor, + acpi_integer * out_quotient, acpi_integer * out_remainder); acpi_status -acpi_ut_short_divide ( - acpi_integer in_dividend, - u32 divisor, - acpi_integer *out_quotient, - u32 *out_remainder); +acpi_ut_short_divide(acpi_integer in_dividend, + u32 divisor, + acpi_integer * out_quotient, u32 * out_remainder); /* * utmisc */ +acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); + +void acpi_ut_release_owner_id(acpi_owner_id * owner_id); + acpi_status -acpi_ut_walk_package_tree ( - union acpi_operand_object *source_object, - void *target_object, - acpi_pkg_callback walk_callback, - void *context); +acpi_ut_walk_package_tree(union acpi_operand_object *source_object, + void *target_object, + acpi_pkg_callback walk_callback, void *context); -char * -acpi_ut_strupr ( - char *src_string); +void acpi_ut_strupr(char *src_string); -void -acpi_ut_print_string ( - char *string, - u8 max_length); +void acpi_ut_print_string(char *string, u8 max_length); -u8 -acpi_ut_valid_acpi_name ( - u32 name); +u8 acpi_ut_valid_acpi_name(u32 name); -u8 -acpi_ut_valid_acpi_character ( - char character); +u8 acpi_ut_valid_acpi_character(char character); acpi_status -acpi_ut_strtoul64 ( - char *string, - u32 base, - acpi_integer *ret_integer); +acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); /* Values for Base above (16=Hex, 10=Decimal) */ #define ACPI_ANY_BASE 0 -acpi_status -acpi_ut_mutex_initialize ( - void); - -void -acpi_ut_mutex_terminate ( - void); - -acpi_status -acpi_ut_acquire_mutex ( - acpi_mutex_handle mutex_id); - -acpi_status -acpi_ut_release_mutex ( - acpi_mutex_handle mutex_id); - -u8 * -acpi_ut_get_resource_end_tag ( - union acpi_operand_object *obj_desc); +u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); -u8 -acpi_ut_generate_checksum ( - u8 *buffer, - u32 length); +u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); -u32 -acpi_ut_dword_byte_swap ( - u32 value); +u32 acpi_ut_dword_byte_swap(u32 value); -void -acpi_ut_set_integer_width ( - u8 revision); +void acpi_ut_set_integer_width(u8 revision); #ifdef ACPI_DEBUG_OUTPUT void -acpi_ut_display_init_pathname ( - u8 type, - struct acpi_namespace_node *obj_handle, - char *path); +acpi_ut_display_init_pathname(u8 type, + struct acpi_namespace_node *obj_handle, + char *path); #endif +/* + * utmutex - mutex support + */ +acpi_status acpi_ut_mutex_initialize(void); + +void acpi_ut_mutex_terminate(void); + +acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id); + +acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id); /* * utalloc - memory allocation and object caching */ -void * -acpi_ut_acquire_from_cache ( - u32 list_id); +acpi_status acpi_ut_create_caches(void); -void -acpi_ut_release_to_cache ( - u32 list_id, - void *object); +acpi_status acpi_ut_delete_caches(void); -#ifdef ACPI_ENABLE_OBJECT_CACHE -void -acpi_ut_delete_generic_cache ( - u32 list_id); -#endif +acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer); acpi_status -acpi_ut_validate_buffer ( - struct acpi_buffer *buffer); +acpi_ut_initialize_buffer(struct acpi_buffer *buffer, + acpi_size required_length); -acpi_status -acpi_ut_initialize_buffer ( - struct acpi_buffer *buffer, - acpi_size required_length); - -void * -acpi_ut_allocate ( - acpi_size size, - u32 component, - char *module, - u32 line); - -void * -acpi_ut_callocate ( - acpi_size size, - u32 component, - char *module, - u32 line); +void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); + +void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); #ifdef ACPI_DBG_TRACK_ALLOCATIONS -void * -acpi_ut_allocate_and_track ( - acpi_size size, - u32 component, - char *module, - u32 line); - -void * -acpi_ut_callocate_and_track ( - acpi_size size, - u32 component, - char *module, - u32 line); +void *acpi_ut_allocate_and_track(acpi_size size, + u32 component, char *module, u32 line); + +void *acpi_ut_callocate_and_track(acpi_size size, + u32 component, char *module, u32 line); void -acpi_ut_free_and_track ( - void *address, - u32 component, - char *module, - u32 line); +acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); #ifdef ACPI_FUTURE_USAGE -void -acpi_ut_dump_allocation_info ( - void); -#endif /* ACPI_FUTURE_USAGE */ +void acpi_ut_dump_allocation_info(void); +#endif /* ACPI_FUTURE_USAGE */ -void -acpi_ut_dump_allocations ( - u32 component, - char *module); +void acpi_ut_dump_allocations(u32 component, char *module); #endif -#endif /* _ACUTILS_H */ +#endif /* _ACUTILS_H */ diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 55e97ed2919..7fdf5299f50 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -59,17 +59,17 @@ #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_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_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 #define AML_NAME_CHAR_SUBSEQ (u16) 0x30 #define AML_NAME_CHAR_FIRST (u16) 0x41 -#define AML_OP_PREFIX (u16) 0x5b +#define AML_EXTENDED_OP_PREFIX (u16) 0x5b #define AML_ROOT_PREFIX (u16) 0x5c #define AML_PARENT_PREFIX (u16) 0x5e #define AML_LOCAL_OP (u16) 0x60 @@ -109,8 +109,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_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 @@ -120,21 +120,21 @@ #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d #define AML_TYPE_OP (u16) 0x8e -#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ +#define AML_CREATE_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_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 @@ -146,7 +146,7 @@ /* prefixed opcodes */ -#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */ +#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */ #define AML_MUTEX_OP (u16) 0x5b01 #define AML_EVENT_OP (u16) 0x5b02 @@ -154,7 +154,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_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 @@ -169,7 +169,7 @@ #define AML_REVISION_OP (u16) 0x5b30 #define AML_DEBUG_OP (u16) 0x5b31 #define AML_FATAL_OP (u16) 0x5b32 -#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ +#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ #define AML_REGION_OP (u16) 0x5b80 #define AML_FIELD_OP (u16) 0x5b81 #define AML_DEVICE_OP (u16) 0x5b82 @@ -178,8 +178,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 */ - +#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ /* Bogus opcodes (they are actually two separate opcodes) */ @@ -187,7 +186,6 @@ #define AML_LLESSEQUAL_OP (u16) 0x9294 #define AML_LNOTEQUAL_OP (u16) 0x9293 - /* * Internal opcodes * Use only "Unknown" AML opcodes, don't attempt to use @@ -203,7 +201,6 @@ #define AML_INT_RETURN_VALUE_OP (u16) 0x0036 #define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037 - #define ARG_NONE 0x0 /* @@ -245,7 +242,7 @@ /* Single, simple types */ -#define ARGI_ANYTYPE 0x01 /* Don't care */ +#define ARGI_ANYTYPE 0x01 /* Don't care */ #define ARGI_PACKAGE 0x02 #define ARGI_EVENT 0x03 #define ARGI_MUTEX 0x04 @@ -256,8 +253,8 @@ #define ARGI_INTEGER 0x06 #define ARGI_STRING 0x07 #define ARGI_BUFFER 0x08 -#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ -#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ +#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ +#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ /* Reference objects */ @@ -265,30 +262,28 @@ #define ARGI_OBJECT_REF 0x0C #define ARGI_DEVICE_REF 0x0D #define ARGI_REFERENCE 0x0E -#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ -#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ -#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ +#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ +#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ +#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ /* Multiple/complex types */ -#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator*/ -#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ -#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ -#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ +#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */ +#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ +#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ +#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ #define ARGI_DATAREFOBJ 0x16 /* Note: types above can expand to 0x1F maximum */ #define ARGI_INVALID_OPCODE 0xFFFFFFFF - /* * hash offsets */ #define AML_EXTOP_HASH_OFFSET 22 #define AML_LNOT_HASH_OFFSET 19 - /* * opcode groups and types */ @@ -296,7 +291,6 @@ #define OPGRP_FIELD 0x02 #define OPGRP_BYTELIST 0x04 - /* * Opcode information */ @@ -322,31 +316,30 @@ /* Convenient flag groupings */ #define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL -#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ -#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ +#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ +#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET -#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ -#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ -#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ -#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ +#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ +#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ +#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ +#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ #define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL #define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS #define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL #define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL - /* * The opcode Type is used in a dispatch table, do not change * without updating the table. */ #define AML_TYPE_EXEC_0A_0T_1R 0x00 -#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ -#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ +#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ +#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ #define AML_TYPE_EXEC_1A_1T_0R 0x03 -#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ -#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ -#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ -#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ +#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ +#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ +#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ +#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ #define AML_TYPE_EXEC_2A_2T_1R 0x08 #define AML_TYPE_EXEC_3A_0T_0R 0x09 #define AML_TYPE_EXEC_3A_1T_1R 0x0A @@ -399,40 +392,33 @@ #define AML_CLASS_METHOD_CALL 0x09 #define AML_CLASS_UNKNOWN 0x0A - /* Predefined Operation Region space_iDs */ -typedef enum -{ - REGION_MEMORY = 0, +typedef enum { + REGION_MEMORY = 0, REGION_IO, REGION_PCI_CONFIG, REGION_EC, REGION_SMBUS, REGION_CMOS, REGION_PCI_BAR, - REGION_DATA_TABLE, /* Internal use only */ - REGION_FIXED_HW = 0x7F - + REGION_DATA_TABLE, /* Internal use only */ + REGION_FIXED_HW = 0x7F } AML_REGION_TYPES; - /* Comparison operation codes for match_op operator */ -typedef enum -{ - MATCH_MTR = 0, - MATCH_MEQ = 1, - MATCH_MLE = 2, - MATCH_MLT = 3, - MATCH_MGE = 4, - MATCH_MGT = 5 - +typedef enum { + MATCH_MTR = 0, + MATCH_MEQ = 1, + MATCH_MLE = 2, + MATCH_MLT = 3, + MATCH_MGE = 4, + MATCH_MGT = 5 } AML_MATCH_OPERATOR; #define MAX_MATCH_OPERATOR 5 - /* * field_flags * @@ -450,60 +436,47 @@ typedef enum #define AML_FIELD_LOCK_RULE_MASK 0x10 #define AML_FIELD_UPDATE_RULE_MASK 0x60 - /* 1) Field Access Types */ -typedef enum -{ - AML_FIELD_ACCESS_ANY = 0x00, - AML_FIELD_ACCESS_BYTE = 0x01, - AML_FIELD_ACCESS_WORD = 0x02, - AML_FIELD_ACCESS_DWORD = 0x03, - AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ - AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ - +typedef enum { + AML_FIELD_ACCESS_ANY = 0x00, + AML_FIELD_ACCESS_BYTE = 0x01, + AML_FIELD_ACCESS_WORD = 0x02, + AML_FIELD_ACCESS_DWORD = 0x03, + AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ + AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ } AML_ACCESS_TYPE; - /* 2) Field Lock Rules */ -typedef enum -{ - AML_FIELD_LOCK_NEVER = 0x00, - AML_FIELD_LOCK_ALWAYS = 0x10 - +typedef enum { + AML_FIELD_LOCK_NEVER = 0x00, + AML_FIELD_LOCK_ALWAYS = 0x10 } AML_LOCK_RULE; - /* 3) Field Update Rules */ -typedef enum -{ - AML_FIELD_UPDATE_PRESERVE = 0x00, - AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, +typedef enum { + AML_FIELD_UPDATE_PRESERVE = 0x00, + AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 - } AML_UPDATE_RULE; - /* * Field Access Attributes. * This byte is extracted from the AML via the * access_as keyword */ -typedef enum -{ - AML_FIELD_ATTRIB_SMB_QUICK = 0x02, - AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, - AML_FIELD_ATTRIB_SMB_BYTE = 0x06, - AML_FIELD_ATTRIB_SMB_WORD = 0x08, - AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, - AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, +typedef enum { + AML_FIELD_ATTRIB_SMB_QUICK = 0x02, + AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, + AML_FIELD_ATTRIB_SMB_BYTE = 0x06, + AML_FIELD_ATTRIB_SMB_WORD = 0x08, + AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, + AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D - } AML_ACCESS_ATTRIBUTE; - /* Bit fields in method_flags byte */ #define AML_METHOD_ARG_COUNT 0x07 @@ -516,5 +489,4 @@ typedef enum #define AML_METHOD_RESERVED1 0x02 #define AML_METHOD_RESERVED2 0x04 - -#endif /* __AMLCODE_H__ */ +#endif /* __AMLCODE_H__ */ diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index b20ec303df0..051786e4b21 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -42,29 +42,27 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #ifndef __AMLRESRC_H #define __AMLRESRC_H - #define ASL_RESNAME_ADDRESS "_ADR" #define ASL_RESNAME_ALIGNMENT "_ALN" #define ASL_RESNAME_ADDRESSSPACE "_ASI" #define ASL_RESNAME_ACCESSSIZE "_ASZ" #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" #define ASL_RESNAME_BASEADDRESS "_BAS" -#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ +#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ #define ASL_RESNAME_DECODE "_DEC" #define ASL_RESNAME_DMA "_DMA" -#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ +#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ #define ASL_RESNAME_GRANULARITY "_GRA" #define ASL_RESNAME_INTERRUPT "_INT" -#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ -#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ -#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ +#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ +#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ +#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ #define ASL_RESNAME_LENGTH "_LEN" -#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ -#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ +#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ +#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ #define ASL_RESNAME_MAXADDR "_MAX" #define ASL_RESNAME_MINADDR "_MIN" #define ASL_RESNAME_MAXTYPE "_MAF" @@ -72,12 +70,11 @@ #define ASL_RESNAME_REGISTERBITOFFSET "_RBO" #define ASL_RESNAME_REGISTERBITWIDTH "_RBW" #define ASL_RESNAME_RANGETYPE "_RNG" -#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ +#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ #define ASL_RESNAME_TRANSLATION "_TRA" -#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ -#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ -#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ - +#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ +#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ +#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ /* Default sizes for "small" resource descriptors */ @@ -89,15 +86,12 @@ #define ASL_RDESC_FIXED_IO_SIZE 0x03 #define ASL_RDESC_END_TAG_SIZE 0x01 - -struct asl_resource_node -{ - u32 buffer_length; - void *buffer; - struct asl_resource_node *next; +struct asl_resource_node { + u32 buffer_length; + void *buffer; + struct asl_resource_node *next; }; - /* * Resource descriptors defined in the ACPI specification. * @@ -106,214 +100,175 @@ struct asl_resource_node */ #pragma pack(1) -struct asl_irq_format_desc -{ - u8 descriptor_type; - u16 irq_mask; - u8 flags; +struct asl_irq_format_desc { + u8 descriptor_type; + u16 irq_mask; + u8 flags; }; - -struct asl_irq_noflags_desc -{ - u8 descriptor_type; - u16 irq_mask; +struct asl_irq_noflags_desc { + u8 descriptor_type; + u16 irq_mask; }; - -struct asl_dma_format_desc -{ - u8 descriptor_type; - u8 dma_channel_mask; - u8 flags; +struct asl_dma_format_desc { + u8 descriptor_type; + u8 dma_channel_mask; + u8 flags; }; - -struct asl_start_dependent_desc -{ - u8 descriptor_type; - u8 flags; +struct asl_start_dependent_desc { + u8 descriptor_type; + u8 flags; }; - -struct asl_start_dependent_noprio_desc -{ - u8 descriptor_type; +struct asl_start_dependent_noprio_desc { + u8 descriptor_type; }; - -struct asl_end_dependent_desc -{ - u8 descriptor_type; +struct asl_end_dependent_desc { + u8 descriptor_type; }; - -struct asl_io_port_desc -{ - u8 descriptor_type; - u8 information; - u16 address_min; - u16 address_max; - u8 alignment; - u8 length; +struct asl_io_port_desc { + u8 descriptor_type; + u8 information; + u16 address_min; + u16 address_max; + u8 alignment; + u8 length; }; - -struct asl_fixed_io_port_desc -{ - u8 descriptor_type; - u16 base_address; - u8 length; +struct asl_fixed_io_port_desc { + u8 descriptor_type; + u16 base_address; + u8 length; }; - -struct asl_small_vendor_desc -{ - u8 descriptor_type; - u8 vendor_defined[7]; +struct asl_small_vendor_desc { + u8 descriptor_type; + u8 vendor_defined[7]; }; - -struct asl_end_tag_desc -{ - u8 descriptor_type; - u8 checksum; +struct asl_end_tag_desc { + u8 descriptor_type; + u8 checksum; }; - /* LARGE descriptors */ -struct asl_memory_24_desc -{ - u8 descriptor_type; - u16 length; - u8 information; - u16 address_min; - u16 address_max; - u16 alignment; - u16 range_length; +struct asl_memory_24_desc { + u8 descriptor_type; + u16 length; + u8 information; + u16 address_min; + u16 address_max; + u16 alignment; + u16 range_length; }; - -struct asl_large_vendor_desc -{ - u8 descriptor_type; - u16 length; - u8 vendor_defined[1]; +struct asl_large_vendor_desc { + u8 descriptor_type; + u16 length; + u8 vendor_defined[1]; }; - -struct asl_memory_32_desc -{ - u8 descriptor_type; - u16 length; - u8 information; - u32 address_min; - u32 address_max; - u32 alignment; - u32 range_length; +struct asl_memory_32_desc { + u8 descriptor_type; + u16 length; + u8 information; + u32 address_min; + u32 address_max; + u32 alignment; + u32 range_length; }; - -struct asl_fixed_memory_32_desc -{ - u8 descriptor_type; - u16 length; - u8 information; - u32 base_address; - u32 range_length; +struct asl_fixed_memory_32_desc { + u8 descriptor_type; + u16 length; + u8 information; + u32 base_address; + u32 range_length; }; - -struct asl_extended_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u8 revision_iD; - u8 reserved; - u64 granularity; - u64 address_min; - u64 address_max; - u64 translation_offset; - u64 address_length; - u64 type_specific_attributes; - u8 optional_fields[2]; /* Used for length calculation only */ +struct asl_extended_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u8 revision_iD; + u8 reserved; + u64 granularity; + u64 address_min; + u64 address_max; + u64 translation_offset; + u64 address_length; + u64 type_specific_attributes; + u8 optional_fields[2]; /* Used for length calculation only */ }; -#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ - - -struct asl_qword_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u64 granularity; - u64 address_min; - u64 address_max; - u64 translation_offset; - u64 address_length; - u8 optional_fields[2]; +#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ + +struct asl_qword_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u64 granularity; + u64 address_min; + u64 address_max; + u64 translation_offset; + u64 address_length; + u8 optional_fields[2]; }; - -struct asl_dword_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u32 granularity; - u32 address_min; - u32 address_max; - u32 translation_offset; - u32 address_length; - u8 optional_fields[2]; +struct asl_dword_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u32 granularity; + u32 address_min; + u32 address_max; + u32 translation_offset; + u32 address_length; + u8 optional_fields[2]; }; - -struct asl_word_address_desc -{ - u8 descriptor_type; - u16 length; - u8 resource_type; - u8 flags; - u8 specific_flags; - u16 granularity; - u16 address_min; - u16 address_max; - u16 translation_offset; - u16 address_length; - u8 optional_fields[2]; +struct asl_word_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u16 granularity; + u16 address_min; + u16 address_max; + u16 translation_offset; + u16 address_length; + u8 optional_fields[2]; }; - -struct asl_extended_xrupt_desc -{ - u8 descriptor_type; - u16 length; - u8 flags; - u8 table_length; - u32 interrupt_number[1]; +struct asl_extended_xrupt_desc { + u8 descriptor_type; + u16 length; + u8 flags; + u8 table_length; + u32 interrupt_number[1]; /* res_source_index, res_source optional fields follow */ }; - -struct asl_general_register_desc -{ - u8 descriptor_type; - u16 length; - u8 address_space_id; - u8 bit_width; - u8 bit_offset; - u8 access_size; /* ACPI 3.0, was Reserved */ - u64 address; +struct asl_general_register_desc { + u8 descriptor_type; + u16 length; + u8 address_space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; /* ACPI 3.0, was Reserved */ + u64 address; }; /* restore default alignment */ @@ -322,32 +277,29 @@ struct asl_general_register_desc /* Union of all resource descriptors, so we can allocate the worst case */ -union asl_resource_desc -{ - struct asl_irq_format_desc irq; - struct asl_dma_format_desc dma; - struct asl_start_dependent_desc std; - struct asl_end_dependent_desc end; - struct asl_io_port_desc iop; - struct asl_fixed_io_port_desc fio; - struct asl_small_vendor_desc smv; - struct asl_end_tag_desc et; - - struct asl_memory_24_desc M24; - struct asl_large_vendor_desc lgv; - struct asl_memory_32_desc M32; - struct asl_fixed_memory_32_desc F32; - struct asl_qword_address_desc qas; - struct asl_dword_address_desc das; - struct asl_word_address_desc was; - struct asl_extended_address_desc eas; - struct asl_extended_xrupt_desc exx; - struct asl_general_register_desc grg; - u32 u32_item; - u16 u16_item; - u8 U8item; +union asl_resource_desc { + struct asl_irq_format_desc irq; + struct asl_dma_format_desc dma; + struct asl_start_dependent_desc std; + struct asl_end_dependent_desc end; + struct asl_io_port_desc iop; + struct asl_fixed_io_port_desc fio; + struct asl_small_vendor_desc smv; + struct asl_end_tag_desc et; + + struct asl_memory_24_desc M24; + struct asl_large_vendor_desc lgv; + struct asl_memory_32_desc M32; + struct asl_fixed_memory_32_desc F32; + struct asl_qword_address_desc qas; + struct asl_dword_address_desc das; + struct asl_word_address_desc was; + struct asl_extended_address_desc eas; + struct asl_extended_xrupt_desc exx; + struct asl_general_register_desc grg; + u32 u32_item; + u16 u16_item; + u8 U8item; }; - #endif - diff --git a/include/acpi/container.h b/include/acpi/container.h index d716df04d9d..a703f14e049 100644 --- a/include/acpi/container.h +++ b/include/acpi/container.h @@ -9,5 +9,4 @@ struct acpi_container { int state; }; -#endif /* __ACPI_CONTAINER_H */ - +#endif /* __ACPI_CONTAINER_H */ diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h index fd6730e4e56..91f4a12a99a 100644 --- a/include/acpi/pdc_intel.h +++ b/include/acpi/pdc_intel.h @@ -14,7 +14,6 @@ #define ACPI_PDC_SMP_T_SWCOORD (0x0080) #define ACPI_PDC_C_C1_FFH (0x0100) - #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ ACPI_PDC_C_C1_HALT) @@ -25,5 +24,4 @@ ACPI_PDC_SMP_C1PT | \ ACPI_PDC_C_C1_HALT) -#endif /* __PDC_INTEL_H__ */ - +#endif /* __PDC_INTEL_H__ */ diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index adf969efa51..16609c1ab2e 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -44,40 +44,42 @@ #ifndef __ACENV_H__ #define __ACENV_H__ - /* * Configuration for ACPI tools and utilities */ -#ifdef _ACPI_DUMP_APP +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE +#endif + +#ifdef ACPI_DUMP_APP #ifndef MSDOS #define ACPI_DEBUG_OUTPUT #endif #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_NO_METHOD_EXECUTION -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE #endif -#ifdef _ACPI_EXEC_APP +#ifdef ACPI_EXEC_APP #undef DEBUGGER_THREADING #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE #endif -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_CONSTANT_EVAL_ONLY +#endif + +#ifdef ACPI_APPLICATION #define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE +#define ACPI_USE_LOCAL_CACHE #endif /* @@ -131,7 +133,7 @@ #elif defined(WIN64) #include "acwin64.h" -#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ +#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ #include "acdos16.h" #elif defined(__FreeBSD__) @@ -177,7 +179,6 @@ /*! [End] no source code translation !*/ - /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application @@ -196,8 +197,7 @@ #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif -#endif /* !DEBUGGER_THREADING */ - +#endif /* !DEBUGGER_THREADING */ /****************************************************************************** * @@ -219,7 +219,7 @@ #include <string.h> #include <ctype.h> -#endif /* ACPI_USE_STANDARD_HEADERS */ +#endif /* ACPI_USE_STANDARD_HEADERS */ /* * We will be linking to the standard Clib functions @@ -238,15 +238,15 @@ #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) -#define ACPI_TOUPPER toupper -#define ACPI_TOLOWER tolower -#define ACPI_IS_XDIGIT isxdigit -#define ACPI_IS_DIGIT isdigit -#define ACPI_IS_SPACE isspace -#define ACPI_IS_UPPER isupper -#define ACPI_IS_PRINT isprint -#define ACPI_IS_ALPHA isalpha -#define ACPI_IS_ASCII isascii +#define ACPI_TOUPPER(i) toupper((int) (i)) +#define ACPI_TOLOWER(i) tolower((int) (i)) +#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) +#define ACPI_IS_DIGIT(i) isdigit((int) (i)) +#define ACPI_IS_SPACE(i) isspace((int) (i)) +#define ACPI_IS_UPPER(i) isupper((int) (i)) +#define ACPI_IS_PRINT(i) isprint((int) (i)) +#define ACPI_IS_ALPHA(i) isalpha((int) (i)) +#define ACPI_IS_ASCII(i) isascii((int) (i)) #else @@ -257,18 +257,18 @@ *****************************************************************************/ /* - * Use local definitions of C library macros and functions - * NOTE: The function implementations may not be as efficient - * as an inline or assembly code implementation provided by a - * native C library. - */ + * Use local definitions of C library macros and functions + * NOTE: The function implementations may not be as efficient + * as an inline or assembly code implementation provided by a + * native C library. + */ #ifndef va_arg #ifndef _VALIST #define _VALIST typedef char *va_list; -#endif /* _VALIST */ +#endif /* _VALIST */ /* * Storage alignment properties @@ -284,8 +284,7 @@ typedef char *va_list; #define va_end(ap) (void) 0 #define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) -#endif /* va_arg */ - +#endif /* va_arg */ #define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) #define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) @@ -303,8 +302,7 @@ typedef char *va_list; #define ACPI_TOUPPER acpi_ut_to_upper #define ACPI_TOLOWER acpi_ut_to_lower -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ /****************************************************************************** * @@ -345,8 +343,7 @@ typedef char *va_list; #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) -#endif /* ACPI_ASM_MACROS */ - +#endif /* ACPI_ASM_MACROS */ #ifdef ACPI_APPLICATION @@ -356,11 +353,10 @@ typedef char *va_list; #define BREAKPOINT3 #endif - /****************************************************************************** * * Compiler-specific information is contained in the compiler-specific * headers. * *****************************************************************************/ -#endif /* __ACENV_H__ */ +#endif /* __ACENV_H__ */ diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 91fda36b042..4c0e0ba09ba 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -44,16 +44,20 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +/* Function name is used for debug output. Non-ANSI, compiler-dependent */ + +#define ACPI_GET_FUNCTION_NAME __FUNCTION__ + /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. */ -#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) +#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7))) /* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us + * use all the variables (for example, _acpi_module_name). This allows us * to to tell the compiler warning in a per-variable manner that a variable * is unused. */ #define ACPI_UNUSED_VAR __attribute__ ((unused)) -#endif /* __ACGCC_H__ */ +#endif /* __ACGCC_H__ */ diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index a3de0db8569..c93e6562f0e 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -62,7 +62,16 @@ #define ACPI_MACHINE_WIDTH BITS_PER_LONG -#else /* !__KERNEL__ */ +/* Type(s) for the OSL */ + +#ifdef ACPI_USE_LOCAL_CACHE +#define acpi_cache_t struct acpi_memory_list +#else +#include <linux/slab.h> +#define acpi_cache_t kmem_cache_t +#endif + +#else /* !__KERNEL__ */ #include <stdarg.h> #include <string.h> @@ -83,10 +92,10 @@ #define __cdecl #define ACPI_FLUSH_CPU_CACHE() -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ /* Linux uses GCC */ #include "acgcc.h" -#endif /* __ACLINUX_H__ */ +#endif /* __ACLINUX_H__ */ diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 50cfea4ff6c..7a00d5089de 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -23,45 +23,44 @@ struct acpi_processor_cx; struct acpi_power_register { - u8 descriptor; - u16 length; - u8 space_id; - u8 bit_width; - u8 bit_offset; - u8 reserved; - u64 address; + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 reserved; + u64 address; } __attribute__ ((packed)); - struct acpi_processor_cx_policy { - u32 count; + u32 count; struct acpi_processor_cx *state; struct { - u32 time; - u32 ticks; - u32 count; - u32 bm; - } threshold; + u32 time; + u32 ticks; + u32 count; + u32 bm; + } threshold; }; struct acpi_processor_cx { - u8 valid; - u8 type; - u32 address; - u32 latency; - u32 latency_ticks; - u32 power; - u32 usage; + u8 valid; + u8 type; + u32 address; + u32 latency; + u32 latency_ticks; + u32 power; + u32 usage; struct acpi_processor_cx_policy promotion; struct acpi_processor_cx_policy demotion; }; struct acpi_processor_power { struct acpi_processor_cx *state; - unsigned long bm_check_timestamp; - u32 default_state; - u32 bm_activity; - int count; + unsigned long bm_check_timestamp; + u32 default_state; + u32 bm_activity; + int count; struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; /* the _PDC objects passed by the driver, if any */ @@ -71,85 +70,82 @@ struct acpi_processor_power { /* Performance Management */ struct acpi_pct_register { - u8 descriptor; - u16 length; - u8 space_id; - u8 bit_width; - u8 bit_offset; - u8 reserved; - u64 address; + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 reserved; + u64 address; } __attribute__ ((packed)); struct acpi_processor_px { - acpi_integer core_frequency; /* megahertz */ - acpi_integer power; /* milliWatts */ - acpi_integer transition_latency; /* microseconds */ - acpi_integer bus_master_latency; /* microseconds */ - acpi_integer control; /* control value */ - acpi_integer status; /* success indicator */ + acpi_integer core_frequency; /* megahertz */ + acpi_integer power; /* milliWatts */ + acpi_integer transition_latency; /* microseconds */ + acpi_integer bus_master_latency; /* microseconds */ + acpi_integer control; /* control value */ + acpi_integer status; /* success indicator */ }; struct acpi_processor_performance { - unsigned int state; - unsigned int platform_limit; + unsigned int state; + unsigned int platform_limit; struct acpi_pct_register control_register; struct acpi_pct_register status_register; - unsigned int state_count; + unsigned int state_count; struct acpi_processor_px *states; /* the _PDC objects passed by the driver, if any */ struct acpi_object_list *pdc; }; - - /* Throttling Control */ struct acpi_processor_tx { - u16 power; - u16 performance; + u16 power; + u16 performance; }; struct acpi_processor_throttling { - int state; - u32 address; - u8 duty_offset; - u8 duty_width; - int state_count; + int state; + u32 address; + u8 duty_offset; + u8 duty_width; + int state_count; struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; }; /* Limit Interface */ struct acpi_processor_lx { - int px; /* performace state */ - int tx; /* throttle level */ + int px; /* performace state */ + int tx; /* throttle level */ }; struct acpi_processor_limit { - struct acpi_processor_lx state; /* current limit */ + struct acpi_processor_lx state; /* current limit */ struct acpi_processor_lx thermal; /* thermal limit */ - struct acpi_processor_lx user; /* user limit */ + struct acpi_processor_lx user; /* user limit */ }; - struct acpi_processor_flags { - u8 power:1; - u8 performance:1; - u8 throttling:1; - u8 limit:1; - u8 bm_control:1; - u8 bm_check:1; - u8 has_cst:1; - u8 power_setup_done:1; + u8 power:1; + u8 performance:1; + u8 throttling:1; + u8 limit:1; + u8 bm_control:1; + u8 bm_check:1; + u8 has_cst:1; + u8 power_setup_done:1; }; struct acpi_processor { - acpi_handle handle; - u32 acpi_id; - u32 id; - u32 pblk; - int performance_platform_limit; + acpi_handle handle; + u32 acpi_id; + u32 id; + u32 pblk; + int performance_platform_limit; struct acpi_processor_flags flags; struct acpi_processor_power power; struct acpi_processor_performance *performance; @@ -158,50 +154,49 @@ struct acpi_processor { }; struct acpi_processor_errata { - u8 smp; + u8 smp; struct { - u8 throttle:1; - u8 fdma:1; - u8 reserved:6; - u32 bmisx; - } piix4; + u8 throttle:1; + u8 fdma:1; + u8 reserved:6; + u32 bmisx; + } piix4; }; -extern int acpi_processor_register_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu); -extern void acpi_processor_unregister_performance ( - struct acpi_processor_performance * performance, - unsigned int cpu); +extern int acpi_processor_register_performance(struct acpi_processor_performance + *performance, unsigned int cpu); +extern void acpi_processor_unregister_performance(struct + acpi_processor_performance + *performance, + unsigned int cpu); /* note: this locks both the calling module and the processor module if a _PPC object exists, rmmod is disallowed then */ int acpi_processor_notify_smm(struct module *calling_module); - - /* for communication between multiple parts of the processor kernel module */ -extern struct acpi_processor *processors[NR_CPUS]; +extern struct acpi_processor *processors[NR_CPUS]; extern struct acpi_processor_errata errata; int acpi_processor_set_pdc(struct acpi_processor *pr, - struct acpi_object_list *pdc_in); + struct acpi_object_list *pdc_in); #ifdef ARCH_HAS_POWER_PDC_INIT void acpi_processor_power_init_pdc(struct acpi_processor_power *pow, - unsigned int cpu); + unsigned int cpu); void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, - unsigned int cpu); + unsigned int cpu); #else -static inline void acpi_processor_power_init_pdc( - struct acpi_processor_power *pow, unsigned int cpu) +static inline void acpi_processor_power_init_pdc(struct acpi_processor_power + *pow, unsigned int cpu) { pow->pdc = NULL; return; } -static inline void acpi_processor_power_init_bm_check( - struct acpi_processor_flags *flags, unsigned int cpu) +static inline void acpi_processor_power_init_bm_check(struct + acpi_processor_flags + *flags, unsigned int cpu) { flags->bm_check = 1; return; @@ -215,51 +210,62 @@ void acpi_processor_ppc_init(void); void acpi_processor_ppc_exit(void); int acpi_processor_ppc_has_changed(struct acpi_processor *pr); #else -static inline void acpi_processor_ppc_init(void) { return; } -static inline void acpi_processor_ppc_exit(void) { return; } -static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) { +static inline void acpi_processor_ppc_init(void) +{ + return; +} +static inline void acpi_processor_ppc_exit(void) +{ + return; +} +static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) +{ static unsigned int printout = 1; if (printout) { - printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n"); - printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n"); + printk(KERN_WARNING + "Warning: Processor Platform Limit event detected, but not handled.\n"); + printk(KERN_WARNING + "Consider compiling CPUfreq support into your kernel.\n"); printout = 0; } return 0; } -#endif /* CONFIG_CPU_FREQ */ +#endif /* CONFIG_CPU_FREQ */ /* in processor_throttling.c */ -int acpi_processor_get_throttling_info (struct acpi_processor *pr); -int acpi_processor_set_throttling (struct acpi_processor *pr, int state); -ssize_t acpi_processor_write_throttling ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data); +int acpi_processor_get_throttling_info(struct acpi_processor *pr); +int acpi_processor_set_throttling(struct acpi_processor *pr, int state); +ssize_t acpi_processor_write_throttling(struct file *file, + const char __user * buffer, + size_t count, loff_t * data); extern struct file_operations acpi_processor_throttling_fops; /* in processor_idle.c */ -int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device); -int acpi_processor_cst_has_changed (struct acpi_processor *pr); -int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device); - +int acpi_processor_power_init(struct acpi_processor *pr, + struct acpi_device *device); +int acpi_processor_cst_has_changed(struct acpi_processor *pr); +int acpi_processor_power_exit(struct acpi_processor *pr, + struct acpi_device *device); /* in processor_thermal.c */ -int acpi_processor_get_limit_info (struct acpi_processor *pr); -ssize_t acpi_processor_write_limit ( - struct file *file, - const char __user *buffer, - size_t count, - loff_t *data); +int acpi_processor_get_limit_info(struct acpi_processor *pr); +ssize_t acpi_processor_write_limit(struct file *file, + const char __user * buffer, + size_t count, loff_t * data); extern struct file_operations acpi_processor_limit_fops; #ifdef CONFIG_CPU_FREQ void acpi_thermal_cpufreq_init(void); void acpi_thermal_cpufreq_exit(void); #else -static inline void acpi_thermal_cpufreq_init(void) { return; } -static inline void acpi_thermal_cpufreq_exit(void) { return; } +static inline void acpi_thermal_cpufreq_init(void) +{ + return; +} +static inline void acpi_thermal_cpufreq_exit(void) +{ + return; +} #endif - #endif diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h index f681e675b82..4e115f368d5 100644 --- a/include/asm-alpha/pci.h +++ b/include/asm-alpha/pci.h @@ -254,6 +254,19 @@ extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *, extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index static inline int pci_proc_domain(struct pci_bus *bus) diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h index 80780dba998..8197c69eff4 100644 --- a/include/asm-alpha/spinlock.h +++ b/include/asm-alpha/spinlock.h @@ -6,7 +6,6 @@ #include <linux/kernel.h> #include <asm/current.h> - /* * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. @@ -14,43 +13,18 @@ * We make no fairness assumptions. They have a cost. */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_DEBUG_SPINLOCK - int on_cpu; - int line_no; - void *previous; - struct task_struct * task; - const char *base_file; -#endif -} spinlock_t; - -#ifdef CONFIG_DEBUG_SPINLOCK -#define SPIN_LOCK_UNLOCKED (spinlock_t){ 0, -1, 0, NULL, NULL, NULL } -#else -#define SPIN_LOCK_UNLOCKED (spinlock_t){ 0 } -#endif - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) -#define spin_is_locked(x) ((x)->lock != 0) -#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) - -#ifdef CONFIG_DEBUG_SPINLOCK -extern void _raw_spin_unlock(spinlock_t * lock); -extern void debug_spin_lock(spinlock_t * lock, const char *, int); -extern int debug_spin_trylock(spinlock_t * lock, const char *, int); -#define _raw_spin_lock(LOCK) \ - debug_spin_lock(LOCK, __BASE_FILE__, __LINE__) -#define _raw_spin_trylock(LOCK) \ - debug_spin_trylock(LOCK, __BASE_FILE__, __LINE__) -#else -static inline void _raw_spin_unlock(spinlock_t * lock) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_unlock_wait(x) \ + do { cpu_relax(); } while ((x)->lock) + +static inline void __raw_spin_unlock(raw_spinlock_t * lock) { mb(); lock->lock = 0; } -static inline void _raw_spin_lock(spinlock_t * lock) +static inline void __raw_spin_lock(raw_spinlock_t * lock) { long tmp; @@ -70,80 +44,64 @@ static inline void _raw_spin_lock(spinlock_t * lock) : "m"(lock->lock) : "memory"); } -static inline int _raw_spin_trylock(spinlock_t *lock) +static inline int __raw_spin_trylock(raw_spinlock_t *lock) { return !test_and_set_bit(0, &lock->lock); } -#endif /* CONFIG_DEBUG_SPINLOCK */ - -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) /***********************************************************/ -typedef struct { - volatile unsigned int lock; -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t){ 0 } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) - -static inline int read_can_lock(rwlock_t *lock) +static inline int __raw_read_can_lock(raw_rwlock_t *lock) { return (lock->lock & 1) == 0; } -static inline int write_can_lock(rwlock_t *lock) +static inline int __raw_write_can_lock(raw_rwlock_t *lock) { return lock->lock == 0; } -#ifdef CONFIG_DEBUG_RWLOCK -extern void _raw_write_lock(rwlock_t * lock); -extern void _raw_read_lock(rwlock_t * lock); -#else -static inline void _raw_write_lock(rwlock_t * lock) +static inline void __raw_read_lock(raw_rwlock_t *lock) { long regx; __asm__ __volatile__( "1: ldl_l %1,%0\n" - " bne %1,6f\n" - " lda %1,1\n" + " blbs %1,6f\n" + " subl %1,2,%1\n" " stl_c %1,%0\n" " beq %1,6f\n" " mb\n" ".subsection 2\n" "6: ldl %1,%0\n" - " bne %1,6b\n" + " blbs %1,6b\n" " br 1b\n" ".previous" : "=m" (*lock), "=&r" (regx) : "m" (*lock) : "memory"); } -static inline void _raw_read_lock(rwlock_t * lock) +static inline void __raw_write_lock(raw_rwlock_t *lock) { long regx; __asm__ __volatile__( "1: ldl_l %1,%0\n" - " blbs %1,6f\n" - " subl %1,2,%1\n" + " bne %1,6f\n" + " lda %1,1\n" " stl_c %1,%0\n" " beq %1,6f\n" " mb\n" ".subsection 2\n" "6: ldl %1,%0\n" - " blbs %1,6b\n" + " bne %1,6b\n" " br 1b\n" ".previous" : "=m" (*lock), "=&r" (regx) : "m" (*lock) : "memory"); } -#endif /* CONFIG_DEBUG_RWLOCK */ -static inline int _raw_read_trylock(rwlock_t * lock) +static inline int __raw_read_trylock(raw_rwlock_t * lock) { long regx; int success; @@ -165,7 +123,7 @@ static inline int _raw_read_trylock(rwlock_t * lock) return success; } -static inline int _raw_write_trylock(rwlock_t * lock) +static inline int __raw_write_trylock(raw_rwlock_t * lock) { long regx; int success; @@ -187,13 +145,7 @@ static inline int _raw_write_trylock(rwlock_t * lock) return success; } -static inline void _raw_write_unlock(rwlock_t * lock) -{ - mb(); - lock->lock = 0; -} - -static inline void _raw_read_unlock(rwlock_t * lock) +static inline void __raw_read_unlock(raw_rwlock_t * lock) { long regx; __asm__ __volatile__( @@ -209,4 +161,10 @@ static inline void _raw_read_unlock(rwlock_t * lock) : "m" (*lock) : "memory"); } +static inline void __raw_write_unlock(raw_rwlock_t * lock) +{ + mb(); + lock->lock = 0; +} + #endif /* _ALPHA_SPINLOCK_H */ diff --git a/include/asm-alpha/spinlock_types.h b/include/asm-alpha/spinlock_types.h new file mode 100644 index 00000000000..8141eb5ebf0 --- /dev/null +++ b/include/asm-alpha/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef _ALPHA_SPINLOCK_TYPES_H +#define _ALPHA_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h index 72b04d846a2..cf35721cfa4 100644 --- a/include/asm-arm/arch-pxa/hardware.h +++ b/include/asm-arm/arch-pxa/hardware.h @@ -44,24 +44,12 @@ #ifndef __ASSEMBLY__ -#if 0 -# define __REG(x) (*((volatile u32 *)io_p2v(x))) -#else -/* - * This __REG() version gives the same results as the one above, except - * that we are fooling gcc somehow so it generates far better and smaller - * assembly code for access to contigous registers. It's a shame that gcc - * doesn't guess this by itself. - */ -#include <asm/types.h> -typedef struct { volatile u32 offset[4096]; } __regbase; -# define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2] -# define __REG(x) __REGP(io_p2v(x)) -#endif +# define __REG(x) (*((volatile unsigned long *)io_p2v(x))) /* With indexed regs we don't want to feed the index through io_p2v() especially if it is a variable, otherwise horrible code will result. */ -# define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y))) +# define __REG2(x,y) \ + (*(volatile unsigned long *)((unsigned long)&__REG(x) + (y))) # define __PREG(x) (io_v2p((u32)&(x))) diff --git a/include/asm-arm/arch-pxa/i2c.h b/include/asm-arm/arch-pxa/i2c.h new file mode 100644 index 00000000000..46ec2243974 --- /dev/null +++ b/include/asm-arm/arch-pxa/i2c.h @@ -0,0 +1,70 @@ +/* + * i2c_pxa.h + * + * Copyright (C) 2002 Intrinsyc Software Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#ifndef _I2C_PXA_H_ +#define _I2C_PXA_H_ + +#if 0 +#define DEF_TIMEOUT 3 +#else +/* need a longer timeout if we're dealing with the fact we may well be + * looking at a multi-master environment +*/ +#define DEF_TIMEOUT 32 +#endif + +#define BUS_ERROR (-EREMOTEIO) +#define XFER_NAKED (-ECONNREFUSED) +#define I2C_RETRY (-2000) /* an error has occurred retry transmit */ + +/* ICR initialize bit values +* +* 15. FM 0 (100 Khz operation) +* 14. UR 0 (No unit reset) +* 13. SADIE 0 (Disables the unit from interrupting on slave addresses +* matching its slave address) +* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration +* in master mode) +* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode) +* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent) +* 9. IRFIE 1 (Enable interrupts from full buffer received) +* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty) +* 7. GCD 1 (Disables i2c unit response to general call messages as a slave) +* 6. IUE 0 (Disable unit until we change settings) +* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL) +* 4. MA 0 (Only send stop with the ICR stop bit) +* 3. TB 0 (We are not transmitting a byte initially) +* 2. ACKNAK 0 (Send an ACK after the unit receives a byte) +* 1. STOP 0 (Do not send a STOP) +* 0. START 0 (Do not send a START) +* +*/ +#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) + +/* I2C status register init values + * + * 10. BED 1 (Clear bus error detected) + * 9. SAD 1 (Clear slave address detected) + * 7. IRF 1 (Clear IDBR Receive Full) + * 6. ITE 1 (Clear IDBR Transmit Empty) + * 5. ALD 1 (Clear Arbitration Loss Detected) + * 4. SSD 1 (Clear Slave Stop Detected) + */ +#define I2C_ISR_INIT 0x7FF /* status register init */ + +struct i2c_slave_client; + +struct i2c_pxa_platform_data { + unsigned int slave_addr; + struct i2c_slave_client *slave; +}; + +extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); +#endif diff --git a/include/asm-arm/arch-pxa/mmc.h b/include/asm-arm/arch-pxa/mmc.h index 9718063a211..88c17dd02ed 100644 --- a/include/asm-arm/arch-pxa/mmc.h +++ b/include/asm-arm/arch-pxa/mmc.h @@ -9,6 +9,7 @@ struct mmc_host; struct pxamci_platform_data { unsigned int ocr_mask; /* available voltages */ + unsigned long detect_delay; /* delay in jiffies before detecting cards after interrupt */ int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *); int (*get_ro)(struct device *); void (*setpower)(struct device *, unsigned int); diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h index 27d71e9d413..21c0e16dce5 100644 --- a/include/asm-arm/arch-pxa/pxafb.h +++ b/include/asm-arm/arch-pxa/pxafb.h @@ -66,3 +66,4 @@ struct pxafb_mach_info { }; void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); +unsigned long pxafb_get_hsync_time(struct device *dev); diff --git a/include/asm-arm/arch-s3c2410/fb.h b/include/asm-arm/arch-s3c2410/fb.h new file mode 100644 index 00000000000..ac57bc887d8 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/fb.h @@ -0,0 +1,69 @@ +/* linux/include/asm/arch-s3c2410/fb.h + * + * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org> + * + * Inspired by pxafb.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * + * Changelog: + * 07-Sep-2004 RTP Created file + * 03-Nov-2004 BJD Updated and minor cleanups + * 03-Aug-2005 RTP Renamed to fb.h +*/ + +#ifndef __ASM_ARM_FB_H +#define __ASM_ARM_FB_H + +#include <asm/arch/regs-lcd.h> + +struct s3c2410fb_val { + unsigned int defval; + unsigned int min; + unsigned int max; +}; + +struct s3c2410fb_hw { + unsigned long lcdcon1; + unsigned long lcdcon2; + unsigned long lcdcon3; + unsigned long lcdcon4; + unsigned long lcdcon5; +}; + +struct s3c2410fb_mach_info { + unsigned char fixed_syncs; /* do not update sync/border */ + + /* Screen size */ + int width; + int height; + + /* Screen info */ + struct s3c2410fb_val xres; + struct s3c2410fb_val yres; + struct s3c2410fb_val bpp; + + /* lcd configuration registers */ + struct s3c2410fb_hw regs; + + /* GPIOs */ + + unsigned long gpcup; + unsigned long gpcup_mask; + unsigned long gpccon; + unsigned long gpccon_mask; + unsigned long gpdup; + unsigned long gpdup_mask; + unsigned long gpdcon; + unsigned long gpdcon_mask; + + /* lpc3600 control register */ + unsigned long lpcsel; +}; + +void __init set_s3c2410fb_info(struct s3c2410fb_mach_info *hard_s3c2410fb_info); + +#endif /* __ASM_ARM_FB_H */ diff --git a/include/asm-arm/arch-s3c2410/regs-lcd.h b/include/asm-arm/arch-s3c2410/regs-lcd.h index 7f882ea92b2..b6b1b4e8bbe 100644 --- a/include/asm-arm/arch-s3c2410/regs-lcd.h +++ b/include/asm-arm/arch-s3c2410/regs-lcd.h @@ -51,21 +51,32 @@ #define S3C2410_LCDCON1_ENVID (1) +#define S3C2410_LCDCON1_MODEMASK 0x1E + #define S3C2410_LCDCON2_VBPD(x) ((x) << 24) #define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14) #define S3C2410_LCDCON2_VFPD(x) ((x) << 6) #define S3C2410_LCDCON2_VSPW(x) ((x) << 0) +#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF) +#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >> 6) & 0xFF) +#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >> 0) & 0x3F) + #define S3C2410_LCDCON3_HBPD(x) ((x) << 19) #define S3C2410_LCDCON3_WDLY(x) ((x) << 19) #define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8) #define S3C2410_LCDCON3_HFPD(x) ((x) << 0) #define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0) +#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F) +#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF) + #define S3C2410_LCDCON4_MVAL(x) ((x) << 8) #define S3C2410_LCDCON4_HSPW(x) ((x) << 0) #define S3C2410_LCDCON4_WLH(x) ((x) << 0) +#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >> 0) & 0xFF) + #define S3C2410_LCDCON5_BPP24BL (1<<12) #define S3C2410_LCDCON5_FRM565 (1<<11) #define S3C2410_LCDCON5_INVVCLK (1<<10) @@ -100,10 +111,16 @@ #define S3C2410_DITHMODE S3C2410_LCDREG(0x4C) #define S3C2410_TPAL S3C2410_LCDREG(0x50) +#define S3C2410_TPAL_EN (1<<24) + /* interrupt info */ #define S3C2410_LCDINTPND S3C2410_LCDREG(0x54) #define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58) #define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C) +#define S3C2410_LCDINT_FIWSEL (1<<2) +#define S3C2410_LCDINT_FRSYNC (1<<1) +#define S3C2410_LCDINT_FICNT (1<<0) + #define S3C2410_LPCSEL S3C2410_LCDREG(0x60) #define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h index 10c62db3436..19c3b1e186b 100644 --- a/include/asm-arm/arch-sa1100/hardware.h +++ b/include/asm-arm/arch-sa1100/hardware.h @@ -49,23 +49,9 @@ ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START ) #ifndef __ASSEMBLY__ -#include <asm/types.h> -#if 0 -# define __REG(x) (*((volatile u32 *)io_p2v(x))) -#else -/* - * This __REG() version gives the same results as the one above, except - * that we are fooling gcc somehow so it generates far better and smaller - * assembly code for access to contigous registers. It's a shame that gcc - * doesn't guess this by itself. - */ -typedef struct { volatile u32 offset[4096]; } __regbase; -# define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2] -# define __REG(x) __REGP(io_p2v(x)) -#endif - -# define __PREG(x) (io_v2p((u32)&(x))) +# define __REG(x) (*((volatile unsigned long *)io_p2v(x))) +# define __PREG(x) (io_v2p((unsigned long)&(x))) #else diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h index 035cdcff43d..e81baff4f54 100644 --- a/include/asm-arm/cacheflush.h +++ b/include/asm-arm/cacheflush.h @@ -256,7 +256,7 @@ extern void dmac_flush_range(unsigned long, unsigned long); * Convert calls to our calling convention. */ #define flush_cache_all() __cpuc_flush_kern_all() - +#ifndef CONFIG_CPU_CACHE_VIPT static inline void flush_cache_mm(struct mm_struct *mm) { if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) @@ -279,6 +279,11 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned l __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags); } } +#else +extern void flush_cache_mm(struct mm_struct *mm); +extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); +extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn); +#endif /* * flush_cache_user_range is used when we want to ensure that the diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h index 38ea5899a58..ead3ced38cb 100644 --- a/include/asm-arm/pci.h +++ b/include/asm-arm/pci.h @@ -64,6 +64,19 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + static inline void pcibios_add_platform_entries(struct pci_dev *dev) { } diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index 1f906d09b68..cb4906b4555 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h @@ -16,21 +16,14 @@ * Unlocked value: 0 * Locked value: 1 */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while (0) -#define spin_is_locked(x) ((x)->lock != 0) -#define spin_unlock_wait(x) do { barrier(); } while (spin_is_locked(x)) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) -static inline void _raw_spin_lock(spinlock_t *lock) +static inline void __raw_spin_lock(raw_spinlock_t *lock) { unsigned long tmp; @@ -47,7 +40,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) smp_mb(); } -static inline int _raw_spin_trylock(spinlock_t *lock) +static inline int __raw_spin_trylock(raw_spinlock_t *lock) { unsigned long tmp; @@ -67,7 +60,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock) } } -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { smp_mb(); @@ -80,23 +73,14 @@ static inline void _raw_spin_unlock(spinlock_t *lock) /* * RWLOCKS - */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0) -#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0) - -/* + * + * * Write locks are easy - we just set bit 31. When unlocking, we can * just write zero since the lock is exclusively held. */ -static inline void _raw_write_lock(rwlock_t *rw) +#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0) + +static inline void __raw_write_lock(rwlock_t *rw) { unsigned long tmp; @@ -113,7 +97,7 @@ static inline void _raw_write_lock(rwlock_t *rw) smp_mb(); } -static inline int _raw_write_trylock(rwlock_t *rw) +static inline int __raw_write_trylock(rwlock_t *rw) { unsigned long tmp; @@ -133,7 +117,7 @@ static inline int _raw_write_trylock(rwlock_t *rw) } } -static inline void _raw_write_unlock(rwlock_t *rw) +static inline void __raw_write_unlock(raw_rwlock_t *rw) { smp_mb(); @@ -156,7 +140,7 @@ static inline void _raw_write_unlock(rwlock_t *rw) * currently active. However, we know we won't have any write * locks. */ -static inline void _raw_read_lock(rwlock_t *rw) +static inline void __raw_read_lock(raw_rwlock_t *rw) { unsigned long tmp, tmp2; @@ -173,7 +157,7 @@ static inline void _raw_read_lock(rwlock_t *rw) smp_mb(); } -static inline void _raw_read_unlock(rwlock_t *rw) +static inline void __raw_read_unlock(rwlock_t *rw) { unsigned long tmp, tmp2; @@ -190,6 +174,6 @@ static inline void _raw_read_unlock(rwlock_t *rw) : "cc"); } -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-arm/spinlock_types.h b/include/asm-arm/spinlock_types.h new file mode 100644 index 00000000000..43e83f6d2ee --- /dev/null +++ b/include/asm-arm/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 278de61224d..c49df635a80 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -355,6 +355,9 @@ #define __NR_inotify_init (__NR_SYSCALL_BASE+316) #define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317) #define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318) +#define __NR_mbind (__NR_SYSCALL_BASE+319) +#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320) +#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321) /* * The following SWIs are ARM private. diff --git a/include/asm-arm26/hardirq.h b/include/asm-arm26/hardirq.h index 791ee1da9bf..dc28daab8aa 100644 --- a/include/asm-arm26/hardirq.h +++ b/include/asm-arm26/hardirq.h @@ -22,8 +22,6 @@ typedef struct { # error HARDIRQ_BITS is too low! #endif -#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) - #ifndef CONFIG_SMP extern asmlinkage void __do_softirq(void); diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h index ee1d8b5d816..c36a77d3bf4 100644 --- a/include/asm-generic/pci.h +++ b/include/asm-generic/pci.h @@ -30,6 +30,19 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, res->end = region->end; } +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + #define pcibios_scan_all_fns(a, b) 0 #ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index faff403e106..7d0298347ee 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -23,7 +23,11 @@ * and page free order so much.. */ #ifdef CONFIG_SMP - #define FREE_PTE_NR 506 + #ifdef ARCH_FREE_PTR_NR + #define FREE_PTR_NR ARCH_FREE_PTR_NR + #else + #define FREE_PTE_NR 506 + #endif #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U) #else #define FREE_PTE_NR 1 diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 6f857be2b64..a9c55490fb8 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -103,3 +103,41 @@ VMLINUX_SYMBOL(__kprobes_text_start) = .; \ *(.kprobes.text) \ VMLINUX_SYMBOL(__kprobes_text_end) = .; + + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to + the beginning of the section so we begin them at 0. */ +#define DWARF_DEBUG \ + /* DWARF 1 */ \ + .debug 0 : { *(.debug) } \ + .line 0 : { *(.line) } \ + /* GNU DWARF 1 extensions */ \ + .debug_srcinfo 0 : { *(.debug_srcinfo) } \ + .debug_sfnames 0 : { *(.debug_sfnames) } \ + /* DWARF 1.1 and DWARF 2 */ \ + .debug_aranges 0 : { *(.debug_aranges) } \ + .debug_pubnames 0 : { *(.debug_pubnames) } \ + /* DWARF 2 */ \ + .debug_info 0 : { *(.debug_info \ + .gnu.linkonce.wi.*) } \ + .debug_abbrev 0 : { *(.debug_abbrev) } \ + .debug_line 0 : { *(.debug_line) } \ + .debug_frame 0 : { *(.debug_frame) } \ + .debug_str 0 : { *(.debug_str) } \ + .debug_loc 0 : { *(.debug_loc) } \ + .debug_macinfo 0 : { *(.debug_macinfo) } \ + /* SGI/MIPS DWARF 2 extensions */ \ + .debug_weaknames 0 : { *(.debug_weaknames) } \ + .debug_funcnames 0 : { *(.debug_funcnames) } \ + .debug_typenames 0 : { *(.debug_typenames) } \ + .debug_varnames 0 : { *(.debug_varnames) } \ + + /* Stabs debugging sections. */ +#define STABS_DEBUG \ + .stab 0 : { *(.stab) } \ + .stabstr 0 : { *(.stabstr) } \ + .stab.excl 0 : { *(.stab.excl) } \ + .stab.exclstr 0 : { *(.stab.exclstr) } \ + .stab.index 0 : { *(.stab.index) } \ + .stab.indexstr 0 : { *(.stab.indexstr) } \ + .comment 0 : { *(.comment) } diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index cf828ace13f..df4ed323aa4 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h @@ -103,7 +103,7 @@ __acpi_release_global_lock (unsigned int *lock) :"=r"(n_hi), "=r"(n_lo) \ :"0"(n_hi), "1"(n_lo)) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int acpi_lapic; extern int acpi_ioapic; extern int acpi_noirq; @@ -146,13 +146,6 @@ static inline void check_acpi_pci(void) { } #endif -#else /* CONFIG_ACPI_BOOT */ -# define acpi_lapic 0 -# define acpi_ioapic 0 - -#endif - -#ifdef CONFIG_ACPI_PCI static inline void acpi_noirq_set(void) { acpi_noirq = 1; } static inline void acpi_disable_pci(void) { @@ -160,11 +153,16 @@ static inline void acpi_disable_pci(void) acpi_noirq_set(); } extern int acpi_irq_balance_set(char *str); -#else + +#else /* !CONFIG_ACPI */ + +#define acpi_lapic 0 +#define acpi_ioapic 0 static inline void acpi_noirq_set(void) { } static inline void acpi_disable_pci(void) { } -static inline int acpi_irq_balance_set(char *str) { return 0; } -#endif + +#endif /* !CONFIG_ACPI */ + #ifdef CONFIG_ACPI_SLEEP diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 6a1b1882285..8c454aa58ac 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h @@ -130,6 +130,8 @@ extern unsigned int nmi_watchdog; #define NMI_LOCAL_APIC 2 #define NMI_INVALID 3 +extern int disable_timer_pin_1; + #else /* !CONFIG_X86_LOCAL_APIC */ static inline void lapic_shutdown(void) { } diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h index 28ed8b296af..75c67c785bb 100644 --- a/include/asm-i386/div64.h +++ b/include/asm-i386/div64.h @@ -35,7 +35,7 @@ */ #define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c) -extern inline long +static inline long div_ll_X_l_rem(long long divs, long div, long *rem) { long dum2; diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index c94cac95838..cfb1c61d3b9 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h @@ -76,7 +76,7 @@ enum fixed_addresses { FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, #endif -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI FIX_ACPI_BEGIN, FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1, #endif diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h index 002c203ccd6..51c4e5fe606 100644 --- a/include/asm-i386/io_apic.h +++ b/include/asm-i386/io_apic.h @@ -195,12 +195,12 @@ extern int skip_ioapic_setup; */ #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int io_apic_get_unique_id (int ioapic, int apic_id); extern int io_apic_get_version (int ioapic); extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_ACPI */ extern int (*ioapic_renumber_irq)(int ioapic, int irq); diff --git a/include/asm-i386/mach-default/mach_reboot.h b/include/asm-i386/mach-default/mach_reboot.h index 521e227db67..06ae4d81ba6 100644 --- a/include/asm-i386/mach-default/mach_reboot.h +++ b/include/asm-i386/mach-default/mach_reboot.h @@ -22,7 +22,15 @@ static inline void mach_reboot(void) for (i = 0; i < 100; i++) { kb_wait(); udelay(50); - outb(0xfe, 0x64); /* pulse reset low */ + outb(0x60, 0x64); /* write Controller Command Byte */ + udelay(50); + kb_wait(); + udelay(50); + outb(0x14, 0x60); /* set "System flag" */ + udelay(50); + kb_wait(); + udelay(50); + outb(0xfe, 0x64); /* pulse reset low */ udelay(50); } } diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 516421300ea..348fe3a4879 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h @@ -29,7 +29,7 @@ static inline void get_memcfg_numa(void) #ifdef CONFIG_X86_NUMAQ if (get_memcfg_numaq()) return; -#elif CONFIG_ACPI_SRAT +#elif defined(CONFIG_ACPI_SRAT) if (get_memcfg_from_srat()) return; #endif diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h index d84a9c326c2..64a0b8e6afe 100644 --- a/include/asm-i386/mpspec.h +++ b/include/asm-i386/mpspec.h @@ -27,14 +27,14 @@ extern unsigned long mp_lapic_addr; extern int pic_mode; extern int using_apic_timer; -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern void mp_register_lapic (u8 id, u8 enabled); extern void mp_register_lapic_address (u64 address); extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); extern void mp_config_acpi_legacy_irqs (void); extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); -#endif /*CONFIG_ACPI_BOOT*/ +#endif /* CONFIG_ACPI */ #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS) diff --git a/include/asm-i386/numa.h b/include/asm-i386/numa.h new file mode 100644 index 00000000000..96fcb157db1 --- /dev/null +++ b/include/asm-i386/numa.h @@ -0,0 +1,3 @@ + +int pxm_to_nid(int pxm); + diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 37bef8ed7be..0a4ec764377 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -679,7 +679,7 @@ static inline void rep_nop(void) However we don't do prefetches for pre XP Athlons currently That should be fixed. */ #define ARCH_HAS_PREFETCH -extern inline void prefetch(const void *x) +static inline void prefetch(const void *x) { alternative_input(ASM_NOP4, "prefetchnta (%1)", @@ -693,7 +693,7 @@ extern inline void prefetch(const void *x) /* 3dnow! prefetch to get an exclusive cache line. Useful for spinlocks to avoid one state transition in the cache coherency protocol. */ -extern inline void prefetchw(const void *x) +static inline void prefetchw(const void *x) { alternative_input(ASM_NOP4, "prefetchw (%1)", diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index f9ff31f4003..23604350cdf 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -7,46 +7,21 @@ #include <linux/config.h> #include <linux/compiler.h> -asmlinkage int printk(const char * fmt, ...) - __attribute__ ((format (printf, 1, 2))); - /* * Your basic SMP spinlocks, allowing only a single CPU anywhere - */ - -typedef struct { - volatile unsigned int slock; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned magic; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define SPINLOCK_MAGIC 0xdead4ead - -#ifdef CONFIG_DEBUG_SPINLOCK -#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC -#else -#define SPINLOCK_MAGIC_INIT /* */ -#endif - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) - -/* + * * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. * * We make no fairness assumptions. They have a cost. + * + * (the type definitions are in asm/spinlock_types.h) */ -#define spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) <= 0) -#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) +#define __raw_spin_is_locked(x) \ + (*(volatile signed char *)(&(x)->slock) <= 0) -#define spin_lock_string \ +#define __raw_spin_lock_string \ "\n1:\t" \ "lock ; decb %0\n\t" \ "jns 3f\n" \ @@ -57,7 +32,7 @@ typedef struct { "jmp 1b\n" \ "3:\n\t" -#define spin_lock_string_flags \ +#define __raw_spin_lock_string_flags \ "\n1:\t" \ "lock ; decb %0\n\t" \ "jns 4f\n\t" \ @@ -73,86 +48,71 @@ typedef struct { "jmp 1b\n" \ "4:\n\t" +static inline void __raw_spin_lock(raw_spinlock_t *lock) +{ + __asm__ __volatile__( + __raw_spin_lock_string + :"=m" (lock->slock) : : "memory"); +} + +static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) +{ + __asm__ __volatile__( + __raw_spin_lock_string_flags + :"=m" (lock->slock) : "r" (flags) : "memory"); +} + +static inline int __raw_spin_trylock(raw_spinlock_t *lock) +{ + char oldval; + __asm__ __volatile__( + "xchgb %b0,%1" + :"=q" (oldval), "=m" (lock->slock) + :"0" (0) : "memory"); + return oldval > 0; +} + /* - * This works. Despite all the confusion. - * (except on PPro SMP or if we are using OOSTORE) + * __raw_spin_unlock based on writing $1 to the low byte. + * This method works. Despite all the confusion. + * (except on PPro SMP or if we are using OOSTORE, so we use xchgb there) * (PPro errata 66, 92) */ #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) -#define spin_unlock_string \ +#define __raw_spin_unlock_string \ "movb $1,%0" \ :"=m" (lock->slock) : : "memory" -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(lock->magic != SPINLOCK_MAGIC); - BUG_ON(!spin_is_locked(lock)); -#endif __asm__ __volatile__( - spin_unlock_string + __raw_spin_unlock_string ); } #else -#define spin_unlock_string \ +#define __raw_spin_unlock_string \ "xchgb %b0, %1" \ :"=q" (oldval), "=m" (lock->slock) \ :"0" (oldval) : "memory" -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { char oldval = 1; -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(lock->magic != SPINLOCK_MAGIC); - BUG_ON(!spin_is_locked(lock)); -#endif - __asm__ __volatile__( - spin_unlock_string - ); -} -#endif - -static inline int _raw_spin_trylock(spinlock_t *lock) -{ - char oldval; __asm__ __volatile__( - "xchgb %b0,%1" - :"=q" (oldval), "=m" (lock->slock) - :"0" (0) : "memory"); - return oldval > 0; + __raw_spin_unlock_string + ); } -static inline void _raw_spin_lock(spinlock_t *lock) -{ -#ifdef CONFIG_DEBUG_SPINLOCK - if (unlikely(lock->magic != SPINLOCK_MAGIC)) { - printk("eip: %p\n", __builtin_return_address(0)); - BUG(); - } #endif - __asm__ __volatile__( - spin_lock_string - :"=m" (lock->slock) : : "memory"); -} -static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) -{ -#ifdef CONFIG_DEBUG_SPINLOCK - if (unlikely(lock->magic != SPINLOCK_MAGIC)) { - printk("eip: %p\n", __builtin_return_address(0)); - BUG(); - } -#endif - __asm__ __volatile__( - spin_lock_string_flags - :"=m" (lock->slock) : "r" (flags) : "memory"); -} +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) /* * Read-write spinlocks, allowing multiple readers @@ -163,72 +123,41 @@ static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * On x86, we implement read-write locks as a 32-bit counter + * with the high bit (sign) being the "contended" bit. + * + * The inline assembly is non-obvious. Think about it. + * + * Changed to use the same technique as rw semaphores. See + * semaphore.h for details. -ben + * + * the helpers are in arch/i386/kernel/semaphore.c */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned magic; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RWLOCK_MAGIC 0xdeaf1eed - -#ifdef CONFIG_DEBUG_SPINLOCK -#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC -#else -#define RWLOCK_MAGIC_INIT /* */ -#endif - -#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) /** * read_can_lock - would read_trylock() succeed? * @lock: the rwlock in question. */ -#define read_can_lock(x) ((int)(x)->lock > 0) +#define __raw_read_can_lock(x) ((int)(x)->lock > 0) /** * write_can_lock - would write_trylock() succeed? * @lock: the rwlock in question. */ -#define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) +#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) -/* - * On x86, we implement read-write locks as a 32-bit counter - * with the high bit (sign) being the "contended" bit. - * - * The inline assembly is non-obvious. Think about it. - * - * Changed to use the same technique as rw semaphores. See - * semaphore.h for details. -ben - */ -/* the spinlock helpers are in arch/i386/kernel/semaphore.c */ - -static inline void _raw_read_lock(rwlock_t *rw) +static inline void __raw_read_lock(raw_rwlock_t *rw) { -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(rw->magic != RWLOCK_MAGIC); -#endif __build_read_lock(rw, "__read_lock_failed"); } -static inline void _raw_write_lock(rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(rw->magic != RWLOCK_MAGIC); -#endif __build_write_lock(rw, "__write_lock_failed"); } -#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") -#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory") - -static inline int _raw_read_trylock(rwlock_t *lock) +static inline int __raw_read_trylock(raw_rwlock_t *lock) { atomic_t *count = (atomic_t *)lock; atomic_dec(count); @@ -238,7 +167,7 @@ static inline int _raw_read_trylock(rwlock_t *lock) return 0; } -static inline int _raw_write_trylock(rwlock_t *lock) +static inline int __raw_write_trylock(raw_rwlock_t *lock) { atomic_t *count = (atomic_t *)lock; if (atomic_sub_and_test(RW_LOCK_BIAS, count)) @@ -247,4 +176,15 @@ static inline int _raw_write_trylock(rwlock_t *lock) return 0; } +static inline void __raw_read_unlock(raw_rwlock_t *rw) +{ + asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); +} + +static inline void __raw_write_unlock(raw_rwlock_t *rw) +{ + asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0" + : "=m" (rw->lock) : : "memory"); +} + #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-i386/spinlock_types.h b/include/asm-i386/spinlock_types.h new file mode 100644 index 00000000000..59efe849f35 --- /dev/null +++ b/include/asm-i386/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int slock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 1 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } + +#endif diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h index e2cb9fa6f56..8fbf791651b 100644 --- a/include/asm-i386/thread_info.h +++ b/include/asm-i386/thread_info.h @@ -48,7 +48,7 @@ struct thread_info { #else /* !__ASSEMBLY__ */ -#include <asm/asm_offsets.h> +#include <asm/asm-offsets.h> #endif diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index 2461b731781..0ec27c9e8e4 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h @@ -60,7 +60,7 @@ static inline int node_to_first_cpu(int node) return first_cpu(mask); } -#define pcibus_to_node(bus) mp_bus_id_to_node[(bus)->number] +#define pcibus_to_node(bus) ((long) (bus)->sysdata) #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) /* sched_domains SD_NODE_INIT for NUMAQ machines */ diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index a7cb377745b..fbaf90a3968 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -332,7 +332,7 @@ type name(type1 arg1) \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1))); \ + : "0" (__NR_##name),"b" ((long)(arg1)) : "memory"); \ __syscall_return(type,__res); \ } @@ -342,7 +342,7 @@ type name(type1 arg1,type2 arg2) \ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)) : "memory"); \ __syscall_return(type,__res); \ } @@ -353,7 +353,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3))); \ + "d" ((long)(arg3)) : "memory"); \ __syscall_return(type,__res); \ } @@ -364,7 +364,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4))); \ + "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \ __syscall_return(type,__res); \ } @@ -376,7 +376,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) : "memory"); \ __syscall_return(type,__res); \ } @@ -389,7 +389,7 @@ __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; p : "=a" (__res) \ : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ - "0" ((long)(arg6))); \ + "0" ((long)(arg6)) : "memory"); \ __syscall_return(type,__res); \ } diff --git a/include/asm-ia64/acpi-ext.h b/include/asm-ia64/acpi-ext.h index 9271d74c64c..56d2ddc97b3 100644 --- a/include/asm-ia64/acpi-ext.h +++ b/include/asm-ia64/acpi-ext.h @@ -11,6 +11,7 @@ #define _ASM_IA64_ACPI_EXT_H #include <linux/types.h> +#include <acpi/actypes.h> extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length); diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h index a429fe225b0..20f98f1751a 100644 --- a/include/asm-ia64/iosapic.h +++ b/include/asm-ia64/iosapic.h @@ -80,12 +80,9 @@ extern int iosapic_remove (unsigned int gsi_base); #endif /* CONFIG_HOTPLUG */ extern int gsi_to_vector (unsigned int gsi); extern int gsi_to_irq (unsigned int gsi); -extern void iosapic_enable_intr (unsigned int vector); extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, unsigned long trigger); -#ifdef CONFIG_ACPI_DEALLOCATE_IRQ extern void iosapic_unregister_intr (unsigned int irq); -#endif extern void __init iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, unsigned long polarity, unsigned long trigger); @@ -97,7 +94,6 @@ extern int __init iosapic_register_platform_intr (u32 int_type, unsigned long trigger); extern unsigned int iosapic_version (char __iomem *addr); -extern void iosapic_pci_fixup (int); #ifdef CONFIG_NUMA extern void __devinit map_iosapic_to_node (unsigned int, int); #endif diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h index cd984d08fd1..dbe86c0bbce 100644 --- a/include/asm-ia64/irq.h +++ b/include/asm-ia64/irq.h @@ -35,8 +35,4 @@ extern void disable_irq_nosync (unsigned int); extern void enable_irq (unsigned int); extern void set_irq_affinity_info (unsigned int irq, int dest, int redir); -struct irqaction; -struct pt_regs; -int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); - #endif /* _ASM_IA64_IRQ_H */ diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h index 149ad011845..97a28b8b2dd 100644 --- a/include/asm-ia64/mca.h +++ b/include/asm-ia64/mca.h @@ -11,8 +11,6 @@ #ifndef _ASM_IA64_MCA_H #define _ASM_IA64_MCA_H -#define IA64_MCA_STACK_SIZE 8192 - #if !defined(__ASSEMBLY__) #include <linux/interrupt.h> @@ -48,7 +46,8 @@ typedef union cmcv_reg_u { enum { IA64_MCA_RENDEZ_CHECKIN_NOTDONE = 0x0, - IA64_MCA_RENDEZ_CHECKIN_DONE = 0x1 + IA64_MCA_RENDEZ_CHECKIN_DONE = 0x1, + IA64_MCA_RENDEZ_CHECKIN_INIT = 0x2, }; /* Information maintained by the MC infrastructure */ @@ -63,18 +62,42 @@ typedef struct ia64_mc_info_s { } ia64_mc_info_t; -typedef struct ia64_mca_sal_to_os_state_s { - u64 imsto_os_gp; /* GP of the os registered with the SAL */ - u64 imsto_pal_proc; /* PAL_PROC entry point - physical addr */ - u64 imsto_sal_proc; /* SAL_PROC entry point - physical addr */ - u64 imsto_sal_gp; /* GP of the SAL - physical */ - u64 imsto_rendez_state; /* Rendez state information */ - u64 imsto_sal_check_ra; /* Return address in SAL_CHECK while going - * back to SAL from OS after MCA handling. - */ - u64 pal_min_state; /* from PAL in r17 */ - u64 proc_state_param; /* from PAL in r18. See SDV 2:268 11.3.2.1 */ -} ia64_mca_sal_to_os_state_t; +/* Handover state from SAL to OS and vice versa, for both MCA and INIT events. + * Besides the handover state, it also contains some saved registers from the + * time of the event. + * Note: mca_asm.S depends on the precise layout of this structure. + */ + +struct ia64_sal_os_state { + /* SAL to OS, must be at offset 0 */ + u64 os_gp; /* GP of the os registered with the SAL, physical */ + u64 pal_proc; /* PAL_PROC entry point, physical */ + u64 sal_proc; /* SAL_PROC entry point, physical */ + u64 rv_rc; /* MCA - Rendezvous state, INIT - reason code */ + u64 proc_state_param; /* from R18 */ + u64 monarch; /* 1 for a monarch event, 0 for a slave */ + /* common, must follow SAL to OS */ + u64 sal_ra; /* Return address in SAL, physical */ + u64 sal_gp; /* GP of the SAL - physical */ + pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */ + u64 prev_IA64_KR_CURRENT; /* previous value of IA64_KR(CURRENT) */ + struct task_struct *prev_task; /* previous task, NULL if it is not useful */ + /* Some interrupt registers are not saved in minstate, pt_regs or + * switch_stack. Because MCA/INIT can occur when interrupts are + * disabled, we need to save the additional interrupt registers over + * MCA/INIT and resume. + */ + u64 isr; + u64 ifa; + u64 itir; + u64 iipa; + u64 iim; + u64 iha; + /* OS to SAL, must follow common */ + u64 os_status; /* OS status to SAL, enum below */ + u64 context; /* 0 if return to same context + 1 if return to new context */ +}; enum { IA64_MCA_CORRECTED = 0x0, /* Error has been corrected by OS_MCA */ @@ -84,35 +107,21 @@ enum { }; enum { + IA64_INIT_RESUME = 0x0, /* Resume after return from INIT */ + IA64_INIT_WARM_BOOT = -1, /* Warm boot of the system need from SAL */ +}; + +enum { IA64_MCA_SAME_CONTEXT = 0x0, /* SAL to return to same context */ IA64_MCA_NEW_CONTEXT = -1 /* SAL to return to new context */ }; -typedef struct ia64_mca_os_to_sal_state_s { - u64 imots_os_status; /* OS status to SAL as to what happened - * with the MCA handling. - */ - u64 imots_sal_gp; /* GP of the SAL - physical */ - u64 imots_context; /* 0 if return to same context - 1 if return to new context */ - u64 *imots_new_min_state; /* Pointer to structure containing - * new values of registers in the min state - * save area. - */ - u64 imots_sal_check_ra; /* Return address in SAL_CHECK while going - * back to SAL from OS after MCA handling. - */ -} ia64_mca_os_to_sal_state_t; - /* Per-CPU MCA state that is too big for normal per-CPU variables. */ struct ia64_mca_cpu { - u64 stack[IA64_MCA_STACK_SIZE/8]; /* MCA memory-stack */ - u64 proc_state_dump[512]; - u64 stackframe[32]; - u64 rbstore[IA64_MCA_STACK_SIZE/8]; /* MCA reg.-backing store */ + u64 mca_stack[KERNEL_STACK_SIZE/8]; u64 init_stack[KERNEL_STACK_SIZE/8]; -} __attribute__ ((aligned(16))); +}; /* Array of physical addresses of each CPU's MCA area. */ extern unsigned long __per_cpu_mca[NR_CPUS]; @@ -121,12 +130,29 @@ extern void ia64_mca_init(void); extern void ia64_mca_cpu_init(void *); extern void ia64_os_mca_dispatch(void); extern void ia64_os_mca_dispatch_end(void); -extern void ia64_mca_ucmc_handler(void); +extern void ia64_mca_ucmc_handler(struct pt_regs *, struct ia64_sal_os_state *); +extern void ia64_init_handler(struct pt_regs *, + struct switch_stack *, + struct ia64_sal_os_state *); extern void ia64_monarch_init_handler(void); extern void ia64_slave_init_handler(void); extern void ia64_mca_cmc_vector_setup(void); -extern int ia64_reg_MCA_extension(void*); +extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *)); extern void ia64_unreg_MCA_extension(void); +extern u64 ia64_get_rnat(u64 *); + +#else /* __ASSEMBLY__ */ + +#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */ +#define IA64_MCA_WARM_BOOT -1 /* Warm boot of the system need from SAL */ +#define IA64_MCA_COLD_BOOT -2 /* Cold boot of the system need from SAL */ +#define IA64_MCA_HALT -3 /* System to be halted by SAL */ + +#define IA64_INIT_RESUME 0x0 /* Resume after return from INIT */ +#define IA64_INIT_WARM_BOOT -1 /* Warm boot of the system need from SAL */ + +#define IA64_MCA_SAME_CONTEXT 0x0 /* SAL to return to same context */ +#define IA64_MCA_NEW_CONTEXT -1 /* SAL to return to new context */ #endif /* !__ASSEMBLY__ */ #endif /* _ASM_IA64_MCA_H */ diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h index 836953e0f91..27c9203d8ce 100644 --- a/include/asm-ia64/mca_asm.h +++ b/include/asm-ia64/mca_asm.h @@ -8,6 +8,8 @@ * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> * Copyright (C) 2002 Intel Corp. * Copyright (C) 2002 Jenna Hall <jenna.s.hall@intel.com> + * Copyright (C) 2005 Silicon Graphics, Inc + * Copyright (C) 2005 Keith Owens <kaos@sgi.com> */ #ifndef _ASM_IA64_MCA_ASM_H #define _ASM_IA64_MCA_ASM_H @@ -207,106 +209,33 @@ ;; /* - * The following offsets capture the order in which the - * RSE related registers from the old context are - * saved onto the new stack frame. + * The MCA and INIT stacks in struct ia64_mca_cpu look like normal kernel + * stacks, except that the SAL/OS state and a switch_stack are stored near the + * top of the MCA/INIT stack. To support concurrent entry to MCA or INIT, as + * well as MCA over INIT, each event needs its own SAL/OS state. All entries + * are 16 byte aligned. * - * +-----------------------+ - * |NDIRTY [BSP - BSPSTORE]| - * +-----------------------+ - * | RNAT | - * +-----------------------+ - * | BSPSTORE | - * +-----------------------+ - * | IFS | - * +-----------------------+ - * | PFS | - * +-----------------------+ - * | RSC | - * +-----------------------+ <-------- Bottom of new stack frame + * +---------------------------+ + * | pt_regs | + * +---------------------------+ + * | switch_stack | + * +---------------------------+ + * | SAL/OS state | + * +---------------------------+ + * | 16 byte scratch area | + * +---------------------------+ <-------- SP at start of C MCA handler + * | ..... | + * +---------------------------+ + * | RBS for MCA/INIT handler | + * +---------------------------+ + * | struct task for MCA/INIT | + * +---------------------------+ <-------- Bottom of MCA/INIT stack */ -#define rse_rsc_offset 0 -#define rse_pfs_offset (rse_rsc_offset+0x08) -#define rse_ifs_offset (rse_pfs_offset+0x08) -#define rse_bspstore_offset (rse_ifs_offset+0x08) -#define rse_rnat_offset (rse_bspstore_offset+0x08) -#define rse_ndirty_offset (rse_rnat_offset+0x08) -/* - * rse_switch_context - * - * 1. Save old RSC onto the new stack frame - * 2. Save PFS onto new stack frame - * 3. Cover the old frame and start a new frame. - * 4. Save IFS onto new stack frame - * 5. Save the old BSPSTORE on the new stack frame - * 6. Save the old RNAT on the new stack frame - * 7. Write BSPSTORE with the new backing store pointer - * 8. Read and save the new BSP to calculate the #dirty registers - * NOTE: Look at pages 11-10, 11-11 in PRM Vol 2 - */ -#define rse_switch_context(temp,p_stackframe,p_bspstore) \ - ;; \ - mov temp=ar.rsc;; \ - st8 [p_stackframe]=temp,8;; \ - mov temp=ar.pfs;; \ - st8 [p_stackframe]=temp,8; \ - cover ;; \ - mov temp=cr.ifs;; \ - st8 [p_stackframe]=temp,8;; \ - mov temp=ar.bspstore;; \ - st8 [p_stackframe]=temp,8;; \ - mov temp=ar.rnat;; \ - st8 [p_stackframe]=temp,8; \ - mov ar.bspstore=p_bspstore;; \ - mov temp=ar.bsp;; \ - sub temp=temp,p_bspstore;; \ - st8 [p_stackframe]=temp,8;; - -/* - * rse_return_context - * 1. Allocate a zero-sized frame - * 2. Store the number of dirty registers RSC.loadrs field - * 3. Issue a loadrs to insure that any registers from the interrupted - * context which were saved on the new stack frame have been loaded - * back into the stacked registers - * 4. Restore BSPSTORE - * 5. Restore RNAT - * 6. Restore PFS - * 7. Restore IFS - * 8. Restore RSC - * 9. Issue an RFI - */ -#define rse_return_context(psr_mask_reg,temp,p_stackframe) \ - ;; \ - alloc temp=ar.pfs,0,0,0,0; \ - add p_stackframe=rse_ndirty_offset,p_stackframe;; \ - ld8 temp=[p_stackframe];; \ - shl temp=temp,16;; \ - mov ar.rsc=temp;; \ - loadrs;; \ - add p_stackframe=-rse_ndirty_offset+rse_bspstore_offset,p_stackframe;;\ - ld8 temp=[p_stackframe];; \ - mov ar.bspstore=temp;; \ - add p_stackframe=-rse_bspstore_offset+rse_rnat_offset,p_stackframe;;\ - ld8 temp=[p_stackframe];; \ - mov ar.rnat=temp;; \ - add p_stackframe=-rse_rnat_offset+rse_pfs_offset,p_stackframe;; \ - ld8 temp=[p_stackframe];; \ - mov ar.pfs=temp;; \ - add p_stackframe=-rse_pfs_offset+rse_ifs_offset,p_stackframe;; \ - ld8 temp=[p_stackframe];; \ - mov cr.ifs=temp;; \ - add p_stackframe=-rse_ifs_offset+rse_rsc_offset,p_stackframe;; \ - ld8 temp=[p_stackframe];; \ - mov ar.rsc=temp ; \ - mov temp=psr;; \ - or temp=temp,psr_mask_reg;; \ - mov cr.ipsr=temp;; \ - mov temp=ip;; \ - add temp=0x30,temp;; \ - mov cr.iip=temp;; \ - srlz.i;; \ - rfi;; +#define ALIGN16(x) ((x)&~15) +#define MCA_PT_REGS_OFFSET ALIGN16(KERNEL_STACK_SIZE-IA64_PT_REGS_SIZE) +#define MCA_SWITCH_STACK_OFFSET ALIGN16(MCA_PT_REGS_OFFSET-IA64_SWITCH_STACK_SIZE) +#define MCA_SOS_OFFSET ALIGN16(MCA_SWITCH_STACK_OFFSET-IA64_SAL_OS_STATE_SIZE) +#define MCA_SP_OFFSET ALIGN16(MCA_SOS_OFFSET-16) #endif /* _ASM_IA64_MCA_ASM_H */ diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h index dba9f220be7..ef616fd4cb1 100644 --- a/include/asm-ia64/pci.h +++ b/include/asm-ia64/pci.h @@ -156,6 +156,19 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev, extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + #define pcibios_scan_all_fns(a, b) 0 #endif /* _ASM_IA64_PCI_H */ diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index 0bef1953840..fc544929ac3 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h @@ -57,7 +57,7 @@ #include <linux/config.h> #include <asm/fpu.h> -#include <asm/offsets.h> +#include <asm/asm-offsets.h> /* * Base-2 logarithm of number of pages to allocate per task structure @@ -119,7 +119,7 @@ struct pt_regs { unsigned long ar_unat; /* interrupted task's NaT register (preserved) */ unsigned long ar_pfs; /* prev function state */ unsigned long ar_rsc; /* RSE configuration */ - /* The following two are valid only if cr_ipsr.cpl > 0: */ + /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */ unsigned long ar_rnat; /* RSE NaT */ unsigned long ar_bspstore; /* RSE bspstore */ diff --git a/include/asm-ia64/sn/sn_feature_sets.h b/include/asm-ia64/sn/sn_feature_sets.h new file mode 100644 index 00000000000..e68a80853d5 --- /dev/null +++ b/include/asm-ia64/sn/sn_feature_sets.h @@ -0,0 +1,57 @@ +#ifndef _ASM_IA64_SN_FEATURE_SETS_H +#define _ASM_IA64_SN_FEATURE_SETS_H + +/* + * SN PROM Features + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2005 Silicon Graphics, Inc. All rights reserved. + */ + + +#include <asm/types.h> +#include <asm/bitops.h> + +/* --------------------- PROM Features -----------------------------*/ +extern int sn_prom_feature_available(int id); + +#define MAX_PROM_FEATURE_SETS 2 + +/* + * The following defines features that may or may not be supported by the + * current PROM. The OS uses sn_prom_feature_available(feature) to test for + * the presence of a PROM feature. Down rev (old) PROMs will always test + * "false" for new features. + * + * Use: + * if (sn_prom_feature_available(PRF_FEATURE_XXX)) + * ... + */ + +/* + * Example: feature XXX + */ +#define PRF_FEATURE_XXX 0 + + + +/* --------------------- OS Features -------------------------------*/ + +/* + * The following defines OS features that are optionally present in + * the operating system. + * During boot, PROM is notified of these features via a series of calls: + * + * ia64_sn_set_os_feature(feature1); + * + * Once enabled, a feature cannot be disabled. + * + * By default, features are disabled unless explicitly enabled. + */ +#define OSF_MCA_SLV_TO_OS_INIT_SLV 0 +#define OSF_FEAT_LOG_SBES 1 + +#endif /* _ASM_IA64_SN_FEATURE_SETS_H */ diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index e67825ad193..fea35b33d4e 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h @@ -80,6 +80,9 @@ #define SN_SAL_RESERVED_DO_NOT_USE 0x02000062 #define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000064 +#define SN_SAL_GET_PROM_FEATURE_SET 0x02000065 +#define SN_SAL_SET_OS_FEATURE_SET 0x02000066 + /* * Service-specific constants */ @@ -118,8 +121,8 @@ /* * Error Handling Features */ -#define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 -#define SAL_ERR_FEAT_LOG_SBES 0x2 +#define SAL_ERR_FEAT_MCA_SLV_TO_OS_INIT_SLV 0x1 // obsolete +#define SAL_ERR_FEAT_LOG_SBES 0x2 // obsolete #define SAL_ERR_FEAT_MFR_OVERRIDE 0x4 #define SAL_ERR_FEAT_SBE_THRESHOLD 0xffff0000 @@ -152,12 +155,6 @@ sn_sal_rev(void) } /* - * Specify the minimum PROM revsion required for this kernel. - * Note that they're stored in hex format... - */ -#define SN_SAL_MIN_VERSION 0x0404 - -/* * Returns the master console nasid, if the call fails, return an illegal * value. */ @@ -336,7 +333,7 @@ ia64_sn_plat_cpei_handler(void) } /* - * Set Error Handling Features + * Set Error Handling Features (Obsolete) */ static inline u64 ia64_sn_plat_set_error_handling_features(void) @@ -1052,4 +1049,25 @@ ia64_sn_is_fake_prom(void) return (rv.status == 0); } +static inline int +ia64_sn_get_prom_feature_set(int set, unsigned long *feature_set) +{ + struct ia64_sal_retval rv; + + SAL_CALL_NOLOCK(rv, SN_SAL_GET_PROM_FEATURE_SET, set, 0, 0, 0, 0, 0, 0); + if (rv.status != 0) + return rv.status; + *feature_set = rv.v0; + return 0; +} + +static inline int +ia64_sn_set_os_feature(int feature) +{ + struct ia64_sal_retval rv; + + SAL_CALL_NOLOCK(rv, SN_SAL_SET_OS_FEATURE_SET, feature, 0, 0, 0, 0, 0, 0); + return rv.status; +} + #endif /* _ASM_IA64_SN_SN_SAL_H */ diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h index d2430aa0d49..5b78611411c 100644 --- a/include/asm-ia64/spinlock.h +++ b/include/asm-ia64/spinlock.h @@ -17,28 +17,20 @@ #include <asm/intrinsics.h> #include <asm/system.h> -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } -#define spin_lock_init(x) ((x)->lock = 0) +#define __raw_spin_lock_init(x) ((x)->lock = 0) #ifdef ASM_SUPPORTED /* * Try to get the lock. If we fail to get the lock, make a non-standard call to * ia64_spinlock_contention(). We do not use a normal call because that would force all - * callers of spin_lock() to be non-leaf routines. Instead, ia64_spinlock_contention() is - * carefully coded to touch only those registers that spin_lock() marks "clobbered". + * callers of __raw_spin_lock() to be non-leaf routines. Instead, ia64_spinlock_contention() is + * carefully coded to touch only those registers that __raw_spin_lock() marks "clobbered". */ #define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory" static inline void -_raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) +__raw_spin_lock_flags (raw_spinlock_t *lock, unsigned long flags) { register volatile unsigned int *ptr asm ("r31") = &lock->lock; @@ -94,17 +86,17 @@ _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) #endif } -#define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0) +#define __raw_spin_lock(lock) __raw_spin_lock_flags(lock, 0) /* Unlock by doing an ordered store and releasing the cacheline with nta */ -static inline void _raw_spin_unlock(spinlock_t *x) { +static inline void __raw_spin_unlock(raw_spinlock_t *x) { barrier(); asm volatile ("st4.rel.nta [%0] = r0\n\t" :: "r"(x)); } #else /* !ASM_SUPPORTED */ -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) -# define _raw_spin_lock(x) \ +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +# define __raw_spin_lock(x) \ do { \ __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ __u64 ia64_spinlock_val; \ @@ -117,29 +109,20 @@ do { \ } while (ia64_spinlock_val); \ } \ } while (0) -#define _raw_spin_unlock(x) do { barrier(); ((spinlock_t *) x)->lock = 0; } while (0) +#define __raw_spin_unlock(x) do { barrier(); ((raw_spinlock_t *) x)->lock = 0; } while (0) #endif /* !ASM_SUPPORTED */ -#define spin_is_locked(x) ((x)->lock != 0) -#define _raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0) -#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) - -typedef struct { - volatile unsigned int read_counter : 24; - volatile unsigned int write_lock : 8; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; -#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0) +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) -#define read_can_lock(rw) (*(volatile int *)(rw) >= 0) -#define write_can_lock(rw) (*(volatile int *)(rw) == 0) +#define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0) +#define __raw_write_can_lock(rw) (*(volatile int *)(rw) == 0) -#define _raw_read_lock(rw) \ +#define __raw_read_lock(rw) \ do { \ - rwlock_t *__read_lock_ptr = (rw); \ + raw_rwlock_t *__read_lock_ptr = (rw); \ \ while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ @@ -148,14 +131,14 @@ do { \ } \ } while (0) -#define _raw_read_unlock(rw) \ +#define __raw_read_unlock(rw) \ do { \ - rwlock_t *__read_lock_ptr = (rw); \ + raw_rwlock_t *__read_lock_ptr = (rw); \ ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ } while (0) #ifdef ASM_SUPPORTED -#define _raw_write_lock(rw) \ +#define __raw_write_lock(rw) \ do { \ __asm__ __volatile__ ( \ "mov ar.ccv = r0\n" \ @@ -170,7 +153,7 @@ do { \ :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \ } while(0) -#define _raw_write_trylock(rw) \ +#define __raw_write_trylock(rw) \ ({ \ register long result; \ \ @@ -182,7 +165,7 @@ do { \ (result == 0); \ }) -static inline void _raw_write_unlock(rwlock_t *x) +static inline void __raw_write_unlock(raw_rwlock_t *x) { u8 *y = (u8 *)x; barrier(); @@ -191,7 +174,7 @@ static inline void _raw_write_unlock(rwlock_t *x) #else /* !ASM_SUPPORTED */ -#define _raw_write_lock(l) \ +#define __raw_write_lock(l) \ ({ \ __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \ __u32 *ia64_write_lock_ptr = (__u32 *) (l); \ @@ -202,7 +185,7 @@ static inline void _raw_write_unlock(rwlock_t *x) } while (ia64_val); \ }) -#define _raw_write_trylock(rw) \ +#define __raw_write_trylock(rw) \ ({ \ __u64 ia64_val; \ __u64 ia64_set_val = ia64_dep_mi(-1, 0, 31,1); \ @@ -210,7 +193,7 @@ static inline void _raw_write_unlock(rwlock_t *x) (ia64_val == 0); \ }) -static inline void _raw_write_unlock(rwlock_t *x) +static inline void __raw_write_unlock(raw_rwlock_t *x) { barrier(); x->write_lock = 0; @@ -218,6 +201,6 @@ static inline void _raw_write_unlock(rwlock_t *x) #endif /* !ASM_SUPPORTED */ -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) #endif /* _ASM_IA64_SPINLOCK_H */ diff --git a/include/asm-ia64/spinlock_types.h b/include/asm-ia64/spinlock_types.h new file mode 100644 index 00000000000..474e46f1ab4 --- /dev/null +++ b/include/asm-ia64/spinlock_types.h @@ -0,0 +1,21 @@ +#ifndef _ASM_IA64_SPINLOCK_TYPES_H +#define _ASM_IA64_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int read_counter : 31; + volatile unsigned int write_lock : 1; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0, 0 } + +#endif diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 33256db4a7c..635235fa1e3 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h @@ -275,6 +275,7 @@ extern void ia64_load_extra (struct task_struct *task); */ #define __ARCH_WANT_UNLOCKED_CTXSW +#define ARCH_HAS_PREFETCH_SWITCH_STACK #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) void cpu_idle_wait(void); diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 7dc8951708a..cf4a950a0f4 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h @@ -5,7 +5,7 @@ #ifndef _ASM_IA64_THREAD_INFO_H #define _ASM_IA64_THREAD_INFO_H -#include <asm/offsets.h> +#include <asm/asm-offsets.h> #include <asm/processor.h> #include <asm/ptrace.h> @@ -76,6 +76,7 @@ struct thread_info { #define TIF_SIGDELAYED 5 /* signal delayed from MCA/INIT/NMI/PMI context */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_MEMDIE 17 +#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) @@ -85,6 +86,7 @@ struct thread_info { #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED) #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) +#define _TIF_MCA_INIT (1 << TIF_MCA_INIT) /* "work to do on user-return" bits */ #define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED) diff --git a/include/asm-ia64/unwind.h b/include/asm-ia64/unwind.h index 61426ad3ecd..5df0276b049 100644 --- a/include/asm-ia64/unwind.h +++ b/include/asm-ia64/unwind.h @@ -114,13 +114,6 @@ extern void unw_remove_unwind_table (void *handle); */ extern void unw_init_from_blocked_task (struct unw_frame_info *info, struct task_struct *t); -/* - * Prepare to unwind from interruption. The pt-regs and switch-stack structures must have - * be "adjacent" (no state modifications between pt-regs and switch-stack). - */ -extern void unw_init_from_interruption (struct unw_frame_info *info, struct task_struct *t, - struct pt_regs *pt, struct switch_stack *sw); - extern void unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t, struct switch_stack *sw); diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h index 6608d8371c5..7de7def28da 100644 --- a/include/asm-m32r/spinlock.h +++ b/include/asm-m32r/spinlock.h @@ -14,57 +14,30 @@ #include <asm/atomic.h> #include <asm/page.h> -extern int printk(const char * fmt, ...) - __attribute__ ((format (printf, 1, 2))); - -#define RW_LOCK_BIAS 0x01000000 -#define RW_LOCK_BIAS_STR "0x01000000" - /* * Your basic SMP spinlocks, allowing only a single CPU anywhere - */ - -typedef struct { - volatile int slock; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned magic; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define SPINLOCK_MAGIC 0xdead4ead - -#ifdef CONFIG_DEBUG_SPINLOCK -#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC -#else -#define SPINLOCK_MAGIC_INIT /* */ -#endif - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) - -/* + * + * (the type definitions are in asm/spinlock_types.h) + * * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. * * We make no fairness assumptions. They have a cost. */ -#define spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0) -#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_spin_unlock_wait(x) \ + do { cpu_relax(); } while (__raw_spin_is_locked(x)) /** - * _raw_spin_trylock - Try spin lock and return a result + * __raw_spin_trylock - Try spin lock and return a result * @lock: Pointer to the lock variable * - * _raw_spin_trylock() tries to get the lock and returns a result. + * __raw_spin_trylock() tries to get the lock and returns a result. * On the m32r, the result value is 1 (= Success) or 0 (= Failure). */ -static inline int _raw_spin_trylock(spinlock_t *lock) +static inline int __raw_spin_trylock(raw_spinlock_t *lock) { int oldval; unsigned long tmp1, tmp2; @@ -78,7 +51,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock) * } */ __asm__ __volatile__ ( - "# spin_trylock \n\t" + "# __raw_spin_trylock \n\t" "ldi %1, #0; \n\t" "mvfc %2, psw; \n\t" "clrpsw #0x40 -> nop; \n\t" @@ -97,16 +70,10 @@ static inline int _raw_spin_trylock(spinlock_t *lock) return (oldval > 0); } -static inline void _raw_spin_lock(spinlock_t *lock) +static inline void __raw_spin_lock(raw_spinlock_t *lock) { unsigned long tmp0, tmp1; -#ifdef CONFIG_DEBUG_SPINLOCK - if (unlikely(lock->magic != SPINLOCK_MAGIC)) { - printk("pc: %p\n", __builtin_return_address(0)); - BUG(); - } -#endif /* * lock->slock : =1 : unlock * : <=0 : lock @@ -118,7 +85,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) * } */ __asm__ __volatile__ ( - "# spin_lock \n\t" + "# __raw_spin_lock \n\t" ".fillinsn \n" "1: \n\t" "mvfc %1, psw; \n\t" @@ -145,12 +112,8 @@ static inline void _raw_spin_lock(spinlock_t *lock) ); } -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(lock->magic != SPINLOCK_MAGIC); - BUG_ON(!spin_is_locked(lock)); -#endif mb(); lock->slock = 1; } @@ -164,59 +127,32 @@ static inline void _raw_spin_unlock(spinlock_t *lock) * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * On x86, we implement read-write locks as a 32-bit counter + * with the high bit (sign) being the "contended" bit. + * + * The inline assembly is non-obvious. Think about it. + * + * Changed to use the same technique as rw semaphores. See + * semaphore.h for details. -ben */ -typedef struct { - volatile int lock; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned magic; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RWLOCK_MAGIC 0xdeaf1eed - -#ifdef CONFIG_DEBUG_SPINLOCK -#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC -#else -#define RWLOCK_MAGIC_INIT /* */ -#endif - -#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) /** * read_can_lock - would read_trylock() succeed? * @lock: the rwlock in question. */ -#define read_can_lock(x) ((int)(x)->lock > 0) +#define __raw_read_can_lock(x) ((int)(x)->lock > 0) /** * write_can_lock - would write_trylock() succeed? * @lock: the rwlock in question. */ -#define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) - -/* - * On x86, we implement read-write locks as a 32-bit counter - * with the high bit (sign) being the "contended" bit. - * - * The inline assembly is non-obvious. Think about it. - * - * Changed to use the same technique as rw semaphores. See - * semaphore.h for details. -ben - */ -/* the spinlock helpers are in arch/i386/kernel/semaphore.c */ +#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) -static inline void _raw_read_lock(rwlock_t *rw) +static inline void __raw_read_lock(raw_rwlock_t *rw) { unsigned long tmp0, tmp1; -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(rw->magic != RWLOCK_MAGIC); -#endif /* * rw->lock : >0 : unlock * : <=0 : lock @@ -264,13 +200,10 @@ static inline void _raw_read_lock(rwlock_t *rw) ); } -static inline void _raw_write_lock(rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { unsigned long tmp0, tmp1, tmp2; -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(rw->magic != RWLOCK_MAGIC); -#endif /* * rw->lock : =RW_LOCK_BIAS_STR : unlock * : !=RW_LOCK_BIAS_STR : lock @@ -320,7 +253,7 @@ static inline void _raw_write_lock(rwlock_t *rw) ); } -static inline void _raw_read_unlock(rwlock_t *rw) +static inline void __raw_read_unlock(raw_rwlock_t *rw) { unsigned long tmp0, tmp1; @@ -342,7 +275,7 @@ static inline void _raw_read_unlock(rwlock_t *rw) ); } -static inline void _raw_write_unlock(rwlock_t *rw) +static inline void __raw_write_unlock(raw_rwlock_t *rw) { unsigned long tmp0, tmp1, tmp2; @@ -366,9 +299,9 @@ static inline void _raw_write_unlock(rwlock_t *rw) ); } -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) -static inline int _raw_write_trylock(rwlock_t *lock) +static inline int __raw_write_trylock(raw_rwlock_t *lock) { atomic_t *count = (atomic_t *)lock; if (atomic_sub_and_test(RW_LOCK_BIAS, count)) diff --git a/include/asm-m32r/spinlock_types.h b/include/asm-m32r/spinlock_types.h new file mode 100644 index 00000000000..7e9941c45f4 --- /dev/null +++ b/include/asm-m32r/spinlock_types.h @@ -0,0 +1,23 @@ +#ifndef _ASM_M32R_SPINLOCK_TYPES_H +#define _ASM_M32R_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile int slock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 1 } + +typedef struct { + volatile int lock; +} raw_rwlock_t; + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } + +#endif diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index f95e32b4042..c42f88a9b9f 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h @@ -259,7 +259,7 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr) #define find_first_bit(addr, size) \ find_next_bit((addr), (size), 0) -static __inline__ int find_next_zero_bit (void * addr, int size, int offset) +static __inline__ int find_next_zero_bit (const void * addr, int size, int offset) { unsigned long *p = ((unsigned long *) addr) + (offset >> 5); unsigned long result = offset & ~31UL; diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h index aa7a2ffa41a..026bbc9565b 100644 --- a/include/asm-m68knommu/cacheflush.h +++ b/include/asm-m68knommu/cacheflush.h @@ -2,23 +2,23 @@ #define _M68KNOMMU_CACHEFLUSH_H /* - * (C) Copyright 2000-2002, Greg Ungerer <gerg@snapgear.com> + * (C) Copyright 2000-2004, Greg Ungerer <gerg@snapgear.com> */ #include <linux/mm.h> #define flush_cache_all() __flush_cache_all() #define flush_cache_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) -#define flush_dcache_range(start,len) do { } while (0) +#define flush_cache_range(vma, start, end) __flush_cache_all() +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_range(start,len) __flush_cache_all() #define flush_dcache_page(page) do { } while (0) #define flush_dcache_mmap_lock(mapping) do { } while (0) #define flush_dcache_mmap_unlock(mapping) do { } while (0) #define flush_icache_range(start,len) __flush_cache_all() #define flush_icache_page(vma,pg) do { } while (0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) -#define flush_cache_vmap(start, end) flush_cache_all() -#define flush_cache_vunmap(start, end) flush_cache_all() +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ memcpy(dst, src, len) @@ -50,22 +50,23 @@ extern inline void __flush_cache_all(void) "movec %%d0,%%CACR\n\t" : : : "d0", "a0" ); #endif /* CONFIG_M5407 */ -#ifdef CONFIG_M5272 +#if defined(CONFIG_M527x) || defined(CONFIG_M528x) __asm__ __volatile__ ( - "movel #0x01000000, %%d0\n\t" - "movec %%d0, %%CACR\n\t" - "nop\n\t" - "movel #0x80000100, %%d0\n\t" + "movel #0x81400100, %%d0\n\t" "movec %%d0, %%CACR\n\t" "nop\n\t" : : : "d0" ); -#endif /* CONFIG_M5272 */ -#if 0 /* CONFIG_M5249 */ +#endif /* CONFIG_M527x || CONFIG_M528x */ +#ifdef CONFIG_M5272 __asm__ __volatile__ ( "movel #0x01000000, %%d0\n\t" "movec %%d0, %%CACR\n\t" "nop\n\t" - "movel #0xa0000200, %%d0\n\t" + : : : "d0" ); +#endif /* CONFIG_M5272 */ +#if CONFIG_M5249 + __asm__ __volatile__ ( + "movel #0xa1000200, %%d0\n\t" "movec %%d0, %%CACR\n\t" "nop\n\t" : : : "d0" ); diff --git a/include/asm-m68knommu/checksum.h b/include/asm-m68knommu/checksum.h index 92cf102c253..294ec7583ac 100644 --- a/include/asm-m68knommu/checksum.h +++ b/include/asm-m68knommu/checksum.h @@ -25,7 +25,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) * better 64-bit) boundary */ -unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); +unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, + int len, int sum); /* @@ -35,8 +36,8 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); * better 64-bit) boundary */ -extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, - int len, int sum, int *csum_err); +extern unsigned int csum_partial_copy_from_user(const unsigned char *src, + unsigned char *dst, int len, int sum, int *csum_err); #define csum_partial_copy_nocheck(src, dst, len, sum) \ csum_partial_copy((src), (dst), (len), (sum)) diff --git a/include/asm-m68knommu/coldfire.h b/include/asm-m68knommu/coldfire.h index 16f32cc80c4..1df3f666a28 100644 --- a/include/asm-m68knommu/coldfire.h +++ b/include/asm-m68knommu/coldfire.h @@ -22,7 +22,7 @@ #define MCF_MBAR2 0x80000000 #define MCF_IPSBAR 0x40000000 -#if defined(CONFIG_M527x) || defined(CONFIG_M528x) +#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) #undef MCF_MBAR #define MCF_MBAR MCF_IPSBAR #endif @@ -54,6 +54,8 @@ #define MCF_CLK 54000000 #elif defined(CONFIG_CLOCK_60MHz) #define MCF_CLK 60000000 +#elif defined(CONFIG_CLOCK_62_5MHz) +#define MCF_CLK 62500000 #elif defined(CONFIG_CLOCK_64MHz) #define MCF_CLK 64000000 #elif defined(CONFIG_CLOCK_66MHz) @@ -76,7 +78,7 @@ * One some ColdFire family members the bus clock (used by internal * peripherals) is not the same as the CPU clock. */ -#if defined(CONFIG_M5249) || defined(CONFIG_M527x) +#if defined(CONFIG_M523x) || defined(CONFIG_M5249) || defined(CONFIG_M527x) #define MCF_BUSCLK (MCF_CLK / 2) #else #define MCF_BUSCLK MCF_CLK diff --git a/include/asm-m68knommu/m523xsim.h b/include/asm-m68knommu/m523xsim.h new file mode 100644 index 00000000000..926cfb805df --- /dev/null +++ b/include/asm-m68knommu/m523xsim.h @@ -0,0 +1,46 @@ +/****************************************************************************/ + +/* + * m523xsim.h -- ColdFire 523x System Integration Module support. + * + * (C) Copyright 2003-2005, Greg Ungerer <gerg@snapgear.com> + */ + +/****************************************************************************/ +#ifndef m523xsim_h +#define m523xsim_h +/****************************************************************************/ + +#include <linux/config.h> + +/* + * Define the 523x SIM register set addresses. + */ +#define MCFICM_INTC0 0x0c00 /* Base for Interrupt Ctrl 0 */ +#define MCFICM_INTC1 0x0d00 /* Base for Interrupt Ctrl 0 */ +#define MCFINTC_IPRH 0x00 /* Interrupt pending 32-63 */ +#define MCFINTC_IPRL 0x04 /* Interrupt pending 1-31 */ +#define MCFINTC_IMRH 0x08 /* Interrupt mask 32-63 */ +#define MCFINTC_IMRL 0x0c /* Interrupt mask 1-31 */ +#define MCFINTC_INTFRCH 0x10 /* Interrupt force 32-63 */ +#define MCFINTC_INTFRCL 0x14 /* Interrupt force 1-31 */ +#define MCFINTC_IRLR 0x18 /* */ +#define MCFINTC_IACKL 0x19 /* */ +#define MCFINTC_ICR0 0x40 /* Base ICR register */ + +#define MCFINT_VECBASE 64 /* Vector base number */ +#define MCFINT_UART0 13 /* Interrupt number for UART0 */ +#define MCFINT_PIT1 36 /* Interrupt number for PIT1 */ +#define MCFINT_QSPI 18 /* Interrupt number for QSPI */ + +/* + * SDRAM configuration registers. + */ +#define MCFSIM_DCR 0x44 /* SDRAM control */ +#define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */ +#define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */ +#define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ +#define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ + +/****************************************************************************/ +#endif /* m523xsim_h */ diff --git a/include/asm-m68knommu/m527xsim.h b/include/asm-m68knommu/m527xsim.h index d280d013da0..e7878d0f7d7 100644 --- a/include/asm-m68knommu/m527xsim.h +++ b/include/asm-m68knommu/m527xsim.h @@ -37,13 +37,14 @@ /* * SDRAM configuration registers. */ -#ifdef CONFIG_M5271EVB +#ifdef CONFIG_M5271 #define MCFSIM_DCR 0x40 /* SDRAM control */ #define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */ #define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */ #define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ #define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ -#else +#endif +#ifdef CONFIG_M5275 #define MCFSIM_DMR 0x40 /* SDRAM mode */ #define MCFSIM_DCR 0x44 /* SDRAM control */ #define MCFSIM_DCFG1 0x48 /* SDRAM configuration 1 */ @@ -54,5 +55,21 @@ #define MCFSIM_DMR1 0x5c /* SDRAM address mask 1 */ #endif +/* + * GPIO pins setups to enable the UARTs. + */ +#ifdef CONFIG_M5271 +#define MCF_GPIO_PAR_UART 0x100048 /* PAR UART address */ +#define UART0_ENABLE_MASK 0x000f +#define UART1_ENABLE_MASK 0x0ff0 +#define UART2_ENABLE_MASK 0x3000 +#endif +#ifdef CONFIG_M5275 +#define MCF_GPIO_PAR_UART 0x10007c /* PAR UART address */ +#define UART0_ENABLE_MASK 0x000f +#define UART1_ENABLE_MASK 0x00f0 +#define UART2_ENABLE_MASK 0x3f00 +#endif + /****************************************************************************/ #endif /* m527xsim_h */ diff --git a/include/asm-m68knommu/m528xsim.h b/include/asm-m68knommu/m528xsim.h index 371993a206a..610774a17f7 100644 --- a/include/asm-m68knommu/m528xsim.h +++ b/include/asm-m68knommu/m528xsim.h @@ -41,5 +41,117 @@ #define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ #define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ +/* + * Derek Cheung - 6 Feb 2005 + * add I2C and QSPI register definition using Freescale's MCF5282 + */ +/* set Port AS pin for I2C or UART */ +#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056) + +/* Interrupt Mask Register Register Low */ +#define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C) +/* Interrupt Control Register 7 */ +#define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51) + + + +/********************************************************************* +* +* Inter-IC (I2C) Module +* +*********************************************************************/ +/* Read/Write access macros for general use */ +#define MCF5282_I2C_I2ADR (volatile u8 *) (MCF_IPSBAR + 0x0300) // Address +#define MCF5282_I2C_I2FDR (volatile u8 *) (MCF_IPSBAR + 0x0304) // Freq Divider +#define MCF5282_I2C_I2CR (volatile u8 *) (MCF_IPSBAR + 0x0308) // Control +#define MCF5282_I2C_I2SR (volatile u8 *) (MCF_IPSBAR + 0x030C) // Status +#define MCF5282_I2C_I2DR (volatile u8 *) (MCF_IPSBAR + 0x0310) // Data I/O + +/* Bit level definitions and macros */ +#define MCF5282_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01) + +#define MCF5282_I2C_I2FDR_IC(x) (((x)&0x3F)) + +#define MCF5282_I2C_I2CR_IEN (0x80) // I2C enable +#define MCF5282_I2C_I2CR_IIEN (0x40) // interrupt enable +#define MCF5282_I2C_I2CR_MSTA (0x20) // master/slave mode +#define MCF5282_I2C_I2CR_MTX (0x10) // transmit/receive mode +#define MCF5282_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable +#define MCF5282_I2C_I2CR_RSTA (0x04) // repeat start + +#define MCF5282_I2C_I2SR_ICF (0x80) // data transfer bit +#define MCF5282_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave +#define MCF5282_I2C_I2SR_IBB (0x20) // I2C bus busy +#define MCF5282_I2C_I2SR_IAL (0x10) // aribitration lost +#define MCF5282_I2C_I2SR_SRW (0x04) // slave read/write +#define MCF5282_I2C_I2SR_IIF (0x02) // I2C interrupt +#define MCF5282_I2C_I2SR_RXAK (0x01) // received acknowledge + + + +/********************************************************************* +* +* Queued Serial Peripheral Interface (QSPI) Module +* +*********************************************************************/ +/* Derek - 21 Feb 2005 */ +/* change to the format used in I2C */ +/* Read/Write access macros for general use */ +#define MCF5282_QSPI_QMR MCF_IPSBAR + 0x0340 +#define MCF5282_QSPI_QDLYR MCF_IPSBAR + 0x0344 +#define MCF5282_QSPI_QWR MCF_IPSBAR + 0x0348 +#define MCF5282_QSPI_QIR MCF_IPSBAR + 0x034C +#define MCF5282_QSPI_QAR MCF_IPSBAR + 0x0350 +#define MCF5282_QSPI_QDR MCF_IPSBAR + 0x0354 +#define MCF5282_QSPI_QCR MCF_IPSBAR + 0x0354 + +/* Bit level definitions and macros */ +#define MCF5282_QSPI_QMR_MSTR (0x8000) +#define MCF5282_QSPI_QMR_DOHIE (0x4000) +#define MCF5282_QSPI_QMR_BITS_16 (0x0000) +#define MCF5282_QSPI_QMR_BITS_8 (0x2000) +#define MCF5282_QSPI_QMR_BITS_9 (0x2400) +#define MCF5282_QSPI_QMR_BITS_10 (0x2800) +#define MCF5282_QSPI_QMR_BITS_11 (0x2C00) +#define MCF5282_QSPI_QMR_BITS_12 (0x3000) +#define MCF5282_QSPI_QMR_BITS_13 (0x3400) +#define MCF5282_QSPI_QMR_BITS_14 (0x3800) +#define MCF5282_QSPI_QMR_BITS_15 (0x3C00) +#define MCF5282_QSPI_QMR_CPOL (0x0200) +#define MCF5282_QSPI_QMR_CPHA (0x0100) +#define MCF5282_QSPI_QMR_BAUD(x) (((x)&0x00FF)) + +#define MCF5282_QSPI_QDLYR_SPE (0x80) +#define MCF5282_QSPI_QDLYR_QCD(x) (((x)&0x007F)<<8) +#define MCF5282_QSPI_QDLYR_DTL(x) (((x)&0x00FF)) + +#define MCF5282_QSPI_QWR_HALT (0x8000) +#define MCF5282_QSPI_QWR_WREN (0x4000) +#define MCF5282_QSPI_QWR_WRTO (0x2000) +#define MCF5282_QSPI_QWR_CSIV (0x1000) +#define MCF5282_QSPI_QWR_ENDQP(x) (((x)&0x000F)<<8) +#define MCF5282_QSPI_QWR_CPTQP(x) (((x)&0x000F)<<4) +#define MCF5282_QSPI_QWR_NEWQP(x) (((x)&0x000F)) + +#define MCF5282_QSPI_QIR_WCEFB (0x8000) +#define MCF5282_QSPI_QIR_ABRTB (0x4000) +#define MCF5282_QSPI_QIR_ABRTL (0x1000) +#define MCF5282_QSPI_QIR_WCEFE (0x0800) +#define MCF5282_QSPI_QIR_ABRTE (0x0400) +#define MCF5282_QSPI_QIR_SPIFE (0x0100) +#define MCF5282_QSPI_QIR_WCEF (0x0008) +#define MCF5282_QSPI_QIR_ABRT (0x0004) +#define MCF5282_QSPI_QIR_SPIF (0x0001) + +#define MCF5282_QSPI_QAR_ADDR(x) (((x)&0x003F)) + +#define MCF5282_QSPI_QDR_COMMAND(x) (((x)&0xFF00)) +#define MCF5282_QSPI_QCR_DATA(x) (((x)&0x00FF)<<8) +#define MCF5282_QSPI_QCR_CONT (0x8000) +#define MCF5282_QSPI_QCR_BITSE (0x4000) +#define MCF5282_QSPI_QCR_DT (0x2000) +#define MCF5282_QSPI_QCR_DSCK (0x1000) +#define MCF5282_QSPI_QCR_CS (((x)&0x000F)<<8) + /****************************************************************************/ #endif /* m528xsim_h */ diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h index bdd8c53ef34..b17cd920977 100644 --- a/include/asm-m68knommu/mcfcache.h +++ b/include/asm-m68knommu/mcfcache.h @@ -33,7 +33,7 @@ .endm #endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */ -#if defined(CONFIG_M527x) +#if defined(CONFIG_M523x) || defined(CONFIG_M527x) /* * New version 2 cores have a configurable split cache arrangement. * For now I am just enabling instruction cache - but ultimately I @@ -51,23 +51,20 @@ movec %d0,%CACR /* enable cache */ nop .endm -#endif /* CONFIG_M527x */ +#endif /* CONFIG_M523x || CONFIG_M527x */ #if defined(CONFIG_M528x) -/* - * Cache is totally broken on early 5282 silicon. So far now we - * disable its cache all together. - */ .macro CACHE_ENABLE - movel #0x01000000,%d0 - movec %d0,%CACR /* invalidate cache */ nop - movel #0x0000c000,%d0 /* set SDRAM cached only */ - movec %d0,%ACR0 - movel #0x00000000,%d0 /* no other regions cached */ - movec %d0,%ACR1 - movel #0x00000000,%d0 /* configure cache */ - movec %d0,%CACR /* enable cache */ + movel #0x01000000, %d0 + movec %d0, %CACR /* Invalidate cache */ + nop + movel #0x0000c020, %d0 /* Set SDRAM cached only */ + movec %d0, %ACR0 + movel #0xff00c000, %d0 /* Cache Flash also */ + movec %d0, %ACR1 + movel #0x80000200, %d0 /* Setup cache mask */ + movec %d0, %CACR /* Enable cache */ nop .endm #endif /* CONFIG_M528x */ diff --git a/include/asm-m68knommu/mcfdma.h b/include/asm-m68knommu/mcfdma.h index 350c6090b5c..b93f8ba8a24 100644 --- a/include/asm-m68knommu/mcfdma.h +++ b/include/asm-m68knommu/mcfdma.h @@ -21,7 +21,7 @@ #define MCFDMA_BASE1 0x240 /* Base address of DMA 1 */ #elif defined(CONFIG_M5272) #define MCFDMA_BASE0 0x0e0 /* Base address of DMA 0 */ -#elif defined(CONFIG_M527x) || defined(CONFIG_M528x) +#elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) /* These are relative to the IPSBAR, not MBAR */ #define MCFDMA_BASE0 0x100 /* Base address of DMA 0 */ #define MCFDMA_BASE1 0x140 /* Base address of DMA 1 */ diff --git a/include/asm-m68knommu/mcfsim.h b/include/asm-m68knommu/mcfsim.h index 522e513c2bc..b0c7736f7a9 100644 --- a/include/asm-m68knommu/mcfsim.h +++ b/include/asm-m68knommu/mcfsim.h @@ -15,13 +15,15 @@ #include <linux/config.h> /* - * Include 5204, 5206/e, 5249, 5270/5271, 5272, 5280/5282, 5307 or - * 5407 specific addresses. + * Include 5204, 5206/e, 5235, 5249, 5270/5271, 5272, 5280/5282, + * 5307 or 5407 specific addresses. */ #if defined(CONFIG_M5204) #include <asm/m5204sim.h> #elif defined(CONFIG_M5206) || defined(CONFIG_M5206e) #include <asm/m5206sim.h> +#elif defined(CONFIG_M523x) +#include <asm/m523xsim.h> #elif defined(CONFIG_M5249) #include <asm/m5249sim.h> #elif defined(CONFIG_M527x) diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h index 54d4a85f4fd..9c1210613bc 100644 --- a/include/asm-m68knommu/mcfuart.h +++ b/include/asm-m68knommu/mcfuart.h @@ -29,7 +29,7 @@ #define MCFUART_BASE1 0x140 /* Base address of UART1 */ #define MCFUART_BASE2 0x180 /* Base address of UART2 */ #endif -#elif defined(CONFIG_M527x) || defined(CONFIG_M528x) +#elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) #define MCFUART_BASE1 0x200 /* Base address of UART1 */ #define MCFUART_BASE2 0x240 /* Base address of UART2 */ #define MCFUART_BASE3 0x280 /* Base address of UART3 */ diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h index 230b8d56d17..12309b181d2 100644 --- a/include/asm-m68knommu/scatterlist.h +++ b/include/asm-m68knommu/scatterlist.h @@ -1,6 +1,8 @@ #ifndef _M68KNOMMU_SCATTERLIST_H #define _M68KNOMMU_SCATTERLIST_H +#include <linux/mm.h> + struct scatterlist { struct page *page; unsigned int offset; @@ -8,6 +10,10 @@ struct scatterlist { unsigned int length; }; +#define sg_address(sg) (page_address((sg)->page) + (sg)->offset +#define sg_dma_address(sg) ((sg)->dma_address) +#define sg_dma_len(sg) ((sg)->length) + #define ISA_DMA_THRESHOLD (0xffffffff) #endif /* !(_M68KNOMMU_SCATTERLIST_H) */ diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h index c341b66c147..53cbbad0f13 100644 --- a/include/asm-m68knommu/system.h +++ b/include/asm-m68knommu/system.h @@ -57,9 +57,18 @@ asmlinkage void resume(void); : "cc", "%d0", "memory") #define local_irq_disable() __asm__ __volatile__ ( \ "move %/sr,%%d0\n\t" \ - "ori.l #0x0700,%%d0\n\t" \ + "ori.l #0x0700,%%d0\n\t" \ "move %%d0,%/sr\n" \ - : /* no inputs */ \ + : /* no outputs */ \ + : \ + : "cc", "%d0", "memory") +/* For spinlocks etc */ +#define local_irq_save(x) __asm__ __volatile__ ( \ + "movew %%sr,%0\n\t" \ + "movew #0x0700,%%d0\n\t" \ + "or.l %0,%%d0\n\t" \ + "movew %%d0,%/sr" \ + : "=d" (x) \ : \ : "cc", "%d0", "memory") #else @@ -75,7 +84,9 @@ asmlinkage void resume(void); #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") /* For spinlocks etc */ +#ifndef local_irq_save #define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0) +#endif #define irqs_disabled() \ ({ \ @@ -234,9 +245,9 @@ cmpxchg(volatile int *p, int old, int new) #ifdef CONFIG_COLDFIRE #if defined(CONFIG_M5272) && defined(CONFIG_NETtel) /* - * Need to account for broken early mask of 5272 silicon. So don't - * jump through the original start address. Jump strait into the - * known start of the FLASH code. + * Need to account for broken early mask of 5272 silicon. So don't + * jump through the original start address. Jump strait into the + * known start of the FLASH code. */ #define HARD_RESET_NOW() ({ \ asm(" \ @@ -244,7 +255,9 @@ cmpxchg(volatile int *p, int old, int new) jmp 0xf0000400; \ "); \ }) -#elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA) +#elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ + defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ + defined(CONFIG_CLEOPATRA) #define HARD_RESET_NOW() ({ \ asm(" \ movew #0x2700, %sr; \ @@ -257,6 +270,26 @@ cmpxchg(volatile int *p, int old, int new) jmp (%a0); \ "); \ }) +#elif defined(CONFIG_M5272) +/* + * Retrieve the boot address in flash using CSBR0 and CSOR0 + * find the reset vector at flash_address + 4 (e.g. 0x400) + * remap it in the flash's current location (e.g. 0xf0000400) + * and jump there. + */ +#define HARD_RESET_NOW() ({ \ + asm(" \ + movew #0x2700, %%sr; \ + move.l %0+0x40,%%d0; \ + and.l %0+0x44,%%d0; \ + andi.l #0xfffff000,%%d0; \ + mov.l %%d0,%%a0; \ + or.l 4(%%a0),%%d0; \ + mov.l %%d0,%%a0; \ + jmp (%%a0);" \ + : /* No output */ \ + : "o" (*(char *)MCF_MBAR) ); \ +}) #elif defined(CONFIG_M528x) /* * The MCF528x has a bit (SOFTRST) in memory (Reset Control Register RCR), @@ -270,6 +303,15 @@ cmpxchg(volatile int *p, int old, int new) while(1) \ *reset |= (0x01 << 7);\ }) +#elif defined(CONFIG_M523x) +#define HARD_RESET_NOW() ({ \ + asm(" \ + movew #0x2700, %sr; \ + movel #0x01000000, %sp; \ + moveal #0x40110000, %a0; \ + moveb #0x80, (%a0); \ + "); \ +}) #else #define HARD_RESET_NOW() ({ \ asm(" \ diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h index ac8823df255..11daf5ceb7b 100644 --- a/include/asm-mips/asmmacro-32.h +++ b/include/asm-mips/asmmacro-32.h @@ -7,7 +7,7 @@ #ifndef _ASM_ASMMACRO_32_H #define _ASM_ASMMACRO_32_H -#include <asm/offset.h> +#include <asm/asm-offsets.h> #include <asm/regdef.h> #include <asm/fpregdef.h> #include <asm/mipsregs.h> diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h index bbed35511f5..559c355b9b8 100644 --- a/include/asm-mips/asmmacro-64.h +++ b/include/asm-mips/asmmacro-64.h @@ -8,7 +8,7 @@ #ifndef _ASM_ASMMACRO_64_H #define _ASM_ASMMACRO_64_H -#include <asm/offset.h> +#include <asm/asm-offsets.h> #include <asm/regdef.h> #include <asm/fpregdef.h> #include <asm/mipsregs.h> diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h index b90b11d0b88..3f2470e9e67 100644 --- a/include/asm-mips/irq.h +++ b/include/asm-mips/irq.h @@ -49,7 +49,4 @@ do { \ extern void arch_init_irq(void); -struct irqaction; -int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); - #endif /* _ASM_IRQ_H */ diff --git a/include/asm-mips/sim.h b/include/asm-mips/sim.h index 3ccfe09fa74..9c2af1b00e1 100644 --- a/include/asm-mips/sim.h +++ b/include/asm-mips/sim.h @@ -11,7 +11,7 @@ #include <linux/config.h> -#include <asm/offset.h> +#include <asm/asm-offsets.h> #define __str2(x) #x #define __str(x) __str2(x) diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h index 114d3eb98a6..4d0135b1115 100644 --- a/include/asm-mips/spinlock.h +++ b/include/asm-mips/spinlock.h @@ -16,20 +16,10 @@ * Your basic SMP spinlocks, allowing only a single CPU anywhere */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } - -#define spin_lock_init(x) do { (x)->lock = 0; } while(0) - -#define spin_is_locked(x) ((x)->lock != 0) -#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_spin_unlock_wait(x) \ + do { cpu_relax(); } while ((x)->lock) /* * Simple spin lock operations. There are two variants, one clears IRQ's @@ -38,13 +28,13 @@ typedef struct { * We make no fairness assumptions. They have a cost. */ -static inline void _raw_spin_lock(spinlock_t *lock) +static inline void __raw_spin_lock(raw_spinlock_t *lock) { unsigned int tmp; if (R10000_LLSC_WAR) { __asm__ __volatile__( - " .set noreorder # _raw_spin_lock \n" + " .set noreorder # __raw_spin_lock \n" "1: ll %1, %2 \n" " bnez %1, 1b \n" " li %1, 1 \n" @@ -58,7 +48,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) : "memory"); } else { __asm__ __volatile__( - " .set noreorder # _raw_spin_lock \n" + " .set noreorder # __raw_spin_lock \n" "1: ll %1, %2 \n" " bnez %1, 1b \n" " li %1, 1 \n" @@ -72,10 +62,10 @@ static inline void _raw_spin_lock(spinlock_t *lock) } } -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { __asm__ __volatile__( - " .set noreorder # _raw_spin_unlock \n" + " .set noreorder # __raw_spin_unlock \n" " sync \n" " sw $0, %0 \n" " .set\treorder \n" @@ -84,13 +74,13 @@ static inline void _raw_spin_unlock(spinlock_t *lock) : "memory"); } -static inline unsigned int _raw_spin_trylock(spinlock_t *lock) +static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock) { unsigned int temp, res; if (R10000_LLSC_WAR) { __asm__ __volatile__( - " .set noreorder # _raw_spin_trylock \n" + " .set noreorder # __raw_spin_trylock \n" "1: ll %0, %3 \n" " ori %2, %0, 1 \n" " sc %2, %1 \n" @@ -104,7 +94,7 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock) : "memory"); } else { __asm__ __volatile__( - " .set noreorder # _raw_spin_trylock \n" + " .set noreorder # __raw_spin_trylock \n" "1: ll %0, %3 \n" " ori %2, %0, 1 \n" " sc %2, %1 \n" @@ -129,24 +119,13 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock) * read-locks. */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) - -static inline void _raw_read_lock(rwlock_t *rw) +static inline void __raw_read_lock(raw_rwlock_t *rw) { unsigned int tmp; if (R10000_LLSC_WAR) { __asm__ __volatile__( - " .set noreorder # _raw_read_lock \n" + " .set noreorder # __raw_read_lock \n" "1: ll %1, %2 \n" " bltz %1, 1b \n" " addu %1, 1 \n" @@ -160,7 +139,7 @@ static inline void _raw_read_lock(rwlock_t *rw) : "memory"); } else { __asm__ __volatile__( - " .set noreorder # _raw_read_lock \n" + " .set noreorder # __raw_read_lock \n" "1: ll %1, %2 \n" " bltz %1, 1b \n" " addu %1, 1 \n" @@ -177,13 +156,13 @@ static inline void _raw_read_lock(rwlock_t *rw) /* Note the use of sub, not subu which will make the kernel die with an overflow exception if we ever try to unlock an rwlock that is already unlocked or is being held by a writer. */ -static inline void _raw_read_unlock(rwlock_t *rw) +static inline void __raw_read_unlock(raw_rwlock_t *rw) { unsigned int tmp; if (R10000_LLSC_WAR) { __asm__ __volatile__( - "1: ll %1, %2 # _raw_read_unlock \n" + "1: ll %1, %2 # __raw_read_unlock \n" " sub %1, 1 \n" " sc %1, %0 \n" " beqzl %1, 1b \n" @@ -193,7 +172,7 @@ static inline void _raw_read_unlock(rwlock_t *rw) : "memory"); } else { __asm__ __volatile__( - " .set noreorder # _raw_read_unlock \n" + " .set noreorder # __raw_read_unlock \n" "1: ll %1, %2 \n" " sub %1, 1 \n" " sc %1, %0 \n" @@ -206,13 +185,13 @@ static inline void _raw_read_unlock(rwlock_t *rw) } } -static inline void _raw_write_lock(rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { unsigned int tmp; if (R10000_LLSC_WAR) { __asm__ __volatile__( - " .set noreorder # _raw_write_lock \n" + " .set noreorder # __raw_write_lock \n" "1: ll %1, %2 \n" " bnez %1, 1b \n" " lui %1, 0x8000 \n" @@ -226,7 +205,7 @@ static inline void _raw_write_lock(rwlock_t *rw) : "memory"); } else { __asm__ __volatile__( - " .set noreorder # _raw_write_lock \n" + " .set noreorder # __raw_write_lock \n" "1: ll %1, %2 \n" " bnez %1, 1b \n" " lui %1, 0x8000 \n" @@ -241,26 +220,26 @@ static inline void _raw_write_lock(rwlock_t *rw) } } -static inline void _raw_write_unlock(rwlock_t *rw) +static inline void __raw_write_unlock(raw_rwlock_t *rw) { __asm__ __volatile__( - " sync # _raw_write_unlock \n" + " sync # __raw_write_unlock \n" " sw $0, %0 \n" : "=m" (rw->lock) : "m" (rw->lock) : "memory"); } -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) -static inline int _raw_write_trylock(rwlock_t *rw) +static inline int __raw_write_trylock(raw_rwlock_t *rw) { unsigned int tmp; int ret; if (R10000_LLSC_WAR) { __asm__ __volatile__( - " .set noreorder # _raw_write_trylock \n" + " .set noreorder # __raw_write_trylock \n" " li %2, 0 \n" "1: ll %1, %3 \n" " bnez %1, 2f \n" @@ -277,7 +256,7 @@ static inline int _raw_write_trylock(rwlock_t *rw) : "memory"); } else { __asm__ __volatile__( - " .set noreorder # _raw_write_trylock \n" + " .set noreorder # __raw_write_trylock \n" " li %2, 0 \n" "1: ll %1, %3 \n" " bnez %1, 2f \n" diff --git a/include/asm-mips/spinlock_types.h b/include/asm-mips/spinlock_types.h new file mode 100644 index 00000000000..ce26c5048b1 --- /dev/null +++ b/include/asm-mips/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef _ASM_SPINLOCK_TYPES_H +#define _ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h index fb42f99f852..7b5e64600bc 100644 --- a/include/asm-mips/stackframe.h +++ b/include/asm-mips/stackframe.h @@ -15,7 +15,7 @@ #include <asm/asm.h> #include <asm/mipsregs.h> -#include <asm/offset.h> +#include <asm/asm-offsets.h> .macro SAVE_AT .set push diff --git a/include/asm-mips/vr41xx/tb0287.h b/include/asm-mips/vr41xx/tb0287.h new file mode 100644 index 00000000000..dd9832313af --- /dev/null +++ b/include/asm-mips/vr41xx/tb0287.h @@ -0,0 +1,43 @@ +/* + * tb0287.h, Include file for TANBAC TB0287 mini-ITX board. + * + * Copyright (C) 2005 Media Lab Inc. <ito@mlb.co.jp> + * + * This code is largely based on tb0219.h. + * + * 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 __TANBAC_TB0287_H +#define __TANBAC_TB0287_H + +#include <asm/vr41xx/vr41xx.h> + +/* + * General-Purpose I/O Pin Number + */ +#define TB0287_PCI_SLOT_PIN 2 +#define TB0287_SM501_PIN 3 +#define TB0287_SIL680A_PIN 8 +#define TB0287_RTL8110_PIN 13 + +/* + * Interrupt Number + */ +#define TB0287_PCI_SLOT_IRQ GIU_IRQ(TB0287_PCI_SLOT_PIN) +#define TB0287_SM501_IRQ GIU_IRQ(TB0287_SM501_PIN) +#define TB0287_SIL680A_IRQ GIU_IRQ(TB0287_SIL680A_PIN) +#define TB0287_RTL8110_IRQ GIU_IRQ(TB0287_RTL8110_PIN) + +#endif /* __TANBAC_TB0287_H */ diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h index cbc286f49b3..30b023411fe 100644 --- a/include/asm-parisc/assembly.h +++ b/include/asm-parisc/assembly.h @@ -63,7 +63,7 @@ .level 2.0w #endif -#include <asm/offsets.h> +#include <asm/asm-offsets.h> #include <asm/page.h> #include <asm/asmregs.h> diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h index e24f7579adb..048a2c7fd0c 100644 --- a/include/asm-parisc/atomic.h +++ b/include/asm-parisc/atomic.h @@ -24,19 +24,19 @@ # define ATOMIC_HASH_SIZE 4 # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) -extern spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; +extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; -/* Can't use _raw_spin_lock_irq because of #include problems, so +/* Can't use raw_spin_lock_irq because of #include problems, so * this is the substitute */ #define _atomic_spin_lock_irqsave(l,f) do { \ - spinlock_t *s = ATOMIC_HASH(l); \ + raw_spinlock_t *s = ATOMIC_HASH(l); \ local_irq_save(f); \ - _raw_spin_lock(s); \ + __raw_spin_lock(s); \ } while(0) #define _atomic_spin_unlock_irqrestore(l,f) do { \ - spinlock_t *s = ATOMIC_HASH(l); \ - _raw_spin_unlock(s); \ + raw_spinlock_t *s = ATOMIC_HASH(l); \ + __raw_spin_unlock(s); \ local_irq_restore(f); \ } while(0) diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index 928e5ef850b..af7db694b22 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h @@ -2,7 +2,7 @@ #define _PARISC_BITOPS_H #include <linux/compiler.h> -#include <asm/system.h> +#include <asm/spinlock.h> #include <asm/byteorder.h> #include <asm/atomic.h> diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h index 06732719d92..aa592d8c0e3 100644 --- a/include/asm-parisc/cacheflush.h +++ b/include/asm-parisc/cacheflush.h @@ -3,6 +3,7 @@ #include <linux/config.h> #include <linux/mm.h> +#include <asm/cache.h> /* for flush_user_dcache_range_asm() proto */ /* The usual comment is "Caches aren't brain-dead on the <architecture>". * Unfortunately, that doesn't apply to PA-RISC. */ diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h index 98d79a3d54f..d0b761f690b 100644 --- a/include/asm-parisc/pci.h +++ b/include/asm-parisc/pci.h @@ -257,6 +257,19 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + static inline void pcibios_add_platform_entries(struct pci_dev *dev) { } diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h index 0b61f51d846..a9dfadd0565 100644 --- a/include/asm-parisc/processor.h +++ b/include/asm-parisc/processor.h @@ -11,6 +11,7 @@ #ifndef __ASSEMBLY__ #include <linux/config.h> #include <linux/threads.h> +#include <linux/spinlock_types.h> #include <asm/hardware.h> #include <asm/page.h> diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h index 679ea1c651e..43eaa6e742e 100644 --- a/include/asm-parisc/spinlock.h +++ b/include/asm-parisc/spinlock.h @@ -2,30 +2,25 @@ #define __ASM_SPINLOCK_H #include <asm/system.h> +#include <asm/processor.h> +#include <asm/spinlock_types.h> /* Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked * since it only has load-and-zero. Moreover, at least on some PA processors, * the semaphore address has to be 16-byte aligned. */ -#ifndef CONFIG_DEBUG_SPINLOCK - -#define __SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } } -#undef SPIN_LOCK_UNLOCKED -#define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) - -static inline int spin_is_locked(spinlock_t *x) +static inline int __raw_spin_is_locked(raw_spinlock_t *x) { volatile unsigned int *a = __ldcw_align(x); return *a == 0; } -#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_spin_unlock_wait(x) \ + do { cpu_relax(); } while (__raw_spin_is_locked(x)) -static inline void _raw_spin_lock(spinlock_t *x) +static inline void __raw_spin_lock(raw_spinlock_t *x) { volatile unsigned int *a; @@ -36,7 +31,7 @@ static inline void _raw_spin_lock(spinlock_t *x) mb(); } -static inline void _raw_spin_unlock(spinlock_t *x) +static inline void __raw_spin_unlock(raw_spinlock_t *x) { volatile unsigned int *a; mb(); @@ -45,7 +40,7 @@ static inline void _raw_spin_unlock(spinlock_t *x) mb(); } -static inline int _raw_spin_trylock(spinlock_t *x) +static inline int __raw_spin_trylock(raw_spinlock_t *x) { volatile unsigned int *a; int ret; @@ -57,131 +52,38 @@ static inline int _raw_spin_trylock(spinlock_t *x) return ret; } - -#define spin_lock_own(LOCK, LOCATION) ((void)0) - -#else /* !(CONFIG_DEBUG_SPINLOCK) */ - -#define SPINLOCK_MAGIC 0x1D244B3C - -#define __SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 }, SPINLOCK_MAGIC, 10, __FILE__ , NULL, 0, -1, NULL, NULL } -#undef SPIN_LOCK_UNLOCKED -#define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) - -#define CHECK_LOCK(x) \ - do { \ - if (unlikely((x)->magic != SPINLOCK_MAGIC)) { \ - printk(KERN_ERR "%s:%d: spin_is_locked" \ - " on uninitialized spinlock %p.\n", \ - __FILE__, __LINE__, (x)); \ - } \ - } while(0) - -#define spin_is_locked(x) \ - ({ \ - CHECK_LOCK(x); \ - volatile unsigned int *a = __ldcw_align(x); \ - if (unlikely((*a == 0) && (x)->babble)) { \ - (x)->babble--; \ - printk("KERN_WARNING \ - %s:%d: spin_is_locked(%s/%p) already" \ - " locked by %s:%d in %s at %p(%d)\n", \ - __FILE__,__LINE__, (x)->module, (x), \ - (x)->bfile, (x)->bline, (x)->task->comm,\ - (x)->previous, (x)->oncpu); \ - } \ - *a == 0; \ - }) - -#define spin_unlock_wait(x) \ - do { \ - CHECK_LOCK(x); \ - volatile unsigned int *a = __ldcw_align(x); \ - if (unlikely((*a == 0) && (x)->babble)) { \ - (x)->babble--; \ - printk("KERN_WARNING \ - %s:%d: spin_unlock_wait(%s/%p)" \ - " owned by %s:%d in %s at %p(%d)\n", \ - __FILE__,__LINE__, (x)->module, (x), \ - (x)->bfile, (x)->bline, (x)->task->comm,\ - (x)->previous, (x)->oncpu); \ - } \ - barrier(); \ - } while (*((volatile unsigned char *)(__ldcw_align(x))) == 0) - -extern void _dbg_spin_lock(spinlock_t *lock, const char *base_file, int line_no); -extern void _dbg_spin_unlock(spinlock_t *lock, const char *, int); -extern int _dbg_spin_trylock(spinlock_t * lock, const char *, int); - -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) - -#define _raw_spin_unlock(lock) _dbg_spin_unlock(lock, __FILE__, __LINE__) -#define _raw_spin_lock(lock) _dbg_spin_lock(lock, __FILE__, __LINE__) -#define _raw_spin_trylock(lock) _dbg_spin_trylock(lock, __FILE__, __LINE__) - -/* just in case we need it */ -#define spin_lock_own(LOCK, LOCATION) \ -do { \ - volatile unsigned int *a = __ldcw_align(LOCK); \ - if (!((*a == 0) && ((LOCK)->oncpu == smp_processor_id()))) \ - printk("KERN_WARNING \ - %s: called on %d from %p but lock %s on %d\n", \ - LOCATION, smp_processor_id(), \ - __builtin_return_address(0), \ - (*a == 0) ? "taken" : "freed", (LOCK)->on_cpu); \ -} while (0) - -#endif /* !(CONFIG_DEBUG_SPINLOCK) */ /* * Read-write spinlocks, allowing multiple readers * but only one writer. */ -typedef struct { - spinlock_t lock; - volatile int counter; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { __SPIN_LOCK_UNLOCKED, 0 } - -#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while (0) -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) /* read_lock, read_unlock are pretty straightforward. Of course it somehow * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */ -#ifdef CONFIG_DEBUG_RWLOCK -extern void _dbg_read_lock(rwlock_t * rw, const char *bfile, int bline); -#define _raw_read_lock(rw) _dbg_read_lock(rw, __FILE__, __LINE__) -#else -static __inline__ void _raw_read_lock(rwlock_t *rw) +static __inline__ void __raw_read_lock(raw_rwlock_t *rw) { unsigned long flags; local_irq_save(flags); - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); rw->counter++; - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); local_irq_restore(flags); } -#endif /* CONFIG_DEBUG_RWLOCK */ -static __inline__ void _raw_read_unlock(rwlock_t *rw) +static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) { unsigned long flags; local_irq_save(flags); - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); rw->counter--; - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); local_irq_restore(flags); } @@ -194,20 +96,17 @@ static __inline__ void _raw_read_unlock(rwlock_t *rw) * writers) in interrupt handlers someone fucked up and we'd dead-lock * sooner or later anyway. prumpf */ -#ifdef CONFIG_DEBUG_RWLOCK -extern void _dbg_write_lock(rwlock_t * rw, const char *bfile, int bline); -#define _raw_write_lock(rw) _dbg_write_lock(rw, __FILE__, __LINE__) -#else -static __inline__ void _raw_write_lock(rwlock_t *rw) +static __inline__ void __raw_write_lock(raw_rwlock_t *rw) { retry: - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); if(rw->counter != 0) { /* this basically never happens */ - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); - while(rw->counter != 0); + while (rw->counter != 0) + cpu_relax(); goto retry; } @@ -215,26 +114,21 @@ retry: /* got it. now leave without unlocking */ rw->counter = -1; /* remember we are locked */ } -#endif /* CONFIG_DEBUG_RWLOCK */ /* write_unlock is absolutely trivial - we don't have to wait for anything */ -static __inline__ void _raw_write_unlock(rwlock_t *rw) +static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) { rw->counter = 0; - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); } -#ifdef CONFIG_DEBUG_RWLOCK -extern int _dbg_write_trylock(rwlock_t * rw, const char *bfile, int bline); -#define _raw_write_trylock(rw) _dbg_write_trylock(rw, __FILE__, __LINE__) -#else -static __inline__ int _raw_write_trylock(rwlock_t *rw) +static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) { - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); if (rw->counter != 0) { /* this basically never happens */ - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); return 0; } @@ -243,14 +137,13 @@ static __inline__ int _raw_write_trylock(rwlock_t *rw) rw->counter = -1; /* remember we are locked */ return 1; } -#endif /* CONFIG_DEBUG_RWLOCK */ -static __inline__ int is_read_locked(rwlock_t *rw) +static __inline__ int __raw_is_read_locked(raw_rwlock_t *rw) { return rw->counter > 0; } -static __inline__ int is_write_locked(rwlock_t *rw) +static __inline__ int __raw_is_write_locked(raw_rwlock_t *rw) { return rw->counter < 0; } diff --git a/include/asm-parisc/spinlock_types.h b/include/asm-parisc/spinlock_types.h new file mode 100644 index 00000000000..785bba822fb --- /dev/null +++ b/include/asm-parisc/spinlock_types.h @@ -0,0 +1,21 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int lock[4]; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } } + +typedef struct { + raw_spinlock_t lock; + volatile int counter; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { __RAW_SPIN_LOCK_UNLOCKED, 0 } + +#endif diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h index 81c54333903..26ff844a21c 100644 --- a/include/asm-parisc/system.h +++ b/include/asm-parisc/system.h @@ -160,29 +160,7 @@ static inline void set_eiem(unsigned long val) }) #ifdef CONFIG_SMP -/* - * Your basic SMP spinlocks, allowing only a single CPU anywhere - */ - -typedef struct { - volatile unsigned int lock[4]; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned long magic; - volatile unsigned int babble; - const char *module; - char *bfile; - int bline; - int oncpu; - void *previous; - struct task_struct * task; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define __lock_aligned __attribute__((__section__(".data.lock_aligned"))) - +# define __lock_aligned __attribute__((__section__(".data.lock_aligned"))) #endif #define KERNEL_START (0x10100000 - 0x1000) diff --git a/include/asm-powerpc/8253pit.h b/include/asm-powerpc/8253pit.h index 862708a749b..b70d6e53b30 100644 --- a/include/asm-powerpc/8253pit.h +++ b/include/asm-powerpc/8253pit.h @@ -1,10 +1,10 @@ +#ifndef _ASM_POWERPC_8253PIT_H +#define _ASM_POWERPC_8253PIT_H + /* * 8253/8254 Programmable Interval Timer */ -#ifndef _8253PIT_H -#define _8253PIT_H - #define PIT_TICK_RATE 1193182UL -#endif +#endif /* _ASM_POWERPC_8253PIT_H */ diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h index ca9e423307f..885b4631a6c 100644 --- a/include/asm-powerpc/agp.h +++ b/include/asm-powerpc/agp.h @@ -1,10 +1,8 @@ -#ifndef AGP_H -#define AGP_H 1 +#ifndef _ASM_POWERPC_AGP_H +#define _ASM_POWERPC_AGP_H #include <asm/io.h> -/* nothing much needed here */ - #define map_page_into_agp(page) #define unmap_page_from_agp(page) #define flush_agp_mappings() @@ -20,4 +18,4 @@ #define free_gatt_pages(table, order) \ free_pages((unsigned long)(table), (order)) -#endif +#endif /* _ASM_POWERPC_AGP_H */ diff --git a/include/asm-powerpc/bugs.h b/include/asm-powerpc/bugs.h index 310187d0e33..42fdb73e306 100644 --- a/include/asm-powerpc/bugs.h +++ b/include/asm-powerpc/bugs.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_BUGS_H -#define _POWERPC_BUGS_H +#ifndef _ASM_POWERPC_BUGS_H +#define _ASM_POWERPC_BUGS_H /* * This program is free software; you can redistribute it and/or @@ -13,6 +13,6 @@ * architecture-dependent bugs. */ -extern void check_bugs(void); +static inline void check_bugs(void) { } -#endif /* _POWERPC_BUGS_H */ +#endif /* _ASM_POWERPC_BUGS_H */ diff --git a/include/asm-powerpc/errno.h b/include/asm-powerpc/errno.h index 19f20bd41ae..8c145fd17d8 100644 --- a/include/asm-powerpc/errno.h +++ b/include/asm-powerpc/errno.h @@ -1,5 +1,5 @@ -#ifndef _PPC_ERRNO_H -#define _PPC_ERRNO_H +#ifndef _ASM_POWERPC_ERRNO_H +#define _ASM_POWERPC_ERRNO_H #include <asm-generic/errno.h> @@ -8,4 +8,4 @@ #define _LAST_ERRNO 516 -#endif +#endif /* _ASM_POWERPC_ERRNO_H */ diff --git a/include/asm-powerpc/ioctl.h b/include/asm-powerpc/ioctl.h index 93c6acfdd0f..8eb99848c40 100644 --- a/include/asm-powerpc/ioctl.h +++ b/include/asm-powerpc/ioctl.h @@ -1,5 +1,5 @@ -#ifndef _PPC_IOCTL_H -#define _PPC_IOCTL_H +#ifndef _ASM_POWERPC_IOCTL_H +#define _ASM_POWERPC_IOCTL_H /* @@ -66,4 +66,4 @@ extern unsigned int __invalid_size_argument_for_IOC; #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) -#endif +#endif /* _ASM_POWERPC_IOCTL_H */ diff --git a/include/asm-powerpc/ioctls.h b/include/asm-powerpc/ioctls.h index f5b7f2b055e..5b94ff489b8 100644 --- a/include/asm-powerpc/ioctls.h +++ b/include/asm-powerpc/ioctls.h @@ -1,5 +1,5 @@ -#ifndef _ASM_PPC_IOCTLS_H -#define _ASM_PPC_IOCTLS_H +#ifndef _ASM_POWERPC_IOCTLS_H +#define _ASM_POWERPC_IOCTLS_H #include <asm/ioctl.h> @@ -104,4 +104,4 @@ #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ -#endif /* _ASM_PPC_IOCTLS_H */ +#endif /* _ASM_POWERPC_IOCTLS_H */ diff --git a/include/asm-powerpc/linkage.h b/include/asm-powerpc/linkage.h index 291c2d01c44..e1c4ac1cc4b 100644 --- a/include/asm-powerpc/linkage.h +++ b/include/asm-powerpc/linkage.h @@ -1,6 +1,6 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H +#ifndef _ASM_POWERPC_LINKAGE_H +#define _ASM_POWERPC_LINKAGE_H /* Nothing to see here... */ -#endif +#endif /* _ASM_POWERPC_LINKAGE_H */ diff --git a/include/asm-powerpc/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h index a5619a2a139..f2741c8b59a 100644 --- a/include/asm-powerpc/mc146818rtc.h +++ b/include/asm-powerpc/mc146818rtc.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_MC146818RTC_H -#define _POWERPC_MC146818RTC_H +#ifndef _ASM_POWERPC_MC146818RTC_H +#define _ASM_POWERPC_MC146818RTC_H /* * Machine dependent access functions for RTC registers. @@ -33,4 +33,4 @@ outb_p((val),RTC_PORT(1)); \ }) #endif /* __KERNEL__ */ -#endif /* _POWERPC_MC146818RTC_H */ +#endif /* _ASM_POWERPC_MC146818RTC_H */ diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h index f2d55988d74..f5e5342fcac 100644 --- a/include/asm-powerpc/mman.h +++ b/include/asm-powerpc/mman.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_MMAN_H -#define _POWERPC_MMAN_H +#ifndef _ASM_POWERPC_MMAN_H +#define _ASM_POWERPC_MMAN_H /* * This program is free software; you can redistribute it and/or @@ -49,4 +49,4 @@ #define MAP_ANON MAP_ANONYMOUS #define MAP_FILE 0 -#endif /* _POWERPC_MMAN_H */ +#endif /* _ASM_POWERPC_MMAN_H */ diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h index 4438f4fd652..7ecd05e0305 100644 --- a/include/asm-powerpc/module.h +++ b/include/asm-powerpc/module.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_MODULE_H -#define _POWERPC_MODULE_H +#ifndef _ASM_POWERPC_MODULE_H +#define _ASM_POWERPC_MODULE_H /* * This program is free software; you can redistribute it and/or @@ -74,4 +74,4 @@ struct exception_table_entry; void sort_ex_table(struct exception_table_entry *start, struct exception_table_entry *finish); -#endif /* _POWERPC_MODULE_H */ +#endif /* _ASM_POWERPC_MODULE_H */ diff --git a/include/asm-ppc/msgbuf.h b/include/asm-powerpc/msgbuf.h index 1053452a937..dd76743c753 100644 --- a/include/asm-ppc/msgbuf.h +++ b/include/asm-powerpc/msgbuf.h @@ -1,17 +1,25 @@ -#ifndef _PPC_MSGBUF_H -#define _PPC_MSGBUF_H +#ifndef _ASM_POWERPC_MSGBUF_H +#define _ASM_POWERPC_MSGBUF_H /* - * The msqid64_ds structure for the PPC architecture. + * The msqid64_ds structure for the PowerPC architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. */ struct msqid64_ds { struct ipc64_perm msg_perm; +#ifndef __powerpc64__ unsigned int __unused1; +#endif __kernel_time_t msg_stime; /* last msgsnd time */ +#ifndef __powerpc64__ unsigned int __unused2; +#endif __kernel_time_t msg_rtime; /* last msgrcv time */ +#ifndef __powerpc64__ unsigned int __unused3; +#endif __kernel_time_t msg_ctime; /* last change time */ unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_qnum; /* number of messages in queue */ @@ -22,4 +30,4 @@ struct msqid64_ds { unsigned long __unused5; }; -#endif /* _PPC_MSGBUF_H */ +#endif /* _ASM_POWERPC_MSGBUF_H */ diff --git a/include/asm-powerpc/namei.h b/include/asm-powerpc/namei.h index 29c9ec83213..657443474a6 100644 --- a/include/asm-powerpc/namei.h +++ b/include/asm-powerpc/namei.h @@ -1,14 +1,14 @@ +#ifndef _ASM_POWERPC_NAMEI_H +#define _ASM_POWERPC_NAMEI_H + +#ifdef __KERNEL__ + /* - * include/asm-ppc/namei.h * Adapted from include/asm-alpha/namei.h * * Included from fs/namei.c */ -#ifdef __KERNEL__ -#ifndef __PPC_NAMEI_H -#define __PPC_NAMEI_H - /* This dummy routine maybe changed to something useful * for /usr/gnemul/ emulation stuff. * Look at asm-sparc/namei.h for details. @@ -16,5 +16,5 @@ #define __emul_prefix() NULL -#endif /* __PPC_NAMEI_H */ -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ +#endif /* _ASM_POWERPC_NAMEI_H */ diff --git a/include/asm-ppc/param.h b/include/asm-powerpc/param.h index 6198b1657a4..bdc724f7088 100644 --- a/include/asm-ppc/param.h +++ b/include/asm-powerpc/param.h @@ -1,10 +1,10 @@ -#ifndef _ASM_PPC_PARAM_H -#define _ASM_PPC_PARAM_H +#ifndef _ASM_POWERPC_PARAM_H +#define _ASM_POWERPC_PARAM_H #include <linux/config.h> #ifdef __KERNEL__ -#define HZ CONFIG_HZ /* internal timer frequency */ +#define HZ CONFIG_HZ /* internal kernel timer frequency */ #define USER_HZ 100 /* for user interfaces in "ticks" */ #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ #endif /* __KERNEL__ */ @@ -21,4 +21,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ -#endif +#endif /* _ASM_POWERPC_PARAM_H */ diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h index be5024913c6..edd2054da86 100644 --- a/include/asm-powerpc/poll.h +++ b/include/asm-powerpc/poll.h @@ -1,5 +1,5 @@ -#ifndef __PPC_POLL_H -#define __PPC_POLL_H +#ifndef _ASM_POWERPC_POLL_H +#define _ASM_POWERPC_POLL_H #define POLLIN 0x0001 #define POLLPRI 0x0002 @@ -20,4 +20,4 @@ struct pollfd { short revents; }; -#endif +#endif /* _ASM_POWERPC_POLL_H */ diff --git a/include/asm-powerpc/sembuf.h b/include/asm-powerpc/sembuf.h index c98fc18fe80..99a41938ae3 100644 --- a/include/asm-powerpc/sembuf.h +++ b/include/asm-powerpc/sembuf.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_SEMBUF_H -#define _POWERPC_SEMBUF_H +#ifndef _ASM_POWERPC_SEMBUF_H +#define _ASM_POWERPC_SEMBUF_H /* * This program is free software; you can redistribute it and/or @@ -33,4 +33,4 @@ struct semid64_ds { unsigned long __unused4; }; -#endif /* _POWERPC_SEMBUF_H */ +#endif /* _ASM_POWERPC_SEMBUF_H */ diff --git a/include/asm-powerpc/setup.h b/include/asm-powerpc/setup.h new file mode 100644 index 00000000000..3d9740aae01 --- /dev/null +++ b/include/asm-powerpc/setup.h @@ -0,0 +1,9 @@ +#ifndef _ASM_POWERPC_SETUP_H +#define _ASM_POWERPC_SETUP_H + +#ifdef __KERNEL__ + +#define COMMAND_LINE_SIZE 512 + +#endif /* __KERNEL__ */ +#endif /* _ASM_POWERPC_SETUP_H */ diff --git a/include/asm-powerpc/shmbuf.h b/include/asm-powerpc/shmbuf.h index 29632db3b17..8efa39698b6 100644 --- a/include/asm-powerpc/shmbuf.h +++ b/include/asm-powerpc/shmbuf.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_SHMBUF_H -#define _POWERPC_SHMBUF_H +#ifndef _ASM_POWERPC_SHMBUF_H +#define _ASM_POWERPC_SHMBUF_H /* * This program is free software; you can redistribute it and/or @@ -21,19 +21,19 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ -#ifndef __power64__ +#ifndef __powerpc64__ unsigned long __unused1; #endif __kernel_time_t shm_atime; /* last attach time */ -#ifndef __power64__ +#ifndef __powerpc64__ unsigned long __unused2; #endif __kernel_time_t shm_dtime; /* last detach time */ -#ifndef __power64__ +#ifndef __powerpc64__ unsigned long __unused3; #endif __kernel_time_t shm_ctime; /* last change time */ -#ifndef __power64__ +#ifndef __powerpc64__ unsigned long __unused4; #endif size_t shm_segsz; /* size of segment (bytes) */ @@ -56,4 +56,4 @@ struct shminfo64 { unsigned long __unused4; }; -#endif /* _POWERPC_SHMBUF_H */ +#endif /* _ASM_POWERPC_SHMBUF_H */ diff --git a/include/asm-powerpc/shmparam.h b/include/asm-powerpc/shmparam.h index d6250602ae6..5cda42a6d39 100644 --- a/include/asm-powerpc/shmparam.h +++ b/include/asm-powerpc/shmparam.h @@ -1,6 +1,6 @@ -#ifndef _PPC_SHMPARAM_H -#define _PPC_SHMPARAM_H +#ifndef _ASM_POWERPC_SHMPARAM_H +#define _ASM_POWERPC_SHMPARAM_H #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ -#endif /* _PPC_SHMPARAM_H */ +#endif /* _ASM_POWERPC_SHMPARAM_H */ diff --git a/include/asm-powerpc/siginfo.h b/include/asm-powerpc/siginfo.h index ae70b8010b1..12f1bce037b 100644 --- a/include/asm-powerpc/siginfo.h +++ b/include/asm-powerpc/siginfo.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_SIGINFO_H -#define _POWERPC_SIGINFO_H +#ifndef _ASM_POWERPC_SIGINFO_H +#define _ASM_POWERPC_SIGINFO_H /* * This program is free software; you can redistribute it and/or @@ -15,4 +15,12 @@ #include <asm-generic/siginfo.h> -#endif /* _POWERPC_SIGINFO_H */ +/* + * SIGTRAP si_codes + */ +#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ +#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */ +#undef NSIGTRAP +#define NSIGTRAP 4 + +#endif /* _ASM_POWERPC_SIGINFO_H */ diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h index 51a0cf5ee9f..e4b8177d4ac 100644 --- a/include/asm-powerpc/socket.h +++ b/include/asm-powerpc/socket.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_SOCKET_H -#define _POWERPC_SOCKET_H +#ifndef _ASM_POWERPC_SOCKET_H +#define _ASM_POWERPC_SOCKET_H /* * This program is free software; you can redistribute it and/or @@ -56,4 +56,4 @@ #define SO_PEERSEC 31 -#endif /* _POWERPC_SOCKET_H */ +#endif /* _ASM_POWERPC_SOCKET_H */ diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h index ef7ff664167..590078d8ed2 100644 --- a/include/asm-powerpc/sockios.h +++ b/include/asm-powerpc/sockios.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_SOCKIOS_H -#define _POWERPC_SOCKIOS_H +#ifndef _ASM_POWERPC_SOCKIOS_H +#define _ASM_POWERPC_SOCKIOS_H /* * This program is free software; you can redistribute it and/or @@ -16,4 +16,4 @@ #define SIOCATMARK 0x8905 #define SIOCGSTAMP 0x8906 /* Get stamp */ -#endif /* _POWERPC_SOCKIOS_H */ +#endif /* _ASM_POWERPC_SOCKIOS_H */ diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h index 22557599739..8606a696c08 100644 --- a/include/asm-powerpc/string.h +++ b/include/asm-powerpc/string.h @@ -1,5 +1,5 @@ -#ifndef _PPC_STRING_H_ -#define _PPC_STRING_H_ +#ifndef _ASM_POWERPC_STRING_H +#define _ASM_POWERPC_STRING_H #ifdef __KERNEL__ @@ -29,4 +29,4 @@ extern void * memchr(const void *,int,__kernel_size_t); #endif /* __KERNEL__ */ -#endif +#endif /* _ASM_POWERPC_STRING_H */ diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h index 2c5bf85a8c3..ebf6055481d 100644 --- a/include/asm-powerpc/termbits.h +++ b/include/asm-powerpc/termbits.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_TERMBITS_H -#define _POWERPC_TERMBITS_H +#ifndef _ASM_POWERPC_TERMBITS_H +#define _ASM_POWERPC_TERMBITS_H /* * This program is free software; you can redistribute it and/or @@ -188,4 +188,4 @@ struct termios { #define TCSADRAIN 1 #define TCSAFLUSH 2 -#endif /* _POWERPC_TERMBITS_H */ +#endif /* _ASM_POWERPC_TERMBITS_H */ diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h index 237533bb0e9..c5b8e5358f8 100644 --- a/include/asm-powerpc/termios.h +++ b/include/asm-powerpc/termios.h @@ -1,5 +1,5 @@ -#ifndef _POWERPC_TERMIOS_H -#define _POWERPC_TERMIOS_H +#ifndef _ASM_POWERPC_TERMIOS_H +#define _ASM_POWERPC_TERMIOS_H /* * Liberally adapted from alpha/termios.h. In particular, the c_cc[] @@ -233,4 +233,4 @@ struct termio { #endif /* __KERNEL__ */ -#endif /* _POWERPC_TERMIOS_H */ +#endif /* _ASM_POWERPC_TERMIOS_H */ diff --git a/include/asm-ppc/timex.h b/include/asm-powerpc/timex.h index cffc8712077..51c5b316be5 100644 --- a/include/asm-ppc/timex.h +++ b/include/asm-powerpc/timex.h @@ -1,11 +1,11 @@ +#ifndef _ASM_POWERPC_TIMEX_H +#define _ASM_POWERPC_TIMEX_H + +#ifdef __KERNEL__ + /* - * include/asm-ppc/timex.h - * - * ppc architecture timex specifications + * PowerPC architecture timex specifications */ -#ifdef __KERNEL__ -#ifndef _ASMppc_TIMEX_H -#define _ASMppc_TIMEX_H #include <linux/config.h> #include <asm/cputable.h> @@ -14,14 +14,21 @@ typedef unsigned long cycles_t; -/* - * For the "cycle" counter we use the timebase lower half. - * Currently only used on SMP. - */ - static inline cycles_t get_cycles(void) { - cycles_t ret = 0; + cycles_t ret; + +#ifdef __powerpc64__ + + __asm__ __volatile__("mftb %0" : "=r" (ret) : ); + +#else + /* + * For the "cycle" counter we use the timebase lower half. + * Currently only used on SMP. + */ + + ret = 0; __asm__ __volatile__( "98: mftb %0\n" @@ -33,8 +40,10 @@ static inline cycles_t get_cycles(void) " .long 99b\n" ".previous" : "=r" (ret) : "i" (CPU_FTR_601)); +#endif + return ret; } -#endif -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ +#endif /* _ASM_POWERPC_TIMEX_H */ diff --git a/include/asm-ppc64/topology.h b/include/asm-powerpc/topology.h index 1e9b1907323..2512e3836bf 100644 --- a/include/asm-ppc64/topology.h +++ b/include/asm-powerpc/topology.h @@ -1,11 +1,12 @@ -#ifndef _ASM_PPC64_TOPOLOGY_H -#define _ASM_PPC64_TOPOLOGY_H +#ifndef _ASM_POWERPC_TOPOLOGY_H +#define _ASM_POWERPC_TOPOLOGY_H #include <linux/config.h> -#include <asm/mmzone.h> #ifdef CONFIG_NUMA +#include <asm/mmzone.h> + static inline int cpu_to_node(int cpu) { int node; @@ -66,4 +67,4 @@ static inline int node_to_first_cpu(int node) #endif /* CONFIG_NUMA */ -#endif /* _ASM_PPC64_TOPOLOGY_H */ +#endif /* _ASM_POWERPC_TOPOLOGY_H */ diff --git a/include/asm-powerpc/unaligned.h b/include/asm-powerpc/unaligned.h index 45520d9b85d..6c95dfa2652 100644 --- a/include/asm-powerpc/unaligned.h +++ b/include/asm-powerpc/unaligned.h @@ -1,6 +1,7 @@ +#ifndef _ASM_POWERPC_UNALIGNED_H +#define _ASM_POWERPC_UNALIGNED_H + #ifdef __KERNEL__ -#ifndef __PPC_UNALIGNED_H -#define __PPC_UNALIGNED_H /* * The PowerPC can do unaligned accesses itself in big endian mode. @@ -14,5 +15,5 @@ #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) -#endif -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ +#endif /* _ASM_POWERPC_UNALIGNED_H */ diff --git a/include/asm-ppc/user.h b/include/asm-powerpc/user.h index d662b215137..e59ade4b3df 100644 --- a/include/asm-ppc/user.h +++ b/include/asm-powerpc/user.h @@ -1,13 +1,14 @@ -#ifdef __KERNEL__ -#ifndef _PPC_USER_H -#define _PPC_USER_H +#ifndef _ASM_POWERPC_USER_H +#define _ASM_POWERPC_USER_H -/* Adapted from <asm-alpha/user.h> */ +#ifdef __KERNEL__ -#include <linux/ptrace.h> +#include <asm/ptrace.h> #include <asm/page.h> /* + * Adapted from <asm-alpha/user.h> + * * Core file format: The core file is written in such a way that gdb * can understand it and provide useful information to the user (under * linux we use the `trad-core' bfd, NOT the osf-core). The file contents @@ -50,5 +51,5 @@ struct user { #define HOST_DATA_START_ADDR (u.start_data) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) -#endif /* _PPC_USER_H */ -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ +#endif /* _ASM_POWERPC_USER_H */ diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index b4b270457ed..55752474d0d 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h @@ -404,9 +404,5 @@ extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; extern atomic_t ppc_n_lost_interrupts; -struct irqaction; -struct pt_regs; -int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); - #endif /* _ASM_IRQ_H */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h index a811e440c97..9dd06cd4009 100644 --- a/include/asm-ppc/pci.h +++ b/include/asm-ppc/pci.h @@ -109,6 +109,19 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + extern void pcibios_add_platform_entries(struct pci_dev *dev); struct file; diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 9d4e4ea530c..7043c164b53 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h @@ -142,4 +142,11 @@ do { \ #define PTRACE_GETEVRREGS 20 #define PTRACE_SETEVRREGS 21 +/* + * Get or set a debug register. The first 16 are DABR registers and the + * second 16 are IABR registers. + */ +#define PTRACE_GET_DEBUGREG 25 +#define PTRACE_SET_DEBUGREG 26 + #endif diff --git a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h index 88b4222154d..73c33e3ef9c 100644 --- a/include/asm-ppc/reg.h +++ b/include/asm-ppc/reg.h @@ -366,12 +366,6 @@ #define PVR_STB03XXX 0x40310000 #define PVR_NP405H 0x41410000 #define PVR_NP405L 0x41610000 -#define PVR_440GP_RB 0x40120440 -#define PVR_440GP_RC1 0x40120481 -#define PVR_440GP_RC2 0x40200481 -#define PVR_440GX_RA 0x51b21850 -#define PVR_440GX_RB 0x51b21851 -#define PVR_440GX_RC 0x51b21892 #define PVR_601 0x00010000 #define PVR_602 0x00050000 #define PVR_603 0x00030000 diff --git a/include/asm-ppc/setup.h b/include/asm-ppc/setup.h deleted file mode 100644 index d2d19ee103d..00000000000 --- a/include/asm-ppc/setup.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifdef __KERNEL__ -#ifndef _PPC_SETUP_H -#define _PPC_SETUP_H - -#define m68k_num_memory num_memory -#define m68k_memory memory - -#include <asm-m68k/setup.h> -/* We have a bigger command line buffer. */ -#undef COMMAND_LINE_SIZE -#define COMMAND_LINE_SIZE 512 - -#endif /* _PPC_SETUP_H */ -#endif /* __KERNEL__ */ diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index 17530c232c7..829481c0a9d 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h @@ -41,6 +41,10 @@ extern void smp_send_xmon_break(int cpu); struct pt_regs; extern void smp_message_recv(int, struct pt_regs *); +extern int __cpu_disable(void); +extern void __cpu_die(unsigned int cpu); +extern void cpu_die(void) __attribute__((noreturn)); + #define NO_PROC_ID 0xFF /* No processor magic marker */ #define PROC_CHANGE_PENALTY 20 @@ -64,6 +68,8 @@ extern struct klock_info_struct klock_info; #else /* !(CONFIG_SMP) */ +static inline void cpu_die(void) { } + #endif /* !(CONFIG_SMP) */ #endif /* !(_PPC_SMP_H) */ diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h index 909199aae10..20edcf2a6e0 100644 --- a/include/asm-ppc/spinlock.h +++ b/include/asm-ppc/spinlock.h @@ -5,41 +5,21 @@ /* * Simple spin lock operations. + * + * (the type definitions are in asm/raw_spinlock_types.h) */ -typedef struct { - volatile unsigned long lock; -#ifdef CONFIG_DEBUG_SPINLOCK - volatile unsigned long owner_pc; - volatile unsigned long owner_cpu; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#ifdef __KERNEL__ -#ifdef CONFIG_DEBUG_SPINLOCK -#define SPINLOCK_DEBUG_INIT , 0, 0 -#else -#define SPINLOCK_DEBUG_INIT /* */ -#endif - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 SPINLOCK_DEBUG_INIT } - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) -#define spin_is_locked(x) ((x)->lock != 0) -#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) - -#ifndef CONFIG_DEBUG_SPINLOCK - -static inline void _raw_spin_lock(spinlock_t *lock) +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) + +static inline void __raw_spin_lock(raw_spinlock_t *lock) { unsigned long tmp; __asm__ __volatile__( - "b 1f # spin_lock\n\ + "b 1f # __raw_spin_lock\n\ 2: lwzx %0,0,%1\n\ cmpwi 0,%0,0\n\ bne+ 2b\n\ @@ -55,21 +35,13 @@ static inline void _raw_spin_lock(spinlock_t *lock) : "cr0", "memory"); } -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { - __asm__ __volatile__("eieio # spin_unlock": : :"memory"); + __asm__ __volatile__("eieio # __raw_spin_unlock": : :"memory"); lock->lock = 0; } -#define _raw_spin_trylock(l) (!test_and_set_bit(0,&(l)->lock)) - -#else - -extern void _raw_spin_lock(spinlock_t *lock); -extern void _raw_spin_unlock(spinlock_t *lock); -extern int _raw_spin_trylock(spinlock_t *lock); - -#endif +#define __raw_spin_trylock(l) (!test_and_set_bit(0,&(l)->lock)) /* * Read-write spinlocks, allowing multiple readers @@ -81,22 +53,11 @@ extern int _raw_spin_trylock(spinlock_t *lock); * irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -typedef struct { - volatile signed int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; -#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } -#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) +#define __raw_read_can_lock(rw) ((rw)->lock >= 0) +#define __raw_write_can_lock(rw) (!(rw)->lock) -#define read_can_lock(rw) ((rw)->lock >= 0) -#define write_can_lock(rw) (!(rw)->lock) - -#ifndef CONFIG_DEBUG_SPINLOCK - -static __inline__ int _raw_read_trylock(rwlock_t *rw) +static __inline__ int __raw_read_trylock(raw_rwlock_t *rw) { signed int tmp; @@ -116,7 +77,7 @@ static __inline__ int _raw_read_trylock(rwlock_t *rw) return tmp > 0; } -static __inline__ void _raw_read_lock(rwlock_t *rw) +static __inline__ void __raw_read_lock(raw_rwlock_t *rw) { signed int tmp; @@ -137,7 +98,7 @@ static __inline__ void _raw_read_lock(rwlock_t *rw) : "cr0", "memory"); } -static __inline__ void _raw_read_unlock(rwlock_t *rw) +static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) { signed int tmp; @@ -153,7 +114,7 @@ static __inline__ void _raw_read_unlock(rwlock_t *rw) : "cr0", "memory"); } -static __inline__ int _raw_write_trylock(rwlock_t *rw) +static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) { signed int tmp; @@ -173,7 +134,7 @@ static __inline__ int _raw_write_trylock(rwlock_t *rw) return tmp == 0; } -static __inline__ void _raw_write_lock(rwlock_t *rw) +static __inline__ void __raw_write_lock(raw_rwlock_t *rw) { signed int tmp; @@ -194,22 +155,10 @@ static __inline__ void _raw_write_lock(rwlock_t *rw) : "cr0", "memory"); } -static __inline__ void _raw_write_unlock(rwlock_t *rw) +static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) { __asm__ __volatile__("eieio # write_unlock": : :"memory"); rw->lock = 0; } -#else - -extern void _raw_read_lock(rwlock_t *rw); -extern void _raw_read_unlock(rwlock_t *rw); -extern void _raw_write_lock(rwlock_t *rw); -extern void _raw_write_unlock(rwlock_t *rw); -extern int _raw_read_trylock(rwlock_t *rw); -extern int _raw_write_trylock(rwlock_t *rw); - -#endif - #endif /* __ASM_SPINLOCK_H */ -#endif /* __KERNEL__ */ diff --git a/include/asm-ppc/spinlock_types.h b/include/asm-ppc/spinlock_types.h new file mode 100644 index 00000000000..7919ccc75b8 --- /dev/null +++ b/include/asm-ppc/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned long lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile signed int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 513a334c581..d754ab570fe 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -88,6 +88,7 @@ extern void *cacheable_memcpy(void *, const void *, unsigned int); extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); extern void bad_page_fault(struct pt_regs *, unsigned long, int); extern void die(const char *, struct pt_regs *, long); +extern void _exception(int, struct pt_regs *, int, unsigned long); #ifdef CONFIG_BOOKE_WDT extern u32 booke_wdt_enabled; extern u32 booke_wdt_period; diff --git a/include/asm-ppc/topology.h b/include/asm-ppc/topology.h deleted file mode 100644 index 6a029bbba6e..00000000000 --- a/include/asm-ppc/topology.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_PPC_TOPOLOGY_H -#define _ASM_PPC_TOPOLOGY_H - -#include <asm-generic/topology.h> - -#endif /* _ASM_PPC_TOPOLOGY_H */ diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h index 94298b106a4..40c8eb57493 100644 --- a/include/asm-ppc64/eeh.h +++ b/include/asm-ppc64/eeh.h @@ -219,23 +219,24 @@ static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr) static inline void eeh_memset_io(volatile void __iomem *addr, int c, unsigned long n) { + void *p = (void __force *)addr; u32 lc = c; lc |= lc << 8; lc |= lc << 16; - while(n && !EEH_CHECK_ALIGN(addr, 4)) { - *((volatile u8 *)addr) = c; - addr = (void *)((unsigned long)addr + 1); + while(n && !EEH_CHECK_ALIGN(p, 4)) { + *((volatile u8 *)p) = c; + p++; n--; } while(n >= 4) { - *((volatile u32 *)addr) = lc; - addr = (void *)((unsigned long)addr + 4); + *((volatile u32 *)p) = lc; + p += 4; n -= 4; } while(n) { - *((volatile u8 *)addr) = c; - addr = (void *)((unsigned long)addr + 1); + *((volatile u8 *)p) = c; + p++; n--; } __asm__ __volatile__ ("sync" : : : "memory"); @@ -250,22 +251,22 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { *((u8 *)dest) = *((volatile u8 *)vsrc); __asm__ __volatile__ ("eieio" : : : "memory"); - vsrc = (void *)((unsigned long)vsrc + 1); - dest = (void *)((unsigned long)dest + 1); + vsrc++; + dest++; n--; } while(n > 4) { *((u32 *)dest) = *((volatile u32 *)vsrc); __asm__ __volatile__ ("eieio" : : : "memory"); - vsrc = (void *)((unsigned long)vsrc + 4); - dest = (void *)((unsigned long)dest + 4); + vsrc += 4; + dest += 4; n -= 4; } while(n) { *((u8 *)dest) = *((volatile u8 *)vsrc); __asm__ __volatile__ ("eieio" : : : "memory"); - vsrc = (void *)((unsigned long)vsrc + 1); - dest = (void *)((unsigned long)dest + 1); + vsrc++; + dest++; n--; } __asm__ __volatile__ ("sync" : : : "memory"); @@ -286,20 +287,20 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { *((volatile u8 *)vdest) = *((u8 *)src); - src = (void *)((unsigned long)src + 1); - vdest = (void *)((unsigned long)vdest + 1); + src++; + vdest++; n--; } while(n > 4) { *((volatile u32 *)vdest) = *((volatile u32 *)src); - src = (void *)((unsigned long)src + 4); - vdest = (void *)((unsigned long)vdest + 4); + src += 4; + vdest += 4; n-=4; } while(n) { *((volatile u8 *)vdest) = *((u8 *)src); - src = (void *)((unsigned long)src + 1); - vdest = (void *)((unsigned long)vdest + 1); + src++; + vdest++; n--; } __asm__ __volatile__ ("sync" : : : "memory"); diff --git a/include/asm-ppc64/hvcall.h b/include/asm-ppc64/hvcall.h index 4f668a4baff..ab7c3cf2488 100644 --- a/include/asm-ppc64/hvcall.h +++ b/include/asm-ppc64/hvcall.h @@ -56,6 +56,11 @@ #define H_PP1 (1UL<<(63-62)) #define H_PP2 (1UL<<(63-63)) +/* DABRX flags */ +#define H_DABRX_HYPERVISOR (1UL<<(63-61)) +#define H_DABRX_KERNEL (1UL<<(63-62)) +#define H_DABRX_USER (1UL<<(63-63)) + /* pSeries hypervisor opcodes */ #define H_REMOVE 0x04 #define H_ENTER 0x08 @@ -101,6 +106,7 @@ #define H_VIO_SIGNAL 0x104 #define H_SEND_CRQ 0x108 #define H_COPY_RDMA 0x110 +#define H_SET_XDABR 0x134 #define H_STUFF_TCE 0x138 #define H_PUT_TCE_INDIRECT 0x13C #define H_VTERM_PARTNER_INFO 0x150 diff --git a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h index aba1dfa388b..59c958aea4d 100644 --- a/include/asm-ppc64/io.h +++ b/include/asm-ppc64/io.h @@ -20,10 +20,10 @@ #include <asm-generic/iomap.h> -#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 *)(p), (a), (c)) -#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 *)(p), (a), (c)) -#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 *)(p), (a), (c)) -#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 *)(p), (a), (c)) +#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) +#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) +#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) +#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) #define SIO_CONFIG_RA 0x398 @@ -71,8 +71,8 @@ extern unsigned long io_page_mask; * Neither do the standard versions now, these are just here * for older code. */ -#define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) -#define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) +#define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) +#define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) #else static inline unsigned char __raw_readb(const volatile void __iomem *addr) @@ -136,9 +136,9 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) #define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) #define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) -#define outsb(port, buf, ns) _outsb((u8 *)((port)+pci_io_base), (buf), (ns)) -#define outsw(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) -#define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) +#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) +#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) +#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) #endif @@ -147,16 +147,16 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) #define readl_relaxed(addr) readl(addr) #define readq_relaxed(addr) readq(addr) -extern void _insb(volatile u8 *port, void *buf, int ns); -extern void _outsb(volatile u8 *port, const void *buf, int ns); -extern void _insw(volatile u16 *port, void *buf, int ns); -extern void _outsw(volatile u16 *port, const void *buf, int ns); -extern void _insl(volatile u32 *port, void *buf, int nl); -extern void _outsl(volatile u32 *port, const void *buf, int nl); -extern void _insw_ns(volatile u16 *port, void *buf, int ns); -extern void _outsw_ns(volatile u16 *port, const void *buf, int ns); -extern void _insl_ns(volatile u32 *port, void *buf, int nl); -extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); +extern void _insb(volatile u8 __iomem *port, void *buf, int ns); +extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); +extern void _insw(volatile u16 __iomem *port, void *buf, int ns); +extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); +extern void _insl(volatile u32 __iomem *port, void *buf, int nl); +extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); +extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); +extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); +extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); +extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); #define mmiowb() @@ -176,8 +176,8 @@ extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); * Neither do the standard versions now, these are just here * for older code. */ -#define outsw_ns(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) -#define outsl_ns(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) +#define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) +#define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) #define IO_SPACE_LIMIT ~(0UL) diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 9a1ef4427ed..8027160ec96 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h @@ -88,6 +88,7 @@ struct machdep_calls { /* PCI stuff */ void (*pcibios_fixup)(void); + int (*pci_probe_mode)(struct pci_bus *); void (*restart)(char *cmd); void (*power_off)(void); @@ -173,10 +174,6 @@ extern sys_ctrler_t sys_ctrler; void ppc64_boot_msg(unsigned int src, const char *msg); /* Print a termination message (print only -- does not stop the kernel) */ void ppc64_terminate_msg(unsigned int src, const char *msg); -/* Print something that needs attention (device error, etc) */ -void ppc64_attention_msg(unsigned int src, const char *msg); -/* Print a dump progress message. */ -void ppc64_dump_msg(unsigned int src, const char *msg); static inline void log_error(char *buf, unsigned int err_type, int fatal) { diff --git a/include/asm-ppc64/msgbuf.h b/include/asm-ppc64/msgbuf.h deleted file mode 100644 index 31c1cbf133c..00000000000 --- a/include/asm-ppc64/msgbuf.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _PPC64_MSGBUF_H -#define _PPC64_MSGBUF_H - -/* - * The msqid64_ds structure for the PPC architecture. - * - * 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. - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* _PPC64_MSGBUF_H */ diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h deleted file mode 100644 index 76c212d475b..00000000000 --- a/include/asm-ppc64/param.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _ASM_PPC64_PARAM_H -#define _ASM_PPC64_PARAM_H - -#include <linux/config.h> - -/* - * 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. - */ - -#ifdef __KERNEL__ -# define HZ CONFIG_HZ /* Internal kernel timer frequency */ -# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ -# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ -#endif - -#ifndef HZ -#define HZ 100 -#endif - -#define EXEC_PAGESIZE 4096 - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#endif /* _ASM_PPC64_PARAM_H */ diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index c4f9023ea5e..d8991389ab3 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h @@ -48,19 +48,52 @@ struct pci_controller { unsigned long dma_window_size; }; +/* + * PCI stuff, for nodes representing PCI devices, pointed to + * by device_node->data. + */ +struct pci_controller; +struct iommu_table; + +struct pci_dn { + int busno; /* for pci devices */ + int bussubno; /* for pci devices */ + int devfn; /* for pci devices */ + int eeh_mode; /* See eeh.h for possible EEH_MODEs */ + int eeh_config_addr; + int eeh_capable; /* from firmware */ + int eeh_check_count; /* # times driver ignored error */ + int eeh_freeze_count; /* # times this device froze up. */ + int eeh_is_bridge; /* device is pci-to-pci bridge */ + + int pci_ext_config_space; /* for pci devices */ + struct pci_controller *phb; /* for pci devices */ + struct iommu_table *iommu_table; /* for phb's or bridges */ + struct pci_dev *pcidev; /* back-pointer to the pci device */ + struct device_node *node; /* back-pointer to the device_node */ + u32 config_space[16]; /* saved PCI config space */ +}; + +/* Get the pointer to a device_node's pci_dn */ +#define PCI_DN(dn) ((struct pci_dn *) (dn)->data) + struct device_node *fetch_dev_dn(struct pci_dev *dev); -/* Get a device_node from a pci_dev. This code must be fast except in the case - * where the sysdata is incorrect and needs to be fixed up (hopefully just once) +/* Get a device_node from a pci_dev. This code must be fast except + * in the case where the sysdata is incorrect and needs to be fixed + * up (this will only happen once). + * In this case the sysdata will have been inherited from a PCI host + * bridge or a PCI-PCI bridge further up the tree, so it will point + * to a valid struct pci_dn, just not the one we want. */ static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) { struct device_node *dn = dev->sysdata; + struct pci_dn *pdn = dn->data; - if (dn->devfn == dev->devfn && dn->busno == dev->bus->number) + if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number) return dn; /* fast path. sysdata is good */ - else - return fetch_dev_dn(dev); + return fetch_dev_dn(dev); } static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) @@ -83,8 +116,13 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) struct device_node *busdn = bus->sysdata; BUG_ON(busdn == NULL); - return busdn->phb; + return PCI_DN(busdn)->phb; } +/* Return values for ppc_md.pci_probe_mode function */ +#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ +#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ +#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ + #endif #endif /* __KERNEL__ */ diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h index 4d057452f59..a88bbfc2696 100644 --- a/include/asm-ppc64/pci.h +++ b/include/asm-ppc64/pci.h @@ -138,6 +138,19 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +static inline struct resource * +pcibios_select_root(struct pci_dev *pdev, struct resource *res) +{ + struct resource *root = NULL; + + if (res->flags & IORESOURCE_IO) + root = &ioport_resource; + if (res->flags & IORESOURCE_MEM) + root = &iomem_resource; + + return root; +} + extern int unmap_bus_range(struct pci_bus *bus); diff --git a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h index f4a5fb7d67c..72dd2449ee7 100644 --- a/include/asm-ppc64/plpar_wrappers.h +++ b/include/asm-ppc64/plpar_wrappers.h @@ -107,5 +107,14 @@ static inline long plpar_put_term_char(unsigned long termno, lbuf[1]); } +static inline long plpar_set_xdabr(unsigned long address, unsigned long flags) +{ + return plpar_hcall_norets(H_SET_XDABR, address, flags); +} + +static inline long plpar_set_dabr(unsigned long val) +{ + return plpar_hcall_norets(H_SET_DABR, val); +} #endif /* _PPC64_PLPAR_WRAPPERS_H */ diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index 8bd7aa95938..4146189006e 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h @@ -433,6 +433,7 @@ struct thread_struct { unsigned long start_tb; /* Start purr when proc switched in */ unsigned long accum_tb; /* Total accumilated purr for process */ unsigned long vdso_base; /* base of the vDSO library */ + unsigned long dabr; /* Data address breakpoint register */ #ifdef CONFIG_ALTIVEC /* Complete AltiVec register set */ vector128 vr[32] __attribute((aligned(16))); diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h index dc5330b3950..c02ec1d6b90 100644 --- a/include/asm-ppc64/prom.h +++ b/include/asm-ppc64/prom.h @@ -116,14 +116,6 @@ struct property { struct property *next; }; -/* NOTE: the device_node contains PCI specific info for pci devices. - * This perhaps could be hung off the device_node with another struct, - * but for now it is directly in the node. The phb ptr is a good - * indication of a real PCI node. Other nodes leave these fields zeroed. - */ -struct pci_controller; -struct iommu_table; - struct device_node { char *name; char *type; @@ -135,16 +127,6 @@ struct device_node { struct interrupt_info *intrs; char *full_name; - /* PCI stuff probably doesn't belong here */ - int busno; /* for pci devices */ - int bussubno; /* for pci devices */ - int devfn; /* for pci devices */ - int eeh_mode; /* See eeh.h for possible EEH_MODEs */ - int eeh_config_addr; - int pci_ext_config_space; /* for pci devices */ - struct pci_controller *phb; /* for pci devices */ - struct iommu_table *iommu_table; /* for phb's or bridges */ - struct property *properties; struct device_node *parent; struct device_node *child; @@ -154,6 +136,7 @@ struct device_node { struct proc_dir_entry *pde; /* this node's proc directory */ struct kref kref; unsigned long _flags; + void *data; }; extern struct device_node *of_chosen; diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h index af03547f9c7..b1babb72967 100644 --- a/include/asm-ppc64/ptrace-common.h +++ b/include/asm-ppc64/ptrace-common.h @@ -11,6 +11,10 @@ #ifndef _PPC64_PTRACE_COMMON_H #define _PPC64_PTRACE_COMMON_H + +#include <linux/config.h> +#include <asm/system.h> + /* * Set of msr bits that gdb can change on behalf of a process. */ @@ -69,4 +73,92 @@ static inline void clear_single_step(struct task_struct *task) clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); } +#ifdef CONFIG_ALTIVEC +/* + * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. + * The transfer totals 34 quadword. Quadwords 0-31 contain the + * corresponding vector registers. Quadword 32 contains the vscr as the + * last word (offset 12) within that quadword. Quadword 33 contains the + * vrsave as the first word (offset 0) within the quadword. + * + * This definition of the VMX state is compatible with the current PPC32 + * ptrace interface. This allows signal handling and ptrace to use the + * same structures. This also simplifies the implementation of a bi-arch + * (combined (32- and 64-bit) gdb. + */ + +/* + * Get contents of AltiVec register state in task TASK + */ +static inline int get_vrregs(unsigned long __user *data, + struct task_struct *task) +{ + unsigned long regsize; + + /* copy AltiVec registers VR[0] .. VR[31] */ + regsize = 32 * sizeof(vector128); + if (copy_to_user(data, task->thread.vr, regsize)) + return -EFAULT; + data += (regsize / sizeof(unsigned long)); + + /* copy VSCR */ + regsize = 1 * sizeof(vector128); + if (copy_to_user(data, &task->thread.vscr, regsize)) + return -EFAULT; + data += (regsize / sizeof(unsigned long)); + + /* copy VRSAVE */ + if (put_user(task->thread.vrsave, (u32 __user *)data)) + return -EFAULT; + + return 0; +} + +/* + * Write contents of AltiVec register state into task TASK. + */ +static inline int set_vrregs(struct task_struct *task, + unsigned long __user *data) +{ + unsigned long regsize; + + /* copy AltiVec registers VR[0] .. VR[31] */ + regsize = 32 * sizeof(vector128); + if (copy_from_user(task->thread.vr, data, regsize)) + return -EFAULT; + data += (regsize / sizeof(unsigned long)); + + /* copy VSCR */ + regsize = 1 * sizeof(vector128); + if (copy_from_user(&task->thread.vscr, data, regsize)) + return -EFAULT; + data += (regsize / sizeof(unsigned long)); + + /* copy VRSAVE */ + if (get_user(task->thread.vrsave, (u32 __user *)data)) + return -EFAULT; + + return 0; +} +#endif + +static inline int ptrace_set_debugreg(struct task_struct *task, + unsigned long addr, unsigned long data) +{ + /* We only support one DABR and no IABRS at the moment */ + if (addr > 0) + return -EINVAL; + + /* The bottom 3 bits are flags */ + if ((data & ~0x7UL) >= TASK_SIZE) + return -EIO; + + /* Ensure translation is on */ + if (data && !(data & DABR_TRANSLATION)) + return -EIO; + + task->thread.dabr = data; + return 0; +} + #endif /* _PPC64_PTRACE_COMMON_H */ diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h index c96aad28fc0..3a55377f1fd 100644 --- a/include/asm-ppc64/ptrace.h +++ b/include/asm-ppc64/ptrace.h @@ -25,56 +25,49 @@ */ #ifndef __ASSEMBLY__ -#define PPC_REG unsigned long + struct pt_regs { - PPC_REG gpr[32]; - PPC_REG nip; - PPC_REG msr; - PPC_REG orig_gpr3; /* Used for restarting system calls */ - PPC_REG ctr; - PPC_REG link; - PPC_REG xer; - PPC_REG ccr; - PPC_REG softe; /* Soft enabled/disabled */ - PPC_REG trap; /* Reason for being here */ - PPC_REG dar; /* Fault registers */ - PPC_REG dsisr; - PPC_REG result; /* Result of a system call */ + unsigned long gpr[32]; + unsigned long nip; + unsigned long msr; + unsigned long orig_gpr3; /* Used for restarting system calls */ + unsigned long ctr; + unsigned long link; + unsigned long xer; + unsigned long ccr; + unsigned long softe; /* Soft enabled/disabled */ + unsigned long trap; /* Reason for being here */ + unsigned long dar; /* Fault registers */ + unsigned long dsisr; + unsigned long result; /* Result of a system call */ }; -#define PPC_REG_32 unsigned int struct pt_regs32 { - PPC_REG_32 gpr[32]; - PPC_REG_32 nip; - PPC_REG_32 msr; - PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ - PPC_REG_32 ctr; - PPC_REG_32 link; - PPC_REG_32 xer; - PPC_REG_32 ccr; - PPC_REG_32 mq; /* 601 only (not used at present) */ - /* Used on APUS to hold IPL value. */ - PPC_REG_32 trap; /* Reason for being here */ - PPC_REG_32 dar; /* Fault registers */ - PPC_REG_32 dsisr; - PPC_REG_32 result; /* Result of a system call */ + unsigned int gpr[32]; + unsigned int nip; + unsigned int msr; + unsigned int orig_gpr3; /* Used for restarting system calls */ + unsigned int ctr; + unsigned int link; + unsigned int xer; + unsigned int ccr; + unsigned int mq; /* 601 only (not used at present) */ + unsigned int trap; /* Reason for being here */ + unsigned int dar; /* Fault registers */ + unsigned int dsisr; + unsigned int result; /* Result of a system call */ }; +#ifdef __KERNEL__ + #define instruction_pointer(regs) ((regs)->nip) + #ifdef CONFIG_SMP extern unsigned long profile_pc(struct pt_regs *regs); #else #define profile_pc(regs) instruction_pointer(regs) #endif -#endif /* __ASSEMBLY__ */ - -#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ - -/* Size of dummy stack frame allocated when calling signal handler. */ -#define __SIGNAL_FRAMESIZE 128 -#define __SIGNAL_FRAMESIZE32 64 - #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) #define force_successful_syscall_return() \ @@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs); #define TRAP(regs) ((regs)->trap & ~0xF) #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) +#endif /* __KERNEL__ */ + +#endif /* __ASSEMBLY__ */ + +#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ + +/* Size of dummy stack frame allocated when calling signal handler. */ +#define __SIGNAL_FRAMESIZE 128 +#define __SIGNAL_FRAMESIZE32 64 + /* * Offsets used by 'ptrace' system call interface. */ @@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs); #define PT_XER 37 #define PT_CCR 38 #define PT_SOFTE 39 +#define PT_TRAP 40 +#define PT_DAR 41 +#define PT_DSISR 42 #define PT_RESULT 43 #define PT_FPR0 48 -/* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have - * visibility to the asm-ppc/ptrace.h header instead of this one. +/* + * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will + * have visibility to the asm-ppc/ptrace.h header instead of this one. */ -#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ +#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ #ifdef __KERNEL__ -#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ +#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ #endif #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ @@ -173,17 +180,34 @@ extern unsigned long profile_pc(struct pt_regs *regs); #define PTRACE_GETVRREGS 18 #define PTRACE_SETVRREGS 19 -/* Additional PTRACE requests implemented on PowerPC. */ -#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ -#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ -#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ -#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ -#define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ -#define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ -#define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ -#define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ -#define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */ -#define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */ +/* + * While we dont have 64bit book E processors, we need to reserve the + * relevant ptrace calls for 32bit compatibility. + */ +#if 0 +#define PTRACE_GETEVRREGS 20 +#define PTRACE_SETEVRREGS 21 +#endif +/* + * Get or set a debug register. The first 16 are DABR registers and the + * second 16 are IABR registers. + */ +#define PTRACE_GET_DEBUGREG 25 +#define PTRACE_SET_DEBUGREG 26 + +/* Additional PTRACE requests implemented on PowerPC. */ +#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ +#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ +#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ +#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ + +/* Calls to trace a 64bit program from a 32bit program */ +#define PPC_PTRACE_PEEKTEXT_3264 0x95 +#define PPC_PTRACE_PEEKDATA_3264 0x94 +#define PPC_PTRACE_POKETEXT_3264 0x93 +#define PPC_PTRACE_POKEDATA_3264 0x92 +#define PPC_PTRACE_PEEKUSR_3264 0x91 +#define PPC_PTRACE_POKEUSR_3264 0x90 #endif /* _PPC64_PTRACE_H */ diff --git a/include/asm-ppc64/segment.h b/include/asm-ppc64/segment.h deleted file mode 100644 index d80fb68cc79..00000000000 --- a/include/asm-ppc64/segment.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __PPC64_SEGMENT_H -#define __PPC64_SEGMENT_H - -/* Only here because we have some old header files that expect it.. */ - -#endif /* __PPC64_SEGMENT_H */ diff --git a/include/asm-ppc64/setup.h b/include/asm-ppc64/setup.h deleted file mode 100644 index b257b8348c7..00000000000 --- a/include/asm-ppc64/setup.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _PPC_SETUP_H -#define _PPC_SETUP_H - -#define COMMAND_LINE_SIZE 512 - -#endif /* _PPC_SETUP_H */ diff --git a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h index acd11564dd7..14cb895bb60 100644 --- a/include/asm-ppc64/spinlock.h +++ b/include/asm-ppc64/spinlock.h @@ -15,36 +15,42 @@ * 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. + * + * (the type definitions are in asm/spinlock_types.h) */ #include <linux/config.h> #include <asm/paca.h> #include <asm/hvcall.h> #include <asm/iSeries/HvCall.h> -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; +#define __raw_spin_is_locked(x) ((x)->slock != 0) -typedef struct { - volatile signed int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; +/* + * This returns the old value in the lock, so we succeeded + * in getting the lock if the return value is 0. + */ +static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock) +{ + unsigned long tmp, tmp2; -#ifdef __KERNEL__ -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } + __asm__ __volatile__( +" lwz %1,%3(13) # __spin_trylock\n\ +1: lwarx %0,0,%2\n\ + cmpwi 0,%0,0\n\ + bne- 2f\n\ + stwcx. %1,0,%2\n\ + bne- 1b\n\ + isync\n\ +2:" : "=&r" (tmp), "=&r" (tmp2) + : "r" (&lock->slock), "i" (offsetof(struct paca_struct, lock_token)) + : "cr0", "memory"); -#define spin_is_locked(x) ((x)->lock != 0) -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) + return tmp; +} -static __inline__ void _raw_spin_unlock(spinlock_t *lock) +static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock) { - __asm__ __volatile__("lwsync # spin_unlock": : :"memory"); - lock->lock = 0; + return __spin_trylock(lock) == 0; } /* @@ -64,44 +70,15 @@ static __inline__ void _raw_spin_unlock(spinlock_t *lock) #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) /* We only yield to the hypervisor if we are in shared processor mode */ #define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc) -extern void __spin_yield(spinlock_t *lock); -extern void __rw_yield(rwlock_t *lock); +extern void __spin_yield(raw_spinlock_t *lock); +extern void __rw_yield(raw_rwlock_t *lock); #else /* SPLPAR || ISERIES */ #define __spin_yield(x) barrier() #define __rw_yield(x) barrier() #define SHARED_PROCESSOR 0 #endif -extern void spin_unlock_wait(spinlock_t *lock); - -/* - * This returns the old value in the lock, so we succeeded - * in getting the lock if the return value is 0. - */ -static __inline__ unsigned long __spin_trylock(spinlock_t *lock) -{ - unsigned long tmp, tmp2; - - __asm__ __volatile__( -" lwz %1,%3(13) # __spin_trylock\n\ -1: lwarx %0,0,%2\n\ - cmpwi 0,%0,0\n\ - bne- 2f\n\ - stwcx. %1,0,%2\n\ - bne- 1b\n\ - isync\n\ -2:" : "=&r" (tmp), "=&r" (tmp2) - : "r" (&lock->lock), "i" (offsetof(struct paca_struct, lock_token)) - : "cr0", "memory"); - - return tmp; -} - -static int __inline__ _raw_spin_trylock(spinlock_t *lock) -{ - return __spin_trylock(lock) == 0; -} -static void __inline__ _raw_spin_lock(spinlock_t *lock) +static void __inline__ __raw_spin_lock(raw_spinlock_t *lock) { while (1) { if (likely(__spin_trylock(lock) == 0)) @@ -110,12 +87,12 @@ static void __inline__ _raw_spin_lock(spinlock_t *lock) HMT_low(); if (SHARED_PROCESSOR) __spin_yield(lock); - } while (unlikely(lock->lock != 0)); + } while (unlikely(lock->slock != 0)); HMT_medium(); } } -static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) +static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) { unsigned long flags_dis; @@ -128,12 +105,20 @@ static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flag HMT_low(); if (SHARED_PROCESSOR) __spin_yield(lock); - } while (unlikely(lock->lock != 0)); + } while (unlikely(lock->slock != 0)); HMT_medium(); local_irq_restore(flags_dis); } } +static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) +{ + __asm__ __volatile__("lwsync # __raw_spin_unlock": : :"memory"); + lock->slock = 0; +} + +extern void __raw_spin_unlock_wait(raw_spinlock_t *lock); + /* * Read-write spinlocks, allowing multiple readers * but only one writer. @@ -144,24 +129,15 @@ static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flag * irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) - -#define read_can_lock(rw) ((rw)->lock >= 0) -#define write_can_lock(rw) (!(rw)->lock) - -static __inline__ void _raw_write_unlock(rwlock_t *rw) -{ - __asm__ __volatile__("lwsync # write_unlock": : :"memory"); - rw->lock = 0; -} +#define __raw_read_can_lock(rw) ((rw)->lock >= 0) +#define __raw_write_can_lock(rw) (!(rw)->lock) /* * This returns the old value in the lock + 1, * so we got a read lock if the return value is > 0. */ -static long __inline__ __read_trylock(rwlock_t *rw) +static long __inline__ __read_trylock(raw_rwlock_t *rw) { long tmp; @@ -180,45 +156,11 @@ static long __inline__ __read_trylock(rwlock_t *rw) return tmp; } -static int __inline__ _raw_read_trylock(rwlock_t *rw) -{ - return __read_trylock(rw) > 0; -} - -static void __inline__ _raw_read_lock(rwlock_t *rw) -{ - while (1) { - if (likely(__read_trylock(rw) > 0)) - break; - do { - HMT_low(); - if (SHARED_PROCESSOR) - __rw_yield(rw); - } while (unlikely(rw->lock < 0)); - HMT_medium(); - } -} - -static void __inline__ _raw_read_unlock(rwlock_t *rw) -{ - long tmp; - - __asm__ __volatile__( - "eieio # read_unlock\n\ -1: lwarx %0,0,%1\n\ - addic %0,%0,-1\n\ - stwcx. %0,0,%1\n\ - bne- 1b" - : "=&r"(tmp) - : "r"(&rw->lock) - : "cr0", "memory"); -} - /* * This returns the old value in the lock, * so we got the write lock if the return value is 0. */ -static __inline__ long __write_trylock(rwlock_t *rw) +static __inline__ long __write_trylock(raw_rwlock_t *rw) { long tmp, tmp2; @@ -237,12 +179,21 @@ static __inline__ long __write_trylock(rwlock_t *rw) return tmp; } -static int __inline__ _raw_write_trylock(rwlock_t *rw) +static void __inline__ __raw_read_lock(raw_rwlock_t *rw) { - return __write_trylock(rw) == 0; + while (1) { + if (likely(__read_trylock(rw) > 0)) + break; + do { + HMT_low(); + if (SHARED_PROCESSOR) + __rw_yield(rw); + } while (unlikely(rw->lock < 0)); + HMT_medium(); + } } -static void __inline__ _raw_write_lock(rwlock_t *rw) +static void __inline__ __raw_write_lock(raw_rwlock_t *rw) { while (1) { if (likely(__write_trylock(rw) == 0)) @@ -256,5 +207,35 @@ static void __inline__ _raw_write_lock(rwlock_t *rw) } } -#endif /* __KERNEL__ */ +static int __inline__ __raw_read_trylock(raw_rwlock_t *rw) +{ + return __read_trylock(rw) > 0; +} + +static int __inline__ __raw_write_trylock(raw_rwlock_t *rw) +{ + return __write_trylock(rw) == 0; +} + +static void __inline__ __raw_read_unlock(raw_rwlock_t *rw) +{ + long tmp; + + __asm__ __volatile__( + "eieio # read_unlock\n\ +1: lwarx %0,0,%1\n\ + addic %0,%0,-1\n\ + stwcx. %0,0,%1\n\ + bne- 1b" + : "=&r"(tmp) + : "r"(&rw->lock) + : "cr0", "memory"); +} + +static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) +{ + __asm__ __volatile__("lwsync # write_unlock": : :"memory"); + rw->lock = 0; +} + #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-ppc64/spinlock_types.h b/include/asm-ppc64/spinlock_types.h new file mode 100644 index 00000000000..a37c8eabb9f --- /dev/null +++ b/include/asm-ppc64/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int slock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile signed int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index c0396428cc3..375015c62f2 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h @@ -101,6 +101,9 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; } static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } #endif +extern int set_dabr(unsigned long dabr); +extern void _exception(int signr, struct pt_regs *regs, int code, + unsigned long addr); extern int fix_alignment(struct pt_regs *regs); extern void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig); diff --git a/include/asm-ppc64/timex.h b/include/asm-ppc64/timex.h deleted file mode 100644 index 8db4da4064c..00000000000 --- a/include/asm-ppc64/timex.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * linux/include/asm-ppc/timex.h - * - * PPC64 architecture timex specifications - * - * 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. - */ -#ifndef _ASMPPC64_TIMEX_H -#define _ASMPPC64_TIMEX_H - -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ - -typedef unsigned long cycles_t; - -static inline cycles_t get_cycles(void) -{ - cycles_t ret; - - __asm__ __volatile__("mftb %0" : "=r" (ret) : ); - return ret; -} - -#endif diff --git a/include/asm-ppc64/user.h b/include/asm-ppc64/user.h deleted file mode 100644 index d7d6554a421..00000000000 --- a/include/asm-ppc64/user.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef _PPC_USER_H -#define _PPC_USER_H - -/* Adapted from <asm-alpha/user.h> - * - * 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. - */ - -#include <asm/ptrace.h> -#include <asm/page.h> - -/* - * Core file format: The core file is written in such a way that gdb - * can understand it and provide useful information to the user (under - * linux we use the `trad-core' bfd, NOT the osf-core). The file contents - * are as follows: - * - * upage: 1 page consisting of a user struct that tells gdb - * what is present in the file. Directly after this is a - * copy of the task_struct, which is currently not used by gdb, - * but it may come in handy at some point. All of the registers - * are stored as part of the upage. The upage should always be - * only one page long. - * data: The data segment follows next. We use current->end_text to - * current->brk to pick up all of the user variables, plus any memory - * that may have been sbrk'ed. No attempt is made to determine if a - * page is demand-zero or if a page is totally unused, we just cover - * the entire range. All of the addresses are rounded in such a way - * that an integral number of pages is written. - * stack: We need the stack information in order to get a meaningful - * backtrace. We need to write the data from usp to - * current->start_stack, so we round each of these in order to be able - * to write an integer number of pages. - */ -struct user { - struct pt_regs regs; /* entire machine state */ - size_t u_tsize; /* text size (pages) */ - size_t u_dsize; /* data size (pages) */ - size_t u_ssize; /* stack size (pages) */ - unsigned long start_code; /* text starting address */ - unsigned long start_data; /* data starting address */ - unsigned long start_stack; /* stack starting address */ - long int signal; /* signal causing core dump */ - struct regs * u_ar0; /* help gdb find registers */ - unsigned long magic; /* identifies a core file */ - char u_comm[32]; /* user command name */ -}; - -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_DATA_START_ADDR (u.start_data) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif /* _PPC_USER_H */ diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h index 321b23bba1e..273dbecf8ac 100644 --- a/include/asm-s390/spinlock.h +++ b/include/asm-s390/spinlock.h @@ -27,25 +27,19 @@ _raw_compare_and_swap(volatile unsigned int *lock, * on the local processor, one does not. * * We make no fairness assumptions. They have a cost. + * + * (the type definitions are in asm/spinlock_types.h) */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} __attribute__ ((aligned (4))) spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } -#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0) -#define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock) -#define spin_is_locked(x) ((x)->lock != 0) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) -extern void _raw_spin_lock_wait(spinlock_t *lp, unsigned int pc); -extern int _raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc); +extern void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc); +extern int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc); -static inline void _raw_spin_lock(spinlock_t *lp) +static inline void __raw_spin_lock(raw_spinlock_t *lp) { unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); @@ -53,7 +47,7 @@ static inline void _raw_spin_lock(spinlock_t *lp) _raw_spin_lock_wait(lp, pc); } -static inline int _raw_spin_trylock(spinlock_t *lp) +static inline int __raw_spin_trylock(raw_spinlock_t *lp) { unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); @@ -62,7 +56,7 @@ static inline int _raw_spin_trylock(spinlock_t *lp) return _raw_spin_trylock_retry(lp, pc); } -static inline void _raw_spin_unlock(spinlock_t *lp) +static inline void __raw_spin_unlock(raw_spinlock_t *lp) { _raw_compare_and_swap(&lp->lock, lp->lock, 0); } @@ -77,36 +71,25 @@ static inline void _raw_spin_unlock(spinlock_t *lp) * irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -typedef struct { - volatile unsigned int lock; - volatile unsigned long owner_pc; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) /** * read_can_lock - would read_trylock() succeed? * @lock: the rwlock in question. */ -#define read_can_lock(x) ((int)(x)->lock >= 0) +#define __raw_read_can_lock(x) ((int)(x)->lock >= 0) /** * write_can_lock - would write_trylock() succeed? * @lock: the rwlock in question. */ -#define write_can_lock(x) ((x)->lock == 0) +#define __raw_write_can_lock(x) ((x)->lock == 0) -extern void _raw_read_lock_wait(rwlock_t *lp); -extern int _raw_read_trylock_retry(rwlock_t *lp); -extern void _raw_write_lock_wait(rwlock_t *lp); -extern int _raw_write_trylock_retry(rwlock_t *lp); +extern void _raw_read_lock_wait(raw_rwlock_t *lp); +extern int _raw_read_trylock_retry(raw_rwlock_t *lp); +extern void _raw_write_lock_wait(raw_rwlock_t *lp); +extern int _raw_write_trylock_retry(raw_rwlock_t *lp); -static inline void _raw_read_lock(rwlock_t *rw) +static inline void __raw_read_lock(raw_rwlock_t *rw) { unsigned int old; old = rw->lock & 0x7fffffffU; @@ -114,7 +97,7 @@ static inline void _raw_read_lock(rwlock_t *rw) _raw_read_lock_wait(rw); } -static inline void _raw_read_unlock(rwlock_t *rw) +static inline void __raw_read_unlock(raw_rwlock_t *rw) { unsigned int old, cmp; @@ -125,18 +108,18 @@ static inline void _raw_read_unlock(rwlock_t *rw) } while (cmp != old); } -static inline void _raw_write_lock(rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) _raw_write_lock_wait(rw); } -static inline void _raw_write_unlock(rwlock_t *rw) +static inline void __raw_write_unlock(raw_rwlock_t *rw) { _raw_compare_and_swap(&rw->lock, 0x80000000, 0); } -static inline int _raw_read_trylock(rwlock_t *rw) +static inline int __raw_read_trylock(raw_rwlock_t *rw) { unsigned int old; old = rw->lock & 0x7fffffffU; @@ -145,7 +128,7 @@ static inline int _raw_read_trylock(rwlock_t *rw) return _raw_read_trylock_retry(rw); } -static inline int _raw_write_trylock(rwlock_t *rw) +static inline int __raw_write_trylock(raw_rwlock_t *rw) { if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) return 1; diff --git a/include/asm-s390/spinlock_types.h b/include/asm-s390/spinlock_types.h new file mode 100644 index 00000000000..f79a2216204 --- /dev/null +++ b/include/asm-s390/spinlock_types.h @@ -0,0 +1,21 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int lock; +} __attribute__ ((aligned (4))) raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int lock; + volatile unsigned int owner_pc; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0, 0 } + +#endif diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index 831e52ee45b..614a8c13b72 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h @@ -587,10 +587,6 @@ static inline int generic_irq_demux(int irq) #define irq_canonicalize(irq) (irq) #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) -struct irqaction; -struct pt_regs; -int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); - #if defined(CONFIG_CPU_SUBTYPE_SH73180) #include <asm/irq-sh73180.h> #endif diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h index e770b55649e..846322d4c35 100644 --- a/include/asm-sh/spinlock.h +++ b/include/asm-sh/spinlock.h @@ -15,20 +15,11 @@ /* * Your basic SMP spinlocks, allowing only a single CPU anywhere */ -typedef struct { - volatile unsigned long lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) - -#define spin_is_locked(x) ((x)->lock != 0) -#define spin_unlock_wait(x) do { barrier(); } while (spin_is_locked(x)) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_is_locked(x) ((x)->lock != 0) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) +#define __raw_spin_unlock_wait(x) \ + do { cpu_relax(); } while (__raw_spin_is_locked(x)) /* * Simple spin lock operations. There are two variants, one clears IRQ's @@ -36,7 +27,7 @@ typedef struct { * * We make no fairness assumptions. They have a cost. */ -static inline void _raw_spin_lock(spinlock_t *lock) +static inline void __raw_spin_lock(raw_spinlock_t *lock) { __asm__ __volatile__ ( "1:\n\t" @@ -49,14 +40,14 @@ static inline void _raw_spin_lock(spinlock_t *lock) ); } -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { assert_spin_locked(lock); lock->lock = 0; } -#define _raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock)) +#define __raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock)) /* * Read-write spinlocks, allowing multiple readers but only one writer. @@ -66,51 +57,40 @@ static inline void _raw_spin_unlock(spinlock_t *lock) * needs to get a irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -typedef struct { - spinlock_t lock; - atomic_t counter; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RW_LOCK_BIAS 0x01000000 -#define RW_LOCK_UNLOCKED (rwlock_t) { { 0 }, { RW_LOCK_BIAS } } -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0) - -static inline void _raw_read_lock(rwlock_t *rw) + +static inline void __raw_read_lock(raw_rwlock_t *rw) { - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); atomic_inc(&rw->counter); - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); } -static inline void _raw_read_unlock(rwlock_t *rw) +static inline void __raw_read_unlock(raw_rwlock_t *rw) { - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); atomic_dec(&rw->counter); - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); } -static inline void _raw_write_lock(rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { - _raw_spin_lock(&rw->lock); + __raw_spin_lock(&rw->lock); atomic_set(&rw->counter, -1); } -static inline void _raw_write_unlock(rwlock_t *rw) +static inline void __raw_write_unlock(raw_rwlock_t *rw) { atomic_set(&rw->counter, 0); - _raw_spin_unlock(&rw->lock); + __raw_spin_unlock(&rw->lock); } -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) -static inline int _raw_write_trylock(rwlock_t *rw) +static inline int __raw_write_trylock(raw_rwlock_t *rw) { if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter)) return 1; @@ -121,4 +101,3 @@ static inline int _raw_write_trylock(rwlock_t *rw) } #endif /* __ASM_SH_SPINLOCK_H */ - diff --git a/include/asm-sh/spinlock_types.h b/include/asm-sh/spinlock_types.h new file mode 100644 index 00000000000..8c41b6c3aac --- /dev/null +++ b/include/asm-sh/spinlock_types.h @@ -0,0 +1,22 @@ +#ifndef __ASM_SH_SPINLOCK_TYPES_H +#define __ASM_SH_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned long lock; +} raw_spinlock_t; + +#define __SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + raw_spinlock_t lock; + atomic_t counter; +} raw_rwlock_t; + +#define RW_LOCK_BIAS 0x01000000 +#define __RAW_RW_LOCK_UNLOCKED { { 0 }, { RW_LOCK_BIAS } } + +#endif diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h index dd9d94d7e0a..a8ecb2d6977 100644 --- a/include/asm-sparc/ptrace.h +++ b/include/asm-sparc/ptrace.h @@ -73,11 +73,11 @@ extern void show_regs(struct pt_regs *); #endif /* - * The asm_offsets.h is a generated file, so we cannot include it. + * The asm-offsets.h is a generated file, so we cannot include it. * It may be OK for glibc headers, but it's utterly pointless for C code. * The assembly code using those offsets has to include it explicitly. */ -/* #include <asm/asm_offsets.h> */ +/* #include <asm/asm-offsets.h> */ /* These are for pt_regs. */ #define PT_PSR 0x0 diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index 0cbd87ad491..111727a2bb4 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -12,96 +12,12 @@ #include <asm/psr.h> -#ifdef CONFIG_DEBUG_SPINLOCK -struct _spinlock_debug { - unsigned char lock; - unsigned long owner_pc; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -}; -typedef struct _spinlock_debug spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0 } -#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) -#define spin_is_locked(lp) (*((volatile unsigned char *)(&((lp)->lock))) != 0) -#define spin_unlock_wait(lp) do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock)) - -extern void _do_spin_lock(spinlock_t *lock, char *str); -extern int _spin_trylock(spinlock_t *lock); -extern void _do_spin_unlock(spinlock_t *lock); - -#define _raw_spin_trylock(lp) _spin_trylock(lp) -#define _raw_spin_lock(lock) _do_spin_lock(lock, "spin_lock") -#define _raw_spin_unlock(lock) _do_spin_unlock(lock) - -struct _rwlock_debug { - volatile unsigned int lock; - unsigned long owner_pc; - unsigned long reader_pc[NR_CPUS]; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -}; -typedef struct _rwlock_debug rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, {0} } - -#define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) - -extern void _do_read_lock(rwlock_t *rw, char *str); -extern void _do_read_unlock(rwlock_t *rw, char *str); -extern void _do_write_lock(rwlock_t *rw, char *str); -extern void _do_write_unlock(rwlock_t *rw); - -#define _raw_read_lock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_read_lock(lock, "read_lock"); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_read_unlock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_read_unlock(lock, "read_unlock"); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_write_lock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_write_lock(lock, "write_lock"); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_write_unlock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_write_unlock(lock); \ - local_irq_restore(flags); \ -} while(0) - -#else /* !CONFIG_DEBUG_SPINLOCK */ - -typedef struct { - unsigned char lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } - -#define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0) -#define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) +#define __raw_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) -#define spin_unlock_wait(lock) \ -do { \ - barrier(); \ -} while(*((volatile unsigned char *)lock)) +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) -extern __inline__ void _raw_spin_lock(spinlock_t *lock) +extern __inline__ void __raw_spin_lock(raw_spinlock_t *lock) { __asm__ __volatile__( "\n1:\n\t" @@ -121,7 +37,7 @@ extern __inline__ void _raw_spin_lock(spinlock_t *lock) : "g2", "memory", "cc"); } -extern __inline__ int _raw_spin_trylock(spinlock_t *lock) +extern __inline__ int __raw_spin_trylock(raw_spinlock_t *lock) { unsigned int result; __asm__ __volatile__("ldstub [%1], %0" @@ -131,7 +47,7 @@ extern __inline__ int _raw_spin_trylock(spinlock_t *lock) return (result == 0); } -extern __inline__ void _raw_spin_unlock(spinlock_t *lock) +extern __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) { __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); } @@ -147,23 +63,11 @@ extern __inline__ void _raw_spin_unlock(spinlock_t *lock) * * XXX This might create some problems with my dual spinlock * XXX scheme, deadlocks etc. -DaveM - */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } - -#define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) - - -/* Sort of like atomic_t's on Sparc, but even more clever. + * + * Sort of like atomic_t's on Sparc, but even more clever. * * ------------------------------------ - * | 24-bit counter | wlock | rwlock_t + * | 24-bit counter | wlock | raw_rwlock_t * ------------------------------------ * 31 8 7 0 * @@ -174,9 +78,9 @@ typedef struct { * * Unfortunately this scheme limits us to ~16,000,000 cpus. */ -extern __inline__ void _read_lock(rwlock_t *rw) +extern __inline__ void __read_lock(raw_rwlock_t *rw) { - register rwlock_t *lp asm("g1"); + register raw_rwlock_t *lp asm("g1"); lp = rw; __asm__ __volatile__( "mov %%o7, %%g4\n\t" @@ -187,16 +91,16 @@ extern __inline__ void _read_lock(rwlock_t *rw) : "g2", "g4", "memory", "cc"); } -#define _raw_read_lock(lock) \ +#define __raw_read_lock(lock) \ do { unsigned long flags; \ local_irq_save(flags); \ - _read_lock(lock); \ + __raw_read_lock(lock); \ local_irq_restore(flags); \ } while(0) -extern __inline__ void _read_unlock(rwlock_t *rw) +extern __inline__ void __read_unlock(raw_rwlock_t *rw) { - register rwlock_t *lp asm("g1"); + register raw_rwlock_t *lp asm("g1"); lp = rw; __asm__ __volatile__( "mov %%o7, %%g4\n\t" @@ -207,16 +111,16 @@ extern __inline__ void _read_unlock(rwlock_t *rw) : "g2", "g4", "memory", "cc"); } -#define _raw_read_unlock(lock) \ +#define __raw_read_unlock(lock) \ do { unsigned long flags; \ local_irq_save(flags); \ - _read_unlock(lock); \ + __raw_read_unlock(lock); \ local_irq_restore(flags); \ } while(0) -extern __inline__ void _raw_write_lock(rwlock_t *rw) +extern __inline__ void __raw_write_lock(raw_rwlock_t *rw) { - register rwlock_t *lp asm("g1"); + register raw_rwlock_t *lp asm("g1"); lp = rw; __asm__ __volatile__( "mov %%o7, %%g4\n\t" @@ -227,11 +131,9 @@ extern __inline__ void _raw_write_lock(rwlock_t *rw) : "g2", "g4", "memory", "cc"); } -#define _raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) - -#endif /* CONFIG_DEBUG_SPINLOCK */ +#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) #endif /* !(__ASSEMBLY__) */ diff --git a/include/asm-sparc/spinlock_types.h b/include/asm-sparc/spinlock_types.h new file mode 100644 index 00000000000..0a0fb116c4e --- /dev/null +++ b/include/asm-sparc/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __SPARC_SPINLOCK_TYPES_H +#define __SPARC_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + unsigned char lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index a4ab0ec7143..89bd71b1c0d 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h @@ -269,6 +269,8 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); +extern struct resource *pcibios_select_root(struct pci_dev *, struct resource *); + static inline void pcibios_add_platform_entries(struct pci_dev *dev) { } diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index a02c4370eb4..ec85d12d73b 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -29,24 +29,13 @@ * must be pre-V9 branches. */ -#ifndef CONFIG_DEBUG_SPINLOCK +#define __raw_spin_is_locked(lp) ((lp)->lock != 0) -typedef struct { - volatile unsigned char lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) {0,} +#define __raw_spin_unlock_wait(lp) \ + do { rmb(); \ + } while((lp)->lock) -#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) -#define spin_is_locked(lp) ((lp)->lock != 0) - -#define spin_unlock_wait(lp) \ -do { rmb(); \ -} while((lp)->lock) - -static inline void _raw_spin_lock(spinlock_t *lock) +static inline void __raw_spin_lock(raw_spinlock_t *lock) { unsigned long tmp; @@ -67,7 +56,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) : "memory"); } -static inline int _raw_spin_trylock(spinlock_t *lock) +static inline int __raw_spin_trylock(raw_spinlock_t *lock) { unsigned long result; @@ -81,7 +70,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock) return (result == 0UL); } -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { __asm__ __volatile__( " membar #StoreStore | #LoadStore\n" @@ -91,7 +80,7 @@ static inline void _raw_spin_unlock(spinlock_t *lock) : "memory"); } -static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) +static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) { unsigned long tmp1, tmp2; @@ -115,51 +104,9 @@ static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) : "memory"); } -#else /* !(CONFIG_DEBUG_SPINLOCK) */ - -typedef struct { - volatile unsigned char lock; - unsigned int owner_pc, owner_cpu; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0xff } -#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) -#define spin_is_locked(__lock) ((__lock)->lock != 0) -#define spin_unlock_wait(__lock) \ -do { \ - rmb(); \ -} while((__lock)->lock) - -extern void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller); -extern void _do_spin_unlock(spinlock_t *lock); -extern int _do_spin_trylock(spinlock_t *lock, unsigned long caller); - -#define _raw_spin_trylock(lp) \ - _do_spin_trylock(lp, (unsigned long) __builtin_return_address(0)) -#define _raw_spin_lock(lock) \ - _do_spin_lock(lock, "spin_lock", \ - (unsigned long) __builtin_return_address(0)) -#define _raw_spin_unlock(lock) _do_spin_unlock(lock) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) - -#endif /* CONFIG_DEBUG_SPINLOCK */ - /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ -#ifndef CONFIG_DEBUG_SPINLOCK - -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; -#define RW_LOCK_UNLOCKED (rwlock_t) {0,} -#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) - -static void inline __read_lock(rwlock_t *lock) +static void inline __read_lock(raw_rwlock_t *lock) { unsigned long tmp1, tmp2; @@ -184,7 +131,7 @@ static void inline __read_lock(rwlock_t *lock) : "memory"); } -static void inline __read_unlock(rwlock_t *lock) +static void inline __read_unlock(raw_rwlock_t *lock) { unsigned long tmp1, tmp2; @@ -201,7 +148,7 @@ static void inline __read_unlock(rwlock_t *lock) : "memory"); } -static void inline __write_lock(rwlock_t *lock) +static void inline __write_lock(raw_rwlock_t *lock) { unsigned long mask, tmp1, tmp2; @@ -228,7 +175,7 @@ static void inline __write_lock(rwlock_t *lock) : "memory"); } -static void inline __write_unlock(rwlock_t *lock) +static void inline __write_unlock(raw_rwlock_t *lock) { __asm__ __volatile__( " membar #LoadStore | #StoreStore\n" @@ -238,7 +185,7 @@ static void inline __write_unlock(rwlock_t *lock) : "memory"); } -static int inline __write_trylock(rwlock_t *lock) +static int inline __write_trylock(raw_rwlock_t *lock) { unsigned long mask, tmp1, tmp2, result; @@ -263,78 +210,15 @@ static int inline __write_trylock(rwlock_t *lock) return result; } -#define _raw_read_lock(p) __read_lock(p) -#define _raw_read_unlock(p) __read_unlock(p) -#define _raw_write_lock(p) __write_lock(p) -#define _raw_write_unlock(p) __write_unlock(p) -#define _raw_write_trylock(p) __write_trylock(p) - -#else /* !(CONFIG_DEBUG_SPINLOCK) */ - -typedef struct { - volatile unsigned long lock; - unsigned int writer_pc, writer_cpu; - unsigned int reader_pc[NR_CPUS]; -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; -#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } } -#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) - -extern void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller); -extern void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller); -extern void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller); -extern void _do_write_unlock(rwlock_t *rw, unsigned long caller); -extern int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller); - -#define _raw_read_lock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_read_lock(lock, "read_lock", \ - (unsigned long) __builtin_return_address(0)); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_read_unlock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_read_unlock(lock, "read_unlock", \ - (unsigned long) __builtin_return_address(0)); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_write_lock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_write_lock(lock, "write_lock", \ - (unsigned long) __builtin_return_address(0)); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_write_unlock(lock) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - _do_write_unlock(lock, \ - (unsigned long) __builtin_return_address(0)); \ - local_irq_restore(flags); \ -} while(0) - -#define _raw_write_trylock(lock) \ -({ unsigned long flags; \ - int val; \ - local_irq_save(flags); \ - val = _do_write_trylock(lock, "write_trylock", \ - (unsigned long) __builtin_return_address(0)); \ - local_irq_restore(flags); \ - val; \ -}) - -#endif /* CONFIG_DEBUG_SPINLOCK */ - -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) -#define read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) -#define write_can_lock(rw) (!(rw)->lock) +#define __raw_read_lock(p) __read_lock(p) +#define __raw_read_unlock(p) __read_unlock(p) +#define __raw_write_lock(p) __write_lock(p) +#define __raw_write_unlock(p) __write_unlock(p) +#define __raw_write_trylock(p) __write_trylock(p) + +#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) +#define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) +#define __raw_write_can_lock(rw) (!(rw)->lock) #endif /* !(__ASSEMBLY__) */ diff --git a/include/asm-sparc64/spinlock_types.h b/include/asm-sparc64/spinlock_types.h new file mode 100644 index 00000000000..e128112a0d7 --- /dev/null +++ b/include/asm-sparc64/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __SPARC64_SPINLOCK_TYPES_H +#define __SPARC64_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned char lock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 0 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { 0 } + +#endif diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 5e94c05dc2f..b5417529f6f 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -28,13 +28,48 @@ enum sparc_cpu { #define ARCH_SUN4C_SUN4 0 #define ARCH_SUN4 0 -extern void mb(void); -extern void rmb(void); -extern void wmb(void); -extern void membar_storeload(void); -extern void membar_storeload_storestore(void); -extern void membar_storeload_loadload(void); -extern void membar_storestore_loadstore(void); +/* These are here in an effort to more fully work around Spitfire Errata + * #51. Essentially, if a memory barrier occurs soon after a mispredicted + * branch, the chip can stop executing instructions until a trap occurs. + * Therefore, if interrupts are disabled, the chip can hang forever. + * + * It used to be believed that the memory barrier had to be right in the + * delay slot, but a case has been traced recently wherein the memory barrier + * was one instruction after the branch delay slot and the chip still hung. + * The offending sequence was the following in sym_wakeup_done() of the + * sym53c8xx_2 driver: + * + * call sym_ccb_from_dsa, 0 + * movge %icc, 0, %l0 + * brz,pn %o0, .LL1303 + * mov %o0, %l2 + * membar #LoadLoad + * + * The branch has to be mispredicted for the bug to occur. Therefore, we put + * the memory barrier explicitly into a "branch always, predicted taken" + * delay slot to avoid the problem case. + */ +#define membar_safe(type) \ +do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ + " membar " type "\n" \ + "1:\n" \ + : : : "memory"); \ +} while (0) + +#define mb() \ + membar_safe("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad") +#define rmb() \ + membar_safe("#LoadLoad") +#define wmb() \ + membar_safe("#StoreStore") +#define membar_storeload() \ + membar_safe("#StoreLoad") +#define membar_storeload_storestore() \ + membar_safe("#StoreLoad | #StoreStore") +#define membar_storeload_loadload() \ + membar_safe("#StoreLoad | #LoadLoad") +#define membar_storestore_loadstore() \ + membar_safe("#StoreStore | #LoadStore") #endif diff --git a/include/asm-um/page.h b/include/asm-um/page.h index bd850a24918..2c192abe9ae 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h @@ -96,8 +96,7 @@ extern unsigned long uml_physmem; #define __va_space (8*1024*1024) -extern unsigned long to_phys(void *virt); -extern void *to_virt(unsigned long phys); +#include "mem.h" /* Cast to unsigned long before casting to void * to avoid a warning from * mmap_kmem about cutting a long long down to a void *. Not sure that diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index b48e0966ecd..ed06170e0ed 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h @@ -326,14 +326,22 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval) } #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) -extern phys_t page_to_phys(struct page *page); - /* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern pte_t mk_pte(struct page *page, pgprot_t pgprot); +#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) +#define __virt_to_page(virt) phys_to_page(__pa(virt)) +#define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) + +#define mk_pte(page, pgprot) \ + ({ pte_t pte; \ + \ + pte_set_val(pte, page_to_phys(page), (pgprot)); \ + if (pte_present(pte)) \ + pte_mknewprot(pte_mknewpage(pte)); \ + pte;}) static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { @@ -410,8 +418,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) #endif #endif -extern struct page *phys_to_page(const unsigned long phys); -extern struct page *__virt_to_page(const unsigned long virt); #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) /* diff --git a/include/asm-um/spinlock_types.h b/include/asm-um/spinlock_types.h new file mode 100644 index 00000000000..e5a94294bf8 --- /dev/null +++ b/include/asm-um/spinlock_types.h @@ -0,0 +1,6 @@ +#ifndef __UM_SPINLOCK_TYPES_H +#define __UM_SPINLOCK_TYPES_H + +#include "asm/arch/spinlock_types.h" + +#endif diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index dc8c981af27..aa1c7b2e438 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h @@ -101,7 +101,7 @@ __acpi_release_global_lock (unsigned int *lock) :"=r"(n_hi), "=r"(n_lo) \ :"0"(n_hi), "1"(n_lo)) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int acpi_lapic; extern int acpi_ioapic; extern int acpi_noirq; @@ -121,17 +121,6 @@ static inline void disable_acpi(void) #define FIX_ACPI_PAGES 4 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); - -#else /* !CONFIG_ACPI_BOOT */ -#define acpi_lapic 0 -#define acpi_ioapic 0 -#endif /* !CONFIG_ACPI_BOOT */ - -extern int acpi_numa; -extern int acpi_scan_nodes(unsigned long start, unsigned long end); -#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) - -#ifdef CONFIG_ACPI_PCI static inline void acpi_noirq_set(void) { acpi_noirq = 1; } static inline void acpi_disable_pci(void) { @@ -139,11 +128,19 @@ static inline void acpi_disable_pci(void) acpi_noirq_set(); } extern int acpi_irq_balance_set(char *str); -#else + +#else /* !CONFIG_ACPI */ + +#define acpi_lapic 0 +#define acpi_ioapic 0 static inline void acpi_noirq_set(void) { } static inline void acpi_disable_pci(void) { } -static inline int acpi_irq_balance_set(char *str) { return 0; } -#endif + +#endif /* !CONFIG_ACPI */ + +extern int acpi_numa; +extern int acpi_scan_nodes(unsigned long start, unsigned long end); +#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) #ifdef CONFIG_ACPI_SLEEP diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index 16ec82e16b2..6c5d5ca8383 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h @@ -109,9 +109,10 @@ extern unsigned int nmi_watchdog; #define NMI_LOCAL_APIC 2 #define NMI_INVALID 3 +extern int disable_timer_pin_1; + #endif /* CONFIG_X86_LOCAL_APIC */ -#define esr_disable 0 extern unsigned boot_cpu_id; #endif /* __ASM_APIC_H */ diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index 9388062c4f6..fb1c99ac669 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h @@ -113,6 +113,7 @@ #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) #define MAX_IO_APICS 128 +#define MAX_LOCAL_APIC 256 /* * All x86-64 systems are xAPIC compatible. diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h index eed78566728..80ac1fe966a 100644 --- a/include/asm-x86_64/bug.h +++ b/include/asm-x86_64/bug.h @@ -9,10 +9,8 @@ */ struct bug_frame { unsigned char ud2[2]; - unsigned char mov; - /* should use 32bit offset instead, but the assembler doesn't - like it */ - char *filename; + unsigned char push; + signed int filename; unsigned char ret; unsigned short line; } __attribute__((packed)); @@ -25,8 +23,8 @@ struct bug_frame { The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ #define BUG() \ asm volatile( \ - "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ - "i"(__LINE__), "i" (__stringify(__FILE__))) + "ud2 ; pushq $%c1 ; ret $%c0" :: \ + "i"(__LINE__), "i" (__FILE__)) void out_of_line_bug(void); #else static inline void out_of_line_bug(void) { } diff --git a/include/asm-x86_64/calling.h b/include/asm-x86_64/calling.h index 0bc12655fa5..fc2c5a6c262 100644 --- a/include/asm-x86_64/calling.h +++ b/include/asm-x86_64/calling.h @@ -65,27 +65,36 @@ .if \skipr11 .else movq (%rsp),%r11 + CFI_RESTORE r11 .endif .if \skipr8910 .else movq 1*8(%rsp),%r10 + CFI_RESTORE r10 movq 2*8(%rsp),%r9 + CFI_RESTORE r9 movq 3*8(%rsp),%r8 + CFI_RESTORE r8 .endif .if \skiprax .else movq 4*8(%rsp),%rax + CFI_RESTORE rax .endif .if \skiprcx .else movq 5*8(%rsp),%rcx + CFI_RESTORE rcx .endif .if \skiprdx .else movq 6*8(%rsp),%rdx + CFI_RESTORE rdx .endif movq 7*8(%rsp),%rsi + CFI_RESTORE rsi movq 8*8(%rsp),%rdi + CFI_RESTORE rdi .if ARG_SKIP+\addskip > 0 addq $ARG_SKIP+\addskip,%rsp CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip) @@ -124,11 +133,17 @@ .macro RESTORE_REST movq (%rsp),%r15 + CFI_RESTORE r15 movq 1*8(%rsp),%r14 + CFI_RESTORE r14 movq 2*8(%rsp),%r13 + CFI_RESTORE r13 movq 3*8(%rsp),%r12 + CFI_RESTORE r12 movq 4*8(%rsp),%rbp + CFI_RESTORE rbp movq 5*8(%rsp),%rbx + CFI_RESTORE rbx addq $REST_SKIP,%rsp CFI_ADJUST_CFA_OFFSET -(REST_SKIP) .endm @@ -146,11 +161,3 @@ .macro icebp .byte 0xf1 .endm - -#ifdef CONFIG_FRAME_POINTER -#define ENTER enter -#define LEAVE leave -#else -#define ENTER -#define LEAVE -#endif diff --git a/include/asm-x86_64/current.h b/include/asm-x86_64/current.h index 7db560ee6f7..bc8adecee66 100644 --- a/include/asm-x86_64/current.h +++ b/include/asm-x86_64/current.h @@ -17,7 +17,7 @@ static inline struct task_struct *get_current(void) #else #ifndef ASM_OFFSET_H -#include <asm/offset.h> +#include <asm/asm-offsets.h> #endif #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h index c89b58bebee..594e610f4a1 100644 --- a/include/asm-x86_64/desc.h +++ b/include/asm-x86_64/desc.h @@ -191,7 +191,7 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu) /* * load one particular LDT into the current CPU */ -extern inline void load_LDT_nolock (mm_context_t *pc, int cpu) +static inline void load_LDT_nolock (mm_context_t *pc, int cpu) { int count = pc->size; diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h index a416dc31634..e784fdc524f 100644 --- a/include/asm-x86_64/dma-mapping.h +++ b/include/asm-x86_64/dma-mapping.h @@ -85,6 +85,11 @@ static inline void dma_sync_single_for_device(struct device *hwdev, flush_write_buffers(); } +#define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \ + dma_sync_single_for_cpu(dev, dma_handle, size, dir) +#define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \ + dma_sync_single_for_device(dev, dma_handle, size, dir) + static inline void dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, int nelems, int direction) diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h index afd4212e860..582757fc036 100644 --- a/include/asm-x86_64/dwarf2.h +++ b/include/asm-x86_64/dwarf2.h @@ -24,6 +24,10 @@ #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset #define CFI_OFFSET .cfi_offset #define CFI_REL_OFFSET .cfi_rel_offset +#define CFI_REGISTER .cfi_register +#define CFI_RESTORE .cfi_restore +#define CFI_REMEMBER_STATE .cfi_remember_state +#define CFI_RESTORE_STATE .cfi_restore_state #else @@ -36,6 +40,10 @@ #define CFI_ADJUST_CFA_OFFSET # #define CFI_OFFSET # #define CFI_REL_OFFSET # +#define CFI_REGISTER # +#define CFI_RESTORE # +#define CFI_REMEMBER_STATE # +#define CFI_RESTORE_STATE # #endif diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h index cf8b16cbe8d..a582cfcf223 100644 --- a/include/asm-x86_64/fixmap.h +++ b/include/asm-x86_64/fixmap.h @@ -76,7 +76,7 @@ extern void __this_fixmap_does_not_exist(void); * directly without translation, we catch the bug with a NULL-deference * kernel oops. Illegal ranges of incoming indices are caught too. */ -extern inline unsigned long fix_to_virt(const unsigned int idx) +static inline unsigned long fix_to_virt(const unsigned int idx) { /* * this branch gets completely eliminated after inlining, diff --git a/include/asm-x86_64/hardirq.h b/include/asm-x86_64/hardirq.h index 27c381fa1c9..8661b476fb4 100644 --- a/include/asm-x86_64/hardirq.h +++ b/include/asm-x86_64/hardirq.h @@ -9,11 +9,12 @@ #define __ARCH_IRQ_STAT 1 -/* Generate a lvalue for a pda member. Should fix softirq.c instead to use - special access macros. This would generate better code. */ -#define __IRQ_STAT(cpu,member) (read_pda(me)->member) +#define local_softirq_pending() read_pda(__softirq_pending) -#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ +#define __ARCH_SET_SOFTIRQ_PENDING 1 + +#define set_softirq_pending(x) write_pda(__softirq_pending, (x)) +#define or_softirq_pending(x) or_pda(__softirq_pending, (x)) /* * 'what should we do if we get a hw irq event on an illegal vector'. diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h index 2b5cb2865d2..dc97668ea0f 100644 --- a/include/asm-x86_64/hw_irq.h +++ b/include/asm-x86_64/hw_irq.h @@ -26,6 +26,7 @@ struct hw_interrupt_type; #endif +#define NMI_VECTOR 0x02 /* * IDT vectors usable for external interrupt sources start * at 0x20: @@ -50,14 +51,15 @@ struct hw_interrupt_type; */ #define SPURIOUS_APIC_VECTOR 0xff #define ERROR_APIC_VECTOR 0xfe -#define INVALIDATE_TLB_VECTOR 0xfd -#define RESCHEDULE_VECTOR 0xfc -#define TASK_MIGRATION_VECTOR 0xfb -#define CALL_FUNCTION_VECTOR 0xfa -#define KDB_VECTOR 0xf9 - -#define THERMAL_APIC_VECTOR 0xf0 - +#define RESCHEDULE_VECTOR 0xfd +#define CALL_FUNCTION_VECTOR 0xfc +#define KDB_VECTOR 0xfb /* reserved for KDB */ +#define THERMAL_APIC_VECTOR 0xfa +/* 0xf9 free */ +#define INVALIDATE_TLB_VECTOR_END 0xf8 +#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */ + +#define NUM_INVALIDATE_TLB_VECTORS 8 /* * Local APIC timer IRQ vector is on a different priority level, diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h index 37fc3f149a5..52ff269fe05 100644 --- a/include/asm-x86_64/io.h +++ b/include/asm-x86_64/io.h @@ -48,7 +48,7 @@ * Talk about misusing macros.. */ #define __OUT1(s,x) \ -extern inline void out##s(unsigned x value, unsigned short port) { +static inline void out##s(unsigned x value, unsigned short port) { #define __OUT2(s,s1,s2) \ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" @@ -58,7 +58,7 @@ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ __OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ #define __IN1(s) \ -extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; +static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; #define __IN2(s,s1,s2) \ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" @@ -68,12 +68,12 @@ __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ #define __INS(s) \ -extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ +static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ { __asm__ __volatile__ ("rep ; ins" #s \ : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } #define __OUTS(s) \ -extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ +static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ { __asm__ __volatile__ ("rep ; outs" #s \ : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } @@ -110,12 +110,12 @@ __OUTS(l) * Change virtual addresses to physical addresses and vv. * These are pretty trivial */ -extern inline unsigned long virt_to_phys(volatile void * address) +static inline unsigned long virt_to_phys(volatile void * address) { return __pa(address); } -extern inline void * phys_to_virt(unsigned long address) +static inline void * phys_to_virt(unsigned long address) { return __va(address); } @@ -130,7 +130,7 @@ extern inline void * phys_to_virt(unsigned long address) extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags); -extern inline void __iomem * ioremap (unsigned long offset, unsigned long size) +static inline void __iomem * ioremap (unsigned long offset, unsigned long size) { return __ioremap(offset, size, 0); } diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h index a8babd2bbe8..ee1bc69aec9 100644 --- a/include/asm-x86_64/io_apic.h +++ b/include/asm-x86_64/io_apic.h @@ -201,7 +201,7 @@ extern int skip_ioapic_setup; */ #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern int io_apic_get_version (int ioapic); extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int); diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h index 5e166b9d3bd..022e9d340ad 100644 --- a/include/asm-x86_64/ipi.h +++ b/include/asm-x86_64/ipi.h @@ -31,9 +31,20 @@ static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, unsigned int dest) { - unsigned int icr = APIC_DM_FIXED | shortcut | vector | dest; - if (vector == KDB_VECTOR) - icr = (icr & (~APIC_VECTOR_MASK)) | APIC_DM_NMI; + unsigned int icr = shortcut | dest; + + switch (vector) { + default: + icr |= APIC_DM_FIXED | vector; + break; + case NMI_VECTOR: + /* + * Setup KDB IPI to be delivered as an NMI + */ + case KDB_VECTOR: + icr |= APIC_DM_NMI; + break; + } return icr; } @@ -66,7 +77,7 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, unsign /* * Send the IPI. The write to APIC_ICR fires this off. */ - apic_write_around(APIC_ICR, cfg); + apic_write(APIC_ICR, cfg); } @@ -92,7 +103,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) * prepare target chip field */ cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); - apic_write_around(APIC_ICR2, cfg); + apic_write(APIC_ICR2, cfg); /* * program the ICR @@ -102,7 +113,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) /* * Send the IPI. The write to APIC_ICR fires this off. */ - apic_write_around(APIC_ICR, cfg); + apic_write(APIC_ICR, cfg); } local_irq_restore(flags); } diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index 4482657777b..fb724ba37ae 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h @@ -48,10 +48,6 @@ static __inline__ int irq_canonicalize(int irq) #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ #endif -struct irqaction; -struct pt_regs; -int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); - #ifdef CONFIG_HOTPLUG_CPU #include <linux/cpumask.h> extern void fixup_irqs(cpumask_t map); diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h index b90341994d8..f604e84c530 100644 --- a/include/asm-x86_64/kdebug.h +++ b/include/asm-x86_64/kdebug.h @@ -46,7 +46,7 @@ extern void die(const char *,struct pt_regs *,long); extern void __die(const char *,struct pt_regs *,long); extern void show_registers(struct pt_regs *regs); extern void dump_pagetable(unsigned long); -extern void oops_begin(void); -extern void oops_end(void); +extern unsigned long oops_begin(void); +extern void oops_end(unsigned long); #endif diff --git a/include/asm-x86_64/local.h b/include/asm-x86_64/local.h index c954f15c1a7..3e72c41727c 100644 --- a/include/asm-x86_64/local.h +++ b/include/asm-x86_64/local.h @@ -29,7 +29,7 @@ static __inline__ void local_dec(local_t *v) :"m" (v->counter)); } -static __inline__ void local_add(unsigned long i, local_t *v) +static __inline__ void local_add(unsigned int i, local_t *v) { __asm__ __volatile__( "addl %1,%0" @@ -37,7 +37,7 @@ static __inline__ void local_add(unsigned long i, local_t *v) :"ir" (i), "m" (v->counter)); } -static __inline__ void local_sub(unsigned long i, local_t *v) +static __inline__ void local_sub(unsigned int i, local_t *v) { __asm__ __volatile__( "subl %1,%0" diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h index 768413751b3..b40c661f111 100644 --- a/include/asm-x86_64/mmzone.h +++ b/include/asm-x86_64/mmzone.h @@ -12,7 +12,7 @@ #include <asm/smp.h> -#define NODEMAPSIZE 0xff +#define NODEMAPSIZE 0xfff /* Simple perfect hash to map physical addresses to node numbers */ extern int memnode_shift; @@ -54,7 +54,7 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) #define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \ ({ u8 nid__ = pfn_to_nid(pfn); \ - nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) + nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); })) #endif #define local_mapnr(kvaddr) \ diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 331f6a3c72a..f267e10c023 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h @@ -179,7 +179,7 @@ extern int mpc_default_type; extern unsigned long mp_lapic_addr; extern int pic_mode; -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI extern void mp_register_lapic (u8 id, u8 enabled); extern void mp_register_lapic_address (u64 address); diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index ba15279a79d..4d727f3f555 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h @@ -29,22 +29,37 @@ #define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) /* wrmsr with exception handling */ -#define wrmsr_safe(msr,a,b) ({ int ret__; \ - asm volatile("2: wrmsr ; xorl %0,%0\n" \ - "1:\n\t" \ - ".section .fixup,\"ax\"\n\t" \ - "3: movl %4,%0 ; jmp 1b\n\t" \ - ".previous\n\t" \ - ".section __ex_table,\"a\"\n" \ - " .align 8\n\t" \ - " .quad 2b,3b\n\t" \ - ".previous" \ - : "=a" (ret__) \ - : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ +#define wrmsr_safe(msr,a,b) ({ int ret__; \ + asm volatile("2: wrmsr ; xorl %0,%0\n" \ + "1:\n\t" \ + ".section .fixup,\"ax\"\n\t" \ + "3: movl %4,%0 ; jmp 1b\n\t" \ + ".previous\n\t" \ + ".section __ex_table,\"a\"\n" \ + " .align 8\n\t" \ + " .quad 2b,3b\n\t" \ + ".previous" \ + : "=a" (ret__) \ + : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \ ret__; }) #define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32)) +#define rdmsr_safe(msr,a,b) \ + ({ int ret__; \ + asm volatile ("1: rdmsr\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + "3: movl %4,%0\n" \ + " jmp 2b\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .align 8\n" \ + " .quad 1b,3b\n" \ + ".previous":"=&bDS" (ret__), "=a"(a), "=d"(b)\ + :"c"(msr), "i"(-EIO), "0"(0)); \ + ret__; }) + #define rdtsc(low,high) \ __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) @@ -64,7 +79,7 @@ : "=a" (low), "=d" (high) \ : "c" (counter)) -extern inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, +static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { __asm__("cpuid" @@ -90,7 +105,7 @@ static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, /* * CPUID functions returning a single datum */ -extern inline unsigned int cpuid_eax(unsigned int op) +static inline unsigned int cpuid_eax(unsigned int op) { unsigned int eax; @@ -100,7 +115,7 @@ extern inline unsigned int cpuid_eax(unsigned int op) : "bx", "cx", "dx"); return eax; } -extern inline unsigned int cpuid_ebx(unsigned int op) +static inline unsigned int cpuid_ebx(unsigned int op) { unsigned int eax, ebx; @@ -110,7 +125,7 @@ extern inline unsigned int cpuid_ebx(unsigned int op) : "cx", "dx" ); return ebx; } -extern inline unsigned int cpuid_ecx(unsigned int op) +static inline unsigned int cpuid_ecx(unsigned int op) { unsigned int eax, ecx; @@ -120,7 +135,7 @@ extern inline unsigned int cpuid_ecx(unsigned int op) : "bx", "dx" ); return ecx; } -extern inline unsigned int cpuid_edx(unsigned int op) +static inline unsigned int cpuid_edx(unsigned int op) { unsigned int eax, edx; diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 5c363a1482e..bcf55c3f7f7 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h @@ -9,6 +9,7 @@ struct node { }; extern int compute_hash_shift(struct node *nodes, int numnodes); +extern int pxm_to_node(int nid); #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) @@ -16,6 +17,8 @@ extern void numa_add_cpu(int cpu); extern void numa_init_array(void); extern int numa_off; +extern unsigned char apicid_to_node[256]; + #define NUMA_NO_NODE 0xff #endif diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 135ffaa0393..e5ab4d231f2 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h @@ -32,6 +32,8 @@ #ifdef __KERNEL__ #ifndef __ASSEMBLY__ +extern unsigned long end_pfn; + void clear_page(void *); void copy_page(void *, void *); @@ -111,7 +113,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; #ifdef CONFIG_FLATMEM #define pfn_to_page(pfn) (mem_map + (pfn)) #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) -#define pfn_valid(pfn) ((pfn) < max_mapnr) +#define pfn_valid(pfn) ((pfn) < end_pfn) #endif #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index eeb3088a1c9..5a82a6762c2 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h @@ -50,10 +50,10 @@ extern int iommu_setup(char *opt); * address space. The networking and block device layers use * this boolean for bounce buffer decisions * - * On AMD64 it mostly equals, but we set it to zero to tell some subsystems - * that an IOMMU is available. + * On x86-64 it mostly equals, but we set it to zero to tell some subsystems + * that an hard or soft IOMMU is available. */ -#define PCI_DMA_BUS_IS_PHYS (no_iommu ? 1 : 0) +#define PCI_DMA_BUS_IS_PHYS 0 /* * x86-64 always supports DAC, but sometimes it is useful to force diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h index 36b766cfc4d..bbf89aa8a1a 100644 --- a/include/asm-x86_64/pda.h +++ b/include/asm-x86_64/pda.h @@ -10,10 +10,8 @@ struct x8664_pda { struct task_struct *pcurrent; /* Current process */ unsigned long data_offset; /* Per cpu data offset from linker address */ - struct x8664_pda *me; /* Pointer to itself */ unsigned long kernelstack; /* top of kernel stack for current */ unsigned long oldrsp; /* user rsp for system call */ - unsigned long irqrsp; /* Old rsp for interrupts. */ int irqcount; /* Irq nesting counter. Starts with -1 */ int cpunumber; /* Logical CPU number */ char *irqstackptr; /* top of irqstack */ @@ -22,7 +20,7 @@ struct x8664_pda { struct mm_struct *active_mm; int mmu_state; unsigned apic_timer_irqs; -} ____cacheline_aligned; +} ____cacheline_aligned_in_smp; #define IRQSTACK_ORDER 2 @@ -42,13 +40,14 @@ extern void __bad_pda_field(void); #define pda_offset(field) offsetof(struct x8664_pda, field) #define pda_to_op(op,field,val) do { \ + typedef typeof_field(struct x8664_pda, field) T__; \ switch (sizeof_field(struct x8664_pda, field)) { \ case 2: \ -asm volatile(op "w %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ +asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ case 4: \ -asm volatile(op "l %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ +asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ case 8: \ -asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ +asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ default: __bad_pda_field(); \ } \ } while (0) @@ -58,7 +57,7 @@ asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); bre * Unfortunately removing them causes all hell to break lose currently. */ #define pda_from_op(op,field) ({ \ - typedef typeof_field(struct x8664_pda, field) T__; T__ ret__; \ + typeof_field(struct x8664_pda, field) ret__; \ switch (sizeof_field(struct x8664_pda, field)) { \ case 2: \ asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ @@ -75,6 +74,7 @@ asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); b #define write_pda(field,val) pda_to_op("mov",field,val) #define add_pda(field,val) pda_to_op("add",field,val) #define sub_pda(field,val) pda_to_op("sub",field,val) +#define or_pda(field,val) pda_to_op("or",field,val) #endif diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h index deadd146978..08cad2482bc 100644 --- a/include/asm-x86_64/pgalloc.h +++ b/include/asm-x86_64/pgalloc.h @@ -18,12 +18,12 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); } -extern __inline__ pmd_t *get_pmd(void) +static inline pmd_t *get_pmd(void) { return (pmd_t *)get_zeroed_page(GFP_KERNEL); } -extern __inline__ void pmd_free(pmd_t *pmd) +static inline void pmd_free(pmd_t *pmd) { BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); free_page((unsigned long)pmd); @@ -86,13 +86,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add /* Should really implement gc for free page table pages. This could be done with a reference count in struct page. */ -extern __inline__ void pte_free_kernel(pte_t *pte) +static inline void pte_free_kernel(pte_t *pte) { BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); free_page((unsigned long)pte); } -extern inline void pte_free(struct page *pte) +static inline void pte_free(struct page *pte) { __free_page(pte); } diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 5e0f2fdab0d..1dc110ba82d 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h @@ -85,7 +85,7 @@ static inline void set_pud(pud_t *dst, pud_t val) pud_val(*dst) = pud_val(val); } -extern inline void pud_clear (pud_t *pud) +static inline void pud_clear (pud_t *pud) { set_pud(pud, __pud(0)); } @@ -95,7 +95,7 @@ static inline void set_pgd(pgd_t *dst, pgd_t val) pgd_val(*dst) = pgd_val(val); } -extern inline void pgd_clear (pgd_t * pgd) +static inline void pgd_clear (pgd_t * pgd) { set_pgd(pgd, __pgd(0)); } @@ -375,7 +375,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) } /* Change flags of a PTE */ -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) +static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte_val(pte) &= _PAGE_CHG_MASK; pte_val(pte) |= pgprot_val(newprot); diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index a8321999448..03837d34fba 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -254,7 +254,13 @@ struct thread_struct { u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; } __attribute__((aligned(16))); -#define INIT_THREAD {} +#define INIT_THREAD { \ + .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ +} + +#define INIT_TSS { \ + .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ +} #define INIT_MMAP \ { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } @@ -375,13 +381,13 @@ struct extended_sigtable { #define ASM_NOP_MAX 8 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ -extern inline void rep_nop(void) +static inline void rep_nop(void) { __asm__ __volatile__("rep;nop": : :"memory"); } /* Stop speculative execution */ -extern inline void sync_core(void) +static inline void sync_core(void) { int tmp; asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 6c813eb521f..dbb37b0adb4 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h @@ -8,7 +8,6 @@ struct cpuinfo_x86; struct pt_regs; -extern void get_cpu_vendor(struct cpuinfo_x86*); extern void start_kernel(void); extern void pda_init(int); @@ -75,9 +74,6 @@ extern void acpi_reserve_bootmem(void); extern void swap_low_mappings(void); -extern void oops_begin(void); -extern void die(const char *,struct pt_regs *,long); -extern void __die(const char * str, struct pt_regs * regs, long err); extern void __show_regs(struct pt_regs * regs); extern void show_regs(struct pt_regs * regs); @@ -94,8 +90,6 @@ extern int unhandled_signal(struct task_struct *tsk, int sig); extern void select_idle_routine(const struct cpuinfo_x86 *c); extern void swiotlb_init(void); -extern unsigned long max_mapnr; -extern unsigned long end_pfn; extern unsigned long table_start, table_end; extern int exception_trace; diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h index fe9b96d9481..f8d55798535 100644 --- a/include/asm-x86_64/signal.h +++ b/include/asm-x86_64/signal.h @@ -143,23 +143,23 @@ typedef struct sigaltstack { #undef __HAVE_ARCH_SIG_BITOPS #if 0 -extern __inline__ void sigaddset(sigset_t *set, int _sig) +static inline void sigaddset(sigset_t *set, int _sig) { __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); } -extern __inline__ void sigdelset(sigset_t *set, int _sig) +static inline void sigdelset(sigset_t *set, int _sig) { __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); } -extern __inline__ int __const_sigismember(sigset_t *set, int _sig) +static inline int __const_sigismember(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1))); } -extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) +static inline int __gen_sigismember(sigset_t *set, int _sig) { int ret; __asm__("btq %2,%1\n\tsbbq %0,%0" @@ -172,7 +172,7 @@ extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) __const_sigismember((set),(sig)) : \ __gen_sigismember((set),(sig))) -extern __inline__ int sigfindinword(unsigned long word) +static inline int sigfindinword(unsigned long word) { __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc"); return word; diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index de8b57b2b62..24e32611f0b 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h @@ -72,7 +72,7 @@ static inline int num_booting_cpus(void) #define raw_smp_processor_id() read_pda(cpunumber) -extern __inline int hard_smp_processor_id(void) +static inline int hard_smp_processor_id(void) { /* we don't want to mark this access volatile - bad code generation */ return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h index 5aeb57a3baa..69636831ad2 100644 --- a/include/asm-x86_64/spinlock.h +++ b/include/asm-x86_64/spinlock.h @@ -6,47 +6,21 @@ #include <asm/page.h> #include <linux/config.h> -extern int printk(const char * fmt, ...) - __attribute__ ((format (printf, 1, 2))); - /* * Your basic SMP spinlocks, allowing only a single CPU anywhere - */ - -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned magic; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} spinlock_t; - -#define SPINLOCK_MAGIC 0xdead4ead - -#ifdef CONFIG_DEBUG_SPINLOCK -#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC -#else -#define SPINLOCK_MAGIC_INIT /* */ -#endif - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } - -#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) - -/* + * * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. * * We make no fairness assumptions. They have a cost. + * + * (the type definitions are in asm/spinlock_types.h) */ -#define spin_is_locked(x) (*(volatile signed char *)(&(x)->lock) <= 0) -#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) +#define __raw_spin_is_locked(x) \ + (*(volatile signed char *)(&(x)->slock) <= 0) -#define spin_lock_string \ +#define __raw_spin_lock_string \ "\n1:\t" \ "lock ; decb %0\n\t" \ "js 2f\n" \ @@ -58,74 +32,40 @@ typedef struct { "jmp 1b\n" \ LOCK_SECTION_END -/* - * This works. Despite all the confusion. - * (except on PPro SMP or if we are using OOSTORE) - * (PPro errata 66, 92) - */ - -#if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) - -#define spin_unlock_string \ +#define __raw_spin_unlock_string \ "movb $1,%0" \ - :"=m" (lock->lock) : : "memory" - - -static inline void _raw_spin_unlock(spinlock_t *lock) -{ -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(lock->magic != SPINLOCK_MAGIC); - assert_spin_locked(lock); -#endif - __asm__ __volatile__( - spin_unlock_string - ); -} - -#else - -#define spin_unlock_string \ - "xchgb %b0, %1" \ - :"=q" (oldval), "=m" (lock->lock) \ - :"0" (oldval) : "memory" + :"=m" (lock->slock) : : "memory" -static inline void _raw_spin_unlock(spinlock_t *lock) +static inline void __raw_spin_lock(raw_spinlock_t *lock) { - char oldval = 1; -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(lock->magic != SPINLOCK_MAGIC); - assert_spin_locked(lock); -#endif __asm__ __volatile__( - spin_unlock_string - ); + __raw_spin_lock_string + :"=m" (lock->slock) : : "memory"); } -#endif +#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) -static inline int _raw_spin_trylock(spinlock_t *lock) +static inline int __raw_spin_trylock(raw_spinlock_t *lock) { char oldval; + __asm__ __volatile__( "xchgb %b0,%1" - :"=q" (oldval), "=m" (lock->lock) + :"=q" (oldval), "=m" (lock->slock) :"0" (0) : "memory"); + return oldval > 0; } -static inline void _raw_spin_lock(spinlock_t *lock) +static inline void __raw_spin_unlock(raw_spinlock_t *lock) { -#ifdef CONFIG_DEBUG_SPINLOCK - if (lock->magic != SPINLOCK_MAGIC) { - printk("eip: %p\n", __builtin_return_address(0)); - BUG(); - } -#endif __asm__ __volatile__( - spin_lock_string - :"=m" (lock->lock) : : "memory"); + __raw_spin_unlock_string + ); } +#define __raw_spin_unlock_wait(lock) \ + do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) /* * Read-write spinlocks, allowing multiple readers @@ -136,33 +76,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. - */ -typedef struct { - volatile unsigned int lock; -#ifdef CONFIG_DEBUG_SPINLOCK - unsigned magic; -#endif -#ifdef CONFIG_PREEMPT - unsigned int break_lock; -#endif -} rwlock_t; - -#define RWLOCK_MAGIC 0xdeaf1eed - -#ifdef CONFIG_DEBUG_SPINLOCK -#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC -#else -#define RWLOCK_MAGIC_INIT /* */ -#endif - -#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) - -#define read_can_lock(x) ((int)(x)->lock > 0) -#define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) - -/* + * * On x86, we implement read-write locks as a 32-bit counter * with the high bit (sign) being the "contended" bit. * @@ -170,29 +84,24 @@ typedef struct { * * Changed to use the same technique as rw semaphores. See * semaphore.h for details. -ben + * + * the helpers are in arch/i386/kernel/semaphore.c */ -/* the spinlock helpers are in arch/i386/kernel/semaphore.c */ -static inline void _raw_read_lock(rwlock_t *rw) +#define __raw_read_can_lock(x) ((int)(x)->lock > 0) +#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) + +static inline void __raw_read_lock(raw_rwlock_t *rw) { -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(rw->magic != RWLOCK_MAGIC); -#endif __build_read_lock(rw, "__read_lock_failed"); } -static inline void _raw_write_lock(rwlock_t *rw) +static inline void __raw_write_lock(raw_rwlock_t *rw) { -#ifdef CONFIG_DEBUG_SPINLOCK - BUG_ON(rw->magic != RWLOCK_MAGIC); -#endif __build_write_lock(rw, "__write_lock_failed"); } -#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") -#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory") - -static inline int _raw_read_trylock(rwlock_t *lock) +static inline int __raw_read_trylock(raw_rwlock_t *lock) { atomic_t *count = (atomic_t *)lock; atomic_dec(count); @@ -202,7 +111,7 @@ static inline int _raw_read_trylock(rwlock_t *lock) return 0; } -static inline int _raw_write_trylock(rwlock_t *lock) +static inline int __raw_write_trylock(raw_rwlock_t *lock) { atomic_t *count = (atomic_t *)lock; if (atomic_sub_and_test(RW_LOCK_BIAS, count)) @@ -211,4 +120,15 @@ static inline int _raw_write_trylock(rwlock_t *lock) return 0; } +static inline void __raw_read_unlock(raw_rwlock_t *rw) +{ + asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); +} + +static inline void __raw_write_unlock(raw_rwlock_t *rw) +{ + asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0" + : "=m" (rw->lock) : : "memory"); +} + #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-x86_64/spinlock_types.h b/include/asm-x86_64/spinlock_types.h new file mode 100644 index 00000000000..59efe849f35 --- /dev/null +++ b/include/asm-x86_64/spinlock_types.h @@ -0,0 +1,20 @@ +#ifndef __ASM_SPINLOCK_TYPES_H +#define __ASM_SPINLOCK_TYPES_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +typedef struct { + volatile unsigned int slock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 1 } + +typedef struct { + volatile unsigned int lock; +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } + +#endif diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 8606e170a7d..85348e02ad2 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h @@ -188,7 +188,7 @@ static inline void write_cr4(unsigned long val) #define __xg(x) ((volatile long *)(x)) -extern inline void set_64bit(volatile unsigned long *ptr, unsigned long val) +static inline void set_64bit(volatile unsigned long *ptr, unsigned long val) { *ptr = val; } @@ -253,19 +253,19 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, case 2: __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "r"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; case 4: __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "r"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; case 8: __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "r"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; } diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h index 24ecf6a637c..f971f45d6d7 100644 --- a/include/asm-x86_64/timex.h +++ b/include/asm-x86_64/timex.h @@ -6,7 +6,6 @@ #ifndef _ASMx8664_TIMEX_H #define _ASMx8664_TIMEX_H -#include <linux/config.h> #include <asm/8253pit.h> #include <asm/msr.h> #include <asm/vsyscall.h> diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h index 505b0cf906d..4a9c20ea9b1 100644 --- a/include/asm-x86_64/tlbflush.h +++ b/include/asm-x86_64/tlbflush.h @@ -109,6 +109,10 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st #define TLBSTATE_OK 1 #define TLBSTATE_LAZY 2 +/* Roughly an IPI every 20MB with 4k pages for freeing page table + ranges. Cost is about 42k of memory for each CPU. */ +#define ARCH_FREE_PTE_NR 5350 + #endif #define flush_tlb_kernel_range(start, end) flush_tlb_all() diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index c1bc3fad482..1c603cd7e4d 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h @@ -13,7 +13,6 @@ extern cpumask_t cpu_online_map; extern unsigned char cpu_to_node[]; -extern unsigned char pci_bus_to_node[]; extern cpumask_t node_to_cpumask[]; #ifdef CONFIG_ACPI_NUMA @@ -26,7 +25,7 @@ extern int __node_distance(int, int); #define parent_node(node) (node) #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) #define node_to_cpumask(node) (node_to_cpumask[node]) -#define pcibus_to_node(bus) pci_bus_to_node[(bus)->number] +#define pcibus_to_node(bus) ((long)(bus->sysdata)) #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); /* sched_domains SD_NODE_INIT for x86_64 machines */ diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index 2872da23fc7..438a3f52f83 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h @@ -29,7 +29,6 @@ enum vsyscall_num { struct vxtime_data { long hpet_address; /* HPET base address */ - unsigned long hz; /* HPET clocks / sec */ int last; unsigned long last_tsc; long quot; diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h index 2848a5ff834..aa4fd7fb3ce 100644 --- a/include/asm-xtensa/ptrace.h +++ b/include/asm-xtensa/ptrace.h @@ -127,7 +127,7 @@ extern void show_regs(struct pt_regs *); #else /* __ASSEMBLY__ */ #ifdef __KERNEL__ -# include <asm/offsets.h> +# include <asm/asm-offsets.h> #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) #endif diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h index fc268ac923c..06a22b83ba1 100644 --- a/include/asm-xtensa/uaccess.h +++ b/include/asm-xtensa/uaccess.h @@ -25,7 +25,7 @@ #define _ASMLANGUAGE #include <asm/current.h> -#include <asm/offsets.h> +#include <asm/asm-offsets.h> #include <asm/processor.h> /* diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b46a5205ee7..026c3c011dc 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -41,7 +41,7 @@ #include <asm/acpi.h> -#ifdef CONFIG_ACPI_BOOT +#ifdef CONFIG_ACPI enum acpi_irq_model_id { ACPI_IRQ_MODEL_PIC = 0, @@ -429,23 +429,13 @@ extern int pci_mmcfg_config_num; extern int sbf_port ; -#else /*!CONFIG_ACPI_BOOT*/ +#else /* !CONFIG_ACPI */ #define acpi_mp_config 0 -static inline int acpi_boot_init(void) -{ - return 0; -} - -static inline int acpi_boot_table_init(void) -{ - return 0; -} +#endif /* !CONFIG_ACPI */ -#endif /*!CONFIG_ACPI_BOOT*/ - -unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); +int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); /* @@ -455,7 +445,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); */ void acpi_unregister_gsi (u32 gsi); -#ifdef CONFIG_ACPI_PCI +#ifdef CONFIG_ACPI struct acpi_prt_entry { struct list_head node; @@ -489,7 +479,7 @@ struct acpi_pci_driver { int acpi_pci_register_driver(struct acpi_pci_driver *driver); void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); -#endif /*CONFIG_ACPI_PCI*/ +#endif /* CONFIG_ACPI */ #ifdef CONFIG_ACPI_EC @@ -498,20 +488,9 @@ extern int ec_write(u8 addr, u8 val); #endif /*CONFIG_ACPI_EC*/ -#ifdef CONFIG_ACPI_INTERPRETER - extern int acpi_blacklisted(void); extern void acpi_bios_year(char *s); -#else /*!CONFIG_ACPI_INTERPRETER*/ - -static inline int acpi_blacklisted(void) -{ - return 0; -} - -#endif /*!CONFIG_ACPI_INTERPRETER*/ - #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */ #ifdef CONFIG_ACPI @@ -549,5 +528,17 @@ static inline int acpi_get_pxm(acpi_handle handle) extern int pnpacpi_disabled; +#else /* CONFIG_ACPI */ + +static inline int acpi_boot_init(void) +{ + return 0; +} + +static inline int acpi_boot_table_init(void) +{ + return 0; +} + #endif /* CONFIG_ACPI */ #endif /*_LINUX_ACPI_H*/ diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h index f7f0913cd11..c1237aa92e3 100644 --- a/include/linux/bfs_fs.h +++ b/include/linux/bfs_fs.h @@ -14,8 +14,9 @@ #define BFS_INODES_PER_BLOCK 8 /* SVR4 vnode type values (bfs_inode->i_vtype) */ -#define BFS_VDIR 2 -#define BFS_VREG 1 +#define BFS_VDIR 2L +#define BFS_VREG 1L + /* BFS inode layout on disk */ struct bfs_inode { @@ -58,22 +59,22 @@ struct bfs_super_block { __u32 s_padding[118]; }; -#define BFS_NZFILESIZE(ip) \ - (((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE) - -#define BFS_FILESIZE(ip) \ - ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) - -#define BFS_FILEBLOCKS(ip) \ - ((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock) #define BFS_OFF2INO(offset) \ ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) #define BFS_INO2OFF(ino) \ ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) +#define BFS_NZFILESIZE(ip) \ + ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) + +#define BFS_FILESIZE(ip) \ + ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) +#define BFS_FILEBLOCKS(ip) \ + ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) #define BFS_UNCLEAN(bfs_sb, sb) \ - ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY)) + ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) + #endif /* _LINUX_BFS_FS_H */ diff --git a/include/linux/bio.h b/include/linux/bio.h index cdaf03a14a5..6e1c79c8b6b 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -314,9 +314,8 @@ void zero_fill_bio(struct bio *bio); * bvec_kmap_irq and bvec_kunmap_irq!! * * This function MUST be inlined - it plays with the CPU interrupt flags. - * Hence the `extern inline'. */ -extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) +static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) { unsigned long addr; @@ -332,7 +331,7 @@ extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) return (char *) addr + bvec->bv_offset; } -extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) +static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) { unsigned long ptr = (unsigned long) buffer & PAGE_MASK; @@ -345,7 +344,7 @@ extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) #endif -extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, +static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, unsigned long *flags) { return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags); diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h new file mode 100644 index 00000000000..6b20af0bbb7 --- /dev/null +++ b/include/linux/bit_spinlock.h @@ -0,0 +1,77 @@ +#ifndef __LINUX_BIT_SPINLOCK_H +#define __LINUX_BIT_SPINLOCK_H + +/* + * bit-based spin_lock() + * + * Don't use this unless you really need to: spin_lock() and spin_unlock() + * are significantly faster. + */ +static inline void bit_spin_lock(int bitnum, unsigned long *addr) +{ + /* + * Assuming the lock is uncontended, this never enters + * the body of the outer loop. If it is contended, then + * within the inner loop a non-atomic test is used to + * busywait with less bus contention for a good time to + * attempt to acquire the lock bit. + */ + preempt_disable(); +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) + while (test_and_set_bit(bitnum, addr)) { + while (test_bit(bitnum, addr)) { + preempt_enable(); + cpu_relax(); + preempt_disable(); + } + } +#endif + __acquire(bitlock); +} + +/* + * Return true if it was acquired + */ +static inline int bit_spin_trylock(int bitnum, unsigned long *addr) +{ + preempt_disable(); +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) + if (test_and_set_bit(bitnum, addr)) { + preempt_enable(); + return 0; + } +#endif + __acquire(bitlock); + return 1; +} + +/* + * bit-based spin_unlock() + */ +static inline void bit_spin_unlock(int bitnum, unsigned long *addr) +{ +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) + BUG_ON(!test_bit(bitnum, addr)); + smp_mb__before_clear_bit(); + clear_bit(bitnum, addr); +#endif + preempt_enable(); + __release(bitlock); +} + +/* + * Return true if the lock is held. + */ +static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) +{ +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) + return test_bit(bitnum, addr); +#elif defined CONFIG_PREEMPT + return preempt_count(); +#else + return 1; +#endif +} + +#endif /* __LINUX_BIT_SPINLOCK_H */ + diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aefa26fbae8..efdc9b5bc05 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -728,7 +728,7 @@ static inline unsigned int blksize_bits(unsigned int size) return bits; } -extern inline unsigned int block_size(struct block_device *bdev) +static inline unsigned int block_size(struct block_device *bdev) { return bdev->bd_block_size; } diff --git a/include/linux/chio.h b/include/linux/chio.h index 63035ae67e6..a404c111c93 100644 --- a/include/linux/chio.h +++ b/include/linux/chio.h @@ -96,7 +96,7 @@ struct changer_position { */ struct changer_element_status { int ces_type; - unsigned char *ces_data; + unsigned char __user *ces_data; }; #define CESTATUS_FULL 0x01 /* full */ #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ diff --git a/include/linux/connector.h b/include/linux/connector.h new file mode 100644 index 00000000000..96de26301f8 --- /dev/null +++ b/include/linux/connector.h @@ -0,0 +1,158 @@ +/* + * connector.h + * + * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> + * All rights reserved. + * + * 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 __CONNECTOR_H +#define __CONNECTOR_H + +#include <asm/types.h> + +#define CN_IDX_CONNECTOR 0xffffffff +#define CN_VAL_CONNECTOR 0xffffffff + +#define CN_NETLINK_USERS 1 + +/* + * Maximum connector's message size. + */ +#define CONNECTOR_MAX_MSG_SIZE 1024 + +/* + * idx and val are unique identifiers which + * are used for message routing and + * must be registered in connector.h for in-kernel usage. + */ + +struct cb_id { + __u32 idx; + __u32 val; +}; + +struct cn_msg { + struct cb_id id; + + __u32 seq; + __u32 ack; + + __u16 len; /* Length of the following data */ + __u16 flags; + __u8 data[0]; +}; + +/* + * Notify structure - requests notification about + * registering/unregistering idx/val in range [first, first+range]. + */ +struct cn_notify_req { + __u32 first; + __u32 range; +}; + +/* + * Main notification control message + * *_notify_num - number of appropriate cn_notify_req structures after + * this struct. + * group - notification receiver's idx. + * len - total length of the attached data. + */ +struct cn_ctl_msg { + __u32 idx_notify_num; + __u32 val_notify_num; + __u32 group; + __u32 len; + __u8 data[0]; +}; + +#ifdef __KERNEL__ + +#include <asm/atomic.h> + +#include <linux/list.h> +#include <linux/workqueue.h> + +#include <net/sock.h> + +#define CN_CBQ_NAMELEN 32 + +struct cn_queue_dev { + atomic_t refcnt; + unsigned char name[CN_CBQ_NAMELEN]; + + struct workqueue_struct *cn_queue; + + struct list_head queue_list; + spinlock_t queue_lock; + + int netlink_groups; + struct sock *nls; +}; + +struct cn_callback { + unsigned char name[CN_CBQ_NAMELEN]; + + struct cb_id id; + void (*callback) (void *); + void *priv; +}; + +struct cn_callback_entry { + struct list_head callback_entry; + struct cn_callback *cb; + struct work_struct work; + struct cn_queue_dev *pdev; + + void (*destruct_data) (void *); + void *ddata; + + int seq, group; + struct sock *nls; +}; + +struct cn_ctl_entry { + struct list_head notify_entry; + struct cn_ctl_msg *msg; +}; + +struct cn_dev { + struct cb_id id; + + u32 seq, groups; + struct sock *nls; + void (*input) (struct sock * sk, int len); + + struct cn_queue_dev *cbdev; +}; + +int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); +void cn_del_callback(struct cb_id *); +int cn_netlink_send(struct cn_msg *, u32, int); + +int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb); +void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); + +struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); +void cn_queue_free_dev(struct cn_queue_dev *dev); + +int cn_cb_equal(struct cb_id *, struct cb_id *); + +extern int cn_already_initialized; + +#endif /* __KERNEL__ */ +#endif /* __CONNECTOR_H */ diff --git a/include/linux/crc16.h b/include/linux/crc16.h new file mode 100644 index 00000000000..9443c084f88 --- /dev/null +++ b/include/linux/crc16.h @@ -0,0 +1,30 @@ +/* + * crc16.h - CRC-16 routine + * + * Implements the standard CRC-16: + * Width 16 + * Poly 0x8005 (x^16 + x^15 + x^2 + 1) + * Init 0 + * + * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> + * + * This source code is licensed under the GNU General Public License, + * Version 2. See the file COPYING for more details. + */ + +#ifndef __CRC16_H +#define __CRC16_H + +#include <linux/types.h> + +extern u16 const crc16_table[256]; + +extern u16 crc16(u16 crc, const u8 *buffer, size_t len); + +static inline u16 crc16_byte(u16 crc, const u8 data) +{ + return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff]; +} + +#endif /* __CRC16_H */ + diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 007c290f74d..8bf4bacb505 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h @@ -432,7 +432,10 @@ struct dccp_sock { struct ccid *dccps_hc_rx_ccid; struct ccid *dccps_hc_tx_ccid; struct dccp_options_received dccps_options_received; + struct timeval dccps_epoch; enum dccp_role dccps_role:2; + __u8 dccps_hc_rx_insert_options:1; + __u8 dccps_hc_tx_insert_options:1; }; static inline struct dccp_sock *dccp_sk(const struct sock *sk) diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h index e60bfdac348..4932ee5c77f 100644 --- a/include/linux/dmapool.h +++ b/include/linux/dmapool.h @@ -19,7 +19,8 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev, void dma_pool_destroy(struct dma_pool *pool); -void *dma_pool_alloc(struct dma_pool *pool, int mem_flags, dma_addr_t *handle); +void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags, + dma_addr_t *handle); void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); diff --git a/include/linux/dmi.h b/include/linux/dmi.h index c30175e8dec..a415f1d93e9 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h @@ -70,7 +70,7 @@ extern struct dmi_device * dmi_find_device(int type, const char *name, static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } static inline char * dmi_get_system_info(int field) { return NULL; } -static struct dmi_device * dmi_find_device(int type, const char *name, +static inline struct dmi_device * dmi_find_device(int type, const char *name, struct dmi_device *from) { return NULL; } #endif diff --git a/include/linux/fb.h b/include/linux/fb.h index bc24beeed97..82e39cd0c4f 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -107,6 +107,8 @@ #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ +#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ +#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ @@ -495,6 +497,9 @@ struct fb_cursor_user { #define FB_EVENT_BLANK 0x08 /* Private modelist is to be replaced */ #define FB_EVENT_NEW_MODELIST 0x09 +/* The resolution of the passed in fb_info about to change and + all vc's should be changed */ +#define FB_EVENT_MODE_CHANGE_ALL 0x0A struct fb_event { struct fb_info *info; @@ -820,13 +825,29 @@ extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height, u32 shift_high, u32 shift_low, u32 mod); extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); extern void fb_set_suspend(struct fb_info *info, int state); -extern int fb_get_color_depth(struct fb_var_screeninfo *var); +extern int fb_get_color_depth(struct fb_var_screeninfo *var, + struct fb_fix_screeninfo *fix); extern int fb_get_options(char *name, char **option); extern int fb_new_modelist(struct fb_info *info); extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; +static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, + u8 *src, u32 s_pitch, u32 height) +{ + int i, j; + + d_pitch -= s_pitch; + + for (i = height; i--; ) { + /* s_pitch is a few bytes at the most, memcpy is suboptimal */ + for (j = 0; j < s_pitch; j++) + *dst++ = *src++; + dst += d_pitch; + } +} + /* drivers/video/fbsysfs.c */ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); extern void framebuffer_release(struct fb_info *info); @@ -856,8 +877,11 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, extern int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info); extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); -extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs); +extern const unsigned char *fb_firmware_edid(struct device *device); +extern void fb_edid_to_monspecs(unsigned char *edid, + struct fb_monspecs *specs); extern void fb_destroy_modedb(struct fb_videomode *modedb); +extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); /* drivers/video/modedb.c */ #define VESA_MODEDB_SIZE 34 diff --git a/include/linux/file.h b/include/linux/file.h index 5206beb9a80..f5bbd4c508b 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -9,6 +9,7 @@ #include <linux/posix_types.h> #include <linux/compiler.h> #include <linux/spinlock.h> +#include <linux/rcupdate.h> /* * The default fd array needs to be at least BITS_PER_LONG, @@ -16,23 +17,33 @@ */ #define NR_OPEN_DEFAULT BITS_PER_LONG +struct fdtable { + unsigned int max_fds; + int max_fdset; + int next_fd; + struct file ** fd; /* current fd array */ + fd_set *close_on_exec; + fd_set *open_fds; + struct rcu_head rcu; + struct files_struct *free_files; + struct fdtable *next; +}; + /* * Open file table structure */ struct files_struct { atomic_t count; spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ - int max_fds; - int max_fdset; - int next_fd; - struct file ** fd; /* current fd array */ - fd_set *close_on_exec; - fd_set *open_fds; + struct fdtable *fdt; + struct fdtable fdtab; fd_set close_on_exec_init; fd_set open_fds_init; struct file * fd_array[NR_OPEN_DEFAULT]; }; +#define files_fdtable(files) (rcu_dereference((files)->fdt)) + extern void FASTCALL(__fput(struct file *)); extern void FASTCALL(fput(struct file *)); @@ -59,13 +70,16 @@ extern fd_set *alloc_fdset(int); extern void free_fdset(fd_set *, int); extern int expand_files(struct files_struct *, int nr); +extern void free_fdtable(struct fdtable *fdt); +extern void __init files_defer_init(void); static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) { struct file * file = NULL; + struct fdtable *fdt = files_fdtable(files); - if (fd < files->max_fds) - file = files->fd[fd]; + if (fd < fdt->max_fds) + file = rcu_dereference(fdt->fd[fd]); return file; } diff --git a/include/linux/fs.h b/include/linux/fs.h index fd93ab7da90..e0b77c5af9a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -9,6 +9,7 @@ #include <linux/config.h> #include <linux/limits.h> #include <linux/ioctl.h> +#include <linux/rcuref.h> /* * It's silly to have NR_OPEN bigger than NR_FILE, but you can change @@ -597,12 +598,13 @@ struct file { spinlock_t f_ep_lock; #endif /* #ifdef CONFIG_EPOLL */ struct address_space *f_mapping; + struct rcu_head f_rcuhead; }; extern spinlock_t files_lock; #define file_list_lock() spin_lock(&files_lock); #define file_list_unlock() spin_unlock(&files_lock); -#define get_file(x) atomic_inc(&(x)->f_count) +#define get_file(x) rcuref_inc(&(x)->f_count) #define file_count(x) atomic_read(&(x)->f_count) #define MAX_NON_LFS ((1UL<<31) - 1) @@ -1507,8 +1509,6 @@ extern void do_generic_mapping_read(struct address_space *mapping, loff_t *, read_descriptor_t *, read_actor_t); extern void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); -extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb, - const struct iovec *iov, loff_t offset, unsigned long nr_segs); extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, unsigned long nr_segs, loff_t *ppos); ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, diff --git a/include/linux/fuse.h b/include/linux/fuse.h new file mode 100644 index 00000000000..acbeb96a335 --- /dev/null +++ b/include/linux/fuse.h @@ -0,0 +1,259 @@ +/* + FUSE: Filesystem in Userspace + Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> + + This program can be distributed under the terms of the GNU GPL. + See the file COPYING. +*/ + +/* This file defines the kernel interface of FUSE */ + +#include <asm/types.h> + +/** Version number of this interface */ +#define FUSE_KERNEL_VERSION 7 + +/** Minor version number of this interface */ +#define FUSE_KERNEL_MINOR_VERSION 2 + +/** The node ID of the root inode */ +#define FUSE_ROOT_ID 1 + +/** The major number of the fuse character device */ +#define FUSE_MAJOR 10 + +/** The minor number of the fuse character device */ +#define FUSE_MINOR 229 + +/* Make sure all structures are padded to 64bit boundary, so 32bit + userspace works under 64bit kernels */ + +struct fuse_attr { + __u64 ino; + __u64 size; + __u64 blocks; + __u64 atime; + __u64 mtime; + __u64 ctime; + __u32 atimensec; + __u32 mtimensec; + __u32 ctimensec; + __u32 mode; + __u32 nlink; + __u32 uid; + __u32 gid; + __u32 rdev; +}; + +struct fuse_kstatfs { + __u64 blocks; + __u64 bfree; + __u64 bavail; + __u64 files; + __u64 ffree; + __u32 bsize; + __u32 namelen; +}; + +#define FATTR_MODE (1 << 0) +#define FATTR_UID (1 << 1) +#define FATTR_GID (1 << 2) +#define FATTR_SIZE (1 << 3) +#define FATTR_ATIME (1 << 4) +#define FATTR_MTIME (1 << 5) +#define FATTR_CTIME (1 << 6) + +/** + * Flags returned by the OPEN request + * + * FOPEN_DIRECT_IO: bypass page cache for this open file + * FOPEN_KEEP_CACHE: don't invalidate the data cache on open + */ +#define FOPEN_DIRECT_IO (1 << 0) +#define FOPEN_KEEP_CACHE (1 << 1) + +enum fuse_opcode { + FUSE_LOOKUP = 1, + FUSE_FORGET = 2, /* no reply */ + FUSE_GETATTR = 3, + FUSE_SETATTR = 4, + FUSE_READLINK = 5, + FUSE_SYMLINK = 6, + FUSE_MKNOD = 8, + FUSE_MKDIR = 9, + FUSE_UNLINK = 10, + FUSE_RMDIR = 11, + FUSE_RENAME = 12, + FUSE_LINK = 13, + FUSE_OPEN = 14, + FUSE_READ = 15, + FUSE_WRITE = 16, + FUSE_STATFS = 17, + FUSE_RELEASE = 18, + FUSE_FSYNC = 20, + FUSE_SETXATTR = 21, + FUSE_GETXATTR = 22, + FUSE_LISTXATTR = 23, + FUSE_REMOVEXATTR = 24, + FUSE_FLUSH = 25, + FUSE_INIT = 26, + FUSE_OPENDIR = 27, + FUSE_READDIR = 28, + FUSE_RELEASEDIR = 29, + FUSE_FSYNCDIR = 30 +}; + +/* Conservative buffer size for the client */ +#define FUSE_MAX_IN 8192 + +#define FUSE_NAME_MAX 1024 +#define FUSE_SYMLINK_MAX 4096 +#define FUSE_XATTR_SIZE_MAX 4096 + +struct fuse_entry_out { + __u64 nodeid; /* Inode ID */ + __u64 generation; /* Inode generation: nodeid:gen must + be unique for the fs's lifetime */ + __u64 entry_valid; /* Cache timeout for the name */ + __u64 attr_valid; /* Cache timeout for the attributes */ + __u32 entry_valid_nsec; + __u32 attr_valid_nsec; + struct fuse_attr attr; +}; + +struct fuse_forget_in { + __u64 nlookup; +}; + +struct fuse_attr_out { + __u64 attr_valid; /* Cache timeout for the attributes */ + __u32 attr_valid_nsec; + __u32 dummy; + struct fuse_attr attr; +}; + +struct fuse_mknod_in { + __u32 mode; + __u32 rdev; +}; + +struct fuse_mkdir_in { + __u32 mode; + __u32 padding; +}; + +struct fuse_rename_in { + __u64 newdir; +}; + +struct fuse_link_in { + __u64 oldnodeid; +}; + +struct fuse_setattr_in { + __u32 valid; + __u32 padding; + struct fuse_attr attr; +}; + +struct fuse_open_in { + __u32 flags; + __u32 padding; +}; + +struct fuse_open_out { + __u64 fh; + __u32 open_flags; + __u32 padding; +}; + +struct fuse_release_in { + __u64 fh; + __u32 flags; + __u32 padding; +}; + +struct fuse_flush_in { + __u64 fh; + __u32 flush_flags; + __u32 padding; +}; + +struct fuse_read_in { + __u64 fh; + __u64 offset; + __u32 size; + __u32 padding; +}; + +struct fuse_write_in { + __u64 fh; + __u64 offset; + __u32 size; + __u32 write_flags; +}; + +struct fuse_write_out { + __u32 size; + __u32 padding; +}; + +struct fuse_statfs_out { + struct fuse_kstatfs st; +}; + +struct fuse_fsync_in { + __u64 fh; + __u32 fsync_flags; + __u32 padding; +}; + +struct fuse_setxattr_in { + __u32 size; + __u32 flags; +}; + +struct fuse_getxattr_in { + __u32 size; + __u32 padding; +}; + +struct fuse_getxattr_out { + __u32 size; + __u32 padding; +}; + +struct fuse_init_in_out { + __u32 major; + __u32 minor; +}; + +struct fuse_in_header { + __u32 len; + __u32 opcode; + __u64 unique; + __u64 nodeid; + __u32 uid; + __u32 gid; + __u32 pid; + __u32 padding; +}; + +struct fuse_out_header { + __u32 len; + __s32 error; + __u64 unique; +}; + +struct fuse_dirent { + __u64 ino; + __u64 off; + __u32 namelen; + __u32 type; + char name[0]; +}; + +#define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name) +#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) +#define FUSE_DIRENT_SIZE(d) \ + FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h new file mode 100644 index 00000000000..5f3eaf80222 --- /dev/null +++ b/include/linux/i2c-pxa.h @@ -0,0 +1,48 @@ +#ifndef _LINUX_I2C_ALGO_PXA_H +#define _LINUX_I2C_ALGO_PXA_H + +struct i2c_eeprom_emu_watcher { + void (*write)(void *, unsigned int addr, unsigned char newval); +}; + +struct i2c_eeprom_emu_watch { + struct list_head node; + unsigned int start; + unsigned int end; + struct i2c_eeprom_emu_watcher *ops; + void *data; +}; + +#define I2C_EEPROM_EMU_SIZE (256) + +struct i2c_eeprom_emu { + unsigned int size; + unsigned int ptr; + unsigned int seen_start; + struct list_head watch; + + unsigned char bytes[I2C_EEPROM_EMU_SIZE]; +}; + +typedef enum i2c_slave_event_e { + I2C_SLAVE_EVENT_START_READ, + I2C_SLAVE_EVENT_START_WRITE, + I2C_SLAVE_EVENT_STOP +} i2c_slave_event_t; + +struct i2c_slave_client { + void *data; + void (*event)(void *ptr, i2c_slave_event_t event); + int (*read) (void *ptr); + void (*write)(void *ptr, unsigned int val); +}; + +extern int i2c_eeprom_emu_addwatcher(struct i2c_eeprom_emu *, void *data, + unsigned int addr, unsigned int size, + struct i2c_eeprom_emu_watcher *); + +extern void i2c_eeprom_emu_delwatcher(struct i2c_eeprom_emu *, void *data, struct i2c_eeprom_emu_watcher *watcher); + +extern struct i2c_eeprom_emu *i2c_pxa_get_eeprom(void); + +#endif /* _LINUX_I2C_ALGO_PXA_H */ diff --git a/include/linux/in6.h b/include/linux/in6.h index dcf5720ffcb..304aaedea30 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -148,13 +148,13 @@ struct in6_flowlabel_req */ #define IPV6_ADDRFORM 1 -#define IPV6_PKTINFO 2 -#define IPV6_HOPOPTS 3 -#define IPV6_DSTOPTS 4 -#define IPV6_RTHDR 5 -#define IPV6_PKTOPTIONS 6 +#define IPV6_2292PKTINFO 2 +#define IPV6_2292HOPOPTS 3 +#define IPV6_2292DSTOPTS 4 +#define IPV6_2292RTHDR 5 +#define IPV6_2292PKTOPTIONS 6 #define IPV6_CHECKSUM 7 -#define IPV6_HOPLIMIT 8 +#define IPV6_2292HOPLIMIT 8 #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 /* obsolete */ #define IPV6_FLOWINFO 11 @@ -198,4 +198,44 @@ struct in6_flowlabel_req * MCAST_MSFILTER 48 */ +/* + * Advanced API (RFC3542) (1) + * + * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. + */ + +#define IPV6_RECVPKTINFO 49 +#define IPV6_PKTINFO 50 +#define IPV6_RECVHOPLIMIT 51 +#define IPV6_HOPLIMIT 52 +#define IPV6_RECVHOPOPTS 53 +#define IPV6_HOPOPTS 54 +#define IPV6_RTHDRDSTOPTS 55 +#define IPV6_RECVRTHDR 56 +#define IPV6_RTHDR 57 +#define IPV6_RECVDSTOPTS 58 +#define IPV6_DSTOPTS 59 +#if 0 /* not yet */ +#define IPV6_RECVPATHMTU 60 +#define IPV6_PATHMTU 61 +#define IPV6_DONTFRAG 62 +#define IPV6_USE_MIN_MTU 63 +#endif + +/* + * Netfilter + * + * Following socket options are used in ip6_tables; + * see include/linux/netfilter_ipv6/ip6_tables.h. + * + * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 + * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 + */ + +/* + * Advanced API (RFC3542) (2) + */ +#define IPV6_RECVTCLASS 66 +#define IPV6_TCLASS 67 + #endif diff --git a/include/linux/init_task.h b/include/linux/init_task.h index c727c195a91..68ab5f2ab9c 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -2,17 +2,27 @@ #define _LINUX__INIT_TASK_H #include <linux/file.h> +#include <linux/rcupdate.h> -#define INIT_FILES \ -{ \ - .count = ATOMIC_INIT(1), \ - .file_lock = SPIN_LOCK_UNLOCKED, \ +#define INIT_FDTABLE \ +{ \ .max_fds = NR_OPEN_DEFAULT, \ .max_fdset = __FD_SETSIZE, \ .next_fd = 0, \ .fd = &init_files.fd_array[0], \ .close_on_exec = &init_files.close_on_exec_init, \ .open_fds = &init_files.open_fds_init, \ + .rcu = RCU_HEAD_INIT, \ + .free_files = NULL, \ + .next = NULL, \ +} + +#define INIT_FILES \ +{ \ + .count = ATOMIC_INIT(1), \ + .file_lock = SPIN_LOCK_UNLOCKED, \ + .fdt = &init_files.fdtab, \ + .fdtab = INIT_FDTABLE, \ .close_on_exec_init = { { 0, } }, \ .open_fds_init = { { 0, } }, \ .fd_array = { NULL, } \ diff --git a/include/linux/input.h b/include/linux/input.h index 4767e542953..e8c296ff625 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -289,6 +289,8 @@ struct input_absinfo { #define KEY_SCROLLDOWN 178 #define KEY_KPLEFTPAREN 179 #define KEY_KPRIGHTPAREN 180 +#define KEY_NEW 181 +#define KEY_REDO 182 #define KEY_F13 183 #define KEY_F14 184 @@ -335,6 +337,12 @@ struct input_absinfo { #define KEY_KBDILLUMDOWN 229 #define KEY_KBDILLUMUP 230 +#define KEY_SEND 231 +#define KEY_REPLY 232 +#define KEY_FORWARDMAIL 233 +#define KEY_SAVE 234 +#define KEY_DOCUMENTS 235 + #define KEY_UNKNOWN 240 #define BTN_MISC 0x100 diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index d99e7aeb7d3..0a90205184b 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -57,6 +57,11 @@ extern void disable_irq(unsigned int irq); extern void enable_irq(unsigned int irq); #endif +#ifndef __ARCH_SET_SOFTIRQ_PENDING +#define set_softirq_pending(x) (local_softirq_pending() = (x)) +#define or_softirq_pending(x) (local_softirq_pending() |= (x)) +#endif + /* * Temporary defines for UP kernels, until all code gets fixed. */ @@ -123,7 +128,7 @@ struct softirq_action asmlinkage void do_softirq(void); extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); extern void softirq_init(void); -#define __raise_softirq_irqoff(nr) do { local_softirq_pending() |= 1UL << (nr); } while (0) +#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); extern void FASTCALL(raise_softirq(unsigned int nr)); diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 3c7dbc6a0a7..bb6f88e1406 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -68,7 +68,7 @@ struct ipv6_opt_hdr { struct rt0_hdr { struct ipv6_rt_hdr rt_hdr; - __u32 bitmap; /* strict/loose bit map */ + __u32 reserved; struct in6_addr addr[0]; #define rt0_type rt_hdr.type @@ -189,6 +189,7 @@ struct inet6_skb_parm { __u16 dst0; __u16 srcrt; __u16 dst1; + __u16 lastopt; }; #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) @@ -234,14 +235,20 @@ struct ipv6_pinfo { /* pktoption flags */ union { struct { - __u8 srcrt:2, + __u16 srcrt:2, + osrcrt:2, rxinfo:1, + rxoinfo:1, rxhlim:1, + rxohlim:1, hopopts:1, + ohopopts:1, dstopts:1, - rxflow:1; + odstopts:1, + rxflow:1, + rxtclass:1; } bits; - __u8 all; + __u16 all; } rxopt; /* sockopt flags */ @@ -250,6 +257,7 @@ struct ipv6_pinfo { sndflow:1, pmtudisc:2, ipv6only:1; + __u8 tclass; __u32 dst_cookie; @@ -263,6 +271,7 @@ struct ipv6_pinfo { struct ipv6_txoptions *opt; struct rt6_info *rt; int hop_limit; + int tclass; } cork; }; diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 84321a4cac9..de097269bd7 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -28,6 +28,7 @@ #include <linux/buffer_head.h> #include <linux/journal-head.h> #include <linux/stddef.h> +#include <linux/bit_spinlock.h> #include <asm/semaphore.h> #endif diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index d7a2555a886..6acfdbba734 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -254,23 +254,23 @@ static inline u64 get_jiffies_64(void) */ static inline unsigned int jiffies_to_msecs(const unsigned long j) { -#if HZ <= 1000 && !(1000 % HZ) - return (1000 / HZ) * j; -#elif HZ > 1000 && !(HZ % 1000) - return (j + (HZ / 1000) - 1)/(HZ / 1000); +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) + return (MSEC_PER_SEC / HZ) * j; +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) + return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); #else - return (j * 1000) / HZ; + return (j * MSEC_PER_SEC) / HZ; #endif } static inline unsigned int jiffies_to_usecs(const unsigned long j) { -#if HZ <= 1000000 && !(1000000 % HZ) - return (1000000 / HZ) * j; -#elif HZ > 1000000 && !(HZ % 1000000) - return (j + (HZ / 1000000) - 1)/(HZ / 1000000); +#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) + return (USEC_PER_SEC / HZ) * j; +#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) + return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); #else - return (j * 1000000) / HZ; + return (j * USEC_PER_SEC) / HZ; #endif } @@ -278,12 +278,12 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m) { if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; -#if HZ <= 1000 && !(1000 % HZ) - return (m + (1000 / HZ) - 1) / (1000 / HZ); -#elif HZ > 1000 && !(HZ % 1000) - return m * (HZ / 1000); +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) + return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) + return m * (HZ / MSEC_PER_SEC); #else - return (m * HZ + 999) / 1000; + return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC; #endif } @@ -291,12 +291,12 @@ static inline unsigned long usecs_to_jiffies(const unsigned int u) { if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; -#if HZ <= 1000000 && !(1000000 % HZ) - return (u + (1000000 / HZ) - 1) / (1000000 / HZ); -#elif HZ > 1000000 && !(HZ % 1000000) - return u * (HZ / 1000000); +#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) + return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ); +#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) + return u * (HZ / USEC_PER_SEC); #else - return (u * HZ + 999999) / 1000000; + return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC; #endif } diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 94a46f38c53..58385ee1c0a 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -155,6 +155,7 @@ struct mempolicy *get_vma_policy(struct task_struct *task, extern void numa_default_policy(void); extern void numa_policy_init(void); +extern struct mempolicy default_policy; #else diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 6014160d9c0..c1f021eddff 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -109,6 +109,8 @@ struct mmc_host { struct mmc_card *card_selected; /* the selected MMC card */ struct work_struct detect; + + unsigned long private[0] ____cacheline_aligned; }; extern struct mmc_host *mmc_alloc_host(int extra, struct device *); @@ -116,14 +118,18 @@ extern int mmc_add_host(struct mmc_host *); extern void mmc_remove_host(struct mmc_host *); extern void mmc_free_host(struct mmc_host *); -#define mmc_priv(x) ((void *)((x) + 1)) +static inline void *mmc_priv(struct mmc_host *host) +{ + return (void *)host->private; +} + #define mmc_dev(x) ((x)->dev) #define mmc_hostname(x) ((x)->class_dev.class_id) extern int mmc_suspend_host(struct mmc_host *, pm_message_t); extern int mmc_resume_host(struct mmc_host *); -extern void mmc_detect_change(struct mmc_host *); +extern void mmc_detect_change(struct mmc_host *, unsigned long delay); extern void mmc_request_done(struct mmc_host *, struct mmc_request *); #endif diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 16751866893..7bbd25970c9 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -15,6 +15,7 @@ #define NETLINK_ISCSI 8 /* Open-iSCSI */ #define NETLINK_AUDIT 9 /* auditing */ #define NETLINK_FIB_LOOKUP 10 +#define NETLINK_CONNECTOR 11 #define NETLINK_NETFILTER 12 /* netfilter subsystem */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ diff --git a/include/linux/pci.h b/include/linux/pci.h index bc4c40000c0..7349058ed77 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -19,436 +19,10 @@ #include <linux/mod_devicetable.h> -/* - * Under PCI, each device has 256 bytes of configuration address space, - * of which the first 64 bytes are standardized as follows: - */ -#define PCI_VENDOR_ID 0x00 /* 16 bits */ -#define PCI_DEVICE_ID 0x02 /* 16 bits */ -#define PCI_COMMAND 0x04 /* 16 bits */ -#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ -#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ -#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ -#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ -#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ -#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ -#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ -#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ -#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ -#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ -#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ - -#define PCI_STATUS 0x06 /* 16 bits */ -#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ -#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ -#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ -#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ -#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ -#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ -#define PCI_STATUS_DEVSEL_FAST 0x000 -#define PCI_STATUS_DEVSEL_MEDIUM 0x200 -#define PCI_STATUS_DEVSEL_SLOW 0x400 -#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ -#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ -#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ -#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ -#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ - -#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 - revision */ -#define PCI_REVISION_ID 0x08 /* Revision ID */ -#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ -#define PCI_CLASS_DEVICE 0x0a /* Device class */ - -#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ -#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ -#define PCI_HEADER_TYPE 0x0e /* 8 bits */ -#define PCI_HEADER_TYPE_NORMAL 0 -#define PCI_HEADER_TYPE_BRIDGE 1 -#define PCI_HEADER_TYPE_CARDBUS 2 - -#define PCI_BIST 0x0f /* 8 bits */ -#define PCI_BIST_CODE_MASK 0x0f /* Return result */ -#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ -#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ - -/* - * Base addresses specify locations in memory or I/O space. - * Decoded size can be determined by writing a value of - * 0xffffffff to the register, and reading it back. Only - * 1 bits are decoded. - */ -#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ -#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ -#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ -#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ -#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ -#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ -#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ -#define PCI_BASE_ADDRESS_SPACE_IO 0x01 -#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 -#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 -#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ -#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ -#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ -#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ -#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) -#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) -/* bit 1 is reserved if address_space = 1 */ - -/* Header type 0 (normal devices) */ -#define PCI_CARDBUS_CIS 0x28 -#define PCI_SUBSYSTEM_VENDOR_ID 0x2c -#define PCI_SUBSYSTEM_ID 0x2e -#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ -#define PCI_ROM_ADDRESS_ENABLE 0x01 -#define PCI_ROM_ADDRESS_MASK (~0x7ffUL) - -#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ - -/* 0x35-0x3b are reserved */ -#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ -#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ -#define PCI_MIN_GNT 0x3e /* 8 bits */ -#define PCI_MAX_LAT 0x3f /* 8 bits */ - -/* Header type 1 (PCI-to-PCI bridges) */ -#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ -#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ -#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ -#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ -#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ -#define PCI_IO_LIMIT 0x1d -#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ -#define PCI_IO_RANGE_TYPE_16 0x00 -#define PCI_IO_RANGE_TYPE_32 0x01 -#define PCI_IO_RANGE_MASK (~0x0fUL) -#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ -#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ -#define PCI_MEMORY_LIMIT 0x22 -#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL -#define PCI_MEMORY_RANGE_MASK (~0x0fUL) -#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ -#define PCI_PREF_MEMORY_LIMIT 0x26 -#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL -#define PCI_PREF_RANGE_TYPE_32 0x00 -#define PCI_PREF_RANGE_TYPE_64 0x01 -#define PCI_PREF_RANGE_MASK (~0x0fUL) -#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ -#define PCI_PREF_LIMIT_UPPER32 0x2c -#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ -#define PCI_IO_LIMIT_UPPER16 0x32 -/* 0x34 same as for htype 0 */ -/* 0x35-0x3b is reserved */ -#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ -/* 0x3c-0x3d are same as for htype 0 */ -#define PCI_BRIDGE_CONTROL 0x3e -#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ -#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ -#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ -#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ -#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ -#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ -#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ - -/* Header type 2 (CardBus bridges) */ -#define PCI_CB_CAPABILITY_LIST 0x14 -/* 0x15 reserved */ -#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ -#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ -#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ -#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ -#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ -#define PCI_CB_MEMORY_BASE_0 0x1c -#define PCI_CB_MEMORY_LIMIT_0 0x20 -#define PCI_CB_MEMORY_BASE_1 0x24 -#define PCI_CB_MEMORY_LIMIT_1 0x28 -#define PCI_CB_IO_BASE_0 0x2c -#define PCI_CB_IO_BASE_0_HI 0x2e -#define PCI_CB_IO_LIMIT_0 0x30 -#define PCI_CB_IO_LIMIT_0_HI 0x32 -#define PCI_CB_IO_BASE_1 0x34 -#define PCI_CB_IO_BASE_1_HI 0x36 -#define PCI_CB_IO_LIMIT_1 0x38 -#define PCI_CB_IO_LIMIT_1_HI 0x3a -#define PCI_CB_IO_RANGE_MASK (~0x03UL) -/* 0x3c-0x3d are same as for htype 0 */ -#define PCI_CB_BRIDGE_CONTROL 0x3e -#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ -#define PCI_CB_BRIDGE_CTL_SERR 0x02 -#define PCI_CB_BRIDGE_CTL_ISA 0x04 -#define PCI_CB_BRIDGE_CTL_VGA 0x08 -#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 -#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ -#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 -#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 -#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 -#define PCI_CB_SUBSYSTEM_ID 0x42 -#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ -/* 0x48-0x7f reserved */ - -/* Capability lists */ - -#define PCI_CAP_LIST_ID 0 /* Capability ID */ -#define PCI_CAP_ID_PM 0x01 /* Power Management */ -#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ -#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ -#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ -#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ -#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ -#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ -#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ -#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ -#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ -#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ -#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ -#define PCI_CAP_SIZEOF 4 - -/* Power Management Registers */ - -#define PCI_PM_PMC 2 /* PM Capabilities Register */ -#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ -#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ -#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ -#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ -#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ -#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ -#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ -#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ -#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ -#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ -#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ -#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ -#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ -#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ -#define PCI_PM_CTRL 4 /* PM control and status register */ -#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ -#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ -#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ -#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ -#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ -#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ -#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ -#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ -#define PCI_PM_DATA_REGISTER 7 /* (??) */ -#define PCI_PM_SIZEOF 8 - -/* AGP registers */ - -#define PCI_AGP_VERSION 2 /* BCD version number */ -#define PCI_AGP_RFU 3 /* Rest of capability flags */ -#define PCI_AGP_STATUS 4 /* Status register */ -#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ -#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ -#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ -#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ -#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ -#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ -#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ -#define PCI_AGP_COMMAND 8 /* Control register */ -#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ -#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ -#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ -#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ -#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ -#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ -#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ -#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ -#define PCI_AGP_SIZEOF 12 - -/* Vital Product Data */ - -#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ -#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ -#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ -#define PCI_VPD_DATA 4 /* 32-bits of data returned here */ - -/* Slot Identification */ - -#define PCI_SID_ESR 2 /* Expansion Slot Register */ -#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ -#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ -#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ - -/* Message Signalled Interrupts registers */ - -#define PCI_MSI_FLAGS 2 /* Various flags */ -#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ -#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ -#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ -#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ -#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ -#define PCI_MSI_RFU 3 /* Rest of capability flags */ -#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ -#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ -#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ -#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ -#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ - -/* CompactPCI Hotswap Register */ - -#define PCI_CHSWP_CSR 2 /* Control and Status Register */ -#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ -#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ -#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ -#define PCI_CHSWP_LOO 0x08 /* LED On / Off */ -#define PCI_CHSWP_PI 0x30 /* Programming Interface */ -#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ -#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ - -/* PCI-X registers */ - -#define PCI_X_CMD 2 /* Modes & Features */ -#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ -#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ -#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ -#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ -#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ -#define PCI_X_STATUS 4 /* PCI-X capabilities */ -#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ -#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ -#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ -#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ -#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ -#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ -#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ -#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ -#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ -#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ -#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ -#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ -#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ - -/* PCI Express capability registers */ - -#define PCI_EXP_FLAGS 2 /* Capabilities register */ -#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ -#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ -#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ -#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ -#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ -#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ -#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ -#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ -#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ -#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ -#define PCI_EXP_DEVCAP 4 /* Device capabilities */ -#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ -#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ -#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ -#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ -#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ -#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ -#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ -#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ -#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ -#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ -#define PCI_EXP_DEVCTL 8 /* Device Control */ -#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ -#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ -#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ -#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ -#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ -#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ -#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ -#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ -#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ -#define PCI_EXP_DEVSTA 10 /* Device Status */ -#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ -#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ -#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ -#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ -#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ -#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ -#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ -#define PCI_EXP_LNKCTL 16 /* Link Control */ -#define PCI_EXP_LNKSTA 18 /* Link Status */ -#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ -#define PCI_EXP_SLTCTL 24 /* Slot Control */ -#define PCI_EXP_SLTSTA 26 /* Slot Status */ -#define PCI_EXP_RTCTL 28 /* Root Control */ -#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ -#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ -#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ -#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ -#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ -#define PCI_EXP_RTCAP 30 /* Root Capabilities */ -#define PCI_EXP_RTSTA 32 /* Root Status */ - -/* Extended Capabilities (PCI-X 2.0 and Express) */ -#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) -#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) -#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) - -#define PCI_EXT_CAP_ID_ERR 1 -#define PCI_EXT_CAP_ID_VC 2 -#define PCI_EXT_CAP_ID_DSN 3 -#define PCI_EXT_CAP_ID_PWR 4 - -/* Advanced Error Reporting */ -#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ -#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ -#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ -#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ -#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ -#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ -#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ -#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ -#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ -#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ -#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ -#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ -#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ - /* Same bits as above */ -#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ - /* Same bits as above */ -#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ -#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ -#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ -#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ -#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ -#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ -#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ - /* Same bits as above */ -#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ -#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ -#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ -#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ -#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ -#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ -#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ -#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ -#define PCI_ERR_ROOT_STATUS 48 -#define PCI_ERR_ROOT_COR_SRC 52 -#define PCI_ERR_ROOT_SRC 54 - -/* Virtual Channel */ -#define PCI_VC_PORT_REG1 4 -#define PCI_VC_PORT_REG2 8 -#define PCI_VC_PORT_CTRL 12 -#define PCI_VC_PORT_STATUS 14 -#define PCI_VC_RES_CAP 16 -#define PCI_VC_RES_CTRL 20 -#define PCI_VC_RES_STATUS 26 - -/* Power Budgeting */ -#define PCI_PWR_DSR 4 /* Data Select Register */ -#define PCI_PWR_DATA 8 /* Data Register */ -#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ -#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ -#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ -#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ -#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ -#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ -#define PCI_PWR_CAP 12 /* Capability */ -#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ +/* Include the pci register defines */ +#include <linux/pci_regs.h> /* Include the ID list */ - #include <linux/pci_ids.h> /* @@ -496,11 +70,12 @@ enum pci_mmap_state { typedef int __bitwise pci_power_t; -#define PCI_D0 ((pci_power_t __force) 0) -#define PCI_D1 ((pci_power_t __force) 1) -#define PCI_D2 ((pci_power_t __force) 2) +#define PCI_D0 ((pci_power_t __force) 0) +#define PCI_D1 ((pci_power_t __force) 1) +#define PCI_D2 ((pci_power_t __force) 2) #define PCI_D3hot ((pci_power_t __force) 3) #define PCI_D3cold ((pci_power_t __force) 4) +#define PCI_UNKNOWN ((pci_power_t __force) 5) #define PCI_POWER_ERROR ((pci_power_t __force) -1) /* @@ -562,11 +137,6 @@ struct pci_dev { struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ int rom_attr_enabled; /* has display of the rom attribute been enabled? */ struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ -#ifdef CONFIG_PCI_NAMES -#define PCI_NAME_SIZE 255 -#define PCI_NAME_HALF __stringify(43) /* less than half to handle slop */ - char pretty_name[PCI_NAME_SIZE]; /* pretty name for users to see */ -#endif }; #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) @@ -582,15 +152,15 @@ struct pci_dev { * 7-10 bridges: address space assigned to buses behind the bridge */ -#define PCI_ROM_RESOURCE 6 -#define PCI_BRIDGE_RESOURCES 7 -#define PCI_NUM_RESOURCES 11 +#define PCI_ROM_RESOURCE 6 +#define PCI_BRIDGE_RESOURCES 7 +#define PCI_NUM_RESOURCES 11 #ifndef PCI_BUS_NUM_RESOURCES -#define PCI_BUS_NUM_RESOURCES 8 +#define PCI_BUS_NUM_RESOURCES 8 #endif - -#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ + +#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ struct pci_bus { struct list_head node; /* node in list of buses */ @@ -699,7 +269,7 @@ struct pci_driver { * @dev_class_mask: the class mask for this device * * This macro is used to create a struct pci_device_id that matches a - * specific PCI class. The vendor, device, subvendor, and subdevice + * specific PCI class. The vendor, device, subvendor, and subdevice * fields will be set to PCI_ANY_ID. */ #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \ @@ -707,7 +277,7 @@ struct pci_driver { .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID -/* +/* * pci_module_init is obsolete, this stays here till we fix up all usages of it * in the tree. */ @@ -745,12 +315,13 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s pci_bus_add_devices(root_bus); return root_bus; } +struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); +struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); int pci_scan_slot(struct pci_bus *bus, int devfn); struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); +void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); unsigned int pci_scan_child_bus(struct pci_bus *bus); void pci_bus_add_device(struct pci_dev *dev); -void pci_name_device(struct pci_dev *dev); -char *pci_class_name(u32 class); void pci_read_bridge_bases(struct pci_bus *child); struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); @@ -758,6 +329,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev); extern void pci_dev_put(struct pci_dev *dev); extern void pci_remove_bus(struct pci_bus *b); extern void pci_remove_bus_device(struct pci_dev *dev); +void pci_setup_cardbus(struct pci_bus *bus); /* Generic PCI functions exported to card drivers */ @@ -815,13 +387,16 @@ void pci_set_master(struct pci_dev *dev); #define HAVE_PCI_SET_MWI int pci_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); +void pci_intx(struct pci_dev *dev, int enable); int pci_set_dma_mask(struct pci_dev *dev, u64 mask); int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); +void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); int pci_assign_resource(struct pci_dev *dev, int i); +void pci_restore_bars(struct pci_dev *dev); /* ROM control related routines */ -void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); -void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); +void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); +void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); void pci_remove_rom(struct pci_dev *pdev); @@ -865,6 +440,9 @@ const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); +void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), + void *userdata); + /* kmem_cache style wrapper around pci_alloc_consistent() */ #include <linux/dmapool.h> @@ -912,18 +490,26 @@ extern void pci_disable_msix(struct pci_dev *dev); extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); #endif -#endif /* CONFIG_PCI */ - -/* Include architecture-dependent settings and functions */ +/* + * PCI domain support. Sometimes called PCI segment (eg by ACPI), + * a PCI domain is defined to be a set of PCI busses which share + * configuration space. + */ +#ifndef CONFIG_PCI_DOMAINS +static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } +static inline int pci_proc_domain(struct pci_bus *bus) +{ + return 0; +} +#endif -#include <asm/pci.h> +#else /* CONFIG_PCI is not enabled */ /* * If the system does not have PCI, clearly these return errors. Define * these as simple inline functions to avoid hair in drivers. */ -#ifndef CONFIG_PCI #define _PCI_NOP(o,s,t) \ static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ { return PCIBIOS_FUNC_NOT_SUPPORTED; } @@ -974,21 +560,11 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) -#else +#endif /* CONFIG_PCI */ -/* - * PCI domain support. Sometimes called PCI segment (eg by ACPI), - * a PCI domain is defined to be a set of PCI busses which share - * configuration space. - */ -#ifndef CONFIG_PCI_DOMAINS -static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } -static inline int pci_proc_domain(struct pci_bus *bus) -{ - return 0; -} -#endif -#endif /* !CONFIG_PCI */ +/* Include architecture-dependent settings and functions */ + +#include <asm/pci.h> /* these helpers provide future and backwards compatibility * for accessing popular PCI BAR info */ @@ -1025,13 +601,6 @@ static inline char *pci_name(struct pci_dev *pdev) return pdev->dev.bus_id; } -/* Some archs want to see the pretty pci name, so use this macro */ -#ifdef CONFIG_PCI_NAMES -#define pci_pretty_name(dev) ((dev)->pretty_name) -#else -#define pci_pretty_name(dev) "" -#endif - /* Some archs don't want to expose struct resource to userland as-is * in sysfs and /proc @@ -1067,7 +636,7 @@ enum pci_fixup_pass { /* Anonymous variables would be nice... */ #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ - static struct pci_fixup __pci_fixup_##name __attribute_used__ \ + static const struct pci_fixup __pci_fixup_##name __attribute_used__ \ __attribute__((__section__(#section))) = { vendor, device, hook }; #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h new file mode 100644 index 00000000000..e2a089b051e --- /dev/null +++ b/include/linux/pci_regs.h @@ -0,0 +1,448 @@ +/* + * pci_regs.h + * + * PCI standard defines + * Copyright 1994, Drew Eckhardt + * Copyright 1997--1999 Martin Mares <mj@ucw.cz> + * + * For more information, please consult the following manuals (look at + * http://www.pcisig.com/ for how to get them): + * + * PCI BIOS Specification + * PCI Local Bus Specification + * PCI to PCI Bridge Specification + * PCI System Design Guide + */ + +#ifndef LINUX_PCI_REGS_H +#define LINUX_PCI_REGS_H + +/* + * Under PCI, each device has 256 bytes of configuration address space, + * of which the first 64 bytes are standardized as follows: + */ +#define PCI_VENDOR_ID 0x00 /* 16 bits */ +#define PCI_DEVICE_ID 0x02 /* 16 bits */ +#define PCI_COMMAND 0x04 /* 16 bits */ +#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ +#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ +#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ +#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ +#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ +#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ +#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ +#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ +#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ +#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ +#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ + +#define PCI_STATUS 0x06 /* 16 bits */ +#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ +#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ +#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ +#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ +#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ +#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ +#define PCI_STATUS_DEVSEL_FAST 0x000 +#define PCI_STATUS_DEVSEL_MEDIUM 0x200 +#define PCI_STATUS_DEVSEL_SLOW 0x400 +#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ +#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ +#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ +#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ +#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ + +#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ +#define PCI_REVISION_ID 0x08 /* Revision ID */ +#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ +#define PCI_CLASS_DEVICE 0x0a /* Device class */ + +#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ +#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ +#define PCI_HEADER_TYPE 0x0e /* 8 bits */ +#define PCI_HEADER_TYPE_NORMAL 0 +#define PCI_HEADER_TYPE_BRIDGE 1 +#define PCI_HEADER_TYPE_CARDBUS 2 + +#define PCI_BIST 0x0f /* 8 bits */ +#define PCI_BIST_CODE_MASK 0x0f /* Return result */ +#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ +#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ + +/* + * Base addresses specify locations in memory or I/O space. + * Decoded size can be determined by writing a value of + * 0xffffffff to the register, and reading it back. Only + * 1 bits are decoded. + */ +#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ +#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ +#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ +#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ +#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ +#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ +#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ +#define PCI_BASE_ADDRESS_SPACE_IO 0x01 +#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 +#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 +#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ +#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ +#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ +#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) +#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) +/* bit 1 is reserved if address_space = 1 */ + +/* Header type 0 (normal devices) */ +#define PCI_CARDBUS_CIS 0x28 +#define PCI_SUBSYSTEM_VENDOR_ID 0x2c +#define PCI_SUBSYSTEM_ID 0x2e +#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ +#define PCI_ROM_ADDRESS_ENABLE 0x01 +#define PCI_ROM_ADDRESS_MASK (~0x7ffUL) + +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ + +/* 0x35-0x3b are reserved */ +#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ +#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ +#define PCI_MIN_GNT 0x3e /* 8 bits */ +#define PCI_MAX_LAT 0x3f /* 8 bits */ + +/* Header type 1 (PCI-to-PCI bridges) */ +#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ +#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ +#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ +#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ +#define PCI_IO_LIMIT 0x1d +#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ +#define PCI_IO_RANGE_TYPE_16 0x00 +#define PCI_IO_RANGE_TYPE_32 0x01 +#define PCI_IO_RANGE_MASK (~0x0fUL) +#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ +#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ +#define PCI_MEMORY_LIMIT 0x22 +#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL +#define PCI_MEMORY_RANGE_MASK (~0x0fUL) +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ +#define PCI_PREF_MEMORY_LIMIT 0x26 +#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL +#define PCI_PREF_RANGE_TYPE_32 0x00 +#define PCI_PREF_RANGE_TYPE_64 0x01 +#define PCI_PREF_RANGE_MASK (~0x0fUL) +#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ +#define PCI_PREF_LIMIT_UPPER32 0x2c +#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ +#define PCI_IO_LIMIT_UPPER16 0x32 +/* 0x34 same as for htype 0 */ +/* 0x35-0x3b is reserved */ +#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_BRIDGE_CONTROL 0x3e +#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ +#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ +#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ +#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ +#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ +#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ +#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ + +/* Header type 2 (CardBus bridges) */ +#define PCI_CB_CAPABILITY_LIST 0x14 +/* 0x15 reserved */ +#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ +#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ +#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ +#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ +#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ +#define PCI_CB_MEMORY_BASE_0 0x1c +#define PCI_CB_MEMORY_LIMIT_0 0x20 +#define PCI_CB_MEMORY_BASE_1 0x24 +#define PCI_CB_MEMORY_LIMIT_1 0x28 +#define PCI_CB_IO_BASE_0 0x2c +#define PCI_CB_IO_BASE_0_HI 0x2e +#define PCI_CB_IO_LIMIT_0 0x30 +#define PCI_CB_IO_LIMIT_0_HI 0x32 +#define PCI_CB_IO_BASE_1 0x34 +#define PCI_CB_IO_BASE_1_HI 0x36 +#define PCI_CB_IO_LIMIT_1 0x38 +#define PCI_CB_IO_LIMIT_1_HI 0x3a +#define PCI_CB_IO_RANGE_MASK (~0x03UL) +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_CB_BRIDGE_CONTROL 0x3e +#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ +#define PCI_CB_BRIDGE_CTL_SERR 0x02 +#define PCI_CB_BRIDGE_CTL_ISA 0x04 +#define PCI_CB_BRIDGE_CTL_VGA 0x08 +#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 +#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ +#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 +#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 +#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 +#define PCI_CB_SUBSYSTEM_ID 0x42 +#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ +/* 0x48-0x7f reserved */ + +/* Capability lists */ + +#define PCI_CAP_LIST_ID 0 /* Capability ID */ +#define PCI_CAP_ID_PM 0x01 /* Power Management */ +#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ +#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ +#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ +#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ +#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ +#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ +#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ +#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ +#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ +#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ +#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ +#define PCI_CAP_SIZEOF 4 + +/* Power Management Registers */ + +#define PCI_PM_PMC 2 /* PM Capabilities Register */ +#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ +#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ +#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ +#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ +#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ +#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ +#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ +#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ +#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ +#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ +#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ +#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ +#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ +#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ +#define PCI_PM_CTRL 4 /* PM control and status register */ +#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ +#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ +#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ +#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ +#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ +#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ +#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ +#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ +#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ +#define PCI_PM_DATA_REGISTER 7 /* (??) */ +#define PCI_PM_SIZEOF 8 + +/* AGP registers */ + +#define PCI_AGP_VERSION 2 /* BCD version number */ +#define PCI_AGP_RFU 3 /* Rest of capability flags */ +#define PCI_AGP_STATUS 4 /* Status register */ +#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ +#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ +#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ +#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ +#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ +#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ +#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ +#define PCI_AGP_COMMAND 8 /* Control register */ +#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ +#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ +#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ +#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ +#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ +#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ +#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ +#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ +#define PCI_AGP_SIZEOF 12 + +/* Vital Product Data */ + +#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ +#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ +#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ +#define PCI_VPD_DATA 4 /* 32-bits of data returned here */ + +/* Slot Identification */ + +#define PCI_SID_ESR 2 /* Expansion Slot Register */ +#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ +#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ +#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ + +/* Message Signalled Interrupts registers */ + +#define PCI_MSI_FLAGS 2 /* Various flags */ +#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ +#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ +#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ +#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ +#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ +#define PCI_MSI_RFU 3 /* Rest of capability flags */ +#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ +#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ +#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ +#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ +#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ + +/* CompactPCI Hotswap Register */ + +#define PCI_CHSWP_CSR 2 /* Control and Status Register */ +#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ +#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ +#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ +#define PCI_CHSWP_LOO 0x08 /* LED On / Off */ +#define PCI_CHSWP_PI 0x30 /* Programming Interface */ +#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ +#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ + +/* PCI-X registers */ + +#define PCI_X_CMD 2 /* Modes & Features */ +#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ +#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ +#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ +#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ +#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ +#define PCI_X_STATUS 4 /* PCI-X capabilities */ +#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ +#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ +#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ +#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ +#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ +#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ +#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ +#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ +#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ +#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ +#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ +#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ +#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ + +/* PCI Express capability registers */ + +#define PCI_EXP_FLAGS 2 /* Capabilities register */ +#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ +#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ +#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ +#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ +#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ +#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ +#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ +#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ +#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ +#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ +#define PCI_EXP_DEVCAP 4 /* Device capabilities */ +#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ +#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ +#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ +#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ +#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ +#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ +#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ +#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ +#define PCI_EXP_DEVCTL 8 /* Device Control */ +#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ +#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ +#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ +#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ +#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ +#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ +#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ +#define PCI_EXP_DEVSTA 10 /* Device Status */ +#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ +#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ +#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ +#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ +#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ +#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ +#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ +#define PCI_EXP_LNKCTL 16 /* Link Control */ +#define PCI_EXP_LNKSTA 18 /* Link Status */ +#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ +#define PCI_EXP_SLTCTL 24 /* Slot Control */ +#define PCI_EXP_SLTSTA 26 /* Slot Status */ +#define PCI_EXP_RTCTL 28 /* Root Control */ +#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ +#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ +#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ +#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ +#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ +#define PCI_EXP_RTCAP 30 /* Root Capabilities */ +#define PCI_EXP_RTSTA 32 /* Root Status */ + +/* Extended Capabilities (PCI-X 2.0 and Express) */ +#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) +#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) +#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) + +#define PCI_EXT_CAP_ID_ERR 1 +#define PCI_EXT_CAP_ID_VC 2 +#define PCI_EXT_CAP_ID_DSN 3 +#define PCI_EXT_CAP_ID_PWR 4 + +/* Advanced Error Reporting */ +#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ +#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ +#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ +#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ +#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ +#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ +#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ +#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ +#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ +#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ +#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ +#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ +#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ + /* Same bits as above */ +#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ + /* Same bits as above */ +#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ +#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ +#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ +#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ +#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ +#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ +#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ + /* Same bits as above */ +#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ +#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ +#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ +#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ +#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ +#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ +#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ +#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ +#define PCI_ERR_ROOT_STATUS 48 +#define PCI_ERR_ROOT_COR_SRC 52 +#define PCI_ERR_ROOT_SRC 54 + +/* Virtual Channel */ +#define PCI_VC_PORT_REG1 4 +#define PCI_VC_PORT_REG2 8 +#define PCI_VC_PORT_CTRL 12 +#define PCI_VC_PORT_STATUS 14 +#define PCI_VC_RES_CAP 16 +#define PCI_VC_RES_CTRL 20 +#define PCI_VC_RES_STATUS 26 + +/* Power Budgeting */ +#define PCI_PWR_DSR 4 /* Data Select Register */ +#define PCI_PWR_DATA 8 /* Data Register */ +#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ +#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ +#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ +#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ +#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ +#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ +#define PCI_PWR_CAP 12 /* Capability */ +#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ + +#endif /* LINUX_PCI_REGS_H */ diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 8081a281fa5..9c51917b1cc 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -24,7 +24,7 @@ struct radix_tree_root { unsigned int height; - int gfp_mask; + unsigned int gfp_mask; struct radix_tree_node *rnode; }; @@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items); -int radix_tree_preload(int gfp_mask); +int radix_tree_preload(unsigned int __nocast gfp_mask); void radix_tree_init(void); void *radix_tree_tag_set(struct radix_tree_root *root, unsigned long index, int tag); diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 4bf1659f8aa..9de99198caf 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h @@ -7,7 +7,7 @@ #define BITMAP_H 1 #define BITMAP_MAJOR 3 -#define BITMAP_MINOR 38 +#define BITMAP_MINOR 39 /* * in-memory bitmap: @@ -147,8 +147,9 @@ typedef struct bitmap_super_s { __u32 state; /* 48 bitmap state information */ __u32 chunksize; /* 52 the bitmap chunk size in bytes */ __u32 daemon_sleep; /* 56 seconds between disk flushes */ + __u32 write_behind; /* 60 number of outstanding write-behind writes */ - __u8 pad[256 - 60]; /* set to zero */ + __u8 pad[256 - 64]; /* set to zero */ } bitmap_super_t; /* notes: @@ -226,6 +227,9 @@ struct bitmap { unsigned long flags; + unsigned long max_write_behind; /* write-behind mode */ + atomic_t behind_writes; + /* * the bitmap daemon - periodically wakes up and sweeps the bitmap * file, cleaning up bits and flushing out pages to disk as necessary @@ -260,9 +264,10 @@ int bitmap_setallbits(struct bitmap *bitmap); void bitmap_write_all(struct bitmap *bitmap); /* these are exported */ -int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); -void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, - int success); +int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, + unsigned long sectors, int behind); +void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, + unsigned long sectors, int success, int behind); int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); void bitmap_close_sync(struct bitmap *bitmap); diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index e04c4fe45b5..7eaf290e10e 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h @@ -14,8 +14,8 @@ typedef struct dev_info dev_info_t; struct linear_private_data { dev_info_t **hash_table; - dev_info_t *smallest; - int nr_zones; + sector_t hash_spacing; + int preshift; /* shift before dividing by hash_spacing */ dev_info_t disks[0]; }; diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 8c14ba565a4..ebce949b144 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -86,70 +86,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; #define MAX_CHUNK_SIZE (4096*1024) /* - * default readahead - */ - -static inline int disk_faulty(mdp_disk_t * d) -{ - return d->state & (1 << MD_DISK_FAULTY); -} - -static inline int disk_active(mdp_disk_t * d) -{ - return d->state & (1 << MD_DISK_ACTIVE); -} - -static inline int disk_sync(mdp_disk_t * d) -{ - return d->state & (1 << MD_DISK_SYNC); -} - -static inline int disk_spare(mdp_disk_t * d) -{ - return !disk_sync(d) && !disk_active(d) && !disk_faulty(d); -} - -static inline int disk_removed(mdp_disk_t * d) -{ - return d->state & (1 << MD_DISK_REMOVED); -} - -static inline void mark_disk_faulty(mdp_disk_t * d) -{ - d->state |= (1 << MD_DISK_FAULTY); -} - -static inline void mark_disk_active(mdp_disk_t * d) -{ - d->state |= (1 << MD_DISK_ACTIVE); -} - -static inline void mark_disk_sync(mdp_disk_t * d) -{ - d->state |= (1 << MD_DISK_SYNC); -} - -static inline void mark_disk_spare(mdp_disk_t * d) -{ - d->state = 0; -} - -static inline void mark_disk_removed(mdp_disk_t * d) -{ - d->state = (1 << MD_DISK_FAULTY) | (1 << MD_DISK_REMOVED); -} - -static inline void mark_disk_inactive(mdp_disk_t * d) -{ - d->state &= ~(1 << MD_DISK_ACTIVE); -} - -static inline void mark_disk_nonsync(mdp_disk_t * d) -{ - d->state &= ~(1 << MD_DISK_SYNC); -} - -/* * MD's 'extended' device */ struct mdk_rdev_s @@ -166,6 +102,7 @@ struct mdk_rdev_s int sb_loaded; sector_t data_offset; /* start of data in array */ sector_t sb_offset; + int sb_size; /* bytes in the superblock */ int preferred_minor; /* autorun support */ /* A device can be in one of three states based on two flags: @@ -181,6 +118,9 @@ struct mdk_rdev_s int faulty; /* if faulty do not issue IO requests */ int in_sync; /* device is a full member of the array */ + unsigned long flags; /* Should include faulty and in_sync here. */ +#define WriteMostly 4 /* Avoid reading if at all possible */ + int desc_nr; /* descriptor index in the superblock */ int raid_disk; /* role of device in array */ int saved_raid_disk; /* role that device used to have in the @@ -272,12 +212,19 @@ struct mddev_s atomic_t writes_pending; request_queue_t *queue; /* for plugging ... */ + atomic_t write_behind; /* outstanding async IO */ + unsigned int max_write_behind; /* 0 = sync */ + struct bitmap *bitmap; /* the bitmap for the device */ struct file *bitmap_file; /* the bitmap file */ long bitmap_offset; /* offset from superblock of * start of bitmap. May be * negative, but not '0' */ + long default_bitmap_offset; /* this is the offset to use when + * hot-adding a bitmap. It should + * eventually be settable by sysfs. + */ struct list_head all_mddevs; }; @@ -314,6 +261,12 @@ struct mdk_personality_s int (*resize) (mddev_t *mddev, sector_t sectors); int (*reshape) (mddev_t *mddev, int raid_disks); int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); + /* quiesce moves between quiescence states + * 0 - fully active + * 1 - no new requests allowed + * others - reserved + */ + void (*quiesce) (mddev_t *mddev, int state); }; diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index dc65cd43549..c100fa5d4bf 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h @@ -79,6 +79,11 @@ #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ +#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. + * read requests will only be sent here in + * dire need + */ + typedef struct mdp_device_descriptor_s { __u32 number; /* 0 Device number in the entire set */ __u32 major; /* 1 Device major number */ @@ -193,7 +198,7 @@ struct mdp_superblock_1 { __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ - __u32 layout; /* only for raid5 currently */ + __u32 layout; /* only for raid5 and raid10 currently */ __u64 size; /* used size of component devices, in 512byte sectors */ __u32 chunksize; /* in 512byte sectors */ @@ -212,7 +217,9 @@ struct mdp_superblock_1 { __u32 dev_number; /* permanent identifier of this device - not role in raid */ __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ - __u8 pad2[64-56]; /* set to 0 when writing */ + __u8 devflags; /* per-device flags. Only one defined...*/ +#define WriteMostly1 1 /* mask for writemostly flag in above */ + __u8 pad2[64-57]; /* set to 0 when writing */ /* array state information - 64 bytes */ __u64 utime; /* 40 bits second, 24 btes microseconds */ @@ -231,5 +238,10 @@ struct mdp_superblock_1 { __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ }; +/* feature_map bits */ +#define MD_FEATURE_BITMAP_OFFSET 1 + +#define MD_FEATURE_ALL 1 + #endif diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 9d93cf12e89..60e19b66754 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h @@ -80,6 +80,9 @@ struct r1bio_s { atomic_t remaining; /* 'have we finished' count, * used from IRQ handlers */ + atomic_t behind_remaining; /* number of write-behind ios remaining + * in this BehindIO request + */ sector_t sector; int sectors; unsigned long state; @@ -107,4 +110,14 @@ struct r1bio_s { #define R1BIO_Uptodate 0 #define R1BIO_IsSync 1 #define R1BIO_Degraded 2 +#define R1BIO_BehindIO 3 +/* For write-behind requests, we call bi_end_io when + * the last non-write-behind device completes, providing + * any write was successful. Otherwise we call when + * any write-behind write succeeds, otherwise we call + * with failure when last write completes (and all failed). + * Record that bi_end_io was called with this flag... + */ +#define R1BIO_Returned 4 + #endif diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index d63ddcb4afa..176fc653c28 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h @@ -134,6 +134,7 @@ struct stripe_head { unsigned long state; /* state flags */ atomic_t count; /* nr of active thread/requests */ spinlock_t lock; + int bm_seq; /* sequence number for bitmap flushes */ struct r5dev { struct bio req; struct bio_vec vec; @@ -165,12 +166,13 @@ struct stripe_head { /* * Stripe state */ -#define STRIPE_ERROR 1 #define STRIPE_HANDLE 2 #define STRIPE_SYNCING 3 #define STRIPE_INSYNC 4 #define STRIPE_PREREAD_ACTIVE 5 #define STRIPE_DELAYED 6 +#define STRIPE_DEGRADED 7 +#define STRIPE_BIT_DELAY 8 /* * Plugging: @@ -210,10 +212,20 @@ struct raid5_private_data { struct list_head handle_list; /* stripes needing handling */ struct list_head delayed_list; /* stripes that have plugged requests */ + struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ atomic_t preread_active_stripes; /* stripes with scheduled io */ char cache_name[20]; kmem_cache_t *slab_cache; /* for allocating stripes */ + + int seq_flush, seq_write; + int quiesce; + + int fullsync; /* set to 1 if a full sync is needed, + * (fresh device added). + * Cleared when a sync completes. + */ + /* * Free stripes pool */ diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index fd276adf0fd..4e65eb44adf 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -52,8 +52,8 @@ struct rcu_head { void (*func)(struct rcu_head *head); }; -#define RCU_HEAD_INIT(head) { .next = NULL, .func = NULL } -#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT(head) +#define RCU_HEAD_INIT { .next = NULL, .func = NULL } +#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT #define INIT_RCU_HEAD(ptr) do { \ (ptr)->next = NULL; (ptr)->func = NULL; \ } while (0) diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h new file mode 100644 index 00000000000..e1adbba14b6 --- /dev/null +++ b/include/linux/rcuref.h @@ -0,0 +1,220 @@ +/* + * rcuref.h + * + * Reference counting for elements of lists/arrays protected by + * RCU. + * + * 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. + * + * Copyright (C) IBM Corporation, 2005 + * + * Author: Dipankar Sarma <dipankar@in.ibm.com> + * Ravikiran Thirumalai <kiran_th@gmail.com> + * + * See Documentation/RCU/rcuref.txt for detailed user guide. + * + */ + +#ifndef _RCUREF_H_ +#define _RCUREF_H_ + +#ifdef __KERNEL__ + +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <asm/atomic.h> + +/* + * These APIs work on traditional atomic_t counters used in the + * kernel for reference counting. Under special circumstances + * where a lock-free get() operation races with a put() operation + * these APIs can be used. See Documentation/RCU/rcuref.txt. + */ + +#ifdef __HAVE_ARCH_CMPXCHG + +/** + * rcuref_inc - increment refcount for object. + * @rcuref: reference counter in the object in question. + * + * This should be used only for objects where we use RCU and + * use the rcuref_inc_lf() api to acquire a reference + * in a lock-free reader-side critical section. + */ +static inline void rcuref_inc(atomic_t *rcuref) +{ + atomic_inc(rcuref); +} + +/** + * rcuref_dec - decrement refcount for object. + * @rcuref: reference counter in the object in question. + * + * This should be used only for objects where we use RCU and + * use the rcuref_inc_lf() api to acquire a reference + * in a lock-free reader-side critical section. + */ +static inline void rcuref_dec(atomic_t *rcuref) +{ + atomic_dec(rcuref); +} + +/** + * rcuref_dec_and_test - decrement refcount for object and test + * @rcuref: reference counter in the object. + * @release: pointer to the function that will clean up the object + * when the last reference to the object is released. + * This pointer is required. + * + * Decrement the refcount, and if 0, return 1. Else return 0. + * + * This should be used only for objects where we use RCU and + * use the rcuref_inc_lf() api to acquire a reference + * in a lock-free reader-side critical section. + */ +static inline int rcuref_dec_and_test(atomic_t *rcuref) +{ + return atomic_dec_and_test(rcuref); +} + +/* + * cmpxchg is needed on UP too, if deletions to the list/array can happen + * in interrupt context. + */ + +/** + * rcuref_inc_lf - Take reference to an object in a read-side + * critical section protected by RCU. + * @rcuref: reference counter in the object in question. + * + * Try and increment the refcount by 1. The increment might fail if + * the reference counter has been through a 1 to 0 transition and + * is no longer part of the lock-free list. + * Returns non-zero on successful increment and zero otherwise. + */ +static inline int rcuref_inc_lf(atomic_t *rcuref) +{ + int c, old; + c = atomic_read(rcuref); + while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c) + c = old; + return c; +} + +#else /* !__HAVE_ARCH_CMPXCHG */ + +extern spinlock_t __rcuref_hash[]; + +/* + * Use a hash table of locks to protect the reference count + * since cmpxchg is not available in this arch. + */ +#ifdef CONFIG_SMP +#define RCUREF_HASH_SIZE 4 +#define RCUREF_HASH(k) \ + (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)]) +#else +#define RCUREF_HASH_SIZE 1 +#define RCUREF_HASH(k) &__rcuref_hash[0] +#endif /* CONFIG_SMP */ + +/** + * rcuref_inc - increment refcount for object. + * @rcuref: reference counter in the object in question. + * + * This should be used only for objects where we use RCU and + * use the rcuref_inc_lf() api to acquire a reference in a lock-free + * reader-side critical section. + */ +static inline void rcuref_inc(atomic_t *rcuref) +{ + unsigned long flags; + spin_lock_irqsave(RCUREF_HASH(rcuref), flags); + rcuref->counter += 1; + spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); +} + +/** + * rcuref_dec - decrement refcount for object. + * @rcuref: reference counter in the object in question. + * + * This should be used only for objects where we use RCU and + * use the rcuref_inc_lf() api to acquire a reference in a lock-free + * reader-side critical section. + */ +static inline void rcuref_dec(atomic_t *rcuref) +{ + unsigned long flags; + spin_lock_irqsave(RCUREF_HASH(rcuref), flags); + rcuref->counter -= 1; + spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); +} + +/** + * rcuref_dec_and_test - decrement refcount for object and test + * @rcuref: reference counter in the object. + * @release: pointer to the function that will clean up the object + * when the last reference to the object is released. + * This pointer is required. + * + * Decrement the refcount, and if 0, return 1. Else return 0. + * + * This should be used only for objects where we use RCU and + * use the rcuref_inc_lf() api to acquire a reference in a lock-free + * reader-side critical section. + */ +static inline int rcuref_dec_and_test(atomic_t *rcuref) +{ + unsigned long flags; + spin_lock_irqsave(RCUREF_HASH(rcuref), flags); + rcuref->counter--; + if (!rcuref->counter) { + spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); + return 1; + } else { + spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); + return 0; + } +} + +/** + * rcuref_inc_lf - Take reference to an object of a lock-free collection + * by traversing a lock-free list/array. + * @rcuref: reference counter in the object in question. + * + * Try and increment the refcount by 1. The increment might fail if + * the reference counter has been through a 1 to 0 transition and + * object is no longer part of the lock-free list. + * Returns non-zero on successful increment and zero otherwise. + */ +static inline int rcuref_inc_lf(atomic_t *rcuref) +{ + int ret; + unsigned long flags; + spin_lock_irqsave(RCUREF_HASH(rcuref), flags); + if (rcuref->counter) + ret = rcuref->counter++; + else + ret = 0; + spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); + return ret; +} + + +#endif /* !__HAVE_ARCH_CMPXCHG */ + +#endif /* __KERNEL__ */ +#endif /* _RCUREF_H_ */ diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 17e458e17e2..af00b10294c 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h @@ -2097,7 +2097,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted); int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, int); -extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, +static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, b_blocknr_t * new_blocknrs, int amount_needed) { @@ -2113,7 +2113,7 @@ extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, 0); } -extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle +static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle *th, struct inode *inode, b_blocknr_t * new_blocknrs, struct path *path, long block) @@ -2130,7 +2130,7 @@ extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle } #ifdef REISERFS_PREALLOCATE -extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle +static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle *th, struct inode *inode, b_blocknr_t * new_blocknrs, struct path *path, long block) diff --git a/include/linux/sched.h b/include/linux/sched.h index ea1b5f32ec5..38c8654aaa9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -114,6 +114,7 @@ extern unsigned long nr_iowait(void); #define TASK_TRACED 8 #define EXIT_ZOMBIE 16 #define EXIT_DEAD 32 +#define TASK_NONINTERACTIVE 64 #define __set_task_state(tsk, state_value) \ do { (tsk)->state = (state_value); } while (0) @@ -202,6 +203,8 @@ extern int in_sched_functions(unsigned long addr); #define MAX_SCHEDULE_TIMEOUT LONG_MAX extern signed long FASTCALL(schedule_timeout(signed long timeout)); +extern signed long schedule_timeout_interruptible(signed long timeout); +extern signed long schedule_timeout_uninterruptible(signed long timeout); asmlinkage void schedule(void); struct namespace; @@ -604,6 +607,11 @@ extern int groups_search(struct group_info *group_info, gid_t grp); #define GROUP_AT(gi, i) \ ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) +#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK +extern void prefetch_stack(struct task_struct*); +#else +static inline void prefetch_stack(struct task_struct *t) { } +#endif struct audit_context; /* See audit.c */ struct mempolicy; @@ -895,6 +903,8 @@ extern int task_curr(const task_t *p); extern int idle_cpu(int cpu); extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); extern task_t *idle_task(int cpu); +extern task_t *curr_task(int cpu); +extern void set_curr_task(int cpu, task_t *p); void yield(void); diff --git a/include/linux/security.h b/include/linux/security.h index 7aab6ab7c57..55b02e1c73f 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -250,29 +250,37 @@ struct swap_info_struct; * @inode contains the inode structure. * Deallocate the inode security structure and set @inode->i_security to * NULL. + * @inode_init_security: + * Obtain the security attribute name suffix and value to set on a newly + * created inode and set up the incore security field for the new inode. + * This hook is called by the fs code as part of the inode creation + * transaction and provides for atomic labeling of the inode, unlike + * the post_create/mkdir/... hooks called by the VFS. The hook function + * is expected to allocate the name and value via kmalloc, with the caller + * being responsible for calling kfree after using them. + * If the security module does not use security attributes or does + * not wish to put a security attribute on this particular inode, + * then it should return -EOPNOTSUPP to skip this processing. + * @inode contains the inode structure of the newly created inode. + * @dir contains the inode structure of the parent directory. + * @name will be set to the allocated name suffix (e.g. selinux). + * @value will be set to the allocated attribute value. + * @len will be set to the length of the value. + * Returns 0 if @name and @value have been successfully set, + * -EOPNOTSUPP if no security attribute is needed, or + * -ENOMEM on memory allocation failure. * @inode_create: * Check permission to create a regular file. * @dir contains inode structure of the parent of the new file. * @dentry contains the dentry structure for the file to be created. * @mode contains the file mode of the file to be created. * Return 0 if permission is granted. - * @inode_post_create: - * Set the security attributes on a newly created regular file. This hook - * is called after a file has been successfully created. - * @dir contains the inode structure of the parent directory of the new file. - * @dentry contains the the dentry structure for the newly created file. - * @mode contains the file mode. * @inode_link: * Check permission before creating a new hard link to a file. * @old_dentry contains the dentry structure for an existing link to the file. * @dir contains the inode structure of the parent directory of the new link. * @new_dentry contains the dentry structure for the new link. * Return 0 if permission is granted. - * @inode_post_link: - * Set security attributes for a new hard link to a file. - * @old_dentry contains the dentry structure for the existing link. - * @dir contains the inode structure of the parent directory of the new file. - * @new_dentry contains the dentry structure for the new file link. * @inode_unlink: * Check the permission to remove a hard link to a file. * @dir contains the inode structure of parent directory of the file. @@ -284,13 +292,6 @@ struct swap_info_struct; * @dentry contains the dentry structure of the symbolic link. * @old_name contains the pathname of file. * Return 0 if permission is granted. - * @inode_post_symlink: - * @dir contains the inode structure of the parent directory of the new link. - * @dentry contains the dentry structure of new symbolic link. - * @old_name contains the pathname of file. - * Set security attributes for a newly created symbolic link. Note that - * @dentry->d_inode may be NULL, since the filesystem might not - * instantiate the dentry (e.g. NFS). * @inode_mkdir: * Check permissions to create a new directory in the existing directory * associated with inode strcture @dir. @@ -298,11 +299,6 @@ struct swap_info_struct; * @dentry contains the dentry structure of new directory. * @mode contains the mode of new directory. * Return 0 if permission is granted. - * @inode_post_mkdir: - * Set security attributes on a newly created directory. - * @dir contains the inode structure of parent of the directory to be created. - * @dentry contains the dentry structure of new directory. - * @mode contains the mode of new directory. * @inode_rmdir: * Check the permission to remove a directory. * @dir contains the inode structure of parent of the directory to be removed. @@ -318,13 +314,6 @@ struct swap_info_struct; * @mode contains the mode of the new file. * @dev contains the the device number. * Return 0 if permission is granted. - * @inode_post_mknod: - * Set security attributes on a newly created special file (or socket or - * fifo file created via the mknod system call). - * @dir contains the inode structure of parent of the new node. - * @dentry contains the dentry structure of the new node. - * @mode contains the mode of the new node. - * @dev contains the the device number. * @inode_rename: * Check for permission to rename a file or directory. * @old_dir contains the inode structure for parent of the old link. @@ -332,12 +321,6 @@ struct swap_info_struct; * @new_dir contains the inode structure for parent of the new link. * @new_dentry contains the dentry structure of the new link. * Return 0 if permission is granted. - * @inode_post_rename: - * Set security attributes on a renamed file or directory. - * @old_dir contains the inode structure for parent of the old link. - * @old_dentry contains the dentry structure of the old link. - * @new_dir contains the inode structure for parent of the new link. - * @new_dentry contains the dentry structure of the new link. * @inode_readlink: * Check the permission to read the symbolic link. * @dentry contains the dentry structure for the file link. @@ -1080,34 +1063,21 @@ struct security_operations { int (*inode_alloc_security) (struct inode *inode); void (*inode_free_security) (struct inode *inode); + int (*inode_init_security) (struct inode *inode, struct inode *dir, + char **name, void **value, size_t *len); int (*inode_create) (struct inode *dir, struct dentry *dentry, int mode); - void (*inode_post_create) (struct inode *dir, - struct dentry *dentry, int mode); int (*inode_link) (struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry); - void (*inode_post_link) (struct dentry *old_dentry, - struct inode *dir, struct dentry *new_dentry); int (*inode_unlink) (struct inode *dir, struct dentry *dentry); int (*inode_symlink) (struct inode *dir, struct dentry *dentry, const char *old_name); - void (*inode_post_symlink) (struct inode *dir, - struct dentry *dentry, - const char *old_name); int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); - void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry, - int mode); int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); int (*inode_mknod) (struct inode *dir, struct dentry *dentry, int mode, dev_t dev); - void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry, - int mode, dev_t dev); int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry); - void (*inode_post_rename) (struct inode *old_dir, - struct dentry *old_dentry, - struct inode *new_dir, - struct dentry *new_dentry); int (*inode_readlink) (struct dentry *dentry); int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); @@ -1442,6 +1412,17 @@ static inline void security_inode_free (struct inode *inode) return; security_ops->inode_free_security (inode); } + +static inline int security_inode_init_security (struct inode *inode, + struct inode *dir, + char **name, + void **value, + size_t *len) +{ + if (unlikely (IS_PRIVATE (inode))) + return -EOPNOTSUPP; + return security_ops->inode_init_security (inode, dir, name, value, len); +} static inline int security_inode_create (struct inode *dir, struct dentry *dentry, @@ -1452,15 +1433,6 @@ static inline int security_inode_create (struct inode *dir, return security_ops->inode_create (dir, dentry, mode); } -static inline void security_inode_post_create (struct inode *dir, - struct dentry *dentry, - int mode) -{ - if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) - return; - security_ops->inode_post_create (dir, dentry, mode); -} - static inline int security_inode_link (struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) @@ -1470,15 +1442,6 @@ static inline int security_inode_link (struct dentry *old_dentry, return security_ops->inode_link (old_dentry, dir, new_dentry); } -static inline void security_inode_post_link (struct dentry *old_dentry, - struct inode *dir, - struct dentry *new_dentry) -{ - if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode))) - return; - security_ops->inode_post_link (old_dentry, dir, new_dentry); -} - static inline int security_inode_unlink (struct inode *dir, struct dentry *dentry) { @@ -1496,15 +1459,6 @@ static inline int security_inode_symlink (struct inode *dir, return security_ops->inode_symlink (dir, dentry, old_name); } -static inline void security_inode_post_symlink (struct inode *dir, - struct dentry *dentry, - const char *old_name) -{ - if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) - return; - security_ops->inode_post_symlink (dir, dentry, old_name); -} - static inline int security_inode_mkdir (struct inode *dir, struct dentry *dentry, int mode) @@ -1514,15 +1468,6 @@ static inline int security_inode_mkdir (struct inode *dir, return security_ops->inode_mkdir (dir, dentry, mode); } -static inline void security_inode_post_mkdir (struct inode *dir, - struct dentry *dentry, - int mode) -{ - if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) - return; - security_ops->inode_post_mkdir (dir, dentry, mode); -} - static inline int security_inode_rmdir (struct inode *dir, struct dentry *dentry) { @@ -1540,15 +1485,6 @@ static inline int security_inode_mknod (struct inode *dir, return security_ops->inode_mknod (dir, dentry, mode, dev); } -static inline void security_inode_post_mknod (struct inode *dir, - struct dentry *dentry, - int mode, dev_t dev) -{ - if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) - return; - security_ops->inode_post_mknod (dir, dentry, mode, dev); -} - static inline int security_inode_rename (struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, @@ -1561,18 +1497,6 @@ static inline int security_inode_rename (struct inode *old_dir, new_dir, new_dentry); } -static inline void security_inode_post_rename (struct inode *old_dir, - struct dentry *old_dentry, - struct inode *new_dir, - struct dentry *new_dentry) -{ - if (unlikely (IS_PRIVATE (old_dentry->d_inode) || - (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode)))) - return; - security_ops->inode_post_rename (old_dir, old_dentry, - new_dir, new_dentry); -} - static inline int security_inode_readlink (struct dentry *dentry) { if (unlikely (IS_PRIVATE (dentry->d_inode))) @@ -2171,6 +2095,15 @@ static inline int security_inode_alloc (struct inode *inode) static inline void security_inode_free (struct inode *inode) { } + +static inline int security_inode_init_security (struct inode *inode, + struct inode *dir, + char **name, + void **value, + size_t *len) +{ + return -EOPNOTSUPP; +} static inline int security_inode_create (struct inode *dir, struct dentry *dentry, @@ -2179,11 +2112,6 @@ static inline int security_inode_create (struct inode *dir, return 0; } -static inline void security_inode_post_create (struct inode *dir, - struct dentry *dentry, - int mode) -{ } - static inline int security_inode_link (struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) @@ -2191,11 +2119,6 @@ static inline int security_inode_link (struct dentry *old_dentry, return 0; } -static inline void security_inode_post_link (struct dentry *old_dentry, - struct inode *dir, - struct dentry *new_dentry) -{ } - static inline int security_inode_unlink (struct inode *dir, struct dentry *dentry) { @@ -2209,11 +2132,6 @@ static inline int security_inode_symlink (struct inode *dir, return 0; } -static inline void security_inode_post_symlink (struct inode *dir, - struct dentry *dentry, - const char *old_name) -{ } - static inline int security_inode_mkdir (struct inode *dir, struct dentry *dentry, int mode) @@ -2221,11 +2139,6 @@ static inline int security_inode_mkdir (struct inode *dir, return 0; } -static inline void security_inode_post_mkdir (struct inode *dir, - struct dentry *dentry, - int mode) -{ } - static inline int security_inode_rmdir (struct inode *dir, struct dentry *dentry) { @@ -2239,11 +2152,6 @@ static inline int security_inode_mknod (struct inode *dir, return 0; } -static inline void security_inode_post_mknod (struct inode *dir, - struct dentry *dentry, - int mode, dev_t dev) -{ } - static inline int security_inode_rename (struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, @@ -2252,12 +2160,6 @@ static inline int security_inode_rename (struct inode *old_dir, return 0; } -static inline void security_inode_post_rename (struct inode *old_dir, - struct dentry *old_dentry, - struct inode *new_dir, - struct dentry *new_dentry) -{ } - static inline int security_inode_readlink (struct dentry *dentry) { return 0; diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index d8a023d804d..317a979b24d 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -30,6 +30,21 @@ struct plat_serial8250_port { }; /* + * Allocate 8250 platform device IDs. Nothing is implied by + * the numbering here, except for the legacy entry being -1. + */ +enum { + PLAT8250_DEV_LEGACY = -1, + PLAT8250_DEV_PLATFORM, + PLAT8250_DEV_PLATFORM1, + PLAT8250_DEV_FOURPORT, + PLAT8250_DEV_ACCENT, + PLAT8250_DEV_BOCA, + PLAT8250_DEV_HUB6, + PLAT8250_DEV_MCA, +}; + +/* * This should be used by drivers which want to register * their own 8250 ports without registering their own * platform device. Using these will make your driver diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 9b12fe73161..27db8da43aa 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -401,6 +401,9 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch, #endif return 0; } +#ifndef SUPPORT_SYSRQ +#define uart_handle_sysrq_char(port,ch,regs) uart_handle_sysrq_char(port, 0, NULL) +#endif /* * We do the SysRQ and SAK checking like this... diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index da7da9c0ed1..2741c0c55e8 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1167,7 +1167,7 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) { - if (len >= skb->len) + if (likely(len >= skb->len)) return 0; if (skb->ip_summed == CHECKSUM_HW) skb->ip_summed = CHECKSUM_NONE; diff --git a/include/linux/slab.h b/include/linux/slab.h index 42a6bea58af..1f356f3bbc6 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -118,7 +118,8 @@ extern void kfree(const void *); extern unsigned int ksize(const void *); #ifdef CONFIG_NUMA -extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); +extern void *kmem_cache_alloc_node(kmem_cache_t *, + unsigned int __nocast flags, int node); extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); #else static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index d6ba068719b..cdc99a27840 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -2,7 +2,48 @@ #define __LINUX_SPINLOCK_H /* - * include/linux/spinlock.h - generic locking declarations + * include/linux/spinlock.h - generic spinlock/rwlock declarations + * + * here's the role of the various spinlock/rwlock related include files: + * + * on SMP builds: + * + * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the + * initializers + * + * linux/spinlock_types.h: + * defines the generic type and initializers + * + * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel + * implementations, mostly inline assembly code + * + * (also included on UP-debug builds:) + * + * linux/spinlock_api_smp.h: + * contains the prototypes for the _spin_*() APIs. + * + * linux/spinlock.h: builds the final spin_*() APIs. + * + * on UP builds: + * + * linux/spinlock_type_up.h: + * contains the generic, simplified UP spinlock type. + * (which is an empty structure on non-debug builds) + * + * linux/spinlock_types.h: + * defines the generic type and initializers + * + * linux/spinlock_up.h: + * contains the __raw_spin_*()/etc. version of UP + * builds. (which are NOPs on non-debug, non-preempt + * builds) + * + * (included on UP-non-debug builds:) + * + * linux/spinlock_api_up.h: + * builds the _spin_*() APIs. + * + * linux/spinlock.h: builds the final spin_*() APIs. */ #include <linux/config.h> @@ -13,7 +54,6 @@ #include <linux/kernel.h> #include <linux/stringify.h> -#include <asm/processor.h> /* for cpu relax */ #include <asm/system.h> /* @@ -35,423 +75,84 @@ #define __lockfunc fastcall __attribute__((section(".spinlock.text"))) /* - * If CONFIG_SMP is set, pull in the _raw_* definitions + * Pull the raw_spinlock_t and raw_rwlock_t definitions: */ -#ifdef CONFIG_SMP - -#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) -#include <asm/spinlock.h> - -int __lockfunc _spin_trylock(spinlock_t *lock); -int __lockfunc _read_trylock(rwlock_t *lock); -int __lockfunc _write_trylock(rwlock_t *lock); - -void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); -void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); -void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); - -void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); -void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); -void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); - -unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) __acquires(spinlock_t); -unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t); -unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t); - -void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); -void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); -void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); -void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); -void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); -void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); - -void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) __releases(spinlock_t); -void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); -void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); -void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t); -void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); -void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); -void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t); -void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); -void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); - -int __lockfunc _spin_trylock_bh(spinlock_t *lock); -int __lockfunc generic_raw_read_trylock(rwlock_t *lock); -int in_lock_functions(unsigned long addr); - -#else +#include <linux/spinlock_types.h> -#define in_lock_functions(ADDR) 0 +extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock); -#if !defined(CONFIG_PREEMPT) && !defined(CONFIG_DEBUG_SPINLOCK) -# define _atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic) -# define ATOMIC_DEC_AND_LOCK -#endif - -#ifdef CONFIG_DEBUG_SPINLOCK - -#define SPINLOCK_MAGIC 0x1D244B3C -typedef struct { - unsigned long magic; - volatile unsigned long lock; - volatile unsigned int babble; - const char *module; - char *owner; - int oline; -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { SPINLOCK_MAGIC, 0, 10, __FILE__ , NULL, 0} - -#define spin_lock_init(x) \ - do { \ - (x)->magic = SPINLOCK_MAGIC; \ - (x)->lock = 0; \ - (x)->babble = 5; \ - (x)->module = __FILE__; \ - (x)->owner = NULL; \ - (x)->oline = 0; \ - } while (0) - -#define CHECK_LOCK(x) \ - do { \ - if ((x)->magic != SPINLOCK_MAGIC) { \ - printk(KERN_ERR "%s:%d: spin_is_locked on uninitialized spinlock %p.\n", \ - __FILE__, __LINE__, (x)); \ - } \ - } while(0) - -#define _raw_spin_lock(x) \ - do { \ - CHECK_LOCK(x); \ - if ((x)->lock&&(x)->babble) { \ - (x)->babble--; \ - printk("%s:%d: spin_lock(%s:%p) already locked by %s/%d\n", \ - __FILE__,__LINE__, (x)->module, \ - (x), (x)->owner, (x)->oline); \ - } \ - (x)->lock = 1; \ - (x)->owner = __FILE__; \ - (x)->oline = __LINE__; \ - } while (0) - -/* without debugging, spin_is_locked on UP always says - * FALSE. --> printk if already locked. */ -#define spin_is_locked(x) \ - ({ \ - CHECK_LOCK(x); \ - if ((x)->lock&&(x)->babble) { \ - (x)->babble--; \ - printk("%s:%d: spin_is_locked(%s:%p) already locked by %s/%d\n", \ - __FILE__,__LINE__, (x)->module, \ - (x), (x)->owner, (x)->oline); \ - } \ - 0; \ - }) - -/* with debugging, assert_spin_locked() on UP does check - * the lock value properly */ -#define assert_spin_locked(x) \ - ({ \ - CHECK_LOCK(x); \ - BUG_ON(!(x)->lock); \ - }) - -/* without debugging, spin_trylock on UP always says - * TRUE. --> printk if already locked. */ -#define _raw_spin_trylock(x) \ - ({ \ - CHECK_LOCK(x); \ - if ((x)->lock&&(x)->babble) { \ - (x)->babble--; \ - printk("%s:%d: spin_trylock(%s:%p) already locked by %s/%d\n", \ - __FILE__,__LINE__, (x)->module, \ - (x), (x)->owner, (x)->oline); \ - } \ - (x)->lock = 1; \ - (x)->owner = __FILE__; \ - (x)->oline = __LINE__; \ - 1; \ - }) - -#define spin_unlock_wait(x) \ - do { \ - CHECK_LOCK(x); \ - if ((x)->lock&&(x)->babble) { \ - (x)->babble--; \ - printk("%s:%d: spin_unlock_wait(%s:%p) owned by %s/%d\n", \ - __FILE__,__LINE__, (x)->module, (x), \ - (x)->owner, (x)->oline); \ - }\ - } while (0) - -#define _raw_spin_unlock(x) \ - do { \ - CHECK_LOCK(x); \ - if (!(x)->lock&&(x)->babble) { \ - (x)->babble--; \ - printk("%s:%d: spin_unlock(%s:%p) not locked\n", \ - __FILE__,__LINE__, (x)->module, (x));\ - } \ - (x)->lock = 0; \ - } while (0) -#else /* - * gcc versions before ~2.95 have a nasty bug with empty initializers. + * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): */ -#if (__GNUC__ > 2) - typedef struct { } spinlock_t; - #define SPIN_LOCK_UNLOCKED (spinlock_t) { } +#if defined(CONFIG_SMP) +# include <asm/spinlock.h> #else - typedef struct { int gcc_is_buggy; } spinlock_t; - #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } +# include <linux/spinlock_up.h> #endif +#define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) +#define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) + +#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) + +/** + * spin_unlock_wait - wait until the spinlock gets unlocked + * @lock: the spinlock in question. + */ +#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) + /* - * If CONFIG_SMP is unset, declare the _raw_* definitions as nops + * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: */ -#define spin_lock_init(lock) do { (void)(lock); } while(0) -#define _raw_spin_lock(lock) do { (void)(lock); } while(0) -#define spin_is_locked(lock) ((void)(lock), 0) -#define assert_spin_locked(lock) do { (void)(lock); } while(0) -#define _raw_spin_trylock(lock) (((void)(lock), 1)) -#define spin_unlock_wait(lock) (void)(lock) -#define _raw_spin_unlock(lock) do { (void)(lock); } while(0) -#endif /* CONFIG_DEBUG_SPINLOCK */ - -/* RW spinlocks: No debug version */ - -#if (__GNUC__ > 2) - typedef struct { } rwlock_t; - #define RW_LOCK_UNLOCKED (rwlock_t) { } +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) +# include <linux/spinlock_api_smp.h> #else - typedef struct { int gcc_is_buggy; } rwlock_t; - #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +# include <linux/spinlock_api_up.h> #endif -#define rwlock_init(lock) do { (void)(lock); } while(0) -#define _raw_read_lock(lock) do { (void)(lock); } while(0) -#define _raw_read_unlock(lock) do { (void)(lock); } while(0) -#define _raw_write_lock(lock) do { (void)(lock); } while(0) -#define _raw_write_unlock(lock) do { (void)(lock); } while(0) -#define read_can_lock(lock) (((void)(lock), 1)) -#define write_can_lock(lock) (((void)(lock), 1)) -#define _raw_read_trylock(lock) ({ (void)(lock); (1); }) -#define _raw_write_trylock(lock) ({ (void)(lock); (1); }) - -#define _spin_trylock(lock) ({preempt_disable(); _raw_spin_trylock(lock) ? \ - 1 : ({preempt_enable(); 0;});}) - -#define _read_trylock(lock) ({preempt_disable();_raw_read_trylock(lock) ? \ - 1 : ({preempt_enable(); 0;});}) - -#define _write_trylock(lock) ({preempt_disable(); _raw_write_trylock(lock) ? \ - 1 : ({preempt_enable(); 0;});}) - -#define _spin_trylock_bh(lock) ({preempt_disable(); local_bh_disable(); \ - _raw_spin_trylock(lock) ? \ - 1 : ({preempt_enable_no_resched(); local_bh_enable(); 0;});}) - -#define _spin_lock(lock) \ -do { \ - preempt_disable(); \ - _raw_spin_lock(lock); \ - __acquire(lock); \ -} while(0) - -#define _write_lock(lock) \ -do { \ - preempt_disable(); \ - _raw_write_lock(lock); \ - __acquire(lock); \ -} while(0) - -#define _read_lock(lock) \ -do { \ - preempt_disable(); \ - _raw_read_lock(lock); \ - __acquire(lock); \ -} while(0) - -#define _spin_unlock(lock) \ -do { \ - _raw_spin_unlock(lock); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#define _write_unlock(lock) \ -do { \ - _raw_write_unlock(lock); \ - preempt_enable(); \ - __release(lock); \ -} while(0) - -#define _read_unlock(lock) \ -do { \ - _raw_read_unlock(lock); \ - preempt_enable(); \ - __release(lock); \ -} while(0) - -#define _spin_lock_irqsave(lock, flags) \ -do { \ - local_irq_save(flags); \ - preempt_disable(); \ - _raw_spin_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _spin_lock_irq(lock) \ -do { \ - local_irq_disable(); \ - preempt_disable(); \ - _raw_spin_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _spin_lock_bh(lock) \ -do { \ - local_bh_disable(); \ - preempt_disable(); \ - _raw_spin_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _read_lock_irqsave(lock, flags) \ -do { \ - local_irq_save(flags); \ - preempt_disable(); \ - _raw_read_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _read_lock_irq(lock) \ -do { \ - local_irq_disable(); \ - preempt_disable(); \ - _raw_read_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _read_lock_bh(lock) \ -do { \ - local_bh_disable(); \ - preempt_disable(); \ - _raw_read_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _write_lock_irqsave(lock, flags) \ -do { \ - local_irq_save(flags); \ - preempt_disable(); \ - _raw_write_lock(lock); \ - __acquire(lock); \ -} while (0) +#ifdef CONFIG_DEBUG_SPINLOCK + extern void _raw_spin_lock(spinlock_t *lock); +#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) + extern int _raw_spin_trylock(spinlock_t *lock); + extern void _raw_spin_unlock(spinlock_t *lock); + + extern void _raw_read_lock(rwlock_t *lock); + extern int _raw_read_trylock(rwlock_t *lock); + extern void _raw_read_unlock(rwlock_t *lock); + extern void _raw_write_lock(rwlock_t *lock); + extern int _raw_write_trylock(rwlock_t *lock); + extern void _raw_write_unlock(rwlock_t *lock); +#else +# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) +# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) +# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) +# define _raw_spin_lock_flags(lock, flags) \ + __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) +# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) +# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) +# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) +# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) +# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) +# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) +#endif -#define _write_lock_irq(lock) \ -do { \ - local_irq_disable(); \ - preempt_disable(); \ - _raw_write_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _write_lock_bh(lock) \ -do { \ - local_bh_disable(); \ - preempt_disable(); \ - _raw_write_lock(lock); \ - __acquire(lock); \ -} while (0) - -#define _spin_unlock_irqrestore(lock, flags) \ -do { \ - _raw_spin_unlock(lock); \ - local_irq_restore(flags); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#define _spin_unlock_irq(lock) \ -do { \ - _raw_spin_unlock(lock); \ - local_irq_enable(); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#define _spin_unlock_bh(lock) \ -do { \ - _raw_spin_unlock(lock); \ - preempt_enable_no_resched(); \ - local_bh_enable(); \ - __release(lock); \ -} while (0) - -#define _write_unlock_bh(lock) \ -do { \ - _raw_write_unlock(lock); \ - preempt_enable_no_resched(); \ - local_bh_enable(); \ - __release(lock); \ -} while (0) - -#define _read_unlock_irqrestore(lock, flags) \ -do { \ - _raw_read_unlock(lock); \ - local_irq_restore(flags); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#define _write_unlock_irqrestore(lock, flags) \ -do { \ - _raw_write_unlock(lock); \ - local_irq_restore(flags); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#define _read_unlock_irq(lock) \ -do { \ - _raw_read_unlock(lock); \ - local_irq_enable(); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#define _read_unlock_bh(lock) \ -do { \ - _raw_read_unlock(lock); \ - preempt_enable_no_resched(); \ - local_bh_enable(); \ - __release(lock); \ -} while (0) - -#define _write_unlock_irq(lock) \ -do { \ - _raw_write_unlock(lock); \ - local_irq_enable(); \ - preempt_enable(); \ - __release(lock); \ -} while (0) - -#endif /* !SMP */ +#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) +#define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) /* * Define the various spin_lock and rw_lock methods. Note we define these * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various * methods are defined as nops in the case they are not required. */ -#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) -#define read_trylock(lock) __cond_lock(_read_trylock(lock)) -#define write_trylock(lock) __cond_lock(_write_trylock(lock)) +#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) +#define read_trylock(lock) __cond_lock(_read_trylock(lock)) +#define write_trylock(lock) __cond_lock(_write_trylock(lock)) -#define spin_lock(lock) _spin_lock(lock) -#define write_lock(lock) _write_lock(lock) -#define read_lock(lock) _read_lock(lock) +#define spin_lock(lock) _spin_lock(lock) +#define write_lock(lock) _write_lock(lock) +#define read_lock(lock) _read_lock(lock) -#ifdef CONFIG_SMP +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) @@ -470,137 +171,59 @@ do { \ #define write_lock_irq(lock) _write_lock_irq(lock) #define write_lock_bh(lock) _write_lock_bh(lock) -#define spin_unlock(lock) _spin_unlock(lock) -#define write_unlock(lock) _write_unlock(lock) -#define read_unlock(lock) _read_unlock(lock) +#define spin_unlock(lock) _spin_unlock(lock) +#define write_unlock(lock) _write_unlock(lock) +#define read_unlock(lock) _read_unlock(lock) -#define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags) +#define spin_unlock_irqrestore(lock, flags) \ + _spin_unlock_irqrestore(lock, flags) #define spin_unlock_irq(lock) _spin_unlock_irq(lock) #define spin_unlock_bh(lock) _spin_unlock_bh(lock) -#define read_unlock_irqrestore(lock, flags) _read_unlock_irqrestore(lock, flags) -#define read_unlock_irq(lock) _read_unlock_irq(lock) -#define read_unlock_bh(lock) _read_unlock_bh(lock) +#define read_unlock_irqrestore(lock, flags) \ + _read_unlock_irqrestore(lock, flags) +#define read_unlock_irq(lock) _read_unlock_irq(lock) +#define read_unlock_bh(lock) _read_unlock_bh(lock) -#define write_unlock_irqrestore(lock, flags) _write_unlock_irqrestore(lock, flags) -#define write_unlock_irq(lock) _write_unlock_irq(lock) -#define write_unlock_bh(lock) _write_unlock_bh(lock) +#define write_unlock_irqrestore(lock, flags) \ + _write_unlock_irqrestore(lock, flags) +#define write_unlock_irq(lock) _write_unlock_irq(lock) +#define write_unlock_bh(lock) _write_unlock_bh(lock) -#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) +#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) #define spin_trylock_irq(lock) \ ({ \ local_irq_disable(); \ _spin_trylock(lock) ? \ - 1 : ({local_irq_enable(); 0; }); \ + 1 : ({ local_irq_enable(); 0; }); \ }) #define spin_trylock_irqsave(lock, flags) \ ({ \ local_irq_save(flags); \ _spin_trylock(lock) ? \ - 1 : ({local_irq_restore(flags); 0;}); \ + 1 : ({ local_irq_restore(flags); 0; }); \ }) -#ifdef CONFIG_LOCKMETER -extern void _metered_spin_lock (spinlock_t *lock); -extern void _metered_spin_unlock (spinlock_t *lock); -extern int _metered_spin_trylock(spinlock_t *lock); -extern void _metered_read_lock (rwlock_t *lock); -extern void _metered_read_unlock (rwlock_t *lock); -extern void _metered_write_lock (rwlock_t *lock); -extern void _metered_write_unlock (rwlock_t *lock); -extern int _metered_read_trylock (rwlock_t *lock); -extern int _metered_write_trylock(rwlock_t *lock); -#endif - -/* "lock on reference count zero" */ -#ifndef ATOMIC_DEC_AND_LOCK -#include <asm/atomic.h> -extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); -#endif - -#define atomic_dec_and_lock(atomic,lock) __cond_lock(_atomic_dec_and_lock(atomic,lock)) - -/* - * bit-based spin_lock() - * - * Don't use this unless you really need to: spin_lock() and spin_unlock() - * are significantly faster. - */ -static inline void bit_spin_lock(int bitnum, unsigned long *addr) -{ - /* - * Assuming the lock is uncontended, this never enters - * the body of the outer loop. If it is contended, then - * within the inner loop a non-atomic test is used to - * busywait with less bus contention for a good time to - * attempt to acquire the lock bit. - */ - preempt_disable(); -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) - while (test_and_set_bit(bitnum, addr)) { - while (test_bit(bitnum, addr)) { - preempt_enable(); - cpu_relax(); - preempt_disable(); - } - } -#endif - __acquire(bitlock); -} - /* - * Return true if it was acquired + * Pull the atomic_t declaration: + * (asm-mips/atomic.h needs above definitions) */ -static inline int bit_spin_trylock(int bitnum, unsigned long *addr) -{ - preempt_disable(); -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) - if (test_and_set_bit(bitnum, addr)) { - preempt_enable(); - return 0; - } -#endif - __acquire(bitlock); - return 1; -} - -/* - * bit-based spin_unlock() - */ -static inline void bit_spin_unlock(int bitnum, unsigned long *addr) -{ -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) - BUG_ON(!test_bit(bitnum, addr)); - smp_mb__before_clear_bit(); - clear_bit(bitnum, addr); -#endif - preempt_enable(); - __release(bitlock); -} - -/* - * Return true if the lock is held. +#include <asm/atomic.h> +/** + * atomic_dec_and_lock - lock on reaching reference count zero + * @atomic: the atomic counter + * @lock: the spinlock in question */ -static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) -{ -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) - return test_bit(bitnum, addr); -#elif defined CONFIG_PREEMPT - return preempt_count(); -#else - return 1; -#endif -} - -#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED -#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED +extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); +#define atomic_dec_and_lock(atomic, lock) \ + __cond_lock(_atomic_dec_and_lock(atomic, lock)) /** * spin_can_lock - would spin_trylock() succeed? * @lock: the spinlock in question. */ -#define spin_can_lock(lock) (!spin_is_locked(lock)) +#define spin_can_lock(lock) (!spin_is_locked(lock)) #endif /* __LINUX_SPINLOCK_H */ diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h new file mode 100644 index 00000000000..78e6989ffb5 --- /dev/null +++ b/include/linux/spinlock_api_smp.h @@ -0,0 +1,57 @@ +#ifndef __LINUX_SPINLOCK_API_SMP_H +#define __LINUX_SPINLOCK_API_SMP_H + +#ifndef __LINUX_SPINLOCK_H +# error "please don't include this file directly" +#endif + +/* + * include/linux/spinlock_api_smp.h + * + * spinlock API declarations on SMP (and debug) + * (implemented in kernel/spinlock.c) + * + * portions Copyright 2005, Red Hat, Inc., Ingo Molnar + * Released under the General Public License (GPL). + */ + +int in_lock_functions(unsigned long addr); + +#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) + +void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); +void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); +void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); +void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); +void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); +void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); +void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); +void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); +void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); +unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) + __acquires(spinlock_t); +unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) + __acquires(rwlock_t); +unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) + __acquires(rwlock_t); +int __lockfunc _spin_trylock(spinlock_t *lock); +int __lockfunc _read_trylock(rwlock_t *lock); +int __lockfunc _write_trylock(rwlock_t *lock); +int __lockfunc _spin_trylock_bh(spinlock_t *lock); +void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); +void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); +void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); +void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); +void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); +void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); +void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); +void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); +void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); +void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) + __releases(spinlock_t); +void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) + __releases(rwlock_t); +void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) + __releases(rwlock_t); + +#endif /* __LINUX_SPINLOCK_API_SMP_H */ diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h new file mode 100644 index 00000000000..cd81cee566f --- /dev/null +++ b/include/linux/spinlock_api_up.h @@ -0,0 +1,80 @@ +#ifndef __LINUX_SPINLOCK_API_UP_H +#define __LINUX_SPINLOCK_API_UP_H + +#ifndef __LINUX_SPINLOCK_H +# error "please don't include this file directly" +#endif + +/* + * include/linux/spinlock_api_up.h + * + * spinlock API implementation on UP-nondebug (inlined implementation) + * + * portions Copyright 2005, Red Hat, Inc., Ingo Molnar + * Released under the General Public License (GPL). + */ + +#define in_lock_functions(ADDR) 0 + +#define assert_spin_locked(lock) do { (void)(lock); } while (0) + +/* + * In the UP-nondebug case there's no real locking going on, so the + * only thing we have to do is to keep the preempt counts and irq + * flags straight, to supress compiler warnings of unused lock + * variables, and to add the proper checker annotations: + */ +#define __LOCK(lock) \ + do { preempt_disable(); __acquire(lock); (void)(lock); } while (0) + +#define __LOCK_BH(lock) \ + do { local_bh_disable(); __LOCK(lock); } while (0) + +#define __LOCK_IRQ(lock) \ + do { local_irq_disable(); __LOCK(lock); } while (0) + +#define __LOCK_IRQSAVE(lock, flags) \ + do { local_irq_save(flags); __LOCK(lock); } while (0) + +#define __UNLOCK(lock) \ + do { preempt_enable(); __release(lock); (void)(lock); } while (0) + +#define __UNLOCK_BH(lock) \ + do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) + +#define __UNLOCK_IRQ(lock) \ + do { local_irq_enable(); __UNLOCK(lock); } while (0) + +#define __UNLOCK_IRQRESTORE(lock, flags) \ + do { local_irq_restore(flags); __UNLOCK(lock); } while (0) + +#define _spin_lock(lock) __LOCK(lock) +#define _read_lock(lock) __LOCK(lock) +#define _write_lock(lock) __LOCK(lock) +#define _spin_lock_bh(lock) __LOCK_BH(lock) +#define _read_lock_bh(lock) __LOCK_BH(lock) +#define _write_lock_bh(lock) __LOCK_BH(lock) +#define _spin_lock_irq(lock) __LOCK_IRQ(lock) +#define _read_lock_irq(lock) __LOCK_IRQ(lock) +#define _write_lock_irq(lock) __LOCK_IRQ(lock) +#define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) +#define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) +#define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) +#define _spin_trylock(lock) ({ __LOCK(lock); 1; }) +#define _read_trylock(lock) ({ __LOCK(lock); 1; }) +#define _write_trylock(lock) ({ __LOCK(lock); 1; }) +#define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) +#define _spin_unlock(lock) __UNLOCK(lock) +#define _read_unlock(lock) __UNLOCK(lock) +#define _write_unlock(lock) __UNLOCK(lock) +#define _spin_unlock_bh(lock) __UNLOCK_BH(lock) +#define _write_unlock_bh(lock) __UNLOCK_BH(lock) +#define _read_unlock_bh(lock) __UNLOCK_BH(lock) +#define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) +#define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) +#define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) +#define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) +#define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) +#define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) + +#endif /* __LINUX_SPINLOCK_API_UP_H */ diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h new file mode 100644 index 00000000000..9cb51e07039 --- /dev/null +++ b/include/linux/spinlock_types.h @@ -0,0 +1,67 @@ +#ifndef __LINUX_SPINLOCK_TYPES_H +#define __LINUX_SPINLOCK_TYPES_H + +/* + * include/linux/spinlock_types.h - generic spinlock type definitions + * and initializers + * + * portions Copyright 2005, Red Hat, Inc., Ingo Molnar + * Released under the General Public License (GPL). + */ + +#if defined(CONFIG_SMP) +# include <asm/spinlock_types.h> +#else +# include <linux/spinlock_types_up.h> +#endif + +typedef struct { + raw_spinlock_t raw_lock; +#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) + unsigned int break_lock; +#endif +#ifdef CONFIG_DEBUG_SPINLOCK + unsigned int magic, owner_cpu; + void *owner; +#endif +} spinlock_t; + +#define SPINLOCK_MAGIC 0xdead4ead + +typedef struct { + raw_rwlock_t raw_lock; +#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) + unsigned int break_lock; +#endif +#ifdef CONFIG_DEBUG_SPINLOCK + unsigned int magic, owner_cpu; + void *owner; +#endif +} rwlock_t; + +#define RWLOCK_MAGIC 0xdeaf1eed + +#define SPINLOCK_OWNER_INIT ((void *)-1L) + +#ifdef CONFIG_DEBUG_SPINLOCK +# define SPIN_LOCK_UNLOCKED \ + (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ + .magic = SPINLOCK_MAGIC, \ + .owner = SPINLOCK_OWNER_INIT, \ + .owner_cpu = -1 } +#define RW_LOCK_UNLOCKED \ + (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ + .magic = RWLOCK_MAGIC, \ + .owner = SPINLOCK_OWNER_INIT, \ + .owner_cpu = -1 } +#else +# define SPIN_LOCK_UNLOCKED \ + (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED } +#define RW_LOCK_UNLOCKED \ + (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED } +#endif + +#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED +#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED + +#endif /* __LINUX_SPINLOCK_TYPES_H */ diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h new file mode 100644 index 00000000000..def2d173a8d --- /dev/null +++ b/include/linux/spinlock_types_up.h @@ -0,0 +1,51 @@ +#ifndef __LINUX_SPINLOCK_TYPES_UP_H +#define __LINUX_SPINLOCK_TYPES_UP_H + +#ifndef __LINUX_SPINLOCK_TYPES_H +# error "please don't include this file directly" +#endif + +/* + * include/linux/spinlock_types_up.h - spinlock type definitions for UP + * + * portions Copyright 2005, Red Hat, Inc., Ingo Molnar + * Released under the General Public License (GPL). + */ + +#ifdef CONFIG_DEBUG_SPINLOCK + +typedef struct { + volatile unsigned int slock; +} raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { 1 } + +#else + +/* + * All gcc 2.95 versions and early versions of 2.96 have a nasty bug + * with empty initializers. + */ +#if (__GNUC__ > 2) +typedef struct { } raw_spinlock_t; + +#define __RAW_SPIN_LOCK_UNLOCKED { } +#else +typedef struct { int gcc_is_buggy; } raw_spinlock_t; +#define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 } +#endif + +#endif + +#if (__GNUC__ > 2) +typedef struct { + /* no debug version on UP */ +} raw_rwlock_t; + +#define __RAW_RW_LOCK_UNLOCKED { } +#else +typedef struct { int gcc_is_buggy; } raw_rwlock_t; +#define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 } +#endif + +#endif /* __LINUX_SPINLOCK_TYPES_UP_H */ diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h new file mode 100644 index 00000000000..31accf2f0b1 --- /dev/null +++ b/include/linux/spinlock_up.h @@ -0,0 +1,74 @@ +#ifndef __LINUX_SPINLOCK_UP_H +#define __LINUX_SPINLOCK_UP_H + +#ifndef __LINUX_SPINLOCK_H +# error "please don't include this file directly" +#endif + +/* + * include/linux/spinlock_up.h - UP-debug version of spinlocks. + * + * portions Copyright 2005, Red Hat, Inc., Ingo Molnar + * Released under the General Public License (GPL). + * + * In the debug case, 1 means unlocked, 0 means locked. (the values + * are inverted, to catch initialization bugs) + * + * No atomicity anywhere, we are on UP. + */ + +#ifdef CONFIG_DEBUG_SPINLOCK + +#define __raw_spin_is_locked(x) ((x)->slock == 0) + +static inline void __raw_spin_lock(raw_spinlock_t *lock) +{ + lock->slock = 0; +} + +static inline void +__raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) +{ + local_irq_save(flags); + lock->slock = 0; +} + +static inline int __raw_spin_trylock(raw_spinlock_t *lock) +{ + char oldval = lock->slock; + + lock->slock = 0; + + return oldval > 0; +} + +static inline void __raw_spin_unlock(raw_spinlock_t *lock) +{ + lock->slock = 1; +} + +/* + * Read-write spinlocks. No debug version. + */ +#define __raw_read_lock(lock) do { (void)(lock); } while (0) +#define __raw_write_lock(lock) do { (void)(lock); } while (0) +#define __raw_read_trylock(lock) ({ (void)(lock); 1; }) +#define __raw_write_trylock(lock) ({ (void)(lock); 1; }) +#define __raw_read_unlock(lock) do { (void)(lock); } while (0) +#define __raw_write_unlock(lock) do { (void)(lock); } while (0) + +#else /* DEBUG_SPINLOCK */ +#define __raw_spin_is_locked(lock) ((void)(lock), 0) +/* for sched.c and kernel_lock.c: */ +# define __raw_spin_lock(lock) do { (void)(lock); } while (0) +# define __raw_spin_unlock(lock) do { (void)(lock); } while (0) +# define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) +#endif /* DEBUG_SPINLOCK */ + +#define __raw_read_can_lock(lock) (((void)(lock), 1)) +#define __raw_write_can_lock(lock) (((void)(lock), 1)) + +#define __raw_spin_unlock_wait(lock) \ + do { cpu_relax(); } while (__raw_spin_is_locked(lock)) + +#endif /* __LINUX_SPINLOCK_UP_H */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 532a6c5c24e..3a29a9f9b45 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -544,7 +544,8 @@ enum { NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, NET_NETROM_ROUTING_CONTROL=10, - NET_NETROM_LINK_FAILS_COUNT=11 + NET_NETROM_LINK_FAILS_COUNT=11, + NET_NETROM_RESET=12 }; /* /proc/sys/net/ax25 */ diff --git a/include/linux/time.h b/include/linux/time.h index c10d4c21c18..8e83f4e778b 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -28,17 +28,10 @@ struct timezone { #ifdef __KERNEL__ /* Parameters used to convert the timespec values */ -#ifndef USEC_PER_SEC +#define MSEC_PER_SEC (1000L) #define USEC_PER_SEC (1000000L) -#endif - -#ifndef NSEC_PER_SEC #define NSEC_PER_SEC (1000000000L) -#endif - -#ifndef NSEC_PER_USEC #define NSEC_PER_USEC (1000L) -#endif static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) { diff --git a/include/linux/timer.h b/include/linux/timer.h index 221f81ac200..3340f3bd135 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -32,6 +32,10 @@ extern struct timer_base_s __init_timer_base; .magic = TIMER_MAGIC, \ } +#define DEFINE_TIMER(_name, _function, _expires, _data) \ + struct timer_list _name = \ + TIMER_INITIALIZER(_function, _expires, _data) + void fastcall init_timer(struct timer_list * timer); /*** diff --git a/include/linux/tty.h b/include/linux/tty.h index 59ff42c629e..1267f88ece6 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -74,7 +74,8 @@ struct screen_info { u16 vesapm_off; /* 0x30 */ u16 pages; /* 0x32 */ u16 vesa_attributes; /* 0x34 */ - /* 0x36 -- 0x3f reserved for future expansion */ + u32 capabilities; /* 0x36 */ + /* 0x3a -- 0x3f reserved for future expansion */ }; extern struct screen_info screen_info; diff --git a/include/linux/usb.h b/include/linux/usb.h index 72463779299..4dbe580f933 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -5,6 +5,7 @@ #include <linux/usb_ch9.h> #define USB_MAJOR 180 +#define USB_DEVICE_MAJOR 189 #ifdef __KERNEL__ @@ -349,6 +350,7 @@ struct usb_device { char *manufacturer; char *serial; /* static strings from the device */ struct list_head filelist; + struct class_device *class_dev; struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ /* @@ -614,7 +616,6 @@ extern int usb_disabled(void); #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ -#define URB_ASYNC_UNLINK 0x0010 /* usb_unlink_urb() returns asap */ #define URB_NO_FSBR 0x0020 /* UHCI-specific */ #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ @@ -722,13 +723,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); * Initialization: * * All URBs submitted must initialize the dev, pipe, transfer_flags (may be - * zero), and complete fields. - * The URB_ASYNC_UNLINK transfer flag affects later invocations of - * the usb_unlink_urb() routine. Note: Failure to set URB_ASYNC_UNLINK - * with usb_unlink_urb() is deprecated. For synchronous unlinks use - * usb_kill_urb() instead. - * - * All URBs must also initialize + * zero), and complete fields. All URBs must also initialize * transfer_buffer and transfer_buffer_length. They may provide the * URB_SHORT_NOT_OK transfer flag, indicating that short reads are * to be treated as errors; that flag is invalid for write requests. diff --git a/include/linux/usb_isp116x.h b/include/linux/usb_isp116x.h index 5f5a9d9bd6c..436dd8a2b64 100644 --- a/include/linux/usb_isp116x.h +++ b/include/linux/usb_isp116x.h @@ -7,36 +7,18 @@ struct isp116x_platform_data { /* Enable internal resistors on downstream ports */ unsigned sel15Kres:1; - /* Chip's internal clock won't be stopped in suspended state. - Setting/unsetting this bit takes effect only if - 'remote_wakeup_enable' below is not set. */ - unsigned clknotstop:1; - /* On-chip overcurrent protection */ + /* On-chip overcurrent detection */ unsigned oc_enable:1; /* INT output polarity */ unsigned int_act_high:1; /* INT edge or level triggered */ unsigned int_edge_triggered:1; - /* WAKEUP pin connected - NOT SUPPORTED */ - /* unsigned remote_wakeup_connected:1; */ - /* Wakeup by devices on usb bus enabled */ + /* Enable wakeup by devices on usb bus (e.g. wakeup + by attachment/detachment or by device activity + such as moving a mouse). When chosen, this option + prevents stopping internal clock, increasing + thereby power consumption in suspended state. */ unsigned remote_wakeup_enable:1; - /* Switch or not to switch (keep always powered) */ - unsigned no_power_switching:1; - /* Ganged port power switching (0) or individual port - power switching (1) */ - unsigned power_switching_mode:1; - /* Given port_power, msec/2 after power on till power good */ - u8 potpg; - /* Hardware reset set/clear. If implemented, this function must: - if set == 0, deassert chip's HW reset pin - otherwise, assert chip's HW reset pin */ - void (*reset) (struct device * dev, int set); - /* Hardware clock start/stop. If implemented, this function must: - if start == 0, stop the external clock - otherwise, start the external clock - */ - void (*clock) (struct device * dev, int start); /* Inter-io delay (ns). The chip is picky about access timings; it expects at least: 150ns delay between consecutive accesses to DATA_REG, diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index fb57c221746..9facf733800 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -32,7 +32,6 @@ #define _LINUX_USBDEVICE_FS_H #include <linux/types.h> -#include <linux/compat.h> /* --------------------------------------------------------------------- */ @@ -125,6 +124,7 @@ struct usbdevfs_hub_portinfo { }; #ifdef CONFIG_COMPAT +#include <linux/compat.h> struct usbdevfs_urb32 { unsigned char type; unsigned char endpoint; diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 9d6fbde3d29..1cc8c31b798 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -3,7 +3,6 @@ #include <linux/compiler.h> #include <linux/types.h> -#include <linux/version.h> #define HAVE_V4L2 1 #include <linux/videodev2.h> @@ -29,7 +28,6 @@ struct video_device void (*release)(struct video_device *vfd); -#if 1 /* to be removed in 2.7.x */ /* obsolete -- fops->owner is used instead */ struct module *owner; /* dev->driver_data will be used instead some day. @@ -37,7 +35,6 @@ struct video_device * so the switch over will be transparent for you. * Or use {pci|usb}_{get|set}_drvdata() directly. */ void *priv; -#endif /* for videodev.c intenal usage -- please don't touch */ int users; /* video_exclusive_{open|close} ... */ diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index acbfc525576..f623a33b9ab 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -270,7 +270,6 @@ struct v4l2_timecode /* The above is based on SMPTE timecodes */ -#if 1 /* * M P E G C O M P R E S S I O N P A R A M E T E R S * @@ -357,7 +356,6 @@ struct v4l2_mpeg_compression { /* I don't expect the above being perfect yet ;) */ __u32 reserved_5[8]; }; -#endif struct v4l2_jpegcompression { @@ -871,10 +869,8 @@ struct v4l2_streamparm #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) -#if 1 /* experimental */ #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) -#endif #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 542dbaee651..343d883d69c 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -109,8 +109,6 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); int do_writepages(struct address_space *mapping, struct writeback_control *wbc); int sync_page_range(struct inode *inode, struct address_space *mapping, loff_t pos, size_t count); -int sync_page_range_nolock(struct inode *inode, struct address_space - *mapping, loff_t pos, size_t count); /* pdflush.c */ extern int nr_pdflush_threads; /* Global so it can be exported to sysctl diff --git a/include/media/audiochip.h b/include/media/audiochip.h index cd831168fdc..a7ceee9fc5e 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h @@ -1,5 +1,4 @@ /* - * $Id: audiochip.h,v 1.5 2005/06/16 22:59:16 hhackmann Exp $ */ #ifndef AUDIOCHIP_H diff --git a/include/media/id.h b/include/media/id.h index 801ddef301a..6d02c94cdc0 100644 --- a/include/media/id.h +++ b/include/media/id.h @@ -1,5 +1,4 @@ /* - * $Id: id.h,v 1.4 2005/06/12 04:19:19 mchehab Exp $ */ /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 698670547f1..01b56822df4 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -1,5 +1,4 @@ /* - * $Id: ir-common.h,v 1.9 2005/05/15 19:01:26 mchehab Exp $ * * some common structs and functions to handle infrared remotes via * input layer ... @@ -21,11 +20,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/version.h> #include <linux/input.h> #define IR_TYPE_RC5 1 +#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ #define IR_TYPE_OTHER 99 #define IR_KEYTAB_TYPE u32 @@ -60,6 +59,7 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, u32 ir_extract_bits(u32 data, u32 mask); int ir_dump_samples(u32 *samples, int count); int ir_decode_biphase(u32 *samples, int count, int low, int high); +int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); /* * Local variables: diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 3dfb8d670eb..2a897c3a6a9 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h @@ -1,7 +1,6 @@ #ifndef __SAA7146__ #define __SAA7146__ -#include <linux/version.h> /* for version macros */ #include <linux/module.h> /* for module-version */ #include <linux/delay.h> /* for delay-stuff */ #include <linux/slab.h> /* for kmalloc/kfree */ @@ -15,12 +14,7 @@ #include <linux/vmalloc.h> /* for vmalloc() */ #include <linux/mm.h> /* for vmalloc_to_page() */ -/* ugly, but necessary to build the dvb stuff under 2.4. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) - #include "dvb_functions.h" -#endif - -#define SAA7146_VERSION_CODE KERNEL_VERSION(0,5,0) +#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */ #define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) #define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) @@ -33,13 +27,8 @@ extern unsigned int saa7146_debug; #define DEBUG_VARIABLE saa7146_debug #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) -#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_BASENAME),__FUNCTION__) -#define INFO(x) { printk("%s: ",__stringify(KBUILD_BASENAME)); printk x; } -#else #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) #define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } -#endif #define ERR(x) { DEBUG_PROLOG; printk x; } diff --git a/include/media/tuner.h b/include/media/tuner.h index eeaa15ddee8..4ad08e24a1a 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -1,6 +1,4 @@ - -/* $Id: tuner.h,v 1.45 2005/07/28 18:41:21 mchehab Exp $ - * +/* tuner.h - definition for different tuners Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) @@ -28,88 +26,90 @@ #define ADDR_UNSET (255) -#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ -#define TUNER_PHILIPS_PAL_I 1 -#define TUNER_PHILIPS_NTSC 2 -#define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */ - -#define TUNER_ABSENT 4 -#define TUNER_PHILIPS_PAL 5 -#define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */ -#define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */ - -#define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */ -#define TUNER_ALPS_TSBH1_NTSC 9 -#define TUNER_ALPS_TSBE1_PAL 10 -#define TUNER_ALPS_TSBB5_PAL_I 11 - -#define TUNER_ALPS_TSBE5_PAL 12 -#define TUNER_ALPS_TSBC5_PAL 13 -#define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */ -#define TUNER_ALPS_TSHC6_NTSC 15 - -#define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */ -#define TUNER_PHILIPS_NTSC_M 17 -#define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */ -#define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/ - -#define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711)*/ -#define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732)*/ -#define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104)*/ +#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ +#define TUNER_PHILIPS_PAL_I 1 +#define TUNER_PHILIPS_NTSC 2 +#define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */ + +#define TUNER_ABSENT 4 +#define TUNER_PHILIPS_PAL 5 +#define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */ +#define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */ + +#define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */ +#define TUNER_ALPS_TSBH1_NTSC 9 +#define TUNER_ALPS_TSBE1_PAL 10 +#define TUNER_ALPS_TSBB5_PAL_I 11 + +#define TUNER_ALPS_TSBE5_PAL 12 +#define TUNER_ALPS_TSBC5_PAL 13 +#define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */ +#define TUNER_ALPS_TSHC6_NTSC 15 + +#define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */ +#define TUNER_PHILIPS_NTSC_M 17 +#define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */ +#define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657) */ + +#define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711) */ +#define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732) */ +#define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104) */ #define TUNER_PHILIPS_PAL_DK 23 -#define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */ -#define TUNER_LG_PAL_I_FM 25 -#define TUNER_LG_PAL_I 26 -#define TUNER_LG_NTSC_FM 27 +#define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */ +#define TUNER_LG_PAL_I_FM 25 +#define TUNER_LG_PAL_I 26 +#define TUNER_LG_NTSC_FM 27 -#define TUNER_LG_PAL_FM 28 -#define TUNER_LG_PAL 29 -#define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/ -#define TUNER_SHARP_2U5JF5540_NTSC 31 +#define TUNER_LG_PAL_FM 28 +#define TUNER_LG_PAL 29 +#define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163) */ +#define TUNER_SHARP_2U5JF5540_NTSC 31 -#define TUNER_Samsung_PAL_TCPM9091PD27 32 -#define TUNER_MT2032 33 -#define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865)*/ -#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/ +#define TUNER_Samsung_PAL_TCPM9091PD27 32 +#define TUNER_MT2032 33 +#define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865) */ +#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099) */ -#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/ -#define TUNER_LG_PAL_NEW_TAPC 37 -#define TUNER_PHILIPS_FM1216ME_MK3 38 -#define TUNER_LG_NTSC_NEW_TAPC 39 +#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746) */ +#define TUNER_LG_PAL_NEW_TAPC 37 +#define TUNER_PHILIPS_FM1216ME_MK3 38 +#define TUNER_LG_NTSC_NEW_TAPC 39 -#define TUNER_HITACHI_NTSC 40 -#define TUNER_PHILIPS_PAL_MK 41 -#define TUNER_PHILIPS_ATSC 42 -#define TUNER_PHILIPS_FM1236_MK3 43 +#define TUNER_HITACHI_NTSC 40 +#define TUNER_PHILIPS_PAL_MK 41 +#define TUNER_PHILIPS_ATSC 42 +#define TUNER_PHILIPS_FM1236_MK3 43 -#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ +#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ /* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ -#define TUNER_MICROTUNE_4049FM5 45 -#define TUNER_LG_NTSC_TAPE 47 - -#define TUNER_TNF_8831BGFF 48 -#define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */ -#define TUNER_TCL_2002N 50 -#define TUNER_PHILIPS_FM1256_IH3 51 - -#define TUNER_THOMSON_DTT7610 52 -#define TUNER_PHILIPS_FQ1286 53 -#define TUNER_PHILIPS_TDA8290 54 -#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ - -#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ -#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ - -#define TUNER_YMEC_TVF_8531MF 58 -#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ -#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ -#define TUNER_TENA_9533_DI 61 - -#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ -#define TUNER_PHILIPS_FMD1216ME_MK3 63 -#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ -#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ +#define TUNER_MICROTUNE_4049FM5 45 +#define TUNER_MICROTUNE_4042_FI5 46 +#define TUNER_LG_NTSC_TAPE 47 + +#define TUNER_TNF_8831BGFF 48 +#define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */ +#define TUNER_TCL_2002N 50 +#define TUNER_PHILIPS_FM1256_IH3 51 + +#define TUNER_THOMSON_DTT7610 52 +#define TUNER_PHILIPS_FQ1286 53 +#define TUNER_PHILIPS_TDA8290 54 +#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ + +#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ +#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ +#define TUNER_YMEC_TVF_8531MF 58 +#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ + +#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ +#define TUNER_TENA_9533_DI 61 +#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ +#define TUNER_PHILIPS_FMD1216ME_MK3 63 + +#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ +#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ +#define TUNER_LG_NTSC_TALN_MINI 66 #define NOTUNER 0 #define PAL 1 /* PAL_BG */ @@ -117,7 +117,7 @@ #define NTSC 3 #define SECAM 4 #define ATSC 5 -#define RADIO 6 +#define RADIO 6 #define NoTuner 0 #define Philips 1 @@ -134,6 +134,7 @@ #define THOMSON 12 #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) +#define TUNER_SET_STANDBY _IOW('T',4,int) #define TDA9887_SET_CONFIG _IOW('t',5,int) /* tv card specific */ @@ -153,9 +154,6 @@ #ifdef __KERNEL__ -#define I2C_ADDR_TDA8290 0x4b -#define I2C_ADDR_TDA8275 0x61 - enum tuner_mode { T_UNINITIALIZED = 0, T_RADIO = 1 << V4L2_TUNER_RADIO, @@ -165,21 +163,21 @@ enum tuner_mode { }; struct tuner_setup { - unsigned short addr; - unsigned int type; - unsigned int mode_mask; + unsigned short addr; + unsigned int type; + unsigned int mode_mask; }; struct tuner { /* device */ struct i2c_client i2c; - unsigned int type; /* chip type */ + unsigned int type; /* chip type */ - unsigned int mode; - unsigned int mode_mask; /* Combination of allowable modes */ + unsigned int mode; + unsigned int mode_mask; /* Combination of allowable modes */ - unsigned int freq; /* keep track of the current settings */ + unsigned int freq; /* keep track of the current settings */ unsigned int audmode; v4l2_std_id std; @@ -198,6 +196,7 @@ struct tuner { void (*radio_freq)(struct i2c_client *c, unsigned int freq); int (*has_signal)(struct i2c_client *c); int (*is_stereo)(struct i2c_client *c); + void (*standby)(struct i2c_client *c); }; extern unsigned int tuner_debug; @@ -209,16 +208,20 @@ extern int tea5767_tuner_init(struct i2c_client *c); extern int default_tuner_init(struct i2c_client *c); extern int tea5767_autodetection(struct i2c_client *c); -#define tuner_warn(fmt, arg...) \ - dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) -#define tuner_info(fmt, arg...) \ - dev_printk(KERN_INFO , &t->i2c.dev , fmt , ## arg) -#define tuner_dbg(fmt, arg...) \ - if (tuner_debug) dev_printk(KERN_DEBUG , &t->i2c.dev , fmt , ## arg) +#define tuner_warn(fmt, arg...) do {\ + printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ + t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) +#define tuner_info(fmt, arg...) do {\ + printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ + t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) +#define tuner_dbg(fmt, arg...) do {\ + if (tuner_debug) \ + printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ + t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #endif /* __KERNEL__ */ -#endif +#endif /* _TUNER_H */ /* * Overrides for Emacs so that we follow Linus's tabbing style. diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h index 854a2c2f105..e2035c7da09 100644 --- a/include/media/tveeprom.h +++ b/include/media/tveeprom.h @@ -1,18 +1,21 @@ /* - * $Id: tveeprom.h,v 1.2 2005/06/12 04:19:19 mchehab Exp $ */ struct tveeprom { u32 has_radio; + u32 has_ir; /* 0: no IR, 1: IR present, 2: unknown */ u32 tuner_type; u32 tuner_formats; + u32 tuner2_type; + u32 tuner2_formats; + u32 digitizer; u32 digitizer_formats; u32 audio_processor; - /* a_p_fmts? */ + u32 decoder_processor; u32 model; u32 revision; @@ -20,7 +23,7 @@ struct tveeprom { char rev_str[5]; }; -void tveeprom_hauppauge_analog(struct tveeprom *tvee, +void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, unsigned char *eeprom_data); int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); diff --git a/include/media/video-buf.h b/include/media/video-buf.h index ae6da6de98d..ae8d7a00044 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h @@ -1,5 +1,4 @@ /* - * $Id: video-buf.h,v 1.9 2004/11/07 13:17:15 kraxel Exp $ * * generic helper functions for video4linux capture buffers, to handle * memory management and PCI DMA. Right now bttv + saa7134 use it. diff --git a/include/net/ax25.h b/include/net/ax25.h index 364b046e9f4..9dbcd9e51c0 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -26,11 +26,20 @@ /* AX.25 Protocol IDs */ #define AX25_P_ROSE 0x01 -#define AX25_P_IP 0xCC -#define AX25_P_ARP 0xCD -#define AX25_P_TEXT 0xF0 -#define AX25_P_NETROM 0xCF -#define AX25_P_SEGMENT 0x08 +#define AX25_P_VJCOMP 0x06 /* Compressed TCP/IP packet */ + /* Van Jacobsen (RFC 1144) */ +#define AX25_P_VJUNCOMP 0x07 /* Uncompressed TCP/IP packet */ + /* Van Jacobsen (RFC 1144) */ +#define AX25_P_SEGMENT 0x08 /* Segmentation fragment */ +#define AX25_P_TEXNET 0xc3 /* TEXTNET datagram protocol */ +#define AX25_P_LQ 0xc4 /* Link Quality Protocol */ +#define AX25_P_ATALK 0xca /* Appletalk */ +#define AX25_P_ATALK_ARP 0xcb /* Appletalk ARP */ +#define AX25_P_IP 0xcc /* ARPA Internet Protocol */ +#define AX25_P_ARP 0xcd /* ARPA Adress Resolution */ +#define AX25_P_FLEXNET 0xce /* FlexNet */ +#define AX25_P_NETROM 0xcf /* NET/ROM */ +#define AX25_P_TEXT 0xF0 /* No layer 3 protocol impl. */ /* AX.25 Segment control values */ #define AX25_SEG_REM 0x7F @@ -88,11 +97,11 @@ /* Define Link State constants. */ enum { - AX25_STATE_0, - AX25_STATE_1, - AX25_STATE_2, - AX25_STATE_3, - AX25_STATE_4 + AX25_STATE_0, /* Listening */ + AX25_STATE_1, /* SABM sent */ + AX25_STATE_2, /* DISC sent */ + AX25_STATE_3, /* Established */ + AX25_STATE_4 /* Recovery */ }; #define AX25_MODULUS 8 /* Standard AX.25 modulus */ @@ -258,7 +267,7 @@ extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *); /* ax25_addr.c */ extern ax25_address null_ax25_address; extern char *ax2asc(char *buf, ax25_address *); -extern ax25_address *asc2ax(char *); +extern void asc2ax(ax25_address *addr, char *callsign); extern int ax25cmp(ax25_address *, ax25_address *); extern int ax25digicmp(ax25_digi *, ax25_digi *); extern unsigned char *ax25_addr_parse(unsigned char *, int, ax25_address *, ax25_address *, ax25_digi *, int *, int *); @@ -319,7 +328,7 @@ extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *); extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); /* ax25_ip.c */ -extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); +extern int ax25_hard_header(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); extern int ax25_rebuild_header(struct sk_buff *); /* ax25_out.c */ diff --git a/include/net/compat.h b/include/net/compat.h index 9983fd85780..290bab46d45 100644 --- a/include/net/compat.h +++ b/include/net/compat.h @@ -33,7 +33,8 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); -extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *, - int); + +struct sock; +extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); #endif /* NET_COMPAT_H */ diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 3203eaff4bd..65ec86678a0 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -233,6 +233,10 @@ extern int ip6_ra_control(struct sock *sk, int sel, extern int ipv6_parse_hopopts(struct sk_buff *skb, int); extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); +extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, + int newtype, + struct ipv6_opt_hdr __user *newopt, + int newoptlen); extern int ip6_frag_nqueues; extern atomic_t ip6_frag_mem; @@ -373,6 +377,7 @@ extern int ip6_append_data(struct sock *sk, int length, int transhdrlen, int hlimit, + int tclass, struct ipv6_txoptions *opt, struct flowi *fl, struct rt6_info *rt, diff --git a/include/net/netrom.h b/include/net/netrom.h index 45f2c7616d8..a6bf6e0f606 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h @@ -6,6 +6,7 @@ #ifndef _NETROM_H #define _NETROM_H + #include <linux/netrom.h> #include <linux/list.h> #include <net/sock.h> @@ -22,6 +23,7 @@ #define NR_DISCACK 0x04 #define NR_INFO 0x05 #define NR_INFOACK 0x06 +#define NR_RESET 0x07 #define NR_CHOKE_FLAG 0x80 #define NR_NAK_FLAG 0x40 @@ -51,11 +53,16 @@ enum { #define NR_DEFAULT_TTL 16 /* Default Time To Live - 16 */ #define NR_DEFAULT_ROUTING 1 /* Is routing enabled ? */ #define NR_DEFAULT_FAILS 2 /* Link fails until route fails */ +#define NR_DEFAULT_RESET 0 /* Sent / accept reset cmds? */ #define NR_MODULUS 256 #define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ #define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ +struct nr_private { + struct net_device_stats stats; +}; + struct nr_sock { struct sock sock; ax25_address user_addr, source_addr, dest_addr; @@ -176,6 +183,8 @@ extern int sysctl_netrom_transport_requested_window_size; extern int sysctl_netrom_transport_no_activity_timeout; extern int sysctl_netrom_routing_control; extern int sysctl_netrom_link_fails_count; +extern int sysctl_netrom_reset_circuit; + extern int nr_rx_frame(struct sk_buff *, struct net_device *); extern void nr_destroy_socket(struct sock *); @@ -218,7 +227,28 @@ extern void nr_requeue_frames(struct sock *); extern int nr_validate_nr(struct sock *, unsigned short); extern int nr_in_rx_window(struct sock *, unsigned short); extern void nr_write_internal(struct sock *, int); -extern void nr_transmit_refusal(struct sk_buff *, int); + +extern void __nr_transmit_reply(struct sk_buff *skb, int mine, + unsigned char cmdflags); + +/* + * This routine is called when a Connect Acknowledge with the Choke Flag + * set is needed to refuse a connection. + */ +#define nr_transmit_refusal(skb, mine) \ +do { \ + __nr_transmit_reply((skb), (mine), NR_CONNACK | NR_CHOKE_FLAG); \ +} while (0) + +/* + * This routine is called when we don't have a circuit matching an incoming + * NET/ROM packet. This is an G8PZT Xrouter extension. + */ +#define nr_transmit_reset(skb, mine) \ +do { \ + __nr_transmit_reply((skb), (mine), NR_RESET); \ +} while (0) + extern void nr_disconnect(struct sock *, int); /* nr_timer.c */ diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 8b075ab7a26..4e86f2de663 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -37,7 +37,7 @@ extern int datagram_recv_ctl(struct sock *sk, extern int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, struct ipv6_txoptions *opt, - int *hlimit); + int *hlimit, int *tclass); #define LOOPBACK4_IPV6 __constant_htonl(0x7f000006) diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index b707a603351..cb8b6e6ce66 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -151,6 +151,8 @@ struct pcmcia_device { uniquely define a pcmcia_device */ struct pcmcia_socket *socket; + char *devname; + u8 device_no; /* the hardware "function" device; certain subdevices can diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h index 77fe9039209..5308683c8c4 100644 --- a/include/rdma/ib_cm.h +++ b/include/rdma/ib_cm.h @@ -290,6 +290,7 @@ struct ib_cm_id { enum ib_cm_lap_state lap_state; /* internal CM/debug use */ __be32 local_id; __be32 remote_id; + u32 remote_cm_qpn; /* 1 unless redirected */ }; /** diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h index fc6b1c18ffc..53184a38fdf 100644 --- a/include/rdma/ib_mad.h +++ b/include/rdma/ib_mad.h @@ -173,6 +173,27 @@ struct ib_vendor_mad { u8 data[216]; }; +struct ib_class_port_info +{ + u8 base_version; + u8 class_version; + __be16 capability_mask; + u8 reserved[3]; + u8 resp_time_value; + u8 redirect_gid[16]; + __be32 redirect_tcslfl; + __be16 redirect_lid; + __be16 redirect_pkey; + __be32 redirect_qp; + __be32 redirect_qkey; + u8 trap_gid[16]; + __be32 trap_tcslfl; + __be16 trap_lid; + __be16 trap_pkey; + __be32 trap_hlqp; + __be32 trap_qkey; +}; + /** * ib_mad_send_buf - MAD data buffer and work request for sends. * @mad: References an allocated MAD data buffer. The size of the data diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index c022edfc49d..a7555c800ec 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h @@ -46,7 +46,36 @@ enum { IB_SA_METHOD_GET_TABLE = 0x12, IB_SA_METHOD_GET_TABLE_RESP = 0x92, - IB_SA_METHOD_DELETE = 0x15 + IB_SA_METHOD_DELETE = 0x15, + IB_SA_METHOD_DELETE_RESP = 0x95, + IB_SA_METHOD_GET_MULTI = 0x14, + IB_SA_METHOD_GET_MULTI_RESP = 0x94, + IB_SA_METHOD_GET_TRACE_TBL = 0x13 +}; + +enum { + IB_SA_ATTR_CLASS_PORTINFO = 0x01, + IB_SA_ATTR_NOTICE = 0x02, + IB_SA_ATTR_INFORM_INFO = 0x03, + IB_SA_ATTR_NODE_REC = 0x11, + IB_SA_ATTR_PORT_INFO_REC = 0x12, + IB_SA_ATTR_SL2VL_REC = 0x13, + IB_SA_ATTR_SWITCH_REC = 0x14, + IB_SA_ATTR_LINEAR_FDB_REC = 0x15, + IB_SA_ATTR_RANDOM_FDB_REC = 0x16, + IB_SA_ATTR_MCAST_FDB_REC = 0x17, + IB_SA_ATTR_SM_INFO_REC = 0x18, + IB_SA_ATTR_LINK_REC = 0x20, + IB_SA_ATTR_GUID_INFO_REC = 0x30, + IB_SA_ATTR_SERVICE_REC = 0x31, + IB_SA_ATTR_PARTITION_REC = 0x33, + IB_SA_ATTR_PATH_REC = 0x35, + IB_SA_ATTR_VL_ARB_REC = 0x36, + IB_SA_ATTR_MC_MEMBER_REC = 0x38, + IB_SA_ATTR_TRACE_REC = 0x39, + IB_SA_ATTR_MULTI_PATH_REC = 0x3a, + IB_SA_ATTR_SERVICE_ASSOC_REC = 0x3b, + IB_SA_ATTR_INFORM_INFO_REC = 0xf3 }; enum ib_sa_selector { diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h index 72182d16778..e4d1654276a 100644 --- a/include/rdma/ib_user_cm.h +++ b/include/rdma/ib_user_cm.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. + * Copyright (c) 2005 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -37,7 +38,7 @@ #include <linux/types.h> -#define IB_USER_CM_ABI_VERSION 1 +#define IB_USER_CM_ABI_VERSION 2 enum { IB_USER_CM_CMD_CREATE_ID, @@ -60,6 +61,7 @@ enum { IB_USER_CM_CMD_SEND_SIDR_REP, IB_USER_CM_CMD_EVENT, + IB_USER_CM_CMD_INIT_QP_ATTR, }; /* * command ABI structures. @@ -71,6 +73,7 @@ struct ib_ucm_cmd_hdr { }; struct ib_ucm_create_id { + __u64 uid; __u64 response; }; @@ -79,9 +82,14 @@ struct ib_ucm_create_id_resp { }; struct ib_ucm_destroy_id { + __u64 response; __u32 id; }; +struct ib_ucm_destroy_id_resp { + __u32 events_reported; +}; + struct ib_ucm_attr_id { __u64 response; __u32 id; @@ -94,6 +102,64 @@ struct ib_ucm_attr_id_resp { __be32 remote_id; }; +struct ib_ucm_init_qp_attr { + __u64 response; + __u32 id; + __u32 qp_state; +}; + +struct ib_ucm_ah_attr { + __u8 grh_dgid[16]; + __u32 grh_flow_label; + __u16 dlid; + __u16 reserved; + __u8 grh_sgid_index; + __u8 grh_hop_limit; + __u8 grh_traffic_class; + __u8 sl; + __u8 src_path_bits; + __u8 static_rate; + __u8 is_global; + __u8 port_num; +}; + +struct ib_ucm_init_qp_attr_resp { + __u32 qp_attr_mask; + __u32 qp_state; + __u32 cur_qp_state; + __u32 path_mtu; + __u32 path_mig_state; + __u32 qkey; + __u32 rq_psn; + __u32 sq_psn; + __u32 dest_qp_num; + __u32 qp_access_flags; + + struct ib_ucm_ah_attr ah_attr; + struct ib_ucm_ah_attr alt_ah_attr; + + /* ib_qp_cap */ + __u32 max_send_wr; + __u32 max_recv_wr; + __u32 max_send_sge; + __u32 max_recv_sge; + __u32 max_inline_data; + + __u16 pkey_index; + __u16 alt_pkey_index; + __u8 en_sqd_async_notify; + __u8 sq_draining; + __u8 max_rd_atomic; + __u8 max_dest_rd_atomic; + __u8 min_rnr_timer; + __u8 port_num; + __u8 timeout; + __u8 retry_cnt; + __u8 rnr_retry; + __u8 alt_port_num; + __u8 alt_timeout; +}; + struct ib_ucm_listen { __be64 service_id; __be64 service_mask; @@ -157,6 +223,7 @@ struct ib_ucm_req { }; struct ib_ucm_rep { + __u64 uid; __u64 data; __u32 id; __u32 qpn; @@ -232,7 +299,6 @@ struct ib_ucm_event_get { }; struct ib_ucm_req_event_resp { - __u32 listen_id; /* device */ /* port */ struct ib_ucm_path_rec primary_path; @@ -287,7 +353,6 @@ struct ib_ucm_apr_event_resp { }; struct ib_ucm_sidr_req_event_resp { - __u32 listen_id; /* device */ /* port */ __u16 pkey; @@ -307,6 +372,7 @@ struct ib_ucm_sidr_rep_event_resp { #define IB_UCM_PRES_ALTERNATE 0x08 struct ib_ucm_event_resp { + __u64 uid; __u32 id; __u32 event; __u32 present; diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h index 7ebb01c8f99..fd85725391a 100644 --- a/include/rdma/ib_user_verbs.h +++ b/include/rdma/ib_user_verbs.h @@ -42,7 +42,7 @@ * Increment this value if any changes that break userspace ABI * compatibility are made. */ -#define IB_USER_VERBS_ABI_VERSION 1 +#define IB_USER_VERBS_ABI_VERSION 2 enum { IB_USER_VERBS_CMD_QUERY_PARAMS, @@ -292,7 +292,14 @@ struct ib_uverbs_create_cq_resp { }; struct ib_uverbs_destroy_cq { + __u64 response; __u32 cq_handle; + __u32 reserved; +}; + +struct ib_uverbs_destroy_cq_resp { + __u32 comp_events_reported; + __u32 async_events_reported; }; struct ib_uverbs_create_qp { @@ -372,7 +379,13 @@ struct ib_uverbs_modify_qp_resp { }; struct ib_uverbs_destroy_qp { + __u64 response; __u32 qp_handle; + __u32 reserved; +}; + +struct ib_uverbs_destroy_qp_resp { + __u32 events_reported; }; struct ib_uverbs_attach_mcast { @@ -416,7 +429,13 @@ struct ib_uverbs_modify_srq { }; struct ib_uverbs_destroy_srq { + __u64 response; __u32 srq_handle; + __u32 reserved; +}; + +struct ib_uverbs_destroy_srq_resp { + __u32 events_reported; }; #endif /* IB_USER_VERBS_H */ diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index da63722c012..c0e4c67d836 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -178,8 +178,8 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev) extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, uint, uint, uint, void *hostdata); -#define scsi_add_device(host, channel, target, lun) \ - __scsi_add_device(host, channel, target, lun, NULL) +extern int scsi_add_device(struct Scsi_Host *host, uint channel, + uint target, uint lun); extern void scsi_remove_device(struct scsi_device *); extern int scsi_device_cancel(struct scsi_device *, int); diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 70ad16315a1..115db056dc6 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -439,4 +439,12 @@ int fc_remote_port_block(struct fc_rport *rport); void fc_remote_port_unblock(struct fc_rport *rport); int scsi_is_fc_rport(const struct device *); +static inline u64 wwn_to_u64(u8 *wwn) +{ + return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 | + (u64)wwn[2] << 40 | (u64)wwn[3] << 32 | + (u64)wwn[4] << 24 | (u64)wwn[5] << 16 | + (u64)wwn[6] << 8 | (u64)wwn[7]; +} + #endif /* SCSI_TRANSPORT_FC_H */ diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h new file mode 100644 index 00000000000..bc4aeb660dd --- /dev/null +++ b/include/scsi/scsi_transport_sas.h @@ -0,0 +1,100 @@ +#ifndef SCSI_TRANSPORT_SAS_H +#define SCSI_TRANSPORT_SAS_H + +#include <linux/transport_class.h> +#include <linux/types.h> + +struct scsi_transport_template; +struct sas_rphy; + + +enum sas_device_type { + SAS_PHY_UNUSED, + SAS_END_DEVICE, + SAS_EDGE_EXPANDER_DEVICE, + SAS_FANOUT_EXPANDER_DEVICE, +}; + +enum sas_protocol { + SAS_PROTOCOL_SATA = 0x01, + SAS_PROTOCOL_SMP = 0x02, + SAS_PROTOCOL_STP = 0x04, + SAS_PROTOCOL_SSP = 0x08, +}; + +enum sas_linkrate { + SAS_LINK_RATE_UNKNOWN, + SAS_PHY_DISABLED, + SAS_LINK_RATE_FAILED, + SAS_SATA_SPINUP_HOLD, + SAS_SATA_PORT_SELECTOR, + SAS_LINK_RATE_1_5_GBPS, + SAS_LINK_RATE_3_0_GBPS, + SAS_LINK_VIRTUAL, +}; + +struct sas_identify { + enum sas_device_type device_type; + enum sas_protocol initiator_port_protocols; + enum sas_protocol target_port_protocols; + u64 sas_address; + u8 phy_identifier; +}; + +/* The functions by which the transport class and the driver communicate */ +struct sas_function_template { +}; + +struct sas_phy { + struct device dev; + int number; + struct sas_identify identify; + enum sas_linkrate negotiated_linkrate; + enum sas_linkrate minimum_linkrate_hw; + enum sas_linkrate minimum_linkrate; + enum sas_linkrate maximum_linkrate_hw; + enum sas_linkrate maximum_linkrate; + u8 port_identifier; + struct sas_rphy *rphy; +}; + +#define dev_to_phy(d) \ + container_of((d), struct sas_phy, dev) +#define transport_class_to_phy(cdev) \ + dev_to_phy((cdev)->dev) +#define phy_to_shost(phy) \ + dev_to_shost((phy)->dev.parent) + +struct sas_rphy { + struct device dev; + struct sas_identify identify; + struct list_head list; + u32 scsi_target_id; +}; + +#define dev_to_rphy(d) \ + container_of((d), struct sas_rphy, dev) +#define transport_class_to_rphy(cdev) \ + dev_to_rphy((cdev)->dev) +#define rphy_to_shost(rphy) \ + dev_to_shost((rphy)->dev.parent) + +extern void sas_remove_host(struct Scsi_Host *); + +extern struct sas_phy *sas_phy_alloc(struct device *, int); +extern void sas_phy_free(struct sas_phy *); +extern int sas_phy_add(struct sas_phy *); +extern void sas_phy_delete(struct sas_phy *); +extern int scsi_is_sas_phy(const struct device *); + +extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *); +void sas_rphy_free(struct sas_rphy *); +extern int sas_rphy_add(struct sas_rphy *); +extern void sas_rphy_delete(struct sas_rphy *); +extern int scsi_is_sas_rphy(const struct device *); + +extern struct scsi_transport_template * +sas_attach_transport(struct sas_function_template *); +extern void sas_release_transport(struct scsi_transport_template *); + +#endif /* SCSI_TRANSPORT_SAS_H */ diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 389e8ebe9c1..d6361dab037 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -910,11 +910,10 @@ int snd_pcm_format_big_endian(snd_pcm_format_t format); * Returns 1 if the given PCM format is CPU-endian, 0 if * opposite, or a negative error code if endian not specified. */ -/* int snd_pcm_format_cpu_endian(snd_pcm_format_t format); */ #ifdef SNDRV_LITTLE_ENDIAN -#define snd_pcm_format_cpu_endian snd_pcm_format_little_endian +#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format) #else -#define snd_pcm_format_cpu_endian snd_pcm_format_big_endian +#define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format) #endif int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index ad3c3be33c0..b82e408e758 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -34,9 +34,7 @@ struct snd_tea575x_ops { struct snd_tea575x { snd_card_t *card; struct video_device vd; /* video device */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) struct file_operations fops; -#endif int dev_nr; /* requested device number + 1 */ int vd_registered; /* video device is registered */ int tea5759; /* 5759 chip is present */ diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h new file mode 100644 index 00000000000..a9948232b13 --- /dev/null +++ b/include/video/cyblafb.h @@ -0,0 +1,171 @@ + +#ifndef CYBLAFB_DEBUG +#define CYBLAFB_DEBUG 0 +#endif + +#if CYBLAFB_DEBUG +#define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a); +#else +#define debug(f,a...) +#endif + +#define output(f, a...) printk("cyblafb: " f, ## a) + +#define Kb (1024) +#define Mb (Kb*Kb) + +/* PCI IDS of supported cards temporarily here */ + +#define CYBERBLADEi1 0x8500 + +/* these defines are for 'lcd' variable */ +#define LCD_STRETCH 0 +#define LCD_CENTER 1 +#define LCD_BIOS 2 + +/* display types */ +#define DISPLAY_CRT 0 +#define DISPLAY_FP 1 + +#define ROP_S 0xCC + +#define point(x,y) ((y)<<16|(x)) + +// +// Attribute Regs, ARxx, 3c0/3c1 +// +#define AR00 0x00 +#define AR01 0x01 +#define AR02 0x02 +#define AR03 0x03 +#define AR04 0x04 +#define AR05 0x05 +#define AR06 0x06 +#define AR07 0x07 +#define AR08 0x08 +#define AR09 0x09 +#define AR0A 0x0A +#define AR0B 0x0B +#define AR0C 0x0C +#define AR0D 0x0D +#define AR0E 0x0E +#define AR0F 0x0F +#define AR10 0x10 +#define AR12 0x12 +#define AR13 0x13 + +// +// Sequencer Regs, SRxx, 3c4/3c5 +// +#define SR00 0x00 +#define SR01 0x01 +#define SR02 0x02 +#define SR03 0x03 +#define SR04 0x04 +#define SR0D 0x0D +#define SR0E 0x0E +#define SR11 0x11 +#define SR18 0x18 +#define SR19 0x19 + +// +// +// +#define CR00 0x00 +#define CR01 0x01 +#define CR02 0x02 +#define CR03 0x03 +#define CR04 0x04 +#define CR05 0x05 +#define CR06 0x06 +#define CR07 0x07 +#define CR08 0x08 +#define CR09 0x09 +#define CR0A 0x0A +#define CR0B 0x0B +#define CR0C 0x0C +#define CR0D 0x0D +#define CR0E 0x0E +#define CR0F 0x0F +#define CR10 0x10 +#define CR11 0x11 +#define CR12 0x12 +#define CR13 0x13 +#define CR14 0x14 +#define CR15 0x15 +#define CR16 0x16 +#define CR17 0x17 +#define CR18 0x18 +#define CR19 0x19 +#define CR1A 0x1A +#define CR1B 0x1B +#define CR1C 0x1C +#define CR1D 0x1D +#define CR1E 0x1E +#define CR1F 0x1F +#define CR20 0x20 +#define CR21 0x21 +#define CR27 0x27 +#define CR29 0x29 +#define CR2A 0x2A +#define CR2B 0x2B +#define CR2D 0x2D +#define CR2F 0x2F +#define CR36 0x36 +#define CR38 0x38 +#define CR39 0x39 +#define CR3A 0x3A +#define CR55 0x55 +#define CR56 0x56 +#define CR57 0x57 +#define CR58 0x58 + +// +// +// + +#define GR00 0x01 +#define GR01 0x01 +#define GR02 0x02 +#define GR03 0x03 +#define GR04 0x04 +#define GR05 0x05 +#define GR06 0x06 +#define GR07 0x07 +#define GR08 0x08 +#define GR0F 0x0F +#define GR20 0x20 +#define GR23 0x23 +#define GR2F 0x2F +#define GR30 0x30 +#define GR31 0x31 +#define GR33 0x33 +#define GR52 0x52 +#define GR53 0x53 +#define GR5D 0x5d + + +// +// Graphics Engine +// +#define GEBase 0x2100 // could be mapped elsewhere if we like it +#define GE00 (GEBase+0x00) // source 1, p 111 +#define GE04 (GEBase+0x04) // source 2, p 111 +#define GE08 (GEBase+0x08) // destination 1, p 111 +#define GE0C (GEBase+0x0C) // destination 2, p 112 +#define GE20 (GEBase+0x20) // engine status, p 113 +#define GE24 (GEBase+0x24) // reset all GE pointers +#define GE44 (GEBase+0x44) // command register, p 126 +#define GE48 (GEBase+0x48) // raster operation, p 127 +#define GE60 (GEBase+0x60) // foreground color, p 128 +#define GE64 (GEBase+0x64) // background color, p 128 +#define GE6C (GEBase+0x6C) // Pattern and Style, p 129, ok +#define GE9C (GEBase+0x9C) // pixel engine data port, p 125 +#define GEB8 (GEBase+0xB8) // Destination Stride / Buffer Base 0, p 133 +#define GEBC (GEBase+0xBC) // Destination Stride / Buffer Base 1, p 133 +#define GEC0 (GEBase+0xC0) // Destination Stride / Buffer Base 2, p 133 +#define GEC4 (GEBase+0xC4) // Destination Stride / Buffer Base 3, p 133 +#define GEC8 (GEBase+0xC8) // Source Stride / Buffer Base 0, p 133 +#define GECC (GEBase+0xCC) // Source Stride / Buffer Base 1, p 133 +#define GED0 (GEBase+0xD0) // Source Stride / Buffer Base 2, p 133 +#define GED4 (GEBase+0xD4) // Source Stride / Buffer Base 3, p 133 diff --git a/include/video/sisfb.h b/include/video/sisfb.h index 136bf791643..e402eb5b3c7 100644 --- a/include/video/sisfb.h +++ b/include/video/sisfb.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * sisfb.h - definitions for the SiS framebuffer driver + * + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * 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 @@ -16,8 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA */ -#ifndef _LINUX_SISFB -#define _LINUX_SISFB +#ifndef _LINUX_SISFB_H_ +#define _LINUX_SISFB_H_ #include <asm/ioctl.h> #include <asm/types.h> @@ -26,47 +28,35 @@ /* PUBLIC */ /**********************************************/ -/* vbflags */ -#define CRT2_DEFAULT 0x00000001 -#define CRT2_LCD 0x00000002 /* TW: Never change the order of the CRT2_XXX entries */ -#define CRT2_TV 0x00000004 /* (see SISCycleCRT2Type()) */ -#define CRT2_VGA 0x00000008 -#define TV_NTSC 0x00000010 -#define TV_PAL 0x00000020 -#define TV_HIVISION 0x00000040 -#define TV_YPBPR 0x00000080 -#define TV_AVIDEO 0x00000100 -#define TV_SVIDEO 0x00000200 -#define TV_SCART 0x00000400 -#define VB_CONEXANT 0x00000800 /* 661 series only */ -#define VB_TRUMPION VB_CONEXANT /* 300 series only */ -#define TV_PALM 0x00001000 -#define TV_PALN 0x00002000 +/* vbflags, public (others in sis.h) */ +#define CRT2_DEFAULT 0x00000001 +#define CRT2_LCD 0x00000002 +#define CRT2_TV 0x00000004 +#define CRT2_VGA 0x00000008 +#define TV_NTSC 0x00000010 +#define TV_PAL 0x00000020 +#define TV_HIVISION 0x00000040 +#define TV_YPBPR 0x00000080 +#define TV_AVIDEO 0x00000100 +#define TV_SVIDEO 0x00000200 +#define TV_SCART 0x00000400 +#define TV_PALM 0x00001000 +#define TV_PALN 0x00002000 #define TV_NTSCJ 0x00001000 -#define VB_302ELV 0x00004000 -#define TV_CHSCART 0x00008000 -#define TV_CHYPBPR525I 0x00010000 +#define TV_CHSCART 0x00008000 +#define TV_CHYPBPR525I 0x00010000 #define CRT1_VGA 0x00000000 #define CRT1_LCDA 0x00020000 #define VGA2_CONNECTED 0x00040000 -#define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ -#define VB_301 0x00100000 /* Video bridge type */ -#define VB_301B 0x00200000 -#define VB_302B 0x00400000 -#define VB_30xBDH 0x00800000 /* 30xB DH version (w/o LCD support) */ -#define VB_LVDS 0x01000000 -#define VB_CHRONTEL 0x02000000 -#define VB_301LV 0x04000000 -#define VB_302LV 0x08000000 -#define VB_301C 0x10000000 -#define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ -#define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ -#define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ +#define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ +#define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ +#define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ +#define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ /* Aliases: */ #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) -#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) -#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) +#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) +#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) /* Only if TV_YPBPR is set: */ #define TV_YPBPR525I TV_NTSC @@ -75,89 +65,118 @@ #define TV_YPBPR1080I TV_PALN #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) -#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV) -#define VB_SISTVBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV) -#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT) - #define VB_DISPTYPE_DISP2 CRT2_ENABLE #define VB_DISPTYPE_CRT2 CRT2_ENABLE #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 #define VB_DISPMODE_SINGLE VB_SINGLE_MODE #define VB_DISPMODE_MIRROR VB_MIRROR_MODE #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE -#define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) +#define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) /* Structure argument for SISFB_GET_INFO ioctl */ -typedef struct _SISFB_INFO sisfb_info, *psisfb_info; - -struct _SISFB_INFO { - __u32 sisfb_id; /* for identifying sisfb */ +struct sisfb_info { + __u32 sisfb_id; /* for identifying sisfb */ #ifndef SISFB_ID #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ #endif - __u32 chip_id; /* PCI-ID of detected chip */ - __u32 memory; /* video memory in KB which sisfb manages */ - __u32 heapstart; /* heap start (= sisfb "mem" argument) in KB */ + __u32 chip_id; /* PCI-ID of detected chip */ + __u32 memory; /* total video memory in KB */ + __u32 heapstart; /* heap start offset in KB */ __u8 fbvidmode; /* current sisfb mode */ - __u8 sisfb_version; - __u8 sisfb_revision; - __u8 sisfb_patchlevel; + __u8 sisfb_version; + __u8 sisfb_revision; + __u8 sisfb_patchlevel; - __u8 sisfb_caps; /* sisfb capabilities */ + __u8 sisfb_caps; /* sisfb capabilities */ __u32 sisfb_tqlen; /* turbo queue length (in KB) */ - __u32 sisfb_pcibus; /* The card's PCI ID */ - __u32 sisfb_pcislot; - __u32 sisfb_pcifunc; + __u32 sisfb_pcibus; /* The card's PCI ID */ + __u32 sisfb_pcislot; + __u32 sisfb_pcifunc; + + __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ + + __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ + + __u32 sisfb_vbflags; + __u32 sisfb_currentvbflags; + + __u32 sisfb_scalelcd; + __u32 sisfb_specialtiming; + + __u8 sisfb_haveemi; + __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + __u8 sisfb_haveemilcd; - __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ + __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ - __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ + __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ - __u32 sisfb_vbflags; - __u32 sisfb_currentvbflags; + __u32 sisfb_heapsize; /* heap size (in KB) */ + __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */ - __u32 sisfb_scalelcd; - __u32 sisfb_specialtiming; + __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */ + __u32 sisfb_curdstn; - __u8 sisfb_haveemi; - __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; - __u8 sisfb_haveemilcd; + __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */ - __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ + __u32 sisfb_vbflags2; /* ivideo->vbflags2 */ - __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ + __u8 sisfb_can_post; /* sisfb can POST this card */ + __u8 sisfb_card_posted; /* card is POSTED */ + __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */ - __u8 reserved[208]; /* for future use */ + __u8 reserved[183]; /* for future use */ +}; + +#define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */ +#define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */ +/* more to come */ + +#define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */ +#define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */ +#define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */ +#define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */ +#define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */ +/* more to come */ +#define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */ +#define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */ + +/* Argument for SISFB_CMD ioctl */ +struct sisfb_cmd { + __u32 sisfb_cmd; + __u32 sisfb_arg[16]; + __u32 sisfb_result[4]; }; /* Addtional IOCTLs for communication sisfb <> X driver */ /* If changing this, vgatypes.h must also be changed (for X driver) */ /* ioctl for identifying and giving some info (esp. memory heap start) */ -#define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) -#define SISFB_GET_INFO _IOR(0xF3,0x01,struct _SISFB_INFO) +#define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) +#define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info) /* ioctrl to get current vertical retrace status */ -#define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) +#define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ -#define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) -#define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) +#define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) +#define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ -#define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) -#define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) +#define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) +#define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) + +/* ioctl for internal sisfb commands (sisfbctrl) */ +#define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd) /* ioctl for locking sisfb (no register access during lock) */ /* As of now, only used to avoid register access during * the ioctls listed above. */ -#define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) - -/* more to come soon */ +#define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) /* ioctls 0xF3 up to 0x3F reserved for sisfb */ @@ -165,7 +184,7 @@ struct _SISFB_INFO { /* The following are deprecated and should not be used anymore: */ /****************************************************************/ /* ioctl for identifying and giving some info (esp. memory heap start) */ -#define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) +#define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) /* ioctrl to get current vertical retrace status */ #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ @@ -177,8 +196,8 @@ struct _SISFB_INFO { /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ struct sis_memreq { - __u32 offset; - __u32 size; + __u32 offset; + __u32 size; }; /**********************************************/ @@ -187,12 +206,19 @@ struct sis_memreq { /**********************************************/ #ifdef __KERNEL__ + +#include <linux/pci.h> + #define UNKNOWN_VGA 0 #define SIS_300_VGA 1 #define SIS_315_VGA 2 +#define SISFB_HAVE_MALLOC_NEW extern void sis_malloc(struct sis_memreq *req); +extern void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req); + extern void sis_free(u32 base); +extern void sis_free_new(struct pci_dev *pdev, u32 base); #endif #endif |