(2006-08-06) rescue-bootcd

This commit is contained in:
2006-08-06 00:00:00 +02:00
parent 2f796b816a
commit decb062d20
21091 changed files with 7076462 additions and 0 deletions

View File

@@ -0,0 +1,217 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef _ACCONFIG_H
#define _ACCONFIG_H
/******************************************************************************
*
* Configuration options
*
*****************************************************************************/
/*
* ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the
* ACPI subsystem. This includes the DEBUG_PRINT output
* statements. When disabled, all DEBUG_PRINT
* statements are compiled out.
*
* ACPI_APPLICATION - Use this switch if the subsystem is going to be run
* at the application level.
*
*/
/* Version string */
#define ACPI_CA_VERSION 0x20041105
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
* but there is a large base of ASL/AML code in existing machines that check
* for the string below. The use of this string usually guarantees that
* the ASL will execute down the most tested code path. Also, there is some
* code that will not execute the _OSI method unless _OS matches the string
* below. Therefore, change this string at your own risk.
*/
#define ACPI_OS_NAME "Microsoft Windows NT"
/* 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 */
/*
* Should the subystem abort the loading of an ACPI table if the
* table checksum is incorrect?
*/
#define ACPI_CHECKSUM_ABORT FALSE
/******************************************************************************
*
* Subsystem Constants
*
*****************************************************************************/
/* Version of ACPI supported */
#define ACPI_CA_SUPPORT_LEVEL 2
/* String size constants */
#define ACPI_MAX_STRING_LENGTH 512
#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */
#define ACPI_MAX_SEMAPHORE_COUNT 256
/* Max reference count (for debug only) */
#define ACPI_MAX_REFERENCE_COUNT 0x400
/* Size of cached memory mapping for system memory operation region */
#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
/******************************************************************************
*
* ACPI Specification constants (Do not change unless the specification changes)
*
*****************************************************************************/
/* Number of distinct GPE register blocks and register width */
#define ACPI_MAX_GPE_BLOCKS 2
#define ACPI_GPE_REGISTER_WIDTH 8
/*
* Method info (in WALK_STATE), containing local variables and argumetns
*/
#define ACPI_METHOD_NUM_LOCALS 8
#define ACPI_METHOD_MAX_LOCAL 7
#define ACPI_METHOD_NUM_ARGS 7
#define ACPI_METHOD_MAX_ARG 6
/* Maximum length of resulting string when converting from a buffer */
#define ACPI_MAX_STRING_CONVERSION 200
/* Length of _HID, _UID, and _CID values */
#define ACPI_DEVICE_ID_LENGTH 0x09
#define ACPI_MAX_CID_LENGTH 48
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
*/
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
/* 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_SEPARATOR '.'
/* Constants used in searching for the RSDP in low memory */
#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_SIZE 0x00020000
#define ACPI_RSDP_SCAN_STEP 16
/* Operation regions */
#define ACPI_NUM_PREDEFINED_REGIONS 8
#define ACPI_USER_REGION_BEGIN 0x80
/* Maximum space_ids for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
/* Array sizes. Used for range checking also */
#define ACPI_NUM_ACCESS_TYPES 6
#define ACPI_NUM_UPDATE_RULES 3
#define ACPI_NUM_LOCK_RULES 2
#define ACPI_NUM_MATCH_OPS 6
#define ACPI_NUM_OPCODES 256
#define ACPI_NUM_FIELD_NAMES 2
/* RSDP checksums */
#define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36
/* SMBus bidirectional buffer size */
#define ACPI_SMBUS_BUFFER_SIZE 34
/* Number of strings associated with the _OSI reserved method */
#define ACPI_NUM_OSI_STRINGS 9
/******************************************************************************
*
* ACPI AML Debugger
*
*****************************************************************************/
#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 */

View File

@@ -0,0 +1,472 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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 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) {\
acpi_os_printf PARAM_LIST(fp);}
#define EX_NO_SINGLE_STEP 1
#define EX_SINGLE_STEP 2
/* Prototypes */
/*
* dbxface - external debugger interfaces
*/
acpi_status
acpi_db_initialize (
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_status
acpi_db_start_command (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
void
acpi_db_method_end (
struct acpi_walk_state *walk_state);
/*
* dbcmds - debug commands and output routines
*/
acpi_status
acpi_db_disassemble_method (
char *name);
void
acpi_db_display_table_info (
char *table_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);
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_dump_namespace (
char *start_arg,
char *depth_arg);
void
acpi_db_dump_namespace_by_owner (
char *owner_arg,
char *depth_arg);
void
acpi_db_send_notify (
char *name,
u32 value);
void
acpi_db_set_method_data (
char *type_arg,
char *index_arg,
char *value_arg);
acpi_status
acpi_db_display_objects (
char *obj_type_arg,
char *display_count_arg);
acpi_status
acpi_db_find_name_in_namespace (
char *name_arg);
void
acpi_db_set_scope (
char *name);
acpi_status
acpi_db_sleep (
char *object_arg);
void
acpi_db_find_references (
char *object_arg);
void
acpi_db_display_locks (void);
void
acpi_db_display_resources (
char *object_arg);
void
acpi_db_display_gpes (void);
void
acpi_db_check_integrity (
void);
acpi_status
acpi_db_integrity_walk (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
acpi_status
acpi_db_walk_and_match_name (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
acpi_status
acpi_db_walk_for_references (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
acpi_status
acpi_db_walk_for_specific_objects (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
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_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_status
acpi_db_display_all_methods (
char *display_count_arg);
void
acpi_db_display_arguments (
void);
void
acpi_db_display_locals (
void);
void
acpi_db_display_results (
void);
void
acpi_db_display_calling_tree (
void);
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);
void
acpi_db_dump_parser_descriptor (
union acpi_parse_object *op);
void *
acpi_db_get_pointer (
void *target);
/*
* dbexec - debugger control method execution
*/
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_status
acpi_db_execute_method (
struct acpi_db_method_info *info,
struct acpi_buffer *return_obj);
void
acpi_db_execute_setup (
struct acpi_db_method_info *info);
u32
acpi_db_get_outstanding_allocations (
void);
void ACPI_SYSTEM_XFACE
acpi_db_method_thread (
void *context);
acpi_status
acpi_db_execution_walk (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
/*
* dbfileio - Debugger file I/O commands
*/
acpi_object_type
acpi_db_match_argument (
char *user_argument,
struct argument_info *arguments);
acpi_status
ae_local_load_table (
struct acpi_table_header *table_ptr);
void
acpi_db_close_debug_file (
void);
void
acpi_db_open_debug_file (
char *name);
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_status
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_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);
void
acpi_db_display_help (
char *help_type);
char *
acpi_db_get_next_token (
char *string,
char **next);
u32
acpi_db_get_line (
char *input_buffer);
u32
acpi_db_match_command (
char *user_command);
void
acpi_db_single_thread (
void);
/*
* 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);
acpi_status
acpi_db_classify_one_object (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
void
acpi_db_count_namespace_objects (
void);
void
acpi_db_enumerate_object (
union acpi_operand_object *obj_desc);
/*
* dbutils - AML debugger utilities
*/
void
acpi_db_set_output_destination (
u32 where);
void
acpi_db_dump_buffer (
u32 address);
void
acpi_db_dump_object (
union acpi_object *obj_desc,
u32 level);
void
acpi_db_prep_namestring (
char *name);
acpi_status
acpi_db_second_pass_parse (
union acpi_parse_object *root);
struct acpi_namespace_node *
acpi_db_local_ns_lookup (
char *name);
#endif /* __ACDEBUG_H__ */

View File

@@ -0,0 +1,417 @@
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACDISASM_H__
#define __ACDISASM_H__
#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;
};
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_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;
};
typedef
acpi_status (*asl_walk_callback) (
union acpi_parse_object *op,
u32 level,
void *context);
/*
* dmwalk
*/
void
acpi_dm_walk_parse_tree (
union acpi_parse_object *op,
asl_walk_callback descending_callback,
asl_walk_callback ascending_callback,
void *context);
acpi_status
acpi_dm_descending_op (
union acpi_parse_object *op,
u32 level,
void *context);
acpi_status
acpi_dm_ascending_op (
union acpi_parse_object *op,
u32 level,
void *context);
/*
* dmopcode
*/
void
acpi_dm_validate_name (
char *name,
union acpi_parse_object *op);
u32
acpi_dm_dump_name (
char *name);
void
acpi_dm_unicode (
union acpi_parse_object *op);
void
acpi_dm_disassemble (
struct acpi_walk_state *walk_state,
union acpi_parse_object *origin,
u32 num_opcodes);
void
acpi_dm_namestring (
char *name);
void
acpi_dm_display_path (
union acpi_parse_object *op);
void
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);
u32
acpi_dm_block_type (
union acpi_parse_object *op);
u32
acpi_dm_list_type (
union acpi_parse_object *op);
acpi_status
acpi_ps_display_object_pathname (
struct acpi_walk_state *walk_state,
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_address_space (
u8 space_id);
void
acpi_dm_region_flags (
union acpi_parse_object *op);
void
acpi_dm_match_op (
union acpi_parse_object *op);
void
acpi_dm_match_keyword (
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);
/*
* dmobject
*/
void
acpi_dm_decode_node (
struct acpi_namespace_node *node);
void
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_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);
/*
* dmbuffer
*/
void
acpi_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);
u8
acpi_dm_is_string_buffer (
union acpi_parse_object *op);
/*
* dmresrc
*/
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);
void
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);
void
acpi_dm_indent (
u32 level);
void
acpi_dm_bit_list (
u16 mask);
void
acpi_dm_decode_attribute (
u8 attribute);
/*
* dmresrcl
*/
void
acpi_dm_io_flags (
u8 flags);
void
acpi_dm_memory_flags (
u8 flags,
u8 specific_flags);
void
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);
void
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);
void
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);
void
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);
void
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);
void
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);
void
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);
void
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);
/*
* dmutils
*/
void
acpi_dm_add_to_external_list (
char *path);
#endif /* __ACDISASM_H__ */

View File

@@ -0,0 +1,520 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef _ACDISPAT_H_
#define _ACDISPAT_H_
#define NAMEOF_LOCAL_NTE "__L0"
#define NAMEOF_ARG_NTE "__A0"
/* Common interfaces */
acpi_status
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);
#ifdef ACPI_FUTURE_USAGE
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state);
#endif
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
/* dsopcode - support for late evaluation */
acpi_status
acpi_ds_execute_arguments (
struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start);
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_status
acpi_ds_get_buffer_arguments (
union acpi_operand_object *obj_desc);
acpi_status
acpi_ds_get_package_arguments (
union acpi_operand_object *obj_desc);
acpi_status
acpi_ds_init_buffer_field (
u16 aml_opcode,
union acpi_operand_object *obj_desc,
union acpi_operand_object *buffer_desc,
union acpi_operand_object *offset_desc,
union acpi_operand_object *length_desc,
union acpi_operand_object *result_desc);
acpi_status
acpi_ds_eval_buffer_field_operands (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
acpi_status
acpi_ds_eval_region_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_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_status
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_status
acpi_ds_exec_end_op (
struct acpi_walk_state *state);
/* dsfield - Parser/Interpreter interface for AML fields */
acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg);
acpi_status
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_status
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_status
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_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_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);
/* 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_status
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);
u8
acpi_ds_is_method_value (
union acpi_operand_object *obj_desc);
#ifdef ACPI_FUTURE_USAGE
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
#endif
acpi_status
acpi_ds_method_data_get_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc);
void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
acpi_status
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_status
acpi_ds_method_data_set_value (
u16 opcode,
u32 index,
union acpi_operand_object *object,
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_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_status
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);
/* dsobj - Parser/Interpreter interface - object initialization and conversion */
acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_status
acpi_ds_initialize_objects (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *start_node);
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_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_status
acpi_ds_build_internal_object (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
union acpi_operand_object **obj_desc_ptr);
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_status
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 */
u8
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_status
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_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_status
acpi_ds_scope_stack_pop (
struct acpi_walk_state *walk_state);
void
acpi_ds_scope_stack_clear (
struct acpi_walk_state *walk_state);
/* dswstate - parser WALK_STATE management routines */
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);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state);
#endif
acpi_status
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);
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_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_clear (
struct acpi_walk_state *walk_state);
struct acpi_walk_state *
acpi_ds_get_current_walk_state (
struct acpi_thread_state *thread);
void
acpi_ds_delete_walk_state_cache (
void);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_ds_result_insert (
void *object,
u32 index,
struct acpi_walk_state *walk_state);
acpi_status
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_status
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);
#endif /* _ACDISPAT_H_ */

View File

@@ -0,0 +1,320 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACEVENTS_H__
#define __ACEVENTS_H__
acpi_status
acpi_ev_initialize_events (
void);
acpi_status
acpi_ev_install_xrupt_handlers (
void);
/*
* Evfixed - Fixed event handling
*/
acpi_status
acpi_ev_fixed_event_initialize (
void);
u32
acpi_ev_fixed_event_detect (
void);
u32
acpi_ev_fixed_event_dispatch (
u32 event);
/*
* Evmisc
*/
u8
acpi_ev_is_notify_object (
struct acpi_namespace_node *node);
acpi_status
acpi_ev_acquire_global_lock(
u16 timeout);
acpi_status
acpi_ev_release_global_lock(
void);
acpi_status
acpi_ev_init_global_lock_handler (
void);
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);
void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context);
/*
* Evgpe - GPE handling and dispatch
*/
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_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_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_gpe_initialize (
void);
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_status
acpi_ev_delete_gpe_block (
struct acpi_gpe_block_info *gpe_block);
acpi_status
acpi_ev_delete_gpe_handlers (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block);
u32
acpi_ev_gpe_dispatch (
struct acpi_gpe_event_info *gpe_event_info,
u32 gpe_number);
u32
acpi_ev_gpe_detect (
struct acpi_gpe_xrupt_info *gpe_xrupt_list);
acpi_status
acpi_ev_set_gpe_type (
struct acpi_gpe_event_info *gpe_event_info,
u8 type);
acpi_status
acpi_ev_check_for_wake_only_gpe (
struct acpi_gpe_event_info *gpe_event_info);
/*
* Evregion - Address Space handling
*/
acpi_status
acpi_ev_install_region_handlers (
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_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_status
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_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_status
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_status
acpi_ev_reg_run (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
/*
* 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_status
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_status
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_status
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);
/*
* 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);
acpi_status
acpi_ev_remove_sci_handler (
void);
u32
acpi_ev_initialize_sCI (
u32 program_sCI);
void
acpi_ev_terminate (
void);
#endif /* __ACEVENTS_H__ */

View File

@@ -0,0 +1,308 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACEXCEP_H__
#define __ACEXCEP_H__
/*
* Exceptions returned by external ACPI interfaces
*/
#define AE_CODE_ENVIRONMENTAL 0x0000
#define AE_CODE_PROGRAMMER 0x1000
#define AE_CODE_ACPI_TABLES 0x2000
#define AE_CODE_AML 0x3000
#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
/*
* Environmental exceptions
*/
#define AE_ERROR (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_ACPI_TABLES (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_NAMESPACE (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_MEMORY (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_FOUND (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_EXIST (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL)
#define AE_ALREADY_EXISTS (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
#define AE_TYPE (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_OBJECT (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL)
#define AE_NULL_ENTRY (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL)
#define AE_BUFFER_OVERFLOW (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL)
#define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
#define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
#define AE_VERSION_MISMATCH (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
#define AE_SUPPORT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
#define AE_SHARE (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
#define AE_LIMIT (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
#define AE_TIME (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
#define AE_UNKNOWN_STATUS (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
#define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
#define AE_RELEASE_DEADLOCK (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
#define AE_NOT_ACQUIRED (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
#define AE_ALREADY_ACQUIRED (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#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_CODE_ENV_MAX 0x001E
/*
* Programmer exceptions
*/
#define AE_BAD_PARAMETER (acpi_status) (0x0001 | AE_CODE_PROGRAMMER)
#define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
#define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
#define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
#define AE_CODE_PGM_MAX 0x0009
/*
* Acpi table exceptions
*/
#define AE_BAD_SIGNATURE (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES)
#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
#define AE_TABLE_NOT_SUPPORTED (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
#define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES)
#define AE_CODE_TBL_MAX 0x0006
/*
* AML exceptions. These are caused by problems with
* the actual AML byte stream
*/
#define AE_AML_ERROR (acpi_status) (0x0001 | AE_CODE_AML)
#define AE_AML_PARSE (acpi_status) (0x0002 | AE_CODE_AML)
#define AE_AML_BAD_OPCODE (acpi_status) (0x0003 | AE_CODE_AML)
#define AE_AML_NO_OPERAND (acpi_status) (0x0004 | AE_CODE_AML)
#define AE_AML_OPERAND_TYPE (acpi_status) (0x0005 | AE_CODE_AML)
#define AE_AML_OPERAND_VALUE (acpi_status) (0x0006 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0007 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0008 | AE_CODE_AML)
#define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0009 | AE_CODE_AML)
#define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x000A | AE_CODE_AML)
#define AE_AML_REGION_LIMIT (acpi_status) (0x000B | AE_CODE_AML)
#define AE_AML_BUFFER_LIMIT (acpi_status) (0x000C | AE_CODE_AML)
#define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000D | AE_CODE_AML)
#define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000E | AE_CODE_AML)
#define AE_AML_BAD_NAME (acpi_status) (0x000F | AE_CODE_AML)
#define AE_AML_NAME_NOT_FOUND (acpi_status) (0x0010 | AE_CODE_AML)
#define AE_AML_INTERNAL (acpi_status) (0x0011 | AE_CODE_AML)
#define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0012 | AE_CODE_AML)
#define AE_AML_STRING_LIMIT (acpi_status) (0x0013 | AE_CODE_AML)
#define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0014 | AE_CODE_AML)
#define AE_AML_METHOD_LIMIT (acpi_status) (0x0015 | AE_CODE_AML)
#define AE_AML_NOT_OWNER (acpi_status) (0x0016 | AE_CODE_AML)
#define AE_AML_MUTEX_ORDER (acpi_status) (0x0017 | AE_CODE_AML)
#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0018 | AE_CODE_AML)
#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0019 | AE_CODE_AML)
#define AE_AML_INVALID_INDEX (acpi_status) (0x001A | AE_CODE_AML)
#define AE_AML_REGISTER_LIMIT (acpi_status) (0x001B | AE_CODE_AML)
#define AE_AML_NO_WHILE (acpi_status) (0x001C | AE_CODE_AML)
#define AE_AML_ALIGNMENT (acpi_status) (0x001D | AE_CODE_AML)
#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML)
#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML)
#define AE_CODE_AML_MAX 0x0021
/*
* Internal exceptions used for control
*/
#define AE_CTRL_RETURN_VALUE (acpi_status) (0x0001 | AE_CODE_CONTROL)
#define AE_CTRL_PENDING (acpi_status) (0x0002 | AE_CODE_CONTROL)
#define AE_CTRL_TERMINATE (acpi_status) (0x0003 | AE_CODE_CONTROL)
#define AE_CTRL_TRUE (acpi_status) (0x0004 | AE_CODE_CONTROL)
#define AE_CTRL_FALSE (acpi_status) (0x0005 | AE_CODE_CONTROL)
#define AE_CTRL_DEPTH (acpi_status) (0x0006 | AE_CODE_CONTROL)
#define AE_CTRL_END (acpi_status) (0x0007 | AE_CODE_CONTROL)
#define AE_CTRL_TRANSFER (acpi_status) (0x0008 | AE_CODE_CONTROL)
#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)
#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)
#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL)
#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[] =
{
"AE_OK",
"AE_ERROR",
"AE_NO_ACPI_TABLES",
"AE_NO_NAMESPACE",
"AE_NO_MEMORY",
"AE_NOT_FOUND",
"AE_NOT_EXIST",
"AE_ALREADY_EXISTS",
"AE_TYPE",
"AE_NULL_OBJECT",
"AE_NULL_ENTRY",
"AE_BUFFER_OVERFLOW",
"AE_STACK_OVERFLOW",
"AE_STACK_UNDERFLOW",
"AE_NOT_IMPLEMENTED",
"AE_VERSION_MISMATCH",
"AE_SUPPORT",
"AE_SHARE",
"AE_LIMIT",
"AE_TIME",
"AE_UNKNOWN_STATUS",
"AE_ACQUIRE_DEADLOCK",
"AE_RELEASE_DEADLOCK",
"AE_NOT_ACQUIRED",
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
"AE_WAKE_ONLY_GPE"
};
char const *acpi_gbl_exception_names_pgm[] =
{
"AE_BAD_PARAMETER",
"AE_BAD_CHARACTER",
"AE_BAD_PATHNAME",
"AE_BAD_DATA",
"AE_BAD_ADDRESS",
"AE_ALIGNMENT",
"AE_BAD_HEX_CONSTANT",
"AE_BAD_OCTAL_CONSTANT",
"AE_BAD_DECIMAL_CONSTANT"
};
char const *acpi_gbl_exception_names_tbl[] =
{
"AE_BAD_SIGNATURE",
"AE_BAD_HEADER",
"AE_BAD_CHECKSUM",
"AE_BAD_VALUE",
"AE_TABLE_NOT_SUPPORTED",
"AE_INVALID_TABLE_LENGTH"
};
char const *acpi_gbl_exception_names_aml[] =
{
"AE_AML_ERROR",
"AE_AML_PARSE",
"AE_AML_BAD_OPCODE",
"AE_AML_NO_OPERAND",
"AE_AML_OPERAND_TYPE",
"AE_AML_OPERAND_VALUE",
"AE_AML_UNINITIALIZED_LOCAL",
"AE_AML_UNINITIALIZED_ARG",
"AE_AML_UNINITIALIZED_ELEMENT",
"AE_AML_NUMERIC_OVERFLOW",
"AE_AML_REGION_LIMIT",
"AE_AML_BUFFER_LIMIT",
"AE_AML_PACKAGE_LIMIT",
"AE_AML_DIVIDE_BY_ZERO",
"AE_AML_BAD_NAME",
"AE_AML_NAME_NOT_FOUND",
"AE_AML_INTERNAL",
"AE_AML_INVALID_SPACE_ID",
"AE_AML_STRING_LIMIT",
"AE_AML_NO_RETURN_VALUE",
"AE_AML_METHOD_LIMIT",
"AE_AML_NOT_OWNER",
"AE_AML_MUTEX_ORDER",
"AE_AML_MUTEX_NOT_ACQUIRED",
"AE_AML_INVALID_RESOURCE_TYPE",
"AE_AML_INVALID_INDEX",
"AE_AML_REGISTER_LIMIT",
"AE_AML_NO_WHILE",
"AE_AML_ALIGNMENT",
"AE_AML_NO_RESOURCE_END_TAG",
"AE_AML_BAD_RESOURCE_VALUE",
"AE_AML_CIRCULAR_REFERENCE",
"AE_AML_BAD_RESOURCE_LENGTH"
};
char const *acpi_gbl_exception_names_ctrl[] =
{
"AE_CTRL_RETURN_VALUE",
"AE_CTRL_PENDING",
"AE_CTRL_TERMINATE",
"AE_CTRL_TRUE",
"AE_CTRL_FALSE",
"AE_CTRL_DEPTH",
"AE_CTRL_END",
"AE_CTRL_TRANSFER",
"AE_CTRL_BREAK",
"AE_CTRL_CONTINUE",
"AE_CTRL_SKIP"
};
#endif /* ACPI GLOBALS */
#endif /* __ACEXCEP_H__ */

View File

@@ -0,0 +1,356 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACGLOBAL_H__
#define __ACGLOBAL_H__
/*
* Ensure that the globals are actually defined and initialized only once.
*
* The use of these macros allows a single list of globals (here) in order
* to simplify maintenance of the code.
*/
#ifdef DEFINE_ACPI_GLOBALS
#define ACPI_EXTERN
#define ACPI_INIT_GLOBAL(a,b) a=b
#else
#define ACPI_EXTERN extern
#define ACPI_INIT_GLOBAL(a,b) a
#endif
/*
* 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;
/*****************************************************************************
*
* Debug support
*
****************************************************************************/
/* Runtime configuration of debug print levels */
extern u32 acpi_dbg_level;
extern u32 acpi_dbg_layer;
/* Procedure nesting level for debug output */
extern u32 acpi_gbl_nesting_level;
/*****************************************************************************
*
* Runtime configuration (static defaults that can be overriden at runtime)
*
****************************************************************************/
/*
* Enable "slack" in the AML interpreter? Default is FALSE, and the
* interpreter strictly follows the ACPI specification. Setting to TRUE
* allows the interpreter to forgive certain bad AML constructs. Currently:
* 1) Allow "implicit return" of last value in a control method
* 2) Allow access beyond end of operation region
* 3) Allow access to uninitialized locals/args (auto-init to integer 0)
*/
ACPI_EXTERN u8 ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE);
/*
* Automatically serialize ALL control methods? Default is FALSE, meaning
* to use the Serialized/not_serialized method flags on a per method basis.
* 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);
/*
* 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);
/*
* 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 Table globals
*
****************************************************************************/
/*
* Table pointers.
* Although these pointers are somewhat redundant with the global acpi_table,
* they are convenient because they are typed pointers.
*
* 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;
/*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not
* sufficient; Therefore, there isn't one!
*/
/*
* Handle both ACPI 1.0 and ACPI 2.0 Integer widths
* If we are running a method that exists in a 32-bit ACPI table.
* Use only 32 bits of the Integer for conversion.
*/
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];
/*
* 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];
/*****************************************************************************
*
* Miscellaneous globals
*
****************************************************************************/
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];
/*****************************************************************************
*
* Namespace globals
*
****************************************************************************/
#define NUM_NS_TYPES ACPI_TYPE_INVALID+1
#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
#define NUM_PREDEFINED_NAMES 10
#else
#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;
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;
#endif
/*****************************************************************************
*
* Interpreter globals
*
****************************************************************************/
ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
/* Control method single step flag */
ACPI_EXTERN u8 acpi_gbl_cm_single_step;
/*****************************************************************************
*
* Parser globals
*
****************************************************************************/
ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
/*****************************************************************************
*
* Hardware globals
*
****************************************************************************/
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;
/*****************************************************************************
*
* Event and GPE globals
*
****************************************************************************/
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;
/*****************************************************************************
*
* Debugger globals
*
****************************************************************************/
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;
#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;
/*
* 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 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 /* __ACGLOBAL_H__ */

View File

@@ -0,0 +1,182 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACHWARE_H__
#define __ACHWARE_H__
/* PM Timer ticks per second (HZ) */
#define PM_TIMER_FREQUENCY 3579545
/* Prototypes */
acpi_status
acpi_hw_initialize (
void);
acpi_status
acpi_hw_shutdown (
void);
acpi_status
acpi_hw_initialize_system_info (
void);
acpi_status
acpi_hw_set_mode (
u32 mode);
u32
acpi_hw_get_mode (
void);
u32
acpi_hw_get_mode_capabilities (
void);
/* Register I/O Prototypes */
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);
acpi_status
acpi_hw_register_write (
u8 use_lock,
u32 register_id,
u32 value);
acpi_status
acpi_hw_low_level_read (
u32 width,
u32 *value,
struct acpi_generic_address *reg);
acpi_status
acpi_hw_low_level_write (
u32 width,
u32 value,
struct acpi_generic_address *reg);
acpi_status
acpi_hw_clear_acpi_status (
u32 flags);
/* GPE support */
acpi_status
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_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);
#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_status
acpi_hw_disable_all_gpes (
u32 flags);
acpi_status
acpi_hw_enable_all_runtime_gpes (
u32 flags);
acpi_status
acpi_hw_enable_all_wakeup_gpes (
u32 flags);
acpi_status
acpi_hw_enable_runtime_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block);
acpi_status
acpi_hw_enable_wakeup_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block);
/* ACPI Timer prototypes */
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_get_timer_resolution (
u32 *resolution);
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 */
#endif /* __ACHWARE_H__ */

View File

@@ -0,0 +1,765 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACINTERP_H__
#define __ACINTERP_H__
#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
acpi_status
acpi_ex_resolve_operands (
u16 opcode,
union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
acpi_status
acpi_ex_check_object_type (
acpi_object_type type_needed,
acpi_object_type this_type,
void *object);
/*
* exxface - External interpreter interfaces
*/
acpi_status
acpi_ex_load_table (
acpi_table_type table_id);
acpi_status
acpi_ex_execute_method (
struct acpi_namespace_node *method_node,
union acpi_operand_object **params,
union acpi_operand_object **return_obj_desc);
/*
* 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_status
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);
/* Types for ->String conversion */
#define ACPI_EXPLICIT_BYTE_COPY 0x00000000
#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
#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);
u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u16 base,
u8 *string,
u8 max_length);
/*
* 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_status
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_status
acpi_ex_setup_region (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset);
acpi_status
acpi_ex_access_region (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write);
u8
acpi_ex_register_overflow (
union acpi_operand_object *obj_desc,
acpi_integer value);
acpi_status
acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write);
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);
void
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_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_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);
/*
* exmisc - ACPI AML (p-code) execution - specific opcodes
*/
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_6A_0T_1R (
struct acpi_walk_state *walk_state);
u8
acpi_ex_do_match (
u32 match_op,
acpi_integer package_value,
acpi_integer match_value);
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_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_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_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_status
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_integer
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_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_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_event (
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);
/*
* exconfig - dynamic table load/unload
*/
acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
union acpi_operand_object **ddb_handle);
acpi_status
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);
/*
* 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_status
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_link_mutex (
union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread);
/*
* exprep - ACPI AML (p-code) 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);
/*
* 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_status
acpi_ex_system_do_suspend(
acpi_integer 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_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_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);
/*
* exmonadic - ACPI AML (p-code) execution, monadic operators
*/
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_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);
/*
* exdyadic - ACPI AML (p-code) execution, dyadic operators
*/
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_1T_1R (
struct acpi_walk_state *walk_state);
acpi_status
acpi_ex_opcode_2A_2T_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_status
acpi_ex_resolve_node_to_value (
struct acpi_namespace_node **stack_ptr,
struct acpi_walk_state *walk_state);
acpi_status
acpi_ex_resolve_object_to_value (
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_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);
void
acpi_ex_out_string (
char *title,
char *value);
void
acpi_ex_out_pointer (
char *title,
void *value);
void
acpi_ex_out_integer (
char *title,
u32 value);
void
acpi_ex_out_address (
char *title,
acpi_physical_address value);
#endif /* ACPI_FUTURE_USAGE */
/*
* exnames - interpreter/scanner name load/execute
*/
char *
acpi_ex_allocate_name_string (
u32 prefix_count,
u32 num_name_segs);
u32
acpi_ex_good_char (
u32 character);
acpi_status
acpi_ex_name_segment (
u8 **in_aml_address,
char *name_string);
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_status
acpi_ex_do_name (
acpi_object_type data_type,
acpi_interpreter_mode load_exec_mode);
/*
* 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_status
acpi_ex_store_object_to_index (
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);
#define ACPI_IMPLICIT_CONVERSION TRUE
#define ACPI_NO_IMPLICIT_CONVERSION FALSE
/*
* exstoren
*/
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_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);
/*
* excopy - object copy
*/
acpi_status
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_status
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_status
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);
/*
* exutils - interpreter/scanner utilities
*/
acpi_status
acpi_ex_enter_interpreter (
void);
void
acpi_ex_exit_interpreter (
void);
void
acpi_ex_truncate_for32bit_table (
union acpi_operand_object *obj_desc);
u8
acpi_ex_acquire_global_lock (
u32 rule);
void
acpi_ex_release_global_lock (
u8 locked);
u32
acpi_ex_digits_needed (
acpi_integer value,
u32 base);
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__ */

View File

@@ -0,0 +1,990 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACLOCAL_H__
#define __ACLOCAL_H__
#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
typedef void * acpi_mutex;
typedef u32 acpi_mutex_handle;
/* Total number of aml opcodes defined */
#define AML_NUM_OPCODES 0x7F
/*****************************************************************************
*
* Mutex typedefs and structs
*
****************************************************************************/
/*
* Predefined handles for the mutex objects used within the subsystem
* All mutex objects are automatically created by acpi_ut_mutex_initialize.
*
* The acquire/release ordering protocol is implied via this list. Mutexes
* with a lower value must be acquired before mutexes with a higher value.
*
* NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
*/
#define ACPI_MTX_EXECUTE 0
#define ACPI_MTX_INTERPRETER 1
#define ACPI_MTX_PARSER 2
#define ACPI_MTX_DISPATCHER 3
#define ACPI_MTX_TABLES 4
#define ACPI_MTX_OP_REGIONS 5
#define ACPI_MTX_NAMESPACE 6
#define ACPI_MTX_EVENTS 7
#define ACPI_MTX_HARDWARE 8
#define ACPI_MTX_CACHES 9
#define ACPI_MTX_MEMORY 10
#define ACPI_MTX_DEBUG_CMD_COMPLETE 11
#define ACPI_MTX_DEBUG_CMD_READY 12
#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[] =
{
"ACPI_MTX_Execute",
"ACPI_MTX_Interpreter",
"ACPI_MTX_Parser",
"ACPI_MTX_Dispatcher",
"ACPI_MTX_Tables",
"ACPI_MTX_op_regions",
"ACPI_MTX_Namespace",
"ACPI_MTX_Events",
"ACPI_MTX_Hardware",
"ACPI_MTX_Caches",
"ACPI_MTX_Memory",
"ACPI_MTX_debug_cmd_complete",
"ACPI_MTX_debug_cmd_ready",
};
#endif
#endif
/* Table for the global mutexes */
struct acpi_mutex_info
{
acpi_mutex mutex;
u32 use_count;
u32 owner_id;
};
/* This owner ID means that the mutex is not in use (unlocked) */
#define ACPI_MUTEX_NOT_ACQUIRED (u32) (-1)
/* Lock flag parameter for various interfaces */
#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
#define ACPI_FIELD_WORD_GRANULARITY 2
#define ACPI_FIELD_DWORD_GRANULARITY 4
#define ACPI_FIELD_QWORD_GRANULARITY 8
/*****************************************************************************
*
* Namespace typedefs and structs
*
****************************************************************************/
/* Operational modes of the AML interpreter/scanner */
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.
*
* 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;
};
#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_METHOD_ARG 0x08
#define ANOBJ_METHOD_LOCAL 0x10
#define ANOBJ_METHOD_NO_RETVAL 0x20
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
#define ANOBJ_IS_BIT_OFFSET 0x80
/*
* 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_list
{
struct acpi_table_desc *next;
u32 count;
};
struct acpi_find_context
{
char *search_for;
acpi_handle *list;
u32 *count;
};
struct acpi_ns_search_data
{
struct acpi_namespace_node *node;
};
/*
* Predefined Namespace items
*/
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;
};
/* 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;
};
/*****************************************************************************
*
* Event typedefs and structs
*
****************************************************************************/
/* 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) */
};
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 */
};
/* 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 */
};
/*
* 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 */
};
/* 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_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);
/* 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_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;
};
/*****************************************************************************
*
* Generic "state" object for stacks
*
****************************************************************************/
#define ACPI_CONTROL_NORMAL 0xC0
#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
#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; \
u16 value; \
u16 state; \
u16 reserved; \
void *next; \
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;
};
/*
* 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;
};
/*
* 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;
};
/*
* Scope state - current scope during namespace lookups
*/
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 */
};
/*
* 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 */
};
/*
* Result values - used to accumulate the results of nested
* AML arguments
*/
struct acpi_result_values
{
ACPI_STATE_COMMON
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);
/*
* 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;
};
/* 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;
};
/*****************************************************************************
*
* Interpreter typedefs and structs
*
****************************************************************************/
typedef
acpi_status (*ACPI_EXECUTE_OP) (
struct acpi_walk_state *walk_state);
/*****************************************************************************
*
* Parser typedefs and structs
*
****************************************************************************/
/*
* AML opcode, name, and argument layout
*/
struct acpi_opcode_info
{
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
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 */
};
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 \
u8 data_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\
u16 aml_opcode; /* AML opcode */\
u32 aml_offset; /* Offset of declaration in AML */\
union acpi_parse_object *parent; /* Parent op */\
union acpi_parse_object *next; /* Next op */\
ACPI_DISASM_ONLY_MEMBERS (\
u8 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
char aml_op_name[16]) /* Op name (debug only) */\
/* NON-DEBUG members below: */\
struct acpi_namespace_node *node; /* For use by interpreter */\
union acpi_parse_value value; /* Value or args associated with the opcode */\
#define ACPI_DASM_BUFFER 0x00
#define ACPI_DASM_RESOURCE 0x01
#define ACPI_DASM_STRING 0x02
#define ACPI_DASM_UNICODE 0x03
#define ACPI_DASM_EISAID 0x04
#define ACPI_DASM_MATCHOP 0x05
/*
* generic operation (for example: If, While, Store)
*/
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 */
};
/* 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;
};
/*
* 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;
};
/* Parse object flags */
#define ACPI_PARSEOP_GENERIC 0x01
#define ACPI_PARSEOP_NAMED 0x02
#define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_CACHE 0x80
/* Parse object disasm_flags */
#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_SPECIAL 0x10
/*****************************************************************************
*
* Hardware (ACPI registers) and PNP
*
****************************************************************************/
#define PCI_ROOT_HID_STRING "PNP0A03"
struct acpi_bit_register_info
{
u8 parent_register;
u8 bit_position;
u16 access_bit_mask;
};
/*
* Register IDs
* These are the full ACPI registers
*/
#define ACPI_REGISTER_PM1_STATUS 0x01
#define ACPI_REGISTER_PM1_ENABLE 0x02
#define ACPI_REGISTER_PM1_CONTROL 0x03
#define ACPI_REGISTER_PM1A_CONTROL 0x04
#define ACPI_REGISTER_PM1B_CONTROL 0x05
#define ACPI_REGISTER_PM2_CONTROL 0x06
#define ACPI_REGISTER_PM_TIMER 0x07
#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
#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
#define ACPI_BITMASK_WAKE_STATUS 0x8000
#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
ACPI_BITMASK_BUS_MASTER_STATUS | \
ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
ACPI_BITMASK_POWER_BUTTON_STATUS | \
ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
ACPI_BITMASK_RT_CLOCK_STATUS | \
ACPI_BITMASK_WAKE_STATUS)
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
#define ACPI_BITMASK_SCI_ENABLE 0x0001
#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
#define ACPI_BITMASK_ARB_DISABLE 0x0001
/* Raw bit position of each bit_register */
#define ACPI_BITPOSITION_TIMER_STATUS 0x00
#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
#define ACPI_BITPOSITION_SCI_ENABLE 0x00
#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
#define ACPI_BITPOSITION_ARB_DISABLE 0x00
/*****************************************************************************
*
* Resource descriptors
*
****************************************************************************/
/* resource_type values */
#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
#define ACPI_RESOURCE_TYPE_IO_RANGE 1
#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
/* Resource descriptor types and masks */
#define ACPI_RDESC_TYPE_LARGE 0x80
#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 */
/*
* Small resource descriptor types
* Note: The 3 length bits (2:0) must be zero
*/
#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
#define ACPI_RDESC_TYPE_IO_PORT 0x40
#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
#define ACPI_RDESC_TYPE_END_TAG 0x78
/*
* Large resource descriptor types
*/
#define ACPI_RDESC_TYPE_MEMORY_24 0x81
#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
#define ACPI_RDESC_TYPE_MEMORY_32 0x85
#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
/*****************************************************************************
*
* Miscellaneous
*
****************************************************************************/
#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_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
#define ACPI_MEM_CALLOC 1
#define ACPI_MAX_MODULE_NAME 16
#define ACPI_COMMON_DEBUG_MEM_HEADER \
struct acpi_debug_mem_block *previous; \
struct acpi_debug_mem_block *next; \
u32 size; \
u32 component; \
u32 line; \
char module[ACPI_MAX_MODULE_NAME]; \
u8 alloc_type;
struct acpi_debug_mem_header
{
ACPI_COMMON_DEBUG_MEM_HEADER
};
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_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;
#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;
#endif
};
#endif /* __ACLOCAL_H__ */

View File

@@ -0,0 +1,677 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACMACROS_H__
#define __ACMACROS_H__
/*
* Data manipulation macros
*/
#define ACPI_LOWORD(l) ((u16)(u32)(l))
#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
#define ACPI_LOBYTE(l) ((u8)(u16)(l))
#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
#if ACPI_MACHINE_WIDTH == 16
/*
* For 16-bit addresses, we have to assume that the upper 32 bits
* are zero.
*/
#define ACPI_LODWORD(l) ((u32)(l))
#define ACPI_HIDWORD(l) ((u32)(0))
#define ACPI_GET_ADDRESS(a) ((a).lo)
#define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(u32)(b);}
#define ACPI_VALID_ADDRESS(a) ((a).hi | (a).lo)
#else
#ifdef ACPI_NO_INTEGER64_SUPPORT
/*
* acpi_integer is 32-bits, no 64-bit support on this platform
*/
#define ACPI_LODWORD(l) ((u32)(l))
#define ACPI_HIDWORD(l) ((u32)(0))
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
#define ACPI_VALID_ADDRESS(a) (a)
#else
/*
* Full 64-bit address/integer on both 32-bit and 64-bit platforms
*/
#define ACPI_LODWORD(l) ((u32)(u64)(l))
#define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi))
#define ACPI_GET_ADDRESS(a) (a)
#define ACPI_STORE_ADDRESS(a,b) ((a)=(acpi_physical_address)(b))
#define ACPI_VALID_ADDRESS(a) (a)
#endif
#endif
/*
* printf() format helpers
*/
/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */
#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
/*
* Extract a byte of data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below
*/
#define ACPI_GET8(addr) (*(u8*)(addr))
/* Pointer arithmetic */
#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (acpi_native_uint)(b))
#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b))
/* Pointer/Integer type conversions */
#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i)
#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
#if ACPI_MACHINE_WIDTH == 16
#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
#define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i)
#else
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
#endif
/*
* Macros for moving data around to/from buffers that are possibly unaligned.
* If the hardware supports the transfer of unaligned data, just do the store.
* Otherwise, we have to move one byte at a time.
*/
#ifdef ACPI_BIG_ENDIAN
/*
* Macros for big-endian machines
*/
/* This macro sets a buffer index, starting from the end of the buffer */
#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran)))
/* These macros reverse the bytes during the move, converting little-endian to big endian */
/* Big Endian <== Little Endian */
/* Hi...Lo Lo...Hi */
/* 16-bit source, 16/32/64 destination */
#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\
((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\
((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
/* 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_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\
((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
/* 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_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
(( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
#else
/*
* Macros for little-endian machines
*/
/* This macro sets a buffer index, starting from the beginning of the buffer */
#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset)
#ifdef ACPI_MISALIGNED_TRANSFERS
/* The hardware supports unaligned transfers, just do the little-endian move */
#if ACPI_MACHINE_WIDTH == 16
/* No 64-bit integers */
/* 16-bit source, 16/32/64 destination */
#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s)
/* 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_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_64(d,s) ACPI_MOVE_32_TO_32(d,s)
#else
/* 16-bit source, 16/32/64 destination */
#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_64(d,s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
/* 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_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_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
#endif
#else
/*
* The hardware does not support unaligned transfers. We must move the
* data one byte at a time. These macros work whether the source or
* the destination (or both) is/are unaligned. (Little-endian move)
*/
/* 16-bit source, 16/32/64 destination */
#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
/* 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_32(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];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; 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_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];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
(( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
(( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
(( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
#endif
#endif
/* Macros based on machine integer width */
#if ACPI_MACHINE_WIDTH == 16
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
#elif ACPI_MACHINE_WIDTH == 32
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s)
#elif ACPI_MACHINE_WIDTH == 64
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s)
#else
#error unknown ACPI_MACHINE_WIDTH
#endif
/*
* Fast power-of-two math macros for non-optimized compilers
*/
#define _ACPI_DIV(value,power_of2) ((u32) ((value) >> (power_of2)))
#define _ACPI_MUL(value,power_of2) ((u32) ((value) << (power_of2)))
#define _ACPI_MOD(value,divisor) ((u32) ((value) & ((divisor) -1)))
#define ACPI_DIV_2(a) _ACPI_DIV(a,1)
#define ACPI_MUL_2(a) _ACPI_MUL(a,1)
#define ACPI_MOD_2(a) _ACPI_MOD(a,2)
#define ACPI_DIV_4(a) _ACPI_DIV(a,2)
#define ACPI_MUL_4(a) _ACPI_MUL(a,2)
#define ACPI_MOD_4(a) _ACPI_MOD(a,4)
#define ACPI_DIV_8(a) _ACPI_DIV(a,3)
#define ACPI_MUL_8(a) _ACPI_MUL(a,3)
#define ACPI_MOD_8(a) _ACPI_MOD(a,8)
#define ACPI_DIV_16(a) _ACPI_DIV(a,4)
#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)
*/
#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & (~(((acpi_native_uint) boundary)-1)))
#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + (((acpi_native_uint) boundary)-1)) & (~(((acpi_native_uint) boundary)-1)))
#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
#define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4)
#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))
#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
/* Generic (non-power-of-two) rounding */
#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
/*
* Bitmask creation
* Bit positions start at zero.
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
#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)
#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
/*
* An struct acpi_namespace_node * can appear in some contexts,
* where a pointer to an union acpi_operand_object can also
* appear. This macro is used to distinguish them.
*
* The "Descriptor" field is the first field in both structures.
*/
#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)
/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
/*
* Macros for the master AML opcode table
*/
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
#else
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
#endif
#ifdef ACPI_DISASSEMBLER
#define ACPI_DISASM_ONLY_MEMBERS(a) a;
#else
#define ACPI_DISASM_ONLY_MEMBERS(a)
#endif
#define ARG_TYPE_WIDTH 5
#define ARG_1(x) ((u32)(x))
#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))
#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH))
#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH))
#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH))
#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))
#define ARGI_LIST1(a) (ARG_1(a))
#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a))
#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
#define ARGP_LIST1(a) (ARG_1(a))
#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b))
#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
#define GET_CURRENT_ARG_TYPE(list) (list & ((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.
*/
#ifdef ACPI_DEBUG_OUTPUT
#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__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_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
#else
#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e);
#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e);
#endif
/* Error reporting. These versions pass thru the module and line# */
#define _ACPI_REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define _ACPI_REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
#define _ACPI_REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \
acpi_os_printf ACPI_PARAM_LIST(fp);}
/*
* Debug macros that are conditionally compiled
*/
#ifdef ACPI_DEBUG_OUTPUT
#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
/*
* 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.
*/
#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _dbg; \
_dbg.component_id = _COMPONENT; \
_dbg.proc_name = a; \
_dbg.module_name = _THIS_MODULE;
#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace(__LINE__,&_dbg)
#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace_str(__LINE__,&_dbg,(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.
*/
#ifdef ACPI_USE_DO_WHILE_0
#define ACPI_DO_WHILE0(a) do a while(0)
#else
#define ACPI_DO_WHILE0(a) a
#endif
#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_dbg);return;})
#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_dbg,(s));return((s));})
#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_dbg,(acpi_integer)(s));return((s));})
#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)(s));return((s));})
/* Conditional execution */
#define ACPI_DEBUG_EXEC(a) a
#define ACPI_NORMAL_EXEC(a)
#define ACPI_DEBUG_DEFINE(a) a;
#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_ENTRY(a,b) acpi_ns_dump_entry (a,b)
#ifdef ACPI_FUTURE_USAGE
#define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b)
#endif
#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
#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!)
*/
#define ACPI_ERROR_BREAK
#ifdef ACPI_ERROR_BREAK
#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
#else
#define ACPI_BREAK_ON_ERROR(lvl)
#endif
/*
* Master debug print macros
* Print iff:
* 1) Debug print for the current component is enabled
* 2) Debug error level or trace level for the print statement is enabled
*/
#define 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_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
#define ACPI_DEBUG_DEFINE(a)
#define ACPI_DEBUG_ONLY_MEMBERS(a)
#define ACPI_FUNCTION_NAME(a)
#define ACPI_FUNCTION_TRACE(a)
#define ACPI_FUNCTION_TRACE_PTR(a,b)
#define ACPI_FUNCTION_TRACE_U32(a,b)
#define ACPI_FUNCTION_TRACE_STR(a,b)
#define ACPI_FUNCTION_EXIT
#define ACPI_FUNCTION_STATUS_EXIT(s)
#define ACPI_FUNCTION_VALUE_EXIT(s)
#define ACPI_FUNCTION_ENTRY()
#define ACPI_DUMP_STACK_ENTRY(a)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
#define ACPI_DUMP_ENTRY(a,b)
#ifdef ACPI_FUTURE_USAGE
#define ACPI_DUMP_TABLES(a,b)
#endif
#define ACPI_DUMP_PATHNAME(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a)
#define ACPI_DUMP_BUFFER(a,b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
#define ACPI_BREAK_MSG(a)
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
#endif
/*
* Some code only gets executed when the debugger is built in.
* Note that this is entirely independent of whether the
* DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
*/
#ifdef ACPI_DEBUGGER
#define ACPI_DEBUGGER_EXEC(a) a
#else
#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
*/
#if ACPI_MACHINE_WIDTH == 16
#undef ACPI_DEBUG_ONLY_MEMBERS
#undef _VERBOSE_STRUCTURES
#define ACPI_DEBUG_ONLY_MEMBERS(a)
#endif
#ifdef ACPI_DEBUG_OUTPUT
/*
* 1) Set name to blanks
* 2) Copy the object name
*/
#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
#else
#define ACPI_ADD_OBJECT_NAME(a,b)
#endif
/*
* Memory allocation tracking (DEBUG ONLY)
*/
#ifndef ACPI_DBG_TRACK_ALLOCATIONS
/* 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_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_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
#endif /* ACMACROS_H */

View File

@@ -0,0 +1,515 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACNAMESP_H__
#define __ACNAMESP_H__
/* To search the entire name space, pass this as search_base */
#define ACPI_NS_ALL ((acpi_handle)0)
/*
* Elements of acpi_ns_properties are bit significant
* 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 */
/* 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_NS_ROOT_PATH "\\"
#define ACPI_NS_SYSTEM_BUS "_SB_"
/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
#define ACPI_NS_NO_UPSEARCH 0
#define ACPI_NS_SEARCH_PARENT 0x01
#define ACPI_NS_DONT_OPEN_SCOPE 0x02
#define ACPI_NS_NO_PEER_SEARCH 0x04
#define ACPI_NS_ERROR_IF_FOUND 0x08
#define ACPI_NS_WALK_UNLOCK TRUE
#define ACPI_NS_WALK_NO_UNLOCK FALSE
acpi_status
acpi_ns_load_namespace (
void);
acpi_status
acpi_ns_initialize_objects (
void);
acpi_status
acpi_ns_initialize_devices (
void);
/* Namespace init - nsxfinit */
acpi_status
acpi_ns_init_one_device (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
acpi_status
acpi_ns_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_status
acpi_ns_walk_namespace (
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);
void
acpi_ns_delete_namespace_by_owner (
u16 table_id);
/* Namespace loading - nsload */
acpi_status
acpi_ns_one_complete_parse (
u32 pass_number,
struct acpi_table_desc *table_desc);
acpi_status
acpi_ns_parse_table (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *scope);
acpi_status
acpi_ns_load_table (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *node);
acpi_status
acpi_ns_load_table_by_type (
acpi_table_type table_type);
/*
* Top-level namespace access - nsaccess
*/
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);
/*
* Named object allocation/deallocation - nsalloc
*/
struct acpi_namespace_node *
acpi_ns_create_node (
u32 name);
void
acpi_ns_delete_node (
struct acpi_namespace_node *node);
void
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_children (
struct acpi_namespace_node *parent);
int
acpi_ns_compare_names (
char *name1,
char *name2);
void
acpi_ns_remove_reference (
struct acpi_namespace_node *node);
/*
* Namespace modification - nsmodify
*/
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_ns_unload_namespace (
acpi_handle handle);
acpi_status
acpi_ns_delete_subtree (
acpi_handle start_handle);
#endif
/*
* Namespace dump/print utilities - nsdump
*/
#ifdef ACPI_FUTURE_USAGE
void
acpi_ns_dump_tables (
acpi_handle search_base,
u32 max_depth);
#endif
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);
void
acpi_ns_print_pathname (
u32 num_segments,
char *pathname);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
void
acpi_ns_dump_root_devices (
void);
#endif /* ACPI_FUTURE_USAGE */
acpi_status
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
/*
* Namespace evaluation functions - nseval
*/
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_status
acpi_ns_evaluate_relative (
char *pathname,
struct acpi_parameter_info *info);
acpi_status
acpi_ns_execute_control_method (
struct acpi_parameter_info *info);
acpi_status
acpi_ns_get_object_value (
struct acpi_parameter_info *info);
/*
* Parent/Child/Peer utility functions
*/
#ifdef ACPI_FUTURE_USAGE
acpi_name
acpi_ns_find_parent_name (
struct acpi_namespace_node *node_to_search);
#endif
/*
* Name and Scope manipulation - nsnames
*/
u32
acpi_ns_opens_scope (
acpi_object_type type);
void
acpi_ns_build_external_path (
struct acpi_namespace_node *node,
acpi_size size,
char *name_buffer);
char *
acpi_ns_get_external_pathname (
struct acpi_namespace_node *node);
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);
u8
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);
/*
* Object management for namespace nodes - nsobject
*/
acpi_status
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_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_status
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);
/*
* Namespace searching and entry - nssearch
*/
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_status
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);
/*
* Utility functions - nsutils
*/
u8
acpi_ns_valid_root_prefix (
char prefix);
u8
acpi_ns_valid_path_separator (
char sep);
acpi_object_type
acpi_ns_get_type (
struct acpi_namespace_node *node);
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);
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);
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);
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_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);
acpi_handle
acpi_ns_convert_entry_to_handle(
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);
#endif /* __ACNAMESP_H__ */

View File

@@ -0,0 +1,503 @@
/******************************************************************************
*
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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
* address space handlers and notify handlers. The object is a constant
* size in order to allow it to be cached and reused.
*/
/*******************************************************************************
*
* Common Descriptors
*
******************************************************************************/
/*
* Common area for all objects.
*
* data_type is used to differentiate between internal descriptors, and MUST
* be the first byte in this structure.
*/
#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
u8 descriptor; /* To differentiate various internal objs */\
u8 type; /* acpi_object_type */\
u16 reference_count; /* For object deletion management */\
union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
u8 flags; \
/* Values for flag byte above */
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08
#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
* "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
*/
#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
u8 field_flags; /* Access, update, and lock bits */\
u8 attribute; /* From access_as keyword */\
u8 access_byte_width; /* Read/Write size in bytes */\
u32 bit_length; /* Length of field in bits */\
u32 base_byte_offset; /* Byte offset within containing object */\
u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
u8 datum_valid_bits; /* Valid bit in first "Field datum" */\
u8 end_field_valid_bits; /* Valid bits in the last "field datum" */\
u8 end_buffer_valid_bits; /* Valid bits in the last "buffer datum" */\
u32 value; /* Value to store into the Bank or Index register */\
struct acpi_namespace_node *node; /* Link back to parent node */
/*
* Fields common to both Strings and Buffers
*/
#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 */
/******************************************************************************
*
* Basic data types
*
*****************************************************************************/
struct acpi_object_common
{
ACPI_OBJECT_COMMON_HEADER
};
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_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 */
};
/******************************************************************************
*
* Complex data types
*
*****************************************************************************/
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;
};
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;
};
/******************************************************************************
*
* 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_power_resource
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
u32 system_level;
u32 resource_order;
};
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
};
/******************************************************************************
*
* Fields. All share a common header/info field.
*
*****************************************************************************/
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_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 */
};
/* 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 */
};
/******************************************************************************
*
* 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;
};
/* 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;
};
/******************************************************************************
*
* Special internal objects
*
*****************************************************************************/
/*
* 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;
};
/*
* Extra object is used as additional storage for types that
* have AML code in their declarations (term_args) that must be
* evaluated at run time.
*
* Currently: Region and field_unit types
*/
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;
};
/* 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*/
};
/******************************************************************************
*
* 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_descriptor - objects that share a common descriptor identifier
*
*****************************************************************************/
/* Object descriptor types */
#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
#define ACPI_DESC_TYPE_STATE_CONTROL 0x05
#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06
#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07
#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08
#define ACPI_DESC_TYPE_STATE_RESULT 0x09
#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A
#define ACPI_DESC_TYPE_STATE_THREAD 0x0B
#define ACPI_DESC_TYPE_WALK 0x0C
#define ACPI_DESC_TYPE_PARSER 0x0D
#define ACPI_DESC_TYPE_OPERAND 0x0E
#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;
};
#endif /* _ACOBJECT_H */

View File

@@ -0,0 +1,185 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACOUTPUT_H__
#define __ACOUTPUT_H__
/*
* Debug levels and component IDs. These are used to control the
* granularity of the output of the DEBUG_PRINT macro -- on a per-
* component basis and a per-exception-type basis.
*/
/* Component IDs are used in the global "debug_layer" */
#define ACPI_UTILITIES 0x00000001
#define ACPI_HARDWARE 0x00000002
#define ACPI_EVENTS 0x00000004
#define ACPI_TABLES 0x00000008
#define ACPI_NAMESPACE 0x00000010
#define ACPI_PARSER 0x00000020
#define ACPI_DISPATCHER 0x00000040
#define ACPI_EXECUTER 0x00000080
#define ACPI_RESOURCES 0x00000100
#define ACPI_CA_DEBUGGER 0x00000200
#define ACPI_OS_SERVICES 0x00000400
#define ACPI_CA_DISASSEMBLER 0x00000800
/* Component IDs for ACPI tools and utilities */
#define ACPI_COMPILER 0x00001000
#define ACPI_TOOLS 0x00002000
#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
*/
#define ACPI_LV_ERROR 0x00000001
#define ACPI_LV_WARN 0x00000002
#define ACPI_LV_INIT 0x00000004
#define ACPI_LV_DEBUG_OBJECT 0x00000008
#define ACPI_LV_INFO 0x00000010
#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
/* Trace verbosity level 1 [Standard Trace Level] */
#define ACPI_LV_INIT_NAMES 0x00000020
#define ACPI_LV_PARSE 0x00000040
#define ACPI_LV_LOAD 0x00000080
#define ACPI_LV_DISPATCH 0x00000100
#define ACPI_LV_EXEC 0x00000200
#define ACPI_LV_NAMES 0x00000400
#define ACPI_LV_OPREGION 0x00000800
#define ACPI_LV_BFIELD 0x00001000
#define ACPI_LV_TABLES 0x00002000
#define ACPI_LV_VALUES 0x00004000
#define ACPI_LV_OBJECTS 0x00008000
#define ACPI_LV_RESOURCES 0x00010000
#define ACPI_LV_USER_REQUESTS 0x00020000
#define ACPI_LV_PACKAGE 0x00040000
#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS
/* Trace verbosity level 2 [Function tracing and memory allocation] */
#define ACPI_LV_ALLOCATIONS 0x00100000
#define ACPI_LV_FUNCTIONS 0x00200000
#define ACPI_LV_OPTIMIZATIONS 0x00400000
#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1
#define ACPI_LV_ALL ACPI_LV_VERBOSITY2
/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
#define ACPI_LV_MUTEX 0x01000000
#define ACPI_LV_THREADS 0x02000000
#define ACPI_LV_IO 0x04000000
#define ACPI_LV_INTERRUPTS 0x08000000
#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
/* Exceptionally verbose output -- also used in the global "debug_level" */
#define ACPI_LV_AML_DISASSEMBLE 0x10000000
#define ACPI_LV_VERBOSE_INFO 0x20000000
#define ACPI_LV_FULL_TABLES 0x40000000
#define ACPI_LV_EVENTS 0x80000000
#define ACPI_LV_VERBOSE 0xF0000000
/*
* Debug level macros that are used in the DEBUG_PRINT macros
*/
#define ACPI_DEBUG_LEVEL(dl) (u32) dl,__LINE__,&_dbg
/* Exception level -- used in the global "debug_level" */
#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
#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)
#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD)
#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC)
#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES)
#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION)
#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD)
#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)
#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES)
#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO)
#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS)
#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
#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__ */

View File

@@ -0,0 +1,349 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* 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
#define ACPI_PARSE_LOAD_PASS1 0x0010
#define ACPI_PARSE_LOAD_PASS2 0x0020
#define ACPI_PARSE_EXECUTE 0x0030
#define ACPI_PARSE_MODE_MASK 0x0030
#define ACPI_PARSE_DEFERRED_OP 0x0100
/* 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);
/******************************************************************************
*
* Parser interfaces
*
*****************************************************************************/
/* psargs - Parse AML opcode arguments */
u8 *
acpi_ps_get_next_package_end (
struct acpi_parse_state *parser_state);
u32
acpi_ps_get_next_package_length (
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_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);
union acpi_parse_object *
acpi_ps_get_next_field (
struct acpi_parse_state *parser_state);
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);
/* 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);
/* psopcode - AML Opcode information */
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 */
u32
acpi_ps_get_opcode_size (
u32 opcode);
void
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);
acpi_status
acpi_ps_find_object (
struct acpi_walk_state *walk_state,
union acpi_parse_object **out_op);
void
acpi_ps_delete_parse_tree (
union acpi_parse_object *root);
acpi_status
acpi_ps_parse_loop (
struct acpi_walk_state *walk_state);
acpi_status
acpi_ps_parse_aml (
struct acpi_walk_state *walk_state);
acpi_status
acpi_ps_parse_table (
u8 *aml,
u32 aml_size,
acpi_parse_downwards descending_callback,
acpi_parse_upwards ascending_callback,
union acpi_parse_object **root_object);
u16
acpi_ps_peek_opcode (
struct acpi_parse_state *state);
/* psscope - Scope stack management routines */
acpi_status
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);
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_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);
/* 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);
#ifdef ACPI_FUTURE_USAGE
union acpi_parse_object *
acpi_ps_get_child (
union acpi_parse_object *op);
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_status
acpi_ps_delete_completed_op (
struct acpi_walk_state *walk_state);
/* psutils - parser utilities */
union acpi_parse_object *
acpi_ps_create_scope_op (
void);
void
acpi_ps_init_op (
union acpi_parse_object *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_delete_parse_cache (
void);
u8
acpi_ps_is_leading_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
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);
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);
#endif /* __ACPARSER_H__ */

View File

@@ -0,0 +1,69 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACPI_H__
#define __ACPI_H__
/*
* Common includes for all ACPI driver files
* We put them here because we don't want to duplicate them
* in the rest of the source code again and again.
*/
#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__ */

View File

@@ -0,0 +1,334 @@
/*
* acpi_bus.h - ACPI Bus Driver ($Revision: 22 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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 __ACPI_BUS_H__
#define __ACPI_BUS_H__
#include <linux/kobject.h>
#include <acpi/acpi.h>
#define PREFIX "ACPI: "
/* TBD: Make dynamic */
#define ACPI_MAX_HANDLES 10
struct acpi_handle_list {
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_status
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);
#ifdef CONFIG_ACPI_BUS
#include <linux/proc_fs.h>
#define ACPI_BUS_FILE_ROOT "acpi"
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_EJECT,
ACPI_BUS_REMOVAL_SUPRISE,
ACPI_BUS_REMOVAL_TYPE_COUNT
};
enum acpi_bus_device_type {
ACPI_BUS_TYPE_DEVICE = 0,
ACPI_BUS_TYPE_POWER,
ACPI_BUS_TYPE_PROCESSOR,
ACPI_BUS_TYPE_THERMAL,
ACPI_BUS_TYPE_SYSTEM,
ACPI_BUS_TYPE_POWER_BUTTON,
ACPI_BUS_TYPE_SLEEP_BUTTON,
ACPI_BUS_DEVICE_TYPE_COUNT
};
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_match) (struct acpi_device *device,
struct acpi_driver *driver);
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_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;
};
/*
* ACPI Device
* -----------
*/
/* 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;
};
/* 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;
};
/* File System */
struct acpi_device_dir {
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];
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; /* " */
};
#define acpi_device_bid(d) ((d)->pnp.bus_id)
#define acpi_device_adr(d) ((d)->pnp.bus_address)
#define acpi_device_hid(d) ((d)->pnp.hardware_id)
#define acpi_device_uid(d) ((d)->pnp.unique_id)
#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;
};
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 */
};
struct acpi_device_power {
int state; /* Current state */
struct acpi_device_power_flags flags;
struct acpi_device_power_state states[4]; /* Power states (D0-D3) */
};
/* Performance Management */
struct acpi_device_perf_flags {
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) */
};
struct acpi_device_perf {
int state;
struct acpi_device_perf_flags flags;
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 */
};
struct acpi_device_wakeup_state {
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;
};
/* 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;
struct acpi_device_status status;
struct acpi_device_flags flags;
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;
};
#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;
};
extern struct subsystem acpi_subsys;
/*
* External Functions
*/
int acpi_bus_get_device(acpi_handle, struct acpi_device **device);
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_match_ids (struct acpi_device *device, char *ids);
int acpi_create_dir(struct acpi_device *);
void acpi_remove_dir(struct acpi_device *);
#endif /*CONFIG_ACPI_BUS*/
#endif /*__ACPI_BUS_H__*/

View File

@@ -0,0 +1,109 @@
/*
* acpi_drivers.h ($Revision: 31 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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 __ACPI_DRIVERS_H__
#define __ACPI_DRIVERS_H__
#include <linux/acpi.h>
#include <acpi/acpi_bus.h>
#define ACPI_MAX_STRING 80
#define ACPI_BUS_COMPONENT 0x00010000
#define ACPI_SYSTEM_COMPONENT 0x02000000
/* _HID definitions */
#define ACPI_POWER_HID "ACPI_PWR"
#define ACPI_PROCESSOR_HID "ACPI_CPU"
#define ACPI_SYSTEM_HID "ACPI_SYS"
#define ACPI_THERMAL_HID "ACPI_THM"
#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_get_irq (acpi_handle handle, int index, int* edge_level, int* active_high_low);
/* ACPI PCI Interrupt Routing (pci_irq.c) */
int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
/* ACPI PCI Device Binding (pci_bind.c) */
struct pci_bus;
int acpi_pci_bind (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*/
/* --------------------------------------------------------------------------
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);
#endif
/* --------------------------------------------------------------------------
Embedded Controller
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_EC
int acpi_ec_ecdt_probe (void);
#endif
/* --------------------------------------------------------------------------
Processor
-------------------------------------------------------------------------- */
#define ACPI_PROCESSOR_LIMIT_NONE 0x00
#define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01
#define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02
int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
#endif /*__ACPI_DRIVERS_H__*/

View File

@@ -0,0 +1,389 @@
/******************************************************************************
*
* Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
* interfaces must be implemented by OSL to interface the
* ACPI components to the host operating system.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACPIOSXF_H__
#define __ACPIOSXF_H__
#include "platform/acenv.h"
#include "actypes.h"
/* Priorities for acpi_os_queue_for_execution */
#define OSD_PRIORITY_GPE 1
#define OSD_PRIORITY_HIGH 2
#define OSD_PRIORITY_MED 3
#define OSD_PRIORITY_LO 4
#define ACPI_NO_UNIT_LIMIT ((u32) -1)
#define ACPI_MUTEX_SEM 1
/* 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;
};
/*
* OSL Initialization and shutdown primitives
*/
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_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);
/*
* 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_status
acpi_os_wait_semaphore (
acpi_handle handle,
u32 units,
u16 timeout);
acpi_status
acpi_os_signal_semaphore (
acpi_handle handle,
u32 units);
acpi_status
acpi_os_create_lock (
acpi_handle *out_handle);
void
acpi_os_delete_lock (
acpi_handle handle);
void
acpi_os_acquire_lock (
acpi_handle handle,
u32 flags);
void
acpi_os_release_lock (
acpi_handle handle,
u32 flags);
/*
* Memory allocation and mapping
*/
void *
acpi_os_allocate (
acpi_size size);
void
acpi_os_free (
void * memory);
acpi_status
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);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_os_get_physical_address (
void *logical_address,
acpi_physical_address *physical_address);
#endif
/*
* Interrupt handlers
*/
acpi_status
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);
/*
* Threads and Scheduling
*/
u32
acpi_os_get_thread_id (
void);
acpi_status
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_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);
/*
* Platform and hardware-independent physical memory interfaces
*/
acpi_status
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);
/*
* Platform and hardware-independent PCI configuration space access
* Note: Can't use "Register" as a parameter, changed to "Reg" --
* certain compilers complain.
*/
acpi_status
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);
/*
* 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);
/*
* Miscellaneous
*/
u8
acpi_os_readable (
void *pointer,
acpi_size length);
#ifdef ACPI_FUTURE_USAGE
u8
acpi_os_writable (
void *pointer,
acpi_size length);
#endif
u64
acpi_os_get_timer (
void);
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_os_redirect_output (
void *destination);
/*
* Debug input
*/
#ifdef ACPI_FUTURE_USAGE
u32
acpi_os_get_line (
char *buffer);
#endif
/*
* Directory manipulation
*/
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);
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);
#endif /* __ACPIOSXF_H__ */

View File

@@ -0,0 +1,497 @@
/******************************************************************************
*
* Name: acpixf.h - External interfaces to the ACPI subsystem
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* 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_enable_subsystem (
u32 flags);
acpi_status
acpi_initialize_objects (
u32 flags);
acpi_status
acpi_terminate (
void);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_subsystem_status (
void);
#endif
acpi_status
acpi_enable (
void);
acpi_status
acpi_disable (
void);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_get_system_info (
struct acpi_buffer *ret_buffer);
#endif
const char *
acpi_format_exception (
acpi_status exception);
acpi_status
acpi_purge_cached_objects (
void);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_install_initialization_handler (
acpi_init_handler handler,
u32 function);
#endif
/*
* ACPI Memory manager
*/
void *
acpi_allocate (
u32 size);
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_status
acpi_load_tables (
void);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_load_table (
struct acpi_table_header *table_ptr);
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_status
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);
/*
* 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_status
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_status
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_status
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);
/*
* 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);
#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);
#endif
acpi_status
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_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_status
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_status
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_status
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);
#ifdef ACPI_FUTURE_USAGE
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_release_global_lock (
u32 handle);
acpi_status
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_disable_event (
u32 event,
u32 flags);
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_clear_event (
u32 event);
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_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_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_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);
/*
* Resource interfaces
*/
typedef
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);
#ifdef ACPI_FUTURE_USAGE
acpi_status
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_status
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_status
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_set_register (
u32 register_id,
u32 value,
u32 flags);
acpi_status
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);
#endif
acpi_status
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 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);
#endif /* __ACXFACE_H__ */

View File

@@ -0,0 +1,395 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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_status
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_status
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_status
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_status
acpi_rs_create_pci_routing_table (
union acpi_operand_object *package_object,
struct acpi_buffer *output_buffer);
/*
* Function prototypes called from acpi_rs_create*
*/
#ifdef ACPI_FUTURE_USAGE
void
acpi_rs_dump_irq (
union acpi_resource_data *data);
void
acpi_rs_dump_address16 (
union acpi_resource_data *data);
void
acpi_rs_dump_address32 (
union acpi_resource_data *data);
void
acpi_rs_dump_address64 (
union acpi_resource_data *data);
void
acpi_rs_dump_dma (
union acpi_resource_data *data);
void
acpi_rs_dump_io (
union acpi_resource_data *data);
void
acpi_rs_dump_extended_irq (
union acpi_resource_data *data);
void
acpi_rs_dump_fixed_io (
union acpi_resource_data *data);
void
acpi_rs_dump_fixed_memory32 (
union acpi_resource_data *data);
void
acpi_rs_dump_memory24 (
union acpi_resource_data *data);
void
acpi_rs_dump_memory32 (
union acpi_resource_data *data);
void
acpi_rs_dump_start_depend_fns (
union acpi_resource_data *data);
void
acpi_rs_dump_vendor_specific (
union acpi_resource_data *data);
void
acpi_rs_dump_resource_list (
struct acpi_resource *resource);
void
acpi_rs_dump_irq_list (
u8 *route_table);
#endif /* ACPI_FUTURE_USAGE */
acpi_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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_status
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);
u8
acpi_rs_get_resource_type (
u8 resource_start_byte);
#endif /* __ACRESRC_H__ */

View File

@@ -0,0 +1,222 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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.
*/
#define ACPI_NEXT_OP_DOWNWARD 1
#define ACPI_NEXT_OP_UPWARD 2
#define ACPI_WALK_NON_METHOD 0
#define ACPI_WALK_METHOD 1
#define ACPI_WALK_METHOD_RESTART 2
#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 */
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;
};
/* 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;
};
/* TBD: [Restructure] Merge with struct above */
struct acpi_walk_info
{
u32 debug_level;
u32 owner_id;
u8 display_type;
};
/* Display Types */
#define ACPI_DISPLAY_SUMMARY 0
#define ACPI_DISPLAY_OBJECTS 1
struct acpi_get_devices_info
{
acpi_walk_callback user_function;
void *context;
char *hid;
};
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;
} fatal;
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;
} 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;
};
/* Types for parameter_type above */
#define ACPI_PARAM_ARGS 0
#define ACPI_PARAM_GPE 1
#endif

View File

@@ -0,0 +1,235 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_tb_handle_to_object (
u16 table_id,
struct acpi_table_desc **table_desc);
#endif
/*
* tbconvrt - Table conversion routines
*/
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_build_common_facs (
struct acpi_table_desc *table_info);
u32
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_status
acpi_tb_get_table_body (
struct acpi_pointer *address,
struct acpi_table_header *header,
struct acpi_table_desc *table_info);
acpi_status
acpi_tb_get_this_table (
struct acpi_pointer *address,
struct acpi_table_header *header,
struct acpi_table_desc *table_info);
acpi_status
acpi_tb_table_override (
struct acpi_table_header *header,
struct acpi_table_desc *table_info);
acpi_status
acpi_tb_get_table_ptr (
acpi_table_type table_type,
u32 instance,
struct acpi_table_header **table_ptr_loc);
acpi_status
acpi_tb_verify_rsdp (
struct acpi_pointer *address);
void
acpi_tb_get_rsdt_address (
struct acpi_pointer *out_address);
acpi_status
acpi_tb_validate_rsdt (
struct acpi_table_header *table_ptr);
acpi_status
acpi_tb_get_required_tables (
void);
acpi_status
acpi_tb_get_primary_table (
struct acpi_pointer *address,
struct acpi_table_desc *table_info);
acpi_status
acpi_tb_get_secondary_table (
struct acpi_pointer *address,
acpi_string signature,
struct acpi_table_desc *table_info);
/*
* tbinstall - Table installation
*/
acpi_status
acpi_tb_install_table (
struct acpi_table_desc *table_info);
acpi_status
acpi_tb_match_signature (
char *signature,
struct acpi_table_desc *table_info,
u8 search_type);
acpi_status
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);
/*
* 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_single_table (
struct acpi_table_desc *table_desc);
struct acpi_table_desc *
acpi_tb_uninstall_table (
struct acpi_table_desc *table_desc);
/*
* tbrsd - RSDP, RSDT utilities
*/
acpi_status
acpi_tb_get_table_rsdt (
void);
u8 *
acpi_tb_scan_memory_for_rsdp (
u8 *start_address,
u32 length);
acpi_status
acpi_tb_find_rsdp (
struct acpi_table_desc *table_info,
u32 flags);
/*
* tbutils - common table utilities
*/
acpi_status
acpi_tb_find_table (
char *signature,
char *oem_id,
char *oem_table_id,
struct acpi_table_header **table_ptr);
acpi_status
acpi_tb_verify_table_checksum (
struct acpi_table_header *table_header);
u8
acpi_tb_checksum (
void *buffer,
u32 length);
acpi_status
acpi_tb_validate_table_header (
struct acpi_table_header *table_header);
#endif /* __ACTABLES_H__ */

View File

@@ -0,0 +1,352 @@
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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 */
/*
* Common table types. The base code can remain
* constant if the underlying tables are changed
*/
#define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2
#define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2
#define FACS_DESCRIPTOR struct facs_descriptor_rev2
#define FADT_DESCRIPTOR struct fadt_descriptor_rev2
#pragma pack(1)
/*
* ACPI Version-independent tables
*
* 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 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 */\
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 */\
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
};
/*
* MADT values and structures
*/
/* Values for MADT PCATCompat */
#define DUAL_PIC 0
#define MULTIPLE_APIC 1
/* 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;
};
/* Values for Type in APIC_HEADER_DEF */
#define APIC_PROCESSOR 0
#define APIC_IO 1
#define APIC_XRUPT_OVERRIDE 2
#define APIC_NMI 3
#define APIC_LOCAL_NMI 4
#define APIC_ADDRESS_OVERRIDE 5
#define APIC_IO_SAPIC 6
#define APIC_LOCAL_SAPIC 7
#define APIC_XRUPT_SOURCE 8
#define APIC_RESERVED 9 /* 9 and greater are reserved */
/*
* MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
*/
#define APIC_HEADER_DEF /* Common APIC sub-structure header */\
u8 type; \
u8 length;
struct apic_header
{
APIC_HEADER_DEF
};
/* Values for MPS INTI flags */
#define POLARITY_CONFORMS 0
#define POLARITY_ACTIVE_HIGH 1
#define POLARITY_RESERVED 2
#define POLARITY_ACTIVE_LOW 3
#define TRIGGER_CONFORMS 0
#define TRIGGER_EDGE 1
#define TRIGGER_RESERVED 2
#define TRIGGER_LEVEL 3
/* Common flag definitions */
#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 */
#define LOCAL_APIC_FLAGS \
u32 processor_enabled: 1; /* Processor is usable if set */\
u32 reserved2 : 31; /* 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_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_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_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
};
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 reserved; /* Reserved - must be zero */
};
/*
* Smart Battery
*/
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
* table for 1) when we exit, and 2) if a new table is installed
*/
#define ACPI_MEM_NOT_ALLOCATED 0
#define ACPI_MEM_ALLOCATED 1
#define ACPI_MEM_MAPPED 2
/* Definitions for the Flags bitfield member of struct acpi_table_support */
#define ACPI_TABLE_SINGLE 0x00
#define ACPI_TABLE_MULTIPLE 0x01
#define ACPI_TABLE_EXECUTABLE 0x02
#define ACPI_TABLE_ROOT 0x00
#define ACPI_TABLE_PRIMARY 0x10
#define ACPI_TABLE_SECONDARY 0x20
#define ACPI_TABLE_ALL 0x30
#define ACPI_TABLE_TYPE_MASK 0x30
/* Data about each known table type */
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 */
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;
};
#pragma pack()
#endif /* __ACTBL_H__ */

View File

@@ -0,0 +1,136 @@
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACTBL1_H__
#define __ACTBL1_H__
#pragma pack(1)
/*
* 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 */
};
/*
* 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 */
};
/*
* 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 */
};
#pragma pack()
#endif /* __ACTBL1_H__ */

View File

@@ -0,0 +1,232 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACTBL2_H__
#define __ACTBL2_H__
/*
* Prefered Power Management Profiles
*/
#define PM_UNSPECIFIED 0
#define PM_DESKTOP 1
#define PM_MOBILE 2
#define PM_WORKSTATION 3
#define PM_ENTERPRISE_SERVER 4
#define PM_SOHO_SERVER 5
#define PM_APPLIANCE_PC 6
/*
* ACPI Boot Arch Flags
*/
#define BAF_LEGACY_DEVICES 0x0001
#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
#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 */
};
/*
* 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 */
};
/*
* 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 */
};
/*
* 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 reserved; /* Must be 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 */ \
u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
u16 sci_int; /* System vector of SCI interrupt */ \
u32 smi_cmd; /* Port address of SMI command port */ \
u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
u8 pstate_cnt; /* Processor performance state control*/ \
u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \
u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \
u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \
u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \
u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
u8 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 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
u16 flush_size; /* Number of flush strides that need to be read */ \
u16 flush_stride; /* Processor's memory cache line width, in bytes */ \
u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
u8 century; /* Index to century in RTC CMOS RAM */ \
u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
/*
* 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. */
u32 reserved6 : 18; /* 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 */
};
/* "Downrevved" 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 */
};
/* Embedded Controller */
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 */
};
#pragma pack()
#endif /* __ACTBL2_H__ */

View File

@@ -0,0 +1,144 @@
/******************************************************************************
*
* Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
* This file includes tables specific to this
* specification revision.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2003, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ACTBL71_H__
#define __ACTBL71_H__
/* 0.71 FADT address_space data item bitmasks defines */
/* If the associated bit is zero then it is in memory space else in io space */
#define SMI_CMD_ADDRESS_SPACE 0x01
#define PM1_BLK_ADDRESS_SPACE 0x02
#define PM2_CNT_BLK_ADDRESS_SPACE 0x04
#define PM_TMR_BLK_ADDRESS_SPACE 0x08
#define GPE0_BLK_ADDRESS_SPACE 0x10
#define GPE1_BLK_ADDRESS_SPACE 0x20
/* Only for clarity in declarations */
typedef 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 */
};
/*****************************************/
/* 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 */
};
/*******************************************/
/* 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 */
};
/******************************************/
/* 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 */
};
#pragma pack()
#endif /* __ACTBL71_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,871 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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);
acpi_status
acpi_ut_walk_package_tree (
union acpi_operand_object *source_object,
void *target_object,
acpi_pkg_callback walk_callback,
void *context);
struct acpi_pkg_info
{
u8 *free_space;
acpi_size length;
u32 object_space;
u32 num_packages;
};
#define REF_INCREMENT (u16) 0
#define REF_DECREMENT (u16) 1
#define REF_FORCE_DELETE (u16) 2
/* acpi_ut_dump_buffer */
#define DB_BYTE_DISPLAY 1
#define DB_WORD_DISPLAY 2
#define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8
/* Global initialization interfaces */
void
acpi_ut_init_globals (
void);
void
acpi_ut_terminate (
void);
/*
* ut_init - miscellaneous initialization and shutdown
*/
acpi_status
acpi_ut_hardware_initialize (
void);
void
acpi_ut_subsystem_shutdown (
void);
acpi_status
acpi_ut_validate_fadt (
void);
/*
* ut_global - Global data structures and procedures
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
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_object_type_name (
union acpi_operand_object *obj_desc);
char *
acpi_ut_get_region_name (
u8 space_id);
char *
acpi_ut_get_event_name (
u32 event_id);
char
acpi_ut_hex_to_ascii_char (
acpi_integer integer,
u32 position);
u8
acpi_ut_valid_object_type (
acpi_object_type type);
acpi_owner_id
acpi_ut_allocate_owner_id (
u32 id_type);
/*
* ut_clib - 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);
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_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
#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 */
/*
* ut_copy - 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_status
acpi_ut_build_package_object (
union acpi_operand_object *obj,
u8 *buffer,
u32 *space_used);
acpi_status
acpi_ut_copy_ielement_to_eelement (
u8 object_type,
union acpi_operand_object *source_object,
union acpi_generic_state *state,
void *context);
acpi_status
acpi_ut_copy_ielement_to_ielement (
u8 object_type,
union acpi_operand_object *source_object,
union acpi_generic_state *state,
void *context);
acpi_status
acpi_ut_copy_iobject_to_eobject (
union acpi_operand_object *obj,
struct acpi_buffer *ret_buffer);
acpi_status
acpi_ut_copy_esimple_to_isimple(
union acpi_object *user_obj,
union acpi_operand_object **return_obj);
acpi_status
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_status
acpi_ut_copy_ipackage_to_ipackage (
union acpi_operand_object *source_obj,
union acpi_operand_object *dest_obj,
struct acpi_walk_state *walk_state);
acpi_status
acpi_ut_copy_simple_object (
union acpi_operand_object *source_desc,
union acpi_operand_object *dest_desc);
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);
/*
* ut_create - Object creation
*/
acpi_status
acpi_ut_update_object_reference (
union acpi_operand_object *object,
u16 action);
/*
* ut_debug - Debug interfaces
*/
void
acpi_ut_init_stack_ptr_trace (
void);
void
acpi_ut_track_stack_ptr (
void);
void
acpi_ut_trace (
u32 line_number,
struct acpi_debug_print_info *dbg_info);
void
acpi_ut_trace_ptr (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
void *pointer);
void
acpi_ut_trace_u32 (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
u32 integer);
void
acpi_ut_trace_str (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
char *string);
void
acpi_ut_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info);
void
acpi_ut_status_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
acpi_status status);
void
acpi_ut_value_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
acpi_integer value);
void
acpi_ut_ptr_exit (
u32 line_number,
struct acpi_debug_print_info *dbg_info,
u8 *ptr);
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_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_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;
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;
/*
* ut_delete - Object deletion
*/
void
acpi_ut_delete_internal_obj (
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);
/*
* ut_eval - object evaluation
*/
/* Method name strings */
#define METHOD_NAME__HID "_HID"
#define METHOD_NAME__CID "_CID"
#define METHOD_NAME__UID "_UID"
#define METHOD_NAME__ADR "_ADR"
#define METHOD_NAME__STA "_STA"
#define METHOD_NAME__REG "_REG"
#define METHOD_NAME__SEG "_SEG"
#define METHOD_NAME__BBN "_BBN"
#define METHOD_NAME__PRT "_PRT"
#define METHOD_NAME__CRS "_CRS"
#define METHOD_NAME__PRS "_PRS"
#define METHOD_NAME__PRW "_PRW"
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_status
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_status
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_status
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);
/*
* ut_mutex - mutual exclusion interfaces
*/
acpi_status
acpi_ut_mutex_initialize (
void);
void
acpi_ut_mutex_terminate (
void);
acpi_status
acpi_ut_create_mutex (
acpi_mutex_handle mutex_id);
acpi_status
acpi_ut_delete_mutex (
acpi_mutex_handle mutex_id);
acpi_status
acpi_ut_acquire_mutex (
acpi_mutex_handle mutex_id);
acpi_status
acpi_ut_release_mutex (
acpi_mutex_handle mutex_id);
/*
* ut_object - 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)
void
acpi_ut_delete_object_desc (
union acpi_operand_object *object);
u8
acpi_ut_valid_internal_object (
void *object);
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);
/*
* ut_ref_cnt - Object reference count management
*/
void
acpi_ut_add_reference (
union acpi_operand_object *object);
void
acpi_ut_remove_reference (
union acpi_operand_object *object);
/*
* ut_size - Object size routines
*/
acpi_status
acpi_ut_get_simple_object_size (
union acpi_operand_object *obj,
acpi_size *obj_length);
acpi_status
acpi_ut_get_package_object_size (
union acpi_operand_object *obj,
acpi_size *obj_length);
acpi_status
acpi_ut_get_object_size(
union acpi_operand_object *obj,
acpi_size *obj_length);
acpi_status
acpi_ut_get_element_length (
u8 object_type,
union acpi_operand_object *source_object,
union acpi_generic_state *state,
void *context);
/*
* ut_state - Generic state creation/cache routines
*/
void
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_create_generic_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_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);
#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
union acpi_generic_state *
acpi_ut_create_control_state (
void);
void
acpi_ut_delete_generic_state (
union acpi_generic_state *state);
void
acpi_ut_delete_generic_state_cache (
void);
void
acpi_ut_delete_object_cache (
void);
/*
* utmisc
*/
void
acpi_ut_print_string (
char *string,
u8 max_length);
acpi_status
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);
u8
acpi_ut_valid_acpi_name (
u32 name);
u8
acpi_ut_valid_acpi_character (
char character);
acpi_status
acpi_ut_strtoul64 (
char *string,
u32 base,
acpi_integer *ret_integer);
/* Values for Base above (16=Hex, 10=Decimal) */
#define ACPI_ANY_BASE 0
#ifdef ACPI_FUTURE_USAGE
char *
acpi_ut_strupr (
char *src_string);
#endif
u8 *
acpi_ut_get_resource_end_tag (
union acpi_operand_object *obj_desc);
u8
acpi_ut_generate_checksum (
u8 *buffer,
u32 length);
u32
acpi_ut_dword_byte_swap (
u32 value);
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);
#endif
/*
* Utalloc - memory allocation and object caching
*/
void *
acpi_ut_acquire_from_cache (
u32 list_id);
void
acpi_ut_release_to_cache (
u32 list_id,
void *object);
void
acpi_ut_delete_generic_cache (
u32 list_id);
acpi_status
acpi_ut_validate_buffer (
struct acpi_buffer *buffer);
acpi_status
acpi_ut_initialize_buffer (
struct acpi_buffer *buffer,
acpi_size required_length);
/* Memory allocation functions */
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_free_and_track (
void *address,
u32 component,
char *module,
u32 line);
struct acpi_debug_mem_block *
acpi_ut_find_allocation (
u32 list_id,
void *allocation);
acpi_status
acpi_ut_track_allocation (
u32 list_id,
struct acpi_debug_mem_block *address,
acpi_size size,
u8 alloc_type,
u32 component,
char *module,
u32 line);
acpi_status
acpi_ut_remove_allocation (
u32 list_id,
struct acpi_debug_mem_block *address,
u32 component,
char *module,
u32 line);
#ifdef ACPI_FUTURE_USAGE
void
acpi_ut_dump_allocation_info (
void);
#endif
void
acpi_ut_dump_allocations (
u32 component,
char *module);
#endif
#endif /* _ACUTILS_H */

View File

@@ -0,0 +1,516 @@
/******************************************************************************
*
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __AMLCODE_H__
#define __AMLCODE_H__
/* primary opcodes */
#define AML_NULL_CHAR (u16) 0x00
#define AML_ZERO_OP (u16) 0x00
#define AML_ONE_OP (u16) 0x01
#define AML_UNASSIGNED (u16) 0x02
#define AML_ALIAS_OP (u16) 0x06
#define AML_NAME_OP (u16) 0x08
#define AML_BYTE_OP (u16) 0x0a
#define AML_WORD_OP (u16) 0x0b
#define AML_DWORD_OP (u16) 0x0c
#define AML_STRING_OP (u16) 0x0d
#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */
#define AML_SCOPE_OP (u16) 0x10
#define AML_BUFFER_OP (u16) 0x11
#define AML_PACKAGE_OP (u16) 0x12
#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */
#define AML_METHOD_OP (u16) 0x14
#define AML_DUAL_NAME_PREFIX (u16) 0x2e
#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f
#define AML_NAME_CHAR_SUBSEQ (u16) 0x30
#define AML_NAME_CHAR_FIRST (u16) 0x41
#define AML_OP_PREFIX (u16) 0x5b
#define AML_ROOT_PREFIX (u16) 0x5c
#define AML_PARENT_PREFIX (u16) 0x5e
#define AML_LOCAL_OP (u16) 0x60
#define AML_LOCAL0 (u16) 0x60
#define AML_LOCAL1 (u16) 0x61
#define AML_LOCAL2 (u16) 0x62
#define AML_LOCAL3 (u16) 0x63
#define AML_LOCAL4 (u16) 0x64
#define AML_LOCAL5 (u16) 0x65
#define AML_LOCAL6 (u16) 0x66
#define AML_LOCAL7 (u16) 0x67
#define AML_ARG_OP (u16) 0x68
#define AML_ARG0 (u16) 0x68
#define AML_ARG1 (u16) 0x69
#define AML_ARG2 (u16) 0x6a
#define AML_ARG3 (u16) 0x6b
#define AML_ARG4 (u16) 0x6c
#define AML_ARG5 (u16) 0x6d
#define AML_ARG6 (u16) 0x6e
#define AML_STORE_OP (u16) 0x70
#define AML_REF_OF_OP (u16) 0x71
#define AML_ADD_OP (u16) 0x72
#define AML_CONCAT_OP (u16) 0x73
#define AML_SUBTRACT_OP (u16) 0x74
#define AML_INCREMENT_OP (u16) 0x75
#define AML_DECREMENT_OP (u16) 0x76
#define AML_MULTIPLY_OP (u16) 0x77
#define AML_DIVIDE_OP (u16) 0x78
#define AML_SHIFT_LEFT_OP (u16) 0x79
#define AML_SHIFT_RIGHT_OP (u16) 0x7a
#define AML_BIT_AND_OP (u16) 0x7b
#define AML_BIT_NAND_OP (u16) 0x7c
#define AML_BIT_OR_OP (u16) 0x7d
#define AML_BIT_NOR_OP (u16) 0x7e
#define AML_BIT_XOR_OP (u16) 0x7f
#define AML_BIT_NOT_OP (u16) 0x80
#define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81
#define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82
#define AML_DEREF_OF_OP (u16) 0x83
#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */
#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */
#define AML_NOTIFY_OP (u16) 0x86
#define AML_SIZE_OF_OP (u16) 0x87
#define AML_INDEX_OP (u16) 0x88
#define AML_MATCH_OP (u16) 0x89
#define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a
#define AML_CREATE_WORD_FIELD_OP (u16) 0x8b
#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_LAND_OP (u16) 0x90
#define AML_LOR_OP (u16) 0x91
#define AML_LNOT_OP (u16) 0x92
#define AML_LEQUAL_OP (u16) 0x93
#define AML_LGREATER_OP (u16) 0x94
#define AML_LLESS_OP (u16) 0x95
#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */
#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */
#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */
#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */
#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */
#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */
#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */
#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */
#define AML_IF_OP (u16) 0xa0
#define AML_ELSE_OP (u16) 0xa1
#define AML_WHILE_OP (u16) 0xa2
#define AML_NOOP_OP (u16) 0xa3
#define AML_RETURN_OP (u16) 0xa4
#define AML_BREAK_OP (u16) 0xa5
#define AML_BREAK_POINT_OP (u16) 0xcc
#define AML_ONES_OP (u16) 0xff
/* prefixed opcodes */
#define AML_EXTOP (u16) 0x005b
#define AML_MUTEX_OP (u16) 0x5b01
#define AML_EVENT_OP (u16) 0x5b02
#define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10
#define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11
#define AML_COND_REF_OF_OP (u16) 0x5b12
#define AML_CREATE_FIELD_OP (u16) 0x5b13
#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */
#define AML_LOAD_OP (u16) 0x5b20
#define AML_STALL_OP (u16) 0x5b21
#define AML_SLEEP_OP (u16) 0x5b22
#define AML_ACQUIRE_OP (u16) 0x5b23
#define AML_SIGNAL_OP (u16) 0x5b24
#define AML_WAIT_OP (u16) 0x5b25
#define AML_RESET_OP (u16) 0x5b26
#define AML_RELEASE_OP (u16) 0x5b27
#define AML_FROM_BCD_OP (u16) 0x5b28
#define AML_TO_BCD_OP (u16) 0x5b29
#define AML_UNLOAD_OP (u16) 0x5b2a
#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_REGION_OP (u16) 0x5b80
#define AML_FIELD_OP (u16) 0x5b81
#define AML_DEVICE_OP (u16) 0x5b82
#define AML_PROCESSOR_OP (u16) 0x5b83
#define AML_POWER_RES_OP (u16) 0x5b84
#define AML_THERMAL_ZONE_OP (u16) 0x5b85
#define AML_INDEX_FIELD_OP (u16) 0x5b86
#define AML_BANK_FIELD_OP (u16) 0x5b87
#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */
/* Bogus opcodes (they are actually two separate opcodes) */
#define AML_LGREATEREQUAL_OP (u16) 0x9295
#define AML_LLESSEQUAL_OP (u16) 0x9294
#define AML_LNOTEQUAL_OP (u16) 0x9293
/*
* Internal opcodes
* Use only "Unknown" AML opcodes, don't attempt to use
* any valid ACPI ASCII values (A-Z, 0-9, '-')
*/
#define AML_INT_NAMEPATH_OP (u16) 0x002d
#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
#define AML_INT_ACCESSFIELD_OP (u16) 0x0032
#define AML_INT_BYTELIST_OP (u16) 0x0033
#define AML_INT_STATICSTRING_OP (u16) 0x0034
#define AML_INT_METHODCALL_OP (u16) 0x0035
#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
#define ARG_NONE 0x0
/*
* Argument types for the AML Parser
* Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types
* Zero is reserved as end-of-list indicator
*/
#define ARGP_BYTEDATA 0x01
#define ARGP_BYTELIST 0x02
#define ARGP_CHARLIST 0x03
#define ARGP_DATAOBJ 0x04
#define ARGP_DATAOBJLIST 0x05
#define ARGP_DWORDDATA 0x06
#define ARGP_FIELDLIST 0x07
#define ARGP_NAME 0x08
#define ARGP_NAMESTRING 0x09
#define ARGP_OBJLIST 0x0A
#define ARGP_PKGLENGTH 0x0B
#define ARGP_SUPERNAME 0x0C
#define ARGP_TARGET 0x0D
#define ARGP_TERMARG 0x0E
#define ARGP_TERMLIST 0x0F
#define ARGP_WORDDATA 0x10
#define ARGP_QWORDDATA 0x11
#define ARGP_SIMPLENAME 0x12
/*
* Resolved argument types for the AML Interpreter
* Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
*
* Note1: These values are completely independent from the ACPI_TYPEs
* i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
*
* Note2: If and when 5 bits becomes insufficient, it would probably be best
* to convert to a 6-byte array of argument types, allowing 8 bits per argument.
*/
/* Single, simple types */
#define ARGI_ANYTYPE 0x01 /* Don't care */
#define ARGI_PACKAGE 0x02
#define ARGI_EVENT 0x03
#define ARGI_MUTEX 0x04
#define ARGI_DDBHANDLE 0x05
/* Interchangeable types (via implicit conversion) */
#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 */
/* Reference objects */
#define ARGI_INTEGER_REF 0x0B
#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 */
/* 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 */
/* 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
*/
#define OPGRP_NAMED 0x01
#define OPGRP_FIELD 0x02
#define OPGRP_BYTELIST 0x04
/*
* Opcode information
*/
/* Opcode flags */
#define AML_LOGICAL 0x0001
#define AML_LOGICAL_NUMERIC 0x0002
#define AML_MATH 0x0004
#define AML_CREATE 0x0008
#define AML_FIELD 0x0010
#define AML_DEFER 0x0020
#define AML_NAMED 0x0040
#define AML_NSNODE 0x0080
#define AML_NSOPCODE 0x0100
#define AML_NSOBJECT 0x0200
#define AML_HAS_RETVAL 0x0400
#define AML_HAS_TARGET 0x0800
#define AML_HAS_ARGS 0x1000
#define AML_CONSTANT 0x2000
/* 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_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_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_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_2A_2T_1R 0x08
#define AML_TYPE_EXEC_3A_0T_0R 0x09
#define AML_TYPE_EXEC_3A_1T_1R 0x0A
#define AML_TYPE_EXEC_6A_0T_1R 0x0B
/* End of types used in dispatch table */
#define AML_TYPE_LITERAL 0x0B
#define AML_TYPE_CONSTANT 0x0C
#define AML_TYPE_METHOD_ARGUMENT 0x0D
#define AML_TYPE_LOCAL_VARIABLE 0x0E
#define AML_TYPE_DATA_TERM 0x0F
/* Generic for an op that returns a value */
#define AML_TYPE_METHOD_CALL 0x10
/* Misc */
#define AML_TYPE_CREATE_FIELD 0x11
#define AML_TYPE_CREATE_OBJECT 0x12
#define AML_TYPE_CONTROL 0x13
#define AML_TYPE_NAMED_NO_OBJ 0x14
#define AML_TYPE_NAMED_FIELD 0x15
#define AML_TYPE_NAMED_SIMPLE 0x16
#define AML_TYPE_NAMED_COMPLEX 0x17
#define AML_TYPE_RETURN 0x18
#define AML_TYPE_UNDEFINED 0x19
#define AML_TYPE_BOGUS 0x1A
/*
* Opcode classes
*/
#define AML_CLASS_EXECUTE 0x00
#define AML_CLASS_CREATE 0x01
#define AML_CLASS_ARGUMENT 0x02
#define AML_CLASS_NAMED_OBJECT 0x03
#define AML_CLASS_CONTROL 0x04
#define AML_CLASS_ASCII 0x05
#define AML_CLASS_PREFIX 0x06
#define AML_CLASS_INTERNAL 0x07
#define AML_CLASS_RETURN_VALUE 0x08
#define AML_CLASS_METHOD_CALL 0x09
#define AML_CLASS_UNKNOWN 0x0A
/* Predefined Operation Region space_iDs */
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
} 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
} AML_MATCH_OPERATOR;
#define MAX_MATCH_OPERATOR 5
/*
* field_flags
*
* This byte is extracted from the AML and includes three separate
* pieces of information about the field:
* 1) The field access type
* 2) The field update rule
* 3) The lock rule for the field
*
* Bits 00 - 03 : access_type (any_acc, byte_acc, etc.)
* 04 : lock_rule (1 == Lock)
* 05 - 06 : update_rule
*/
#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
#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 */
} AML_ACCESS_TYPE;
/* 2) Field Lock Rules */
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,
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,
AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
} AML_ACCESS_ATTRIBUTE;
/* Bit fields in method_flags byte */
#define AML_METHOD_ARG_COUNT 0x07
#define AML_METHOD_SERIALIZED 0x08
#define AML_METHOD_SYNCH_LEVEL 0xF0
/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
#define AML_METHOD_INTERNAL_ONLY 0x01
#define AML_METHOD_RESERVED1 0x02
#define AML_METHOD_RESERVED2 0x04
#endif /* __AMLCODE_H__ */

View File

@@ -0,0 +1,329 @@
/******************************************************************************
*
* Module Name: amlresrc.h - AML resource descriptors
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* 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_BASEADDRESS "_BAS"
#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_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_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_MAXADDR "_MAX"
#define ASL_RESNAME_MINADDR "_MIN"
#define ASL_RESNAME_MAXTYPE "_MAF"
#define ASL_RESNAME_MINTYPE "_MIF"
#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_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) */
/* Default sizes for "small" resource descriptors */
#define ASL_RDESC_IRQ_SIZE 0x02
#define ASL_RDESC_DMA_SIZE 0x02
#define ASL_RDESC_ST_DEPEND_SIZE 0x00
#define ASL_RDESC_END_DEPEND_SIZE 0x00
#define ASL_RDESC_IO_SIZE 0x07
#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;
};
/*
* Resource descriptors defined in the ACPI specification.
*
* Packing/alignment must be BYTE because these descriptors
* are used to overlay the AML byte stream.
*/
#pragma pack(1)
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_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_noprio_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_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_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_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_fixed_memory_32_desc
{
u8 descriptor_type;
u16 length;
u8 information;
u32 base_address;
u32 range_length;
};
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_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];
/* 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 reserved;
u64 address;
};
/* restore default alignment */
#pragma pack()
/* 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_xrupt_desc exx;
struct asl_general_register_desc grg;
u32 u32_item;
u16 u16_item;
u8 U8item;
};
#endif

View File

@@ -0,0 +1,373 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACENV_H__
#define __ACENV_H__
/*
* Configuration for ACPI tools and utilities
*/
#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
#endif
#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
#endif
#ifdef _ACPI_ASL_COMPILER
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_USE_SYSTEM_CLIBRARY
#endif
/*
* Environment configuration. The purpose of this file is to interface to the
* local generation environment.
*
* 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
* Otherwise, local versions of string/memory functions will be used.
* 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
* the standard header files may be used.
*
* The ACPI subsystem only uses low level C library functions that do not call
* operating system services and may therefore be inlined in the code.
*
* It may be necessary to tailor these include files to the target
* generation environment.
*
*
* Functions and constants used from each header:
*
* string.h: memcpy
* memset
* strcat
* strcmp
* strcpy
* strlen
* strncmp
* strncat
* strncpy
*
* stdlib.h: strtoul
*
* stdarg.h: va_list
* va_arg
* va_start
* va_end
*
*/
/*! [Begin] no source code translation */
#if defined(__linux__)
#include "aclinux.h"
#elif defined(_AED_EFI)
#include "acefi.h"
#elif defined(WIN32)
#include "acwin.h"
#elif defined(WIN64)
#include "acwin64.h"
#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
#include "acdos16.h"
#elif defined(__FreeBSD__)
#include "acfreebsd.h"
#elif defined(__NetBSD__)
#include "acnetbsd.h"
#elif defined(MODESTO)
#include "acmodesto.h"
#elif defined(NETWARE)
#include "acnetware.h"
#else
/* All other environments */
#define ACPI_USE_STANDARD_HEADERS
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
/*
* This macro is used to tag functions as "printf-like" because
* some compilers can catch printf format string problems. MSVC
* doesn't, so this is proprocessed away.
*/
#define ACPI_PRINTF_LIKE_FUNC
#endif
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG_OUTPUT
#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
/*! [End] no source code translation !*/
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
* Use multiple threaded when the subsystem is running in the kernel.
*
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
*/
#define DEBUGGER_SINGLE_THREADED 0
#define DEBUGGER_MULTI_THREADED 1
#ifndef DEBUGGER_THREADING
#ifdef ACPI_APPLICATION
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#else
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
#endif
#endif /* !DEBUGGER_THREADING */
/******************************************************************************
*
* C library configuration
*
*****************************************************************************/
#ifdef ACPI_USE_SYSTEM_CLIBRARY
/*
* Use the standard C library headers.
* We want to keep these to a minimum.
*/
#ifdef ACPI_USE_STANDARD_HEADERS
/*
* Use the standard headers from the standard locations
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#endif /* ACPI_USE_STANDARD_HEADERS */
/*
* We will be linking to the standard Clib functions
*/
#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
#ifdef ACPI_FUTURE_USAGE
#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
#endif
#define ACPI_STRLEN(s) (acpi_size) strlen((s))
#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n))
#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (acpi_size)(n))
#define ACPI_STRCMP(d,s) strcmp((d), (s))
#define ACPI_STRCAT(d,s) (void) strcat((d), (s))
#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n))
#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n))
#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
/******************************************************************************
*
* Not using native C library, use local implementations
*
*****************************************************************************/
#else
/*
* 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 */
/*
* Storage alignment properties
*/
#define _AUPBND (sizeof (acpi_native_int) - 1)
#define _ADNBND (sizeof (acpi_native_int) - 1)
/*
* Variable argument list macro definitions
*/
#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
#define va_end(ap) (void) 0
#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
#endif /* va_arg */
#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
#ifdef ACPI_FUTURE_USAGE
#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
#endif
#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s))
#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))
#define ACPI_STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (acpi_size)(n))
#define ACPI_STRCMP(d,s) acpi_ut_strcmp ((d), (s))
#define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s))
#define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n))
#define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n))
#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n))
#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
#define ACPI_TOUPPER acpi_ut_to_upper
#define ACPI_TOLOWER acpi_ut_to_lower
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
/******************************************************************************
*
* Assembly code macros
*
*****************************************************************************/
/*
* Handle platform- and compiler-specific assembly language differences.
* These should already have been defined by the platform includes above.
*
* Notes:
* 1) Interrupt 3 is used to break into a debugger
* 2) Interrupts are turned off during ACPI register setup
*/
/* Unrecognized compiler, use defaults */
#ifndef ACPI_ASM_MACROS
/*
* Calling conventions:
*
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
* ACPI_EXTERNAL_XFACE - External ACPI interfaces
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
*/
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS()
#define ACPI_ENABLE_IRQS()
#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
#endif /* ACPI_ASM_MACROS */
#ifdef ACPI_APPLICATION
/* Don't want software interrupts within a ring3 application */
#undef BREAKPOINT3
#define BREAKPOINT3
#endif
/******************************************************************************
*
* Compiler-specific information is contained in the compiler-specific
* headers.
*
*****************************************************************************/
#endif /* __ACENV_H__ */

View File

@@ -0,0 +1,59 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACGCC_H__
#define __ACGCC_H__
/* 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)))
/* Some compilers complain about unused variables. Sometimes we don't want to
* use all the variables (most specifically for _THIS_MODULE). This allow 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__ */

View File

@@ -0,0 +1,90 @@
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2004, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACLINUX_H__
#define __ACLINUX_H__
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <asm/div64.h>
#include <asm/acpi.h>
#define strtoul simple_strtoul
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
#else /* !__KERNEL__ */
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
#else
#define ACPI_MACHINE_WIDTH 32
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_USE_NATIVE_DIVIDE
#endif
#endif /* __KERNEL__ */
/* Linux uses GCC */
#include "acgcc.h"
#endif /* __ACLINUX_H__ */

View File

@@ -0,0 +1,147 @@
#ifndef __ACPI_PROCESSOR_H
#define __ACPI_PROCESSOR_H
#include <linux/kernel.h>
#define ACPI_PROCESSOR_BUSY_METRIC 10
#define ACPI_PROCESSOR_MAX_POWER ACPI_C_STATE_COUNT
#define ACPI_PROCESSOR_MAX_C2_LATENCY 100
#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
#define ACPI_PROCESSOR_MAX_THROTTLING 16
#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
/* Power Management */
struct acpi_processor_cx_policy {
u32 count;
u32 state;
struct {
u32 time;
u32 ticks;
u32 count;
u32 bm;
} threshold;
};
struct acpi_processor_cx {
u8 valid;
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 {
u32 state;
u32 default_state;
u32 bm_activity;
struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
};
/* Performance Management */
struct acpi_pct_register {
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 */
};
#define ACPI_PDC_REVISION_ID 0x1
struct acpi_processor_performance {
unsigned int state;
unsigned int platform_limit;
struct acpi_pct_register control_register;
struct acpi_pct_register status_register;
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;
};
struct acpi_processor_throttling {
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 */
};
struct acpi_processor_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_flags {
u8 power:1;
u8 performance:1;
u8 throttling:1;
u8 limit:1;
u8 bm_control:1;
u8 bm_check:1;
u8 reserved:2;
};
struct acpi_processor {
acpi_handle handle;
u32 acpi_id;
u32 id;
int performance_platform_limit;
struct acpi_processor_flags flags;
struct acpi_processor_power power;
struct acpi_processor_performance *performance;
struct acpi_processor_throttling throttling;
struct acpi_processor_limit limit;
};
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);
#endif

View File

@@ -0,0 +1 @@
asm-i386

View File

@@ -0,0 +1,10 @@
/*
* 8253/8254 Programmable Interval Timer
*/
#ifndef _8253PIT_H
#define _8253PIT_H
#define PIT_TICK_RATE 1193180UL
#endif

View File

@@ -0,0 +1,106 @@
#ifndef __ALPHA_A_OUT_H__
#define __ALPHA_A_OUT_H__
#include <linux/types.h>
/*
* OSF/1 ECOFF header structs. ECOFF files consist of:
* - a file header (struct filehdr),
* - an a.out header (struct aouthdr),
* - one or more section headers (struct scnhdr).
* The filhdr's "f_nscns" field contains the
* number of section headers.
*/
struct filehdr
{
/* OSF/1 "file" header */
__u16 f_magic, f_nscns;
__u32 f_timdat;
__u64 f_symptr;
__u32 f_nsyms;
__u16 f_opthdr, f_flags;
};
struct aouthdr
{
__u64 info; /* after that it looks quite normal.. */
__u64 tsize;
__u64 dsize;
__u64 bsize;
__u64 entry;
__u64 text_start; /* with a few additions that actually make sense */
__u64 data_start;
__u64 bss_start;
__u32 gprmask, fprmask; /* bitmask of general & floating point regs used in binary */
__u64 gpvalue;
};
struct scnhdr
{
char s_name[8];
__u64 s_paddr;
__u64 s_vaddr;
__u64 s_size;
__u64 s_scnptr;
__u64 s_relptr;
__u64 s_lnnoptr;
__u16 s_nreloc;
__u16 s_nlnno;
__u32 s_flags;
};
struct exec
{
/* OSF/1 "file" header */
struct filehdr fh;
struct aouthdr ah;
};
/*
* Define's so that the kernel exec code can access the a.out header
* fields...
*/
#define a_info ah.info
#define a_text ah.tsize
#define a_data ah.dsize
#define a_bss ah.bsize
#define a_entry ah.entry
#define a_textstart ah.text_start
#define a_datastart ah.data_start
#define a_bssstart ah.bss_start
#define a_gprmask ah.gprmask
#define a_fprmask ah.fprmask
#define a_gpvalue ah.gpvalue
#define N_TXTADDR(x) ((x).a_textstart)
#define N_DATADDR(x) ((x).a_datastart)
#define N_BSSADDR(x) ((x).a_bssstart)
#define N_DRSIZE(x) 0
#define N_TRSIZE(x) 0
#define N_SYMSIZE(x) 0
#define AOUTHSZ sizeof(struct aouthdr)
#define SCNHSZ sizeof(struct scnhdr)
#define SCNROUND 16
#define N_TXTOFF(x) \
((long) N_MAGIC(x) == ZMAGIC ? 0 : \
(sizeof(struct exec) + (x).fh.f_nscns*SCNHSZ + SCNROUND - 1) & ~(SCNROUND - 1))
#ifdef __KERNEL__
/* Assume that start addresses below 4G belong to a TASO application.
Unfortunately, there is no proper bit in the exec header to check.
Worse, we have to notice the start address before swapping to use
/sbin/loader, which of course is _not_ a TASO application. */
#define SET_AOUT_PERSONALITY(BFPM, EX) \
set_personality (((BFPM->sh_bang || EX.ah.entry < 0x100000000L \
? ADDR_LIMIT_32BIT : 0) | PER_OSF4))
#define STACK_TOP \
(current->personality & ADDR_LIMIT_32BIT ? 0x80000000 : 0x00120000000UL)
#endif
#endif /* __A_OUT_GNU_H__ */

View File

@@ -0,0 +1,13 @@
#ifndef AGP_H
#define AGP_H 1
#include <asm/io.h>
/* dummy for now */
#define map_page_into_agp(page)
#define unmap_page_from_agp(page)
#define flush_agp_mappings()
#define flush_agp_cache() mb()
#endif

View File

@@ -0,0 +1,42 @@
#ifndef _ALPHA_AGP_BACKEND_H
#define _ALPHA_AGP_BACKEND_H 1
typedef union _alpha_agp_mode {
struct {
u32 rate : 3;
u32 reserved0 : 1;
u32 fw : 1;
u32 fourgb : 1;
u32 reserved1 : 2;
u32 enable : 1;
u32 sba : 1;
u32 reserved2 : 14;
u32 rq : 8;
} bits;
u32 lw;
} alpha_agp_mode;
typedef struct _alpha_agp_info {
struct pci_controller *hose;
struct {
dma_addr_t bus_base;
unsigned long size;
void *sysdata;
} aperture;
alpha_agp_mode capability;
alpha_agp_mode mode;
void *private;
struct alpha_agp_ops *ops;
} alpha_agp_info;
struct alpha_agp_ops {
int (*setup)(alpha_agp_info *);
void (*cleanup)(alpha_agp_info *);
int (*configure)(alpha_agp_info *);
int (*bind)(alpha_agp_info *, off_t, struct agp_memory *);
int (*unbind)(alpha_agp_info *, off_t, struct agp_memory *);
unsigned long (*translate)(alpha_agp_info *, dma_addr_t);
};
#endif /* _ALPHA_AGP_BACKEND_H */

View File

@@ -0,0 +1,198 @@
#ifndef _ALPHA_ATOMIC_H
#define _ALPHA_ATOMIC_H
/*
* Atomic operations that C can't guarantee us. Useful for
* resource counting etc...
*
* But use these as seldom as possible since they are much slower
* than regular operations.
*/
/*
* Counter is volatile to make sure gcc doesn't try to be clever
* and move things around on us. We need to use _exactly_ the address
* the user gave us, not some alias that contains the same information.
*/
typedef struct { volatile int counter; } atomic_t;
typedef struct { volatile long counter; } atomic64_t;
#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } )
#define atomic_read(v) ((v)->counter + 0)
#define atomic64_read(v) ((v)->counter + 0)
#define atomic_set(v,i) ((v)->counter = (i))
#define atomic64_set(v,i) ((v)->counter = (i))
/*
* To get proper branch prediction for the main line, we must branch
* forward to code at the end of this object's .text section, then
* branch back to restart the operation.
*/
static __inline__ void atomic_add(int i, atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" addl %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter)
:"Ir" (i), "m" (v->counter));
}
static __inline__ void atomic64_add(long i, atomic64_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ldq_l %0,%1\n"
" addq %0,%2,%0\n"
" stq_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter)
:"Ir" (i), "m" (v->counter));
}
static __inline__ void atomic_sub(int i, atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" subl %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter)
:"Ir" (i), "m" (v->counter));
}
static __inline__ void atomic64_sub(long i, atomic64_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ldq_l %0,%1\n"
" subq %0,%2,%0\n"
" stq_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter)
:"Ir" (i), "m" (v->counter));
}
/*
* Same as above, but return the result value
*/
static __inline__ long atomic_add_return(int i, atomic_t * v)
{
long temp, result;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" addl %0,%3,%2\n"
" addl %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
" mb\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter), "=&r" (result)
:"Ir" (i), "m" (v->counter) : "memory");
return result;
}
#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
static __inline__ long atomic64_add_return(long i, atomic64_t * v)
{
long temp, result;
__asm__ __volatile__(
"1: ldq_l %0,%1\n"
" addq %0,%3,%2\n"
" addq %0,%3,%0\n"
" stq_c %0,%1\n"
" beq %0,2f\n"
" mb\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter), "=&r" (result)
:"Ir" (i), "m" (v->counter) : "memory");
return result;
}
static __inline__ long atomic_sub_return(int i, atomic_t * v)
{
long temp, result;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" subl %0,%3,%2\n"
" subl %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
" mb\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter), "=&r" (result)
:"Ir" (i), "m" (v->counter) : "memory");
return result;
}
static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
{
long temp, result;
__asm__ __volatile__(
"1: ldq_l %0,%1\n"
" subq %0,%3,%2\n"
" subq %0,%3,%0\n"
" stq_c %0,%1\n"
" beq %0,2f\n"
" mb\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter), "=&r" (result)
:"Ir" (i), "m" (v->counter) : "memory");
return result;
}
#define atomic_dec_return(v) atomic_sub_return(1,(v))
#define atomic64_dec_return(v) atomic64_sub_return(1,(v))
#define atomic_inc_return(v) atomic_add_return(1,(v))
#define atomic64_inc_return(v) atomic64_add_return(1,(v))
#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
#define atomic_inc(v) atomic_add(1,(v))
#define atomic64_inc(v) atomic64_add(1,(v))
#define atomic_dec(v) atomic_sub(1,(v))
#define atomic64_dec(v) atomic64_sub(1,(v))
#define smp_mb__before_atomic_dec() smp_mb()
#define smp_mb__after_atomic_dec() smp_mb()
#define smp_mb__before_atomic_inc() smp_mb()
#define smp_mb__after_atomic_inc() smp_mb()
#endif /* _ALPHA_ATOMIC_H */

View File

@@ -0,0 +1,505 @@
#ifndef _ALPHA_BITOPS_H
#define _ALPHA_BITOPS_H
#include <linux/config.h>
#include <asm/compiler.h>
/*
* Copyright 1994, Linus Torvalds.
*/
/*
* These have to be done with inline assembly: that way the bit-setting
* is guaranteed to be atomic. All bit operations return 0 if the bit
* was cleared before the operation and != 0 if it was not.
*
* To get proper branch prediction for the main line, we must branch
* forward to code at the end of this object's .text section, then
* branch back to restart the operation.
*
* bit 0 is the LSB of addr; bit 64 is the LSB of (addr+1).
*/
static inline void
set_bit(unsigned long nr, volatile void * addr)
{
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);
__asm__ __volatile__(
"1: ldl_l %0,%3\n"
" bis %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m)
:"Ir" (1UL << (nr & 31)), "m" (*m));
}
/*
* WARNING: non atomic version.
*/
static inline void
__set_bit(unsigned long nr, volatile void * addr)
{
int *m = ((int *) addr) + (nr >> 5);
*m |= 1 << (nr & 31);
}
#define smp_mb__before_clear_bit() smp_mb()
#define smp_mb__after_clear_bit() smp_mb()
static inline void
clear_bit(unsigned long nr, volatile void * addr)
{
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);
__asm__ __volatile__(
"1: ldl_l %0,%3\n"
" bic %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m)
:"Ir" (1UL << (nr & 31)), "m" (*m));
}
/*
* WARNING: non atomic version.
*/
static __inline__ void
__clear_bit(unsigned long nr, volatile void * addr)
{
int *m = ((int *) addr) + (nr >> 5);
*m &= ~(1 << (nr & 31));
}
static inline void
change_bit(unsigned long nr, volatile void * addr)
{
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);
__asm__ __volatile__(
"1: ldl_l %0,%3\n"
" xor %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m)
:"Ir" (1UL << (nr & 31)), "m" (*m));
}
/*
* WARNING: non atomic version.
*/
static __inline__ void
__change_bit(unsigned long nr, volatile void * addr)
{
int *m = ((int *) addr) + (nr >> 5);
*m ^= 1 << (nr & 31);
}
static inline int
test_and_set_bit(unsigned long nr, volatile void *addr)
{
unsigned long oldbit;
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);
__asm__ __volatile__(
"1: ldl_l %0,%4\n"
" and %0,%3,%2\n"
" bne %2,2f\n"
" xor %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,3f\n"
"2:\n"
#ifdef CONFIG_SMP
" mb\n"
#endif
".subsection 2\n"
"3: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m), "=&r" (oldbit)
:"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
return oldbit != 0;
}
/*
* WARNING: non atomic version.
*/
static inline int
__test_and_set_bit(unsigned long nr, volatile void * addr)
{
unsigned long mask = 1 << (nr & 0x1f);
int *m = ((int *) addr) + (nr >> 5);
int old = *m;
*m = old | mask;
return (old & mask) != 0;
}
static inline int
test_and_clear_bit(unsigned long nr, volatile void * addr)
{
unsigned long oldbit;
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);
__asm__ __volatile__(
"1: ldl_l %0,%4\n"
" and %0,%3,%2\n"
" beq %2,2f\n"
" xor %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,3f\n"
"2:\n"
#ifdef CONFIG_SMP
" mb\n"
#endif
".subsection 2\n"
"3: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m), "=&r" (oldbit)
:"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
return oldbit != 0;
}
/*
* WARNING: non atomic version.
*/
static inline int
__test_and_clear_bit(unsigned long nr, volatile void * addr)
{
unsigned long mask = 1 << (nr & 0x1f);
int *m = ((int *) addr) + (nr >> 5);
int old = *m;
*m = old & ~mask;
return (old & mask) != 0;
}
static inline int
test_and_change_bit(unsigned long nr, volatile void * addr)
{
unsigned long oldbit;
unsigned long temp;
int *m = ((int *) addr) + (nr >> 5);
__asm__ __volatile__(
"1: ldl_l %0,%4\n"
" and %0,%3,%2\n"
" xor %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,3f\n"
#ifdef CONFIG_SMP
" mb\n"
#endif
".subsection 2\n"
"3: br 1b\n"
".previous"
:"=&r" (temp), "=m" (*m), "=&r" (oldbit)
:"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
return oldbit != 0;
}
/*
* WARNING: non atomic version.
*/
static __inline__ int
__test_and_change_bit(unsigned long nr, volatile void * addr)
{
unsigned long mask = 1 << (nr & 0x1f);
int *m = ((int *) addr) + (nr >> 5);
int old = *m;
*m = old ^ mask;
return (old & mask) != 0;
}
static inline int
test_bit(int nr, const volatile void * addr)
{
return (1UL & (((const int *) addr)[nr >> 5] >> (nr & 31))) != 0UL;
}
/*
* ffz = Find First Zero in word. Undefined if no zero exists,
* so code should check against ~0UL first..
*
* Do a binary search on the bits. Due to the nature of large
* constants on the alpha, it is worthwhile to split the search.
*/
static inline unsigned long ffz_b(unsigned long x)
{
unsigned long sum, x1, x2, x4;
x = ~x & -~x; /* set first 0 bit, clear others */
x1 = x & 0xAA;
x2 = x & 0xCC;
x4 = x & 0xF0;
sum = x2 ? 2 : 0;
sum += (x4 != 0) * 4;
sum += (x1 != 0);
return sum;
}
static inline unsigned long ffz(unsigned long word)
{
#if defined(__alpha_cix__) && defined(__alpha_fix__)
/* Whee. EV67 can calculate it directly. */
return __kernel_cttz(~word);
#else
unsigned long bits, qofs, bofs;
bits = __kernel_cmpbge(word, ~0UL);
qofs = ffz_b(bits);
bits = __kernel_extbl(word, qofs);
bofs = ffz_b(bits);
return qofs*8 + bofs;
#endif
}
/*
* __ffs = Find First set bit in word. Undefined if no set bit exists.
*/
static inline unsigned long __ffs(unsigned long word)
{
#if defined(__alpha_cix__) && defined(__alpha_fix__)
/* Whee. EV67 can calculate it directly. */
return __kernel_cttz(word);
#else
unsigned long bits, qofs, bofs;
bits = __kernel_cmpbge(0, word);
qofs = ffz_b(bits);
bits = __kernel_extbl(word, qofs);
bofs = ffz_b(~bits);
return qofs*8 + bofs;
#endif
}
#ifdef __KERNEL__
/*
* ffs: find first bit set. This is defined the same way as
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above __ffs.
*/
static inline int ffs(int word)
{
int result = __ffs(word) + 1;
return word ? result : 0;
}
/*
* fls: find last bit set.
*/
#if defined(__alpha_cix__) && defined(__alpha_fix__)
static inline int fls(int word)
{
return 64 - __kernel_ctlz(word & 0xffffffff);
}
#else
#define fls generic_fls
#endif
/* Compute powers of two for the given integer. */
static inline long floor_log2(unsigned long word)
{
#if defined(__alpha_cix__) && defined(__alpha_fix__)
return 63 - __kernel_ctlz(word);
#else
long bit;
for (bit = -1; word ; bit++)
word >>= 1;
return bit;
#endif
}
static inline long ceil_log2(unsigned long word)
{
long bit = floor_log2(word);
return bit + (word > (1UL << bit));
}
/*
* hweightN: returns the hamming weight (i.e. the number
* of bits set) of a N-bit word
*/
#if defined(__alpha_cix__) && defined(__alpha_fix__)
/* Whee. EV67 can calculate it directly. */
static inline unsigned long hweight64(unsigned long w)
{
return __kernel_ctpop(w);
}
#define hweight32(x) hweight64((x) & 0xfffffffful)
#define hweight16(x) hweight64((x) & 0xfffful)
#define hweight8(x) hweight64((x) & 0xfful)
#else
static inline unsigned long hweight64(unsigned long w)
{
unsigned long result;
for (result = 0; w ; w >>= 1)
result += (w & 1);
return result;
}
#define hweight32(x) generic_hweight32(x)
#define hweight16(x) generic_hweight16(x)
#define hweight8(x) generic_hweight8(x)
#endif
#endif /* __KERNEL__ */
/*
* Find next zero bit in a bitmap reasonably efficiently..
*/
static inline unsigned long
find_next_zero_bit(void * addr, unsigned long size, unsigned long offset)
{
unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
unsigned long result = offset & ~63UL;
unsigned long tmp;
if (offset >= size)
return size;
size -= result;
offset &= 63UL;
if (offset) {
tmp = *(p++);
tmp |= ~0UL >> (64-offset);
if (size < 64)
goto found_first;
if (~tmp)
goto found_middle;
size -= 64;
result += 64;
}
while (size & ~63UL) {
if (~(tmp = *(p++)))
goto found_middle;
result += 64;
size -= 64;
}
if (!size)
return result;
tmp = *p;
found_first:
tmp |= ~0UL << size;
if (tmp == ~0UL) /* Are any bits zero? */
return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
/*
* Find next one bit in a bitmap reasonably efficiently.
*/
static inline unsigned long
find_next_bit(const void * addr, unsigned long size, unsigned long offset)
{
const unsigned long * p = ((const unsigned long *) addr) + (offset >> 6);
unsigned long result = offset & ~63UL;
unsigned long tmp;
if (offset >= size)
return size;
size -= result;
offset &= 63UL;
if (offset) {
tmp = *(p++);
tmp &= ~0UL << offset;
if (size < 64)
goto found_first;
if (tmp)
goto found_middle;
size -= 64;
result += 64;
}
while (size & ~63UL) {
if ((tmp = *(p++)))
goto found_middle;
result += 64;
size -= 64;
}
if (!size)
return result;
tmp = *p;
found_first:
tmp &= ~0UL >> (64 - size);
if (!tmp)
return result + size;
found_middle:
return result + __ffs(tmp);
}
/*
* The optimizer actually does good code for this case.
*/
#define find_first_zero_bit(addr, size) \
find_next_zero_bit((addr), (size), 0)
#define find_first_bit(addr, size) \
find_next_bit((addr), (size), 0)
#ifdef __KERNEL__
/*
* Every architecture must define this function. It's the fastest
* way of searching a 140-bit bitmap where the first 100 bits are
* unlikely to be set. It's guaranteed that at least one of the 140
* bits is set.
*/
static inline unsigned long
sched_find_first_bit(unsigned long b[3])
{
unsigned long b0 = b[0], b1 = b[1], b2 = b[2];
unsigned long ofs;
ofs = (b1 ? 64 : 128);
b1 = (b1 ? b1 : b2);
ofs = (b0 ? 0 : ofs);
b0 = (b0 ? b0 : b1);
return __ffs(b0) + ofs;
}
#define ext2_set_bit __test_and_set_bit
#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
#define ext2_clear_bit __test_and_clear_bit
#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
#define ext2_test_bit test_bit
#define ext2_find_first_zero_bit find_first_zero_bit
#define ext2_find_next_zero_bit find_next_zero_bit
/* Bitmap functions for the minix filesystem. */
#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
#define minix_set_bit(nr,addr) __set_bit(nr,addr)
#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
#define minix_test_bit(nr,addr) test_bit(nr,addr)
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
#endif /* __KERNEL__ */
#endif /* _ALPHA_BITOPS_H */

View File

@@ -0,0 +1,15 @@
#ifndef _ALPHA_BUG_H
#define _ALPHA_BUG_H
#include <asm/pal.h>
/* ??? Would be nice to use .gprel32 here, but we can't be sure that the
function loaded the GP, so this could fail in modules. */
#define BUG() \
__asm__ __volatile__("call_pal %0 # bugchk\n\t"".long %1\n\t.8byte %2" \
: : "i" (PAL_bugchk), "i"(__LINE__), "i"(__FILE__))
#define HAVE_ARCH_BUG
#include <asm-generic/bug.h>
#endif

View File

@@ -0,0 +1,20 @@
/*
* include/asm-alpha/bugs.h
*
* Copyright (C) 1994 Linus Torvalds
*/
/*
* This is included by init/main.c to check for architecture-dependent bugs.
*
* Needs:
* void check_bugs(void);
*/
/*
* I don't know of any alpha bugs yet.. Nice chip
*/
static void check_bugs(void)
{
}

View File

@@ -0,0 +1,47 @@
#ifndef _ALPHA_BYTEORDER_H
#define _ALPHA_BYTEORDER_H
#include <asm/types.h>
#include <linux/compiler.h>
#include <asm/compiler.h>
#ifdef __GNUC__
static __inline __attribute_const__ __u32 __arch__swab32(__u32 x)
{
/*
* Unfortunately, we can't use the 6 instruction sequence
* on ev6 since the latency of the UNPKBW is 3, which is
* pretty hard to hide. Just in case a future implementation
* has a lower latency, here's the sequence (also by Mike Burrows)
*
* UNPKBW a0, v0 v0: 00AA00BB00CC00DD
* SLL v0, 24, a0 a0: BB00CC00DD000000
* BIS v0, a0, a0 a0: BBAACCBBDDCC00DD
* EXTWL a0, 6, v0 v0: 000000000000BBAA
* ZAP a0, 0xf3, a0 a0: 00000000DDCC0000
* ADDL a0, v0, v0 v0: ssssssssDDCCBBAA
*/
__u64 t0, t1, t2, t3;
t0 = __kernel_inslh(x, 7); /* t0 : 0000000000AABBCC */
t1 = __kernel_inswl(x, 3); /* t1 : 000000CCDD000000 */
t1 |= t0; /* t1 : 000000CCDDAABBCC */
t2 = t1 >> 16; /* t2 : 0000000000CCDDAA */
t0 = t1 & 0xFF00FF00; /* t0 : 00000000DD00BB00 */
t3 = t2 & 0x00FF00FF; /* t3 : 0000000000CC00AA */
t1 = t0 + t3; /* t1 : ssssssssDDCCBBAA */
return t1;
}
#define __arch__swab32 __arch__swab32
#endif /* __GNUC__ */
#define __BYTEORDER_HAS_U64__
#include <linux/byteorder/little_endian.h>
#endif /* _ALPHA_BYTEORDER_H */

View File

@@ -0,0 +1,25 @@
/*
* include/asm-alpha/cache.h
*/
#ifndef __ARCH_ALPHA_CACHE_H
#define __ARCH_ALPHA_CACHE_H
#include <linux/config.h>
/* Bytes per L1 (data) cache line. */
#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_EV6)
# define L1_CACHE_BYTES 64
# define L1_CACHE_SHIFT 6
#else
/* Both EV4 and EV5 are write-through, read-allocate,
direct-mapped, physical.
*/
# define L1_CACHE_BYTES 32
# define L1_CACHE_SHIFT 5
#endif
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#define L1_CACHE_SHIFT_MAX L1_CACHE_SHIFT
#endif

View File

@@ -0,0 +1,74 @@
#ifndef _ALPHA_CACHEFLUSH_H
#define _ALPHA_CACHEFLUSH_H
#include <linux/config.h>
#include <linux/mm.h>
/* Caches aren't brain-dead on the Alpha. */
#define flush_cache_all() do { } while (0)
#define flush_cache_mm(mm) do { } while (0)
#define flush_cache_range(vma, start, end) do { } while (0)
#define flush_cache_page(vma, vmaddr) do { } while (0)
#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_cache_vmap(start, end) do { } while (0)
#define flush_cache_vunmap(start, end) do { } while (0)
/* Note that the following two definitions are _highly_ dependent
on the contexts in which they are used in the kernel. I personally
think it is criminal how loosely defined these macros are. */
/* We need to flush the kernel's icache after loading modules. The
only other use of this macro is in load_aout_interp which is not
used on Alpha.
Note that this definition should *not* be used for userspace
icache flushing. While functional, it is _way_ overkill. The
icache is tagged with ASNs and it suffices to allocate a new ASN
for the process. */
#ifndef CONFIG_SMP
#define flush_icache_range(start, end) imb()
#else
#define flush_icache_range(start, end) smp_imb()
extern void smp_imb(void);
#endif
/* We need to flush the userspace icache after setting breakpoints in
ptrace.
Instead of indiscriminately using imb, take advantage of the fact
that icache entries are tagged with the ASN and load a new mm context. */
/* ??? Ought to use this in arch/alpha/kernel/signal.c too. */
#ifndef CONFIG_SMP
extern void __load_new_mm_context(struct mm_struct *);
static inline void
flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
unsigned long addr, int len)
{
if (vma->vm_flags & VM_EXEC) {
struct mm_struct *mm = vma->vm_mm;
if (current->active_mm == mm)
__load_new_mm_context(mm);
else
mm->context[smp_processor_id()] = 0;
}
}
#else
extern void flush_icache_user_range(struct vm_area_struct *vma,
struct page *page, unsigned long addr, int len);
#endif
/* This is used only in do_no_page and do_swap_page. */
#define flush_icache_page(vma, page) \
flush_icache_user_range((vma), (page), 0, 0)
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
do { memcpy(dst, src, len); \
flush_icache_user_range(vma, page, vaddr, len); \
} while (0)
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
memcpy(dst, src, len)
#endif /* _ALPHA_CACHEFLUSH_H */

View File

@@ -0,0 +1,77 @@
#ifndef _ALPHA_CHECKSUM_H
#define _ALPHA_CHECKSUM_H
#include <linux/in6.h>
/*
* This is a version of ip_compute_csum() optimized for IP headers,
* which always checksum on 4 octet boundaries.
*/
extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl);
/*
* computes the checksum of the TCP/UDP pseudo-header
* returns a 16-bit checksum, already complemented
*/
extern unsigned short int csum_tcpudp_magic(unsigned long saddr,
unsigned long daddr,
unsigned short len,
unsigned short proto,
unsigned int sum);
unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
unsigned short len, unsigned short proto,
unsigned int sum);
/*
* computes the checksum of a memory block at buff, length len,
* and adds in "sum" (32-bit)
*
* returns a 32-bit number suitable for feeding into itself
* or csum_tcpudp_magic
*
* this function must be called with even lengths, except
* for the last fragment, which may be odd
*
* it's best to have buff aligned on a 32-bit boundary
*/
extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
/*
* the same as csum_partial, but copies from src while it
* checksums
*
* here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp);
unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum);
/*
* this routine is used for miscellaneous IP-like checksums, mainly
* in icmp.c
*/
extern unsigned short ip_compute_csum(unsigned char * buff, int len);
/*
* Fold a partial checksum without adding pseudo headers
*/
static inline unsigned short csum_fold(unsigned int sum)
{
sum = (sum & 0xffff) + (sum >> 16);
sum = (sum & 0xffff) + (sum >> 16);
return ~sum;
}
#define _HAVE_ARCH_IPV6_CSUM
extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
struct in6_addr *daddr,
__u32 len,
unsigned short proto,
unsigned int sum);
#endif

View File

@@ -0,0 +1,103 @@
#ifndef __ALPHA_COMPILER_H
#define __ALPHA_COMPILER_H
/*
* Herein are macros we use when describing various patterns we want to GCC.
* In all cases we can get better schedules out of the compiler if we hide
* as little as possible inside inline assembly. However, we want to be
* able to know what we'll get out before giving up inline assembly. Thus
* these tests and macros.
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
# define __kernel_insbl(val, shift) __builtin_alpha_insbl(val, shift)
# define __kernel_inswl(val, shift) __builtin_alpha_inswl(val, shift)
# define __kernel_insql(val, shift) __builtin_alpha_insql(val, shift)
# define __kernel_inslh(val, shift) __builtin_alpha_inslh(val, shift)
# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift)
# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift)
# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)
# define __kernel_cttz(x) __builtin_ctzl(x)
# define __kernel_ctlz(x) __builtin_clzl(x)
# define __kernel_ctpop(x) __builtin_popcountl(x)
#else
# define __kernel_insbl(val, shift) \
({ unsigned long __kir; \
__asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
# define __kernel_inswl(val, shift) \
({ unsigned long __kir; \
__asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
# define __kernel_insql(val, shift) \
({ unsigned long __kir; \
__asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
# define __kernel_inslh(val, shift) \
({ unsigned long __kir; \
__asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
# define __kernel_extbl(val, shift) \
({ unsigned long __kir; \
__asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
# define __kernel_extwl(val, shift) \
({ unsigned long __kir; \
__asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
# define __kernel_cmpbge(a, b) \
({ unsigned long __kir; \
__asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
__kir; })
# define __kernel_cttz(x) \
({ unsigned long __kir; \
__asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \
__kir; })
# define __kernel_ctlz(x) \
({ unsigned long __kir; \
__asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
__kir; })
# define __kernel_ctpop(x) \
({ unsigned long __kir; \
__asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
__kir; })
#endif
/*
* Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX
* extension is enabled. Previous versions did not define anything
* we could test during compilation -- too bad, so sad.
*/
#if defined(__alpha_bwx__)
#define __kernel_ldbu(mem) (mem)
#define __kernel_ldwu(mem) (mem)
#define __kernel_stb(val,mem) ((mem) = (val))
#define __kernel_stw(val,mem) ((mem) = (val))
#else
#define __kernel_ldbu(mem) \
({ unsigned char __kir; \
__asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
__kir; })
#define __kernel_ldwu(mem) \
({ unsigned short __kir; \
__asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
__kir; })
#define __kernel_stb(val,mem) \
__asm__("stb %1,%0" : "=m"(mem) : "r"(val))
#define __kernel_stw(val,mem) \
__asm__("stw %1,%0" : "=m"(mem) : "r"(val))
#endif
/* Some idiots over in <linux/compiler.h> thought inline should imply
always_inline. This breaks stuff. We'll include this file whenever
we run into such problems. */
#include <linux/compiler.h>
#undef inline
#undef __inline__
#undef __inline
#endif /* __ALPHA_COMPILER_H */

View File

@@ -0,0 +1,75 @@
#ifndef __AXP_CONSOLE_H
#define __AXP_CONSOLE_H
/*
* Console callback routine numbers
*/
#define CCB_GETC 0x01
#define CCB_PUTS 0x02
#define CCB_RESET_TERM 0x03
#define CCB_SET_TERM_INT 0x04
#define CCB_SET_TERM_CTL 0x05
#define CCB_PROCESS_KEYCODE 0x06
#define CCB_OPEN_CONSOLE 0x07
#define CCB_CLOSE_CONSOLE 0x08
#define CCB_OPEN 0x10
#define CCB_CLOSE 0x11
#define CCB_IOCTL 0x12
#define CCB_READ 0x13
#define CCB_WRITE 0x14
#define CCB_SET_ENV 0x20
#define CCB_RESET_ENV 0x21
#define CCB_GET_ENV 0x22
#define CCB_SAVE_ENV 0x23
#define CCB_PSWITCH 0x30
#define CCB_BIOS_EMUL 0x32
/*
* Environment variable numbers
*/
#define ENV_AUTO_ACTION 0x01
#define ENV_BOOT_DEV 0x02
#define ENV_BOOTDEF_DEV 0x03
#define ENV_BOOTED_DEV 0x04
#define ENV_BOOT_FILE 0x05
#define ENV_BOOTED_FILE 0x06
#define ENV_BOOT_OSFLAGS 0x07
#define ENV_BOOTED_OSFLAGS 0x08
#define ENV_BOOT_RESET 0x09
#define ENV_DUMP_DEV 0x0A
#define ENV_ENABLE_AUDIT 0x0B
#define ENV_LICENSE 0x0C
#define ENV_CHAR_SET 0x0D
#define ENV_LANGUAGE 0x0E
#define ENV_TTY_DEV 0x0F
#ifdef __KERNEL__
#ifndef __ASSEMBLY__
extern long callback_puts(long unit, const char *s, long length);
extern long callback_getc(long unit);
extern long callback_open_console(void);
extern long callback_close_console(void);
extern long callback_open(const char *device, long length);
extern long callback_close(long unit);
extern long callback_read(long channel, long count, const char *buf, long lbn);
extern long callback_getenv(long id, const char *buf, unsigned long buf_size);
extern long callback_setenv(long id, const char *buf, unsigned long buf_size);
extern long callback_save_env(void);
extern int srm_fixup(unsigned long new_callback_addr,
unsigned long new_hwrpb_addr);
extern long srm_puts(const char *, long);
extern long srm_printk(const char *, ...)
__attribute__ ((format (printf, 1, 2)));
struct crb_struct;
struct hwrpb_struct;
extern int callback_init_done;
extern void * callback_init(void *);
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* __AXP_CONSOLE_H */

View File

@@ -0,0 +1,517 @@
#ifndef __ALPHA_APECS__H__
#define __ALPHA_APECS__H__
#include <linux/types.h>
#include <asm/compiler.h>
/*
* APECS is the internal name for the 2107x chipset which provides
* memory controller and PCI access for the 21064 chip based systems.
*
* This file is based on:
*
* DECchip 21071-AA and DECchip 21072-AA Core Logic Chipsets
* Data Sheet
*
* EC-N0648-72
*
*
* david.rusling@reo.mts.dec.com Initial Version.
*
*/
/*
An AVANTI *might* be an XL, and an XL has only 27 bits of ISA address
that get passed through the PCI<->ISA bridge chip. So we've gotta use
both windows to max out the physical memory we can DMA to. Sigh...
If we try a window at 0 for 1GB as a work-around, we run into conflicts
with ISA/PCI bus memory which can't be relocated, like VGA aperture and
BIOS ROMs. So we must put the windows high enough to avoid these areas.
We put window 1 at BUS 64Mb for 64Mb, mapping physical 0 to 64Mb-1,
and window 2 at BUS 1Gb for 1Gb, mapping physical 0 to 1Gb-1.
Yes, this does map 0 to 64Mb-1 twice, but only window 1 will actually
be used for that range (via virt_to_bus()).
Note that we actually fudge the window 1 maximum as 48Mb instead of 64Mb,
to keep virt_to_bus() from returning an address in the first window, for
a data area that goes beyond the 64Mb first DMA window. Sigh...
The fudge factor MUST match with <asm/dma.h> MAX_DMA_ADDRESS, but
we can't just use that here, because of header file looping... :-(
Window 1 will be used for all DMA from the ISA bus; yes, that does
limit what memory an ISA floppy or sound card or Ethernet can touch, but
it's also a known limitation on other platforms as well. We use the
same technique that is used on INTEL platforms with similar limitation:
set MAX_DMA_ADDRESS and clear some pages' DMAable flags during mem_init().
We trust that any ISA bus device drivers will *always* ask for DMAable
memory explicitly via kmalloc()/get_free_pages() flags arguments.
Note that most PCI bus devices' drivers do *not* explicitly ask for
DMAable memory; they count on being able to DMA to any memory they
get from kmalloc()/get_free_pages(). They will also use window 1 for
any physical memory accesses below 64Mb; the rest will be handled by
window 2, maxing out at 1Gb of memory. I trust this is enough... :-)
We hope that the area before the first window is large enough so that
there will be no overlap at the top end (64Mb). We *must* locate the
PCI cards' memory just below window 1, so that there's still the
possibility of being able to access it via SPARSE space. This is
important for cards such as the Matrox Millennium, whose Xserver
wants to access memory-mapped registers in byte and short lengths.
Note that the XL is treated differently from the AVANTI, even though
for most other things they are identical. It didn't seem reasonable to
make the AVANTI support pay for the limitations of the XL. It is true,
however, that an XL kernel will run on an AVANTI without problems.
%%% All of this should be obviated by the ability to route
everything through the iommu.
*/
/*
* 21071-DA Control and Status registers.
* These are used for PCI memory access.
*/
#define APECS_IOC_DCSR (IDENT_ADDR + 0x1A0000000UL)
#define APECS_IOC_PEAR (IDENT_ADDR + 0x1A0000020UL)
#define APECS_IOC_SEAR (IDENT_ADDR + 0x1A0000040UL)
#define APECS_IOC_DR1 (IDENT_ADDR + 0x1A0000060UL)
#define APECS_IOC_DR2 (IDENT_ADDR + 0x1A0000080UL)
#define APECS_IOC_DR3 (IDENT_ADDR + 0x1A00000A0UL)
#define APECS_IOC_TB1R (IDENT_ADDR + 0x1A00000C0UL)
#define APECS_IOC_TB2R (IDENT_ADDR + 0x1A00000E0UL)
#define APECS_IOC_PB1R (IDENT_ADDR + 0x1A0000100UL)
#define APECS_IOC_PB2R (IDENT_ADDR + 0x1A0000120UL)
#define APECS_IOC_PM1R (IDENT_ADDR + 0x1A0000140UL)
#define APECS_IOC_PM2R (IDENT_ADDR + 0x1A0000160UL)
#define APECS_IOC_HAXR0 (IDENT_ADDR + 0x1A0000180UL)
#define APECS_IOC_HAXR1 (IDENT_ADDR + 0x1A00001A0UL)
#define APECS_IOC_HAXR2 (IDENT_ADDR + 0x1A00001C0UL)
#define APECS_IOC_PMLT (IDENT_ADDR + 0x1A00001E0UL)
#define APECS_IOC_TLBTAG0 (IDENT_ADDR + 0x1A0000200UL)
#define APECS_IOC_TLBTAG1 (IDENT_ADDR + 0x1A0000220UL)
#define APECS_IOC_TLBTAG2 (IDENT_ADDR + 0x1A0000240UL)
#define APECS_IOC_TLBTAG3 (IDENT_ADDR + 0x1A0000260UL)
#define APECS_IOC_TLBTAG4 (IDENT_ADDR + 0x1A0000280UL)
#define APECS_IOC_TLBTAG5 (IDENT_ADDR + 0x1A00002A0UL)
#define APECS_IOC_TLBTAG6 (IDENT_ADDR + 0x1A00002C0UL)
#define APECS_IOC_TLBTAG7 (IDENT_ADDR + 0x1A00002E0UL)
#define APECS_IOC_TLBDATA0 (IDENT_ADDR + 0x1A0000300UL)
#define APECS_IOC_TLBDATA1 (IDENT_ADDR + 0x1A0000320UL)
#define APECS_IOC_TLBDATA2 (IDENT_ADDR + 0x1A0000340UL)
#define APECS_IOC_TLBDATA3 (IDENT_ADDR + 0x1A0000360UL)
#define APECS_IOC_TLBDATA4 (IDENT_ADDR + 0x1A0000380UL)
#define APECS_IOC_TLBDATA5 (IDENT_ADDR + 0x1A00003A0UL)
#define APECS_IOC_TLBDATA6 (IDENT_ADDR + 0x1A00003C0UL)
#define APECS_IOC_TLBDATA7 (IDENT_ADDR + 0x1A00003E0UL)
#define APECS_IOC_TBIA (IDENT_ADDR + 0x1A0000400UL)
/*
* 21071-CA Control and Status registers.
* These are used to program memory timing,
* configure memory and initialise the B-Cache.
*/
#define APECS_MEM_GCR (IDENT_ADDR + 0x180000000UL)
#define APECS_MEM_EDSR (IDENT_ADDR + 0x180000040UL)
#define APECS_MEM_TAR (IDENT_ADDR + 0x180000060UL)
#define APECS_MEM_ELAR (IDENT_ADDR + 0x180000080UL)
#define APECS_MEM_EHAR (IDENT_ADDR + 0x1800000a0UL)
#define APECS_MEM_SFT_RST (IDENT_ADDR + 0x1800000c0UL)
#define APECS_MEM_LDxLAR (IDENT_ADDR + 0x1800000e0UL)
#define APECS_MEM_LDxHAR (IDENT_ADDR + 0x180000100UL)
#define APECS_MEM_GTR (IDENT_ADDR + 0x180000200UL)
#define APECS_MEM_RTR (IDENT_ADDR + 0x180000220UL)
#define APECS_MEM_VFPR (IDENT_ADDR + 0x180000240UL)
#define APECS_MEM_PDLDR (IDENT_ADDR + 0x180000260UL)
#define APECS_MEM_PDhDR (IDENT_ADDR + 0x180000280UL)
/* Bank x Base Address Register */
#define APECS_MEM_B0BAR (IDENT_ADDR + 0x180000800UL)
#define APECS_MEM_B1BAR (IDENT_ADDR + 0x180000820UL)
#define APECS_MEM_B2BAR (IDENT_ADDR + 0x180000840UL)
#define APECS_MEM_B3BAR (IDENT_ADDR + 0x180000860UL)
#define APECS_MEM_B4BAR (IDENT_ADDR + 0x180000880UL)
#define APECS_MEM_B5BAR (IDENT_ADDR + 0x1800008A0UL)
#define APECS_MEM_B6BAR (IDENT_ADDR + 0x1800008C0UL)
#define APECS_MEM_B7BAR (IDENT_ADDR + 0x1800008E0UL)
#define APECS_MEM_B8BAR (IDENT_ADDR + 0x180000900UL)
/* Bank x Configuration Register */
#define APECS_MEM_B0BCR (IDENT_ADDR + 0x180000A00UL)
#define APECS_MEM_B1BCR (IDENT_ADDR + 0x180000A20UL)
#define APECS_MEM_B2BCR (IDENT_ADDR + 0x180000A40UL)
#define APECS_MEM_B3BCR (IDENT_ADDR + 0x180000A60UL)
#define APECS_MEM_B4BCR (IDENT_ADDR + 0x180000A80UL)
#define APECS_MEM_B5BCR (IDENT_ADDR + 0x180000AA0UL)
#define APECS_MEM_B6BCR (IDENT_ADDR + 0x180000AC0UL)
#define APECS_MEM_B7BCR (IDENT_ADDR + 0x180000AE0UL)
#define APECS_MEM_B8BCR (IDENT_ADDR + 0x180000B00UL)
/* Bank x Timing Register A */
#define APECS_MEM_B0TRA (IDENT_ADDR + 0x180000C00UL)
#define APECS_MEM_B1TRA (IDENT_ADDR + 0x180000C20UL)
#define APECS_MEM_B2TRA (IDENT_ADDR + 0x180000C40UL)
#define APECS_MEM_B3TRA (IDENT_ADDR + 0x180000C60UL)
#define APECS_MEM_B4TRA (IDENT_ADDR + 0x180000C80UL)
#define APECS_MEM_B5TRA (IDENT_ADDR + 0x180000CA0UL)
#define APECS_MEM_B6TRA (IDENT_ADDR + 0x180000CC0UL)
#define APECS_MEM_B7TRA (IDENT_ADDR + 0x180000CE0UL)
#define APECS_MEM_B8TRA (IDENT_ADDR + 0x180000D00UL)
/* Bank x Timing Register B */
#define APECS_MEM_B0TRB (IDENT_ADDR + 0x180000E00UL)
#define APECS_MEM_B1TRB (IDENT_ADDR + 0x180000E20UL)
#define APECS_MEM_B2TRB (IDENT_ADDR + 0x180000E40UL)
#define APECS_MEM_B3TRB (IDENT_ADDR + 0x180000E60UL)
#define APECS_MEM_B4TRB (IDENT_ADDR + 0x180000E80UL)
#define APECS_MEM_B5TRB (IDENT_ADDR + 0x180000EA0UL)
#define APECS_MEM_B6TRB (IDENT_ADDR + 0x180000EC0UL)
#define APECS_MEM_B7TRB (IDENT_ADDR + 0x180000EE0UL)
#define APECS_MEM_B8TRB (IDENT_ADDR + 0x180000F00UL)
/*
* Memory spaces:
*/
#define APECS_IACK_SC (IDENT_ADDR + 0x1b0000000UL)
#define APECS_CONF (IDENT_ADDR + 0x1e0000000UL)
#define APECS_IO (IDENT_ADDR + 0x1c0000000UL)
#define APECS_SPARSE_MEM (IDENT_ADDR + 0x200000000UL)
#define APECS_DENSE_MEM (IDENT_ADDR + 0x300000000UL)
/*
* Bit definitions for I/O Controller status register 0:
*/
#define APECS_IOC_STAT0_CMD 0xf
#define APECS_IOC_STAT0_ERR (1<<4)
#define APECS_IOC_STAT0_LOST (1<<5)
#define APECS_IOC_STAT0_THIT (1<<6)
#define APECS_IOC_STAT0_TREF (1<<7)
#define APECS_IOC_STAT0_CODE_SHIFT 8
#define APECS_IOC_STAT0_CODE_MASK 0x7
#define APECS_IOC_STAT0_P_NBR_SHIFT 13
#define APECS_IOC_STAT0_P_NBR_MASK 0x7ffff
#define APECS_HAE_ADDRESS APECS_IOC_HAXR1
/*
* Data structure for handling APECS machine checks:
*/
struct el_apecs_mikasa_sysdata_mcheck
{
unsigned long coma_gcr;
unsigned long coma_edsr;
unsigned long coma_ter;
unsigned long coma_elar;
unsigned long coma_ehar;
unsigned long coma_ldlr;
unsigned long coma_ldhr;
unsigned long coma_base0;
unsigned long coma_base1;
unsigned long coma_base2;
unsigned long coma_base3;
unsigned long coma_cnfg0;
unsigned long coma_cnfg1;
unsigned long coma_cnfg2;
unsigned long coma_cnfg3;
unsigned long epic_dcsr;
unsigned long epic_pear;
unsigned long epic_sear;
unsigned long epic_tbr1;
unsigned long epic_tbr2;
unsigned long epic_pbr1;
unsigned long epic_pbr2;
unsigned long epic_pmr1;
unsigned long epic_pmr2;
unsigned long epic_harx1;
unsigned long epic_harx2;
unsigned long epic_pmlt;
unsigned long epic_tag0;
unsigned long epic_tag1;
unsigned long epic_tag2;
unsigned long epic_tag3;
unsigned long epic_tag4;
unsigned long epic_tag5;
unsigned long epic_tag6;
unsigned long epic_tag7;
unsigned long epic_data0;
unsigned long epic_data1;
unsigned long epic_data2;
unsigned long epic_data3;
unsigned long epic_data4;
unsigned long epic_data5;
unsigned long epic_data6;
unsigned long epic_data7;
unsigned long pceb_vid;
unsigned long pceb_did;
unsigned long pceb_revision;
unsigned long pceb_command;
unsigned long pceb_status;
unsigned long pceb_latency;
unsigned long pceb_control;
unsigned long pceb_arbcon;
unsigned long pceb_arbpri;
unsigned long esc_id;
unsigned long esc_revision;
unsigned long esc_int0;
unsigned long esc_int1;
unsigned long esc_elcr0;
unsigned long esc_elcr1;
unsigned long esc_last_eisa;
unsigned long esc_nmi_stat;
unsigned long pci_ir;
unsigned long pci_imr;
unsigned long svr_mgr;
};
/* This for the normal APECS machines. */
struct el_apecs_sysdata_mcheck
{
unsigned long coma_gcr;
unsigned long coma_edsr;
unsigned long coma_ter;
unsigned long coma_elar;
unsigned long coma_ehar;
unsigned long coma_ldlr;
unsigned long coma_ldhr;
unsigned long coma_base0;
unsigned long coma_base1;
unsigned long coma_base2;
unsigned long coma_cnfg0;
unsigned long coma_cnfg1;
unsigned long coma_cnfg2;
unsigned long epic_dcsr;
unsigned long epic_pear;
unsigned long epic_sear;
unsigned long epic_tbr1;
unsigned long epic_tbr2;
unsigned long epic_pbr1;
unsigned long epic_pbr2;
unsigned long epic_pmr1;
unsigned long epic_pmr2;
unsigned long epic_harx1;
unsigned long epic_harx2;
unsigned long epic_pmlt;
unsigned long epic_tag0;
unsigned long epic_tag1;
unsigned long epic_tag2;
unsigned long epic_tag3;
unsigned long epic_tag4;
unsigned long epic_tag5;
unsigned long epic_tag6;
unsigned long epic_tag7;
unsigned long epic_data0;
unsigned long epic_data1;
unsigned long epic_data2;
unsigned long epic_data3;
unsigned long epic_data4;
unsigned long epic_data5;
unsigned long epic_data6;
unsigned long epic_data7;
};
struct el_apecs_procdata
{
unsigned long paltemp[32]; /* PAL TEMP REGS. */
/* EV4-specific fields */
unsigned long exc_addr; /* Address of excepting instruction. */
unsigned long exc_sum; /* Summary of arithmetic traps. */
unsigned long exc_mask; /* Exception mask (from exc_sum). */
unsigned long iccsr; /* IBox hardware enables. */
unsigned long pal_base; /* Base address for PALcode. */
unsigned long hier; /* Hardware Interrupt Enable. */
unsigned long hirr; /* Hardware Interrupt Request. */
unsigned long csr; /* D-stream fault info. */
unsigned long dc_stat; /* D-cache status (ECC/Parity Err). */
unsigned long dc_addr; /* EV3 Phys Addr for ECC/DPERR. */
unsigned long abox_ctl; /* ABox Control Register. */
unsigned long biu_stat; /* BIU Status. */
unsigned long biu_addr; /* BUI Address. */
unsigned long biu_ctl; /* BIU Control. */
unsigned long fill_syndrome;/* For correcting ECC errors. */
unsigned long fill_addr; /* Cache block which was being read */
unsigned long va; /* Effective VA of fault or miss. */
unsigned long bc_tag; /* Backup Cache Tag Probe Results.*/
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* Unlike Jensen, the APECS machines have no concept of local
* I/O---everything goes over the PCI bus.
*
* There is plenty room for optimization here. In particular,
* the Alpha's insb/insw/extb/extw should be useful in moving
* data to/from the right byte-lanes.
*/
#define vip volatile int __force *
#define vuip volatile unsigned int __force *
#define vulp volatile unsigned long __force *
#define APECS_SET_HAE \
do { \
if (addr >= (1UL << 24)) { \
unsigned long msb = addr & 0xf8000000; \
addr -= msb; \
set_hae(msb); \
} \
} while (0)
__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, base_and_type;
if (addr >= APECS_DENSE_MEM) {
addr -= APECS_DENSE_MEM;
APECS_SET_HAE;
base_and_type = APECS_SPARSE_MEM + 0x00;
} else {
addr -= APECS_IO;
base_and_type = APECS_IO + 0x00;
}
result = *(vip) ((addr << 5) + base_and_type);
return __kernel_extbl(result, addr & 3);
}
__EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long w, base_and_type;
if (addr >= APECS_DENSE_MEM) {
addr -= APECS_DENSE_MEM;
APECS_SET_HAE;
base_and_type = APECS_SPARSE_MEM + 0x00;
} else {
addr -= APECS_IO;
base_and_type = APECS_IO + 0x00;
}
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + base_and_type) = w;
}
__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, base_and_type;
if (addr >= APECS_DENSE_MEM) {
addr -= APECS_DENSE_MEM;
APECS_SET_HAE;
base_and_type = APECS_SPARSE_MEM + 0x08;
} else {
addr -= APECS_IO;
base_and_type = APECS_IO + 0x08;
}
result = *(vip) ((addr << 5) + base_and_type);
return __kernel_extwl(result, addr & 3);
}
__EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long w, base_and_type;
if (addr >= APECS_DENSE_MEM) {
addr -= APECS_DENSE_MEM;
APECS_SET_HAE;
base_and_type = APECS_SPARSE_MEM + 0x08;
} else {
addr -= APECS_IO;
base_and_type = APECS_IO + 0x08;
}
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + base_and_type) = w;
}
__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
if (addr < APECS_DENSE_MEM)
addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
return *(vuip)addr;
}
__EXTERN_INLINE void apecs_iowrite32(u32 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
if (addr < APECS_DENSE_MEM)
addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
*(vuip)addr = b;
}
__EXTERN_INLINE void __iomem *apecs_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + APECS_IO);
}
__EXTERN_INLINE void __iomem *apecs_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + APECS_DENSE_MEM);
}
__EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr)
{
return addr >= IDENT_ADDR + 0x180000000UL;
}
__EXTERN_INLINE int apecs_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr >= APECS_DENSE_MEM;
}
#undef APECS_SET_HAE
#undef vip
#undef vuip
#undef vulp
#undef __IO_PREFIX
#define __IO_PREFIX apecs
#define apecs_trivial_io_bw 0
#define apecs_trivial_io_lq 0
#define apecs_trivial_rw_bw 2
#define apecs_trivial_rw_lq 1
#define apecs_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_APECS__H__ */

View File

@@ -0,0 +1,501 @@
#ifndef __ALPHA_CIA__H__
#define __ALPHA_CIA__H__
/* Define to experiment with fitting everything into one 512MB HAE window. */
#define CIA_ONE_HAE_WINDOW 1
#include <linux/config.h>
#include <linux/types.h>
#include <asm/compiler.h>
/*
* CIA is the internal name for the 21171 chipset which provides
* memory controller and PCI access for the 21164 chip based systems.
* Also supported here is the 21172 (CIA-2) and 21174 (PYXIS).
*
* The lineage is a bit confused, since the 21174 was reportedly started
* from the 21171 Pass 1 mask, and so is missing bug fixes that appear
* in 21171 Pass 2 and 21172, but it also contains additional features.
*
* This file is based on:
*
* DECchip 21171 Core Logic Chipset
* Technical Reference Manual
*
* EC-QE18B-TE
*
* david.rusling@reo.mts.dec.com Initial Version.
*
*/
/*
* CIA ADDRESS BIT DEFINITIONS
*
* 3333 3333 3322 2222 2222 1111 1111 11
* 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
* ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
* 1 000
* ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
* | |\|
* | Byte Enable --+ |
* | Transfer Length --+
* +-- IO space, not cached
*
* Byte Transfer
* Enable Length Transfer Byte Address
* adr<6:5> adr<4:3> Length Enable Adder
* ---------------------------------------------
* 00 00 Byte 1110 0x000
* 01 00 Byte 1101 0x020
* 10 00 Byte 1011 0x040
* 11 00 Byte 0111 0x060
*
* 00 01 Word 1100 0x008
* 01 01 Word 1001 0x028 <= Not supported in this code.
* 10 01 Word 0011 0x048
*
* 00 10 Tribyte 1000 0x010
* 01 10 Tribyte 0001 0x030
*
* 10 11 Longword 0000 0x058
*
* Note that byte enables are asserted low.
*
*/
#define CIA_MEM_R1_MASK 0x1fffffff /* SPARSE Mem region 1 mask is 29 bits */
#define CIA_MEM_R2_MASK 0x07ffffff /* SPARSE Mem region 2 mask is 27 bits */
#define CIA_MEM_R3_MASK 0x03ffffff /* SPARSE Mem region 3 mask is 26 bits */
/*
* 21171-CA Control and Status Registers
*/
#define CIA_IOC_CIA_REV (IDENT_ADDR + 0x8740000080UL)
# define CIA_REV_MASK 0xff
#define CIA_IOC_PCI_LAT (IDENT_ADDR + 0x87400000C0UL)
#define CIA_IOC_CIA_CTRL (IDENT_ADDR + 0x8740000100UL)
# define CIA_CTRL_PCI_EN (1 << 0)
# define CIA_CTRL_PCI_LOCK_EN (1 << 1)
# define CIA_CTRL_PCI_LOOP_EN (1 << 2)
# define CIA_CTRL_FST_BB_EN (1 << 3)
# define CIA_CTRL_PCI_MST_EN (1 << 4)
# define CIA_CTRL_PCI_MEM_EN (1 << 5)
# define CIA_CTRL_PCI_REQ64_EN (1 << 6)
# define CIA_CTRL_PCI_ACK64_EN (1 << 7)
# define CIA_CTRL_ADDR_PE_EN (1 << 8)
# define CIA_CTRL_PERR_EN (1 << 9)
# define CIA_CTRL_FILL_ERR_EN (1 << 10)
# define CIA_CTRL_MCHK_ERR_EN (1 << 11)
# define CIA_CTRL_ECC_CHK_EN (1 << 12)
# define CIA_CTRL_ASSERT_IDLE_BC (1 << 13)
# define CIA_CTRL_COM_IDLE_BC (1 << 14)
# define CIA_CTRL_CSR_IOA_BYPASS (1 << 15)
# define CIA_CTRL_IO_FLUSHREQ_EN (1 << 16)
# define CIA_CTRL_CPU_FLUSHREQ_EN (1 << 17)
# define CIA_CTRL_ARB_CPU_EN (1 << 18)
# define CIA_CTRL_EN_ARB_LINK (1 << 19)
# define CIA_CTRL_RD_TYPE_SHIFT 20
# define CIA_CTRL_RL_TYPE_SHIFT 24
# define CIA_CTRL_RM_TYPE_SHIFT 28
# define CIA_CTRL_EN_DMA_RD_PERF (1 << 31)
#define CIA_IOC_CIA_CNFG (IDENT_ADDR + 0x8740000140UL)
# define CIA_CNFG_IOA_BWEN (1 << 0)
# define CIA_CNFG_PCI_MWEN (1 << 4)
# define CIA_CNFG_PCI_DWEN (1 << 5)
# define CIA_CNFG_PCI_WLEN (1 << 8)
#define CIA_IOC_FLASH_CTRL (IDENT_ADDR + 0x8740000200UL)
#define CIA_IOC_HAE_MEM (IDENT_ADDR + 0x8740000400UL)
#define CIA_IOC_HAE_IO (IDENT_ADDR + 0x8740000440UL)
#define CIA_IOC_CFG (IDENT_ADDR + 0x8740000480UL)
#define CIA_IOC_CACK_EN (IDENT_ADDR + 0x8740000600UL)
# define CIA_CACK_EN_LOCK_EN (1 << 0)
# define CIA_CACK_EN_MB_EN (1 << 1)
# define CIA_CACK_EN_SET_DIRTY_EN (1 << 2)
# define CIA_CACK_EN_BC_VICTIM_EN (1 << 3)
/*
* 21171-CA Diagnostic Registers
*/
#define CIA_IOC_CIA_DIAG (IDENT_ADDR + 0x8740002000UL)
#define CIA_IOC_DIAG_CHECK (IDENT_ADDR + 0x8740003000UL)
/*
* 21171-CA Performance Monitor registers
*/
#define CIA_IOC_PERF_MONITOR (IDENT_ADDR + 0x8740004000UL)
#define CIA_IOC_PERF_CONTROL (IDENT_ADDR + 0x8740004040UL)
/*
* 21171-CA Error registers
*/
#define CIA_IOC_CPU_ERR0 (IDENT_ADDR + 0x8740008000UL)
#define CIA_IOC_CPU_ERR1 (IDENT_ADDR + 0x8740008040UL)
#define CIA_IOC_CIA_ERR (IDENT_ADDR + 0x8740008200UL)
# define CIA_ERR_COR_ERR (1 << 0)
# define CIA_ERR_UN_COR_ERR (1 << 1)
# define CIA_ERR_CPU_PE (1 << 2)
# define CIA_ERR_MEM_NEM (1 << 3)
# define CIA_ERR_PCI_SERR (1 << 4)
# define CIA_ERR_PERR (1 << 5)
# define CIA_ERR_PCI_ADDR_PE (1 << 6)
# define CIA_ERR_RCVD_MAS_ABT (1 << 7)
# define CIA_ERR_RCVD_TAR_ABT (1 << 8)
# define CIA_ERR_PA_PTE_INV (1 << 9)
# define CIA_ERR_FROM_WRT_ERR (1 << 10)
# define CIA_ERR_IOA_TIMEOUT (1 << 11)
# define CIA_ERR_LOST_CORR_ERR (1 << 16)
# define CIA_ERR_LOST_UN_CORR_ERR (1 << 17)
# define CIA_ERR_LOST_CPU_PE (1 << 18)
# define CIA_ERR_LOST_MEM_NEM (1 << 19)
# define CIA_ERR_LOST_PERR (1 << 21)
# define CIA_ERR_LOST_PCI_ADDR_PE (1 << 22)
# define CIA_ERR_LOST_RCVD_MAS_ABT (1 << 23)
# define CIA_ERR_LOST_RCVD_TAR_ABT (1 << 24)
# define CIA_ERR_LOST_PA_PTE_INV (1 << 25)
# define CIA_ERR_LOST_FROM_WRT_ERR (1 << 26)
# define CIA_ERR_LOST_IOA_TIMEOUT (1 << 27)
# define CIA_ERR_VALID (1 << 31)
#define CIA_IOC_CIA_STAT (IDENT_ADDR + 0x8740008240UL)
#define CIA_IOC_ERR_MASK (IDENT_ADDR + 0x8740008280UL)
#define CIA_IOC_CIA_SYN (IDENT_ADDR + 0x8740008300UL)
#define CIA_IOC_MEM_ERR0 (IDENT_ADDR + 0x8740008400UL)
#define CIA_IOC_MEM_ERR1 (IDENT_ADDR + 0x8740008440UL)
#define CIA_IOC_PCI_ERR0 (IDENT_ADDR + 0x8740008800UL)
#define CIA_IOC_PCI_ERR1 (IDENT_ADDR + 0x8740008840UL)
#define CIA_IOC_PCI_ERR3 (IDENT_ADDR + 0x8740008880UL)
/*
* 21171-CA System configuration registers
*/
#define CIA_IOC_MCR (IDENT_ADDR + 0x8750000000UL)
#define CIA_IOC_MBA0 (IDENT_ADDR + 0x8750000600UL)
#define CIA_IOC_MBA2 (IDENT_ADDR + 0x8750000680UL)
#define CIA_IOC_MBA4 (IDENT_ADDR + 0x8750000700UL)
#define CIA_IOC_MBA6 (IDENT_ADDR + 0x8750000780UL)
#define CIA_IOC_MBA8 (IDENT_ADDR + 0x8750000800UL)
#define CIA_IOC_MBAA (IDENT_ADDR + 0x8750000880UL)
#define CIA_IOC_MBAC (IDENT_ADDR + 0x8750000900UL)
#define CIA_IOC_MBAE (IDENT_ADDR + 0x8750000980UL)
#define CIA_IOC_TMG0 (IDENT_ADDR + 0x8750000B00UL)
#define CIA_IOC_TMG1 (IDENT_ADDR + 0x8750000B40UL)
#define CIA_IOC_TMG2 (IDENT_ADDR + 0x8750000B80UL)
/*
* 2117A-CA PCI Address and Scatter-Gather Registers.
*/
#define CIA_IOC_PCI_TBIA (IDENT_ADDR + 0x8760000100UL)
#define CIA_IOC_PCI_W0_BASE (IDENT_ADDR + 0x8760000400UL)
#define CIA_IOC_PCI_W0_MASK (IDENT_ADDR + 0x8760000440UL)
#define CIA_IOC_PCI_T0_BASE (IDENT_ADDR + 0x8760000480UL)
#define CIA_IOC_PCI_W1_BASE (IDENT_ADDR + 0x8760000500UL)
#define CIA_IOC_PCI_W1_MASK (IDENT_ADDR + 0x8760000540UL)
#define CIA_IOC_PCI_T1_BASE (IDENT_ADDR + 0x8760000580UL)
#define CIA_IOC_PCI_W2_BASE (IDENT_ADDR + 0x8760000600UL)
#define CIA_IOC_PCI_W2_MASK (IDENT_ADDR + 0x8760000640UL)
#define CIA_IOC_PCI_T2_BASE (IDENT_ADDR + 0x8760000680UL)
#define CIA_IOC_PCI_W3_BASE (IDENT_ADDR + 0x8760000700UL)
#define CIA_IOC_PCI_W3_MASK (IDENT_ADDR + 0x8760000740UL)
#define CIA_IOC_PCI_T3_BASE (IDENT_ADDR + 0x8760000780UL)
#define CIA_IOC_PCI_Wn_BASE(N) (IDENT_ADDR + 0x8760000400UL + (N)*0x100)
#define CIA_IOC_PCI_Wn_MASK(N) (IDENT_ADDR + 0x8760000440UL + (N)*0x100)
#define CIA_IOC_PCI_Tn_BASE(N) (IDENT_ADDR + 0x8760000480UL + (N)*0x100)
#define CIA_IOC_PCI_W_DAC (IDENT_ADDR + 0x87600007C0UL)
/*
* 2117A-CA Address Translation Registers.
*/
/* 8 tag registers, the first 4 of which are lockable. */
#define CIA_IOC_TB_TAGn(n) \
(IDENT_ADDR + 0x8760000800UL + (n)*0x40)
/* 4 page registers per tag register. */
#define CIA_IOC_TBn_PAGEm(n,m) \
(IDENT_ADDR + 0x8760001000UL + (n)*0x100 + (m)*0x40)
/*
* Memory spaces:
*/
#define CIA_IACK_SC (IDENT_ADDR + 0x8720000000UL)
#define CIA_CONF (IDENT_ADDR + 0x8700000000UL)
#define CIA_IO (IDENT_ADDR + 0x8580000000UL)
#define CIA_SPARSE_MEM (IDENT_ADDR + 0x8000000000UL)
#define CIA_SPARSE_MEM_R2 (IDENT_ADDR + 0x8400000000UL)
#define CIA_SPARSE_MEM_R3 (IDENT_ADDR + 0x8500000000UL)
#define CIA_DENSE_MEM (IDENT_ADDR + 0x8600000000UL)
#define CIA_BW_MEM (IDENT_ADDR + 0x8800000000UL)
#define CIA_BW_IO (IDENT_ADDR + 0x8900000000UL)
#define CIA_BW_CFG_0 (IDENT_ADDR + 0x8a00000000UL)
#define CIA_BW_CFG_1 (IDENT_ADDR + 0x8b00000000UL)
/*
* ALCOR's GRU ASIC registers
*/
#define GRU_INT_REQ (IDENT_ADDR + 0x8780000000UL)
#define GRU_INT_MASK (IDENT_ADDR + 0x8780000040UL)
#define GRU_INT_EDGE (IDENT_ADDR + 0x8780000080UL)
#define GRU_INT_HILO (IDENT_ADDR + 0x87800000C0UL)
#define GRU_INT_CLEAR (IDENT_ADDR + 0x8780000100UL)
#define GRU_CACHE_CNFG (IDENT_ADDR + 0x8780000200UL)
#define GRU_SCR (IDENT_ADDR + 0x8780000300UL)
#define GRU_LED (IDENT_ADDR + 0x8780000800UL)
#define GRU_RESET (IDENT_ADDR + 0x8780000900UL)
#define ALCOR_GRU_INT_REQ_BITS 0x800fffffUL
#define XLT_GRU_INT_REQ_BITS 0x80003fffUL
#define GRU_INT_REQ_BITS (alpha_mv.sys.cia.gru_int_req_bits+0)
/*
* PYXIS interrupt control registers
*/
#define PYXIS_INT_REQ (IDENT_ADDR + 0x87A0000000UL)
#define PYXIS_INT_MASK (IDENT_ADDR + 0x87A0000040UL)
#define PYXIS_INT_HILO (IDENT_ADDR + 0x87A00000C0UL)
#define PYXIS_INT_ROUTE (IDENT_ADDR + 0x87A0000140UL)
#define PYXIS_GPO (IDENT_ADDR + 0x87A0000180UL)
#define PYXIS_INT_CNFG (IDENT_ADDR + 0x87A00001C0UL)
#define PYXIS_RT_COUNT (IDENT_ADDR + 0x87A0000200UL)
#define PYXIS_INT_TIME (IDENT_ADDR + 0x87A0000240UL)
#define PYXIS_IIC_CTRL (IDENT_ADDR + 0x87A00002C0UL)
#define PYXIS_RESET (IDENT_ADDR + 0x8780000900UL)
/* Offset between ram physical addresses and pci64 DAC bus addresses. */
#define PYXIS_DAC_OFFSET (1UL << 40)
/*
* Data structure for handling CIA machine checks.
*/
/* System-specific info. */
struct el_CIA_sysdata_mcheck {
unsigned long cpu_err0;
unsigned long cpu_err1;
unsigned long cia_err;
unsigned long cia_stat;
unsigned long err_mask;
unsigned long cia_syn;
unsigned long mem_err0;
unsigned long mem_err1;
unsigned long pci_err0;
unsigned long pci_err1;
unsigned long pci_err2;
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
/* Do not touch, this should *NOT* be static inline */
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* CIA (the 2117x PCI/memory support chipset for the EV5 (21164)
* series of processors uses a sparse address mapping scheme to
* get at PCI memory and I/O.
*/
/*
* Memory functions. 64-bit and 32-bit accesses are done through
* dense memory space, everything else through sparse space.
*
* For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
* which gives 1Gbyte of accessible space which relates exactly
* to the amount of PCI memory mapping *into* system address space.
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
*
* 3 2 1
* 9876543210987654321098765432109876543210
* 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
* LL = Transfer length
*
* PCI Address:
*
* 3 2 1
* 10987654321098765432109876543210
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
*
*/
#define vip volatile int __force *
#define vuip volatile unsigned int __force *
#define vulp volatile unsigned long __force *
__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, base_and_type;
if (addr >= CIA_DENSE_MEM)
base_and_type = CIA_SPARSE_MEM + 0x00;
else
base_and_type = CIA_IO + 0x00;
/* We can use CIA_MEM_R1_MASK for io ports too, since it is large
enough to cover all io ports, and smaller than CIA_IO. */
addr &= CIA_MEM_R1_MASK;
result = *(vip) ((addr << 5) + base_and_type);
return __kernel_extbl(result, addr & 3);
}
__EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long w, base_and_type;
if (addr >= CIA_DENSE_MEM)
base_and_type = CIA_SPARSE_MEM + 0x00;
else
base_and_type = CIA_IO + 0x00;
addr &= CIA_MEM_R1_MASK;
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + base_and_type) = w;
}
__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, base_and_type;
if (addr >= CIA_DENSE_MEM)
base_and_type = CIA_SPARSE_MEM + 0x08;
else
base_and_type = CIA_IO + 0x08;
addr &= CIA_MEM_R1_MASK;
result = *(vip) ((addr << 5) + base_and_type);
return __kernel_extwl(result, addr & 3);
}
__EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long w, base_and_type;
if (addr >= CIA_DENSE_MEM)
base_and_type = CIA_SPARSE_MEM + 0x08;
else
base_and_type = CIA_IO + 0x08;
addr &= CIA_MEM_R1_MASK;
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + base_and_type) = w;
}
__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
if (addr < CIA_DENSE_MEM)
addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18;
return *(vuip)addr;
}
__EXTERN_INLINE void cia_iowrite32(u32 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
if (addr < CIA_DENSE_MEM)
addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18;
*(vuip)addr = b;
}
__EXTERN_INLINE void __iomem *cia_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + CIA_IO);
}
__EXTERN_INLINE void __iomem *cia_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + CIA_DENSE_MEM);
}
__EXTERN_INLINE int cia_is_ioaddr(unsigned long addr)
{
return addr >= IDENT_ADDR + 0x8000000000UL;
}
__EXTERN_INLINE int cia_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr >= CIA_DENSE_MEM;
}
__EXTERN_INLINE void __iomem *cia_bwx_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + CIA_BW_IO);
}
__EXTERN_INLINE void __iomem *cia_bwx_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + CIA_BW_MEM);
}
__EXTERN_INLINE int cia_bwx_is_ioaddr(unsigned long addr)
{
return addr >= IDENT_ADDR + 0x8000000000UL;
}
__EXTERN_INLINE int cia_bwx_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr < CIA_BW_IO;
}
#undef vip
#undef vuip
#undef vulp
#undef __IO_PREFIX
#define __IO_PREFIX cia
#define cia_trivial_rw_bw 2
#define cia_trivial_rw_lq 1
#define cia_trivial_io_bw 0
#define cia_trivial_io_lq 0
#define cia_trivial_iounmap 1
#include <asm/io_trivial.h>
#undef __IO_PREFIX
#define __IO_PREFIX cia_bwx
#define cia_bwx_trivial_rw_bw 1
#define cia_bwx_trivial_rw_lq 1
#define cia_bwx_trivial_io_bw 1
#define cia_bwx_trivial_io_lq 1
#define cia_bwx_trivial_iounmap 1
#include <asm/io_trivial.h>
#undef __IO_PREFIX
#ifdef CONFIG_ALPHA_PYXIS
#define __IO_PREFIX cia_bwx
#else
#define __IO_PREFIX cia
#endif
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_CIA__H__ */

View File

@@ -0,0 +1,232 @@
#ifndef __ALPHA_IRONGATE__H__
#define __ALPHA_IRONGATE__H__
#include <linux/types.h>
#include <asm/compiler.h>
/*
* IRONGATE is the internal name for the AMD-751 K7 core logic chipset
* which provides memory controller and PCI access for NAUTILUS-based
* EV6 (21264) systems.
*
* This file is based on:
*
* IronGate management library, (c) 1999 Alpha Processor, Inc.
* Copyright (C) 1999 Alpha Processor, Inc.,
* (David Daniel, Stig Telfer, Soohoon Lee)
*/
/*
* The 21264 supports, and internally recognizes, a 44-bit physical
* address space that is divided equally between memory address space
* and I/O address space. Memory address space resides in the lower
* half of the physical address space (PA[43]=0) and I/O address space
* resides in the upper half of the physical address space (PA[43]=1).
*/
/*
* Irongate CSR map. Some of the CSRs are 8 or 16 bits, but all access
* through the routines given is 32-bit.
*
* The first 0x40 bytes are standard as per the PCI spec.
*/
typedef volatile __u32 igcsr32;
typedef struct {
igcsr32 dev_vendor; /* 0x00 - device ID, vendor ID */
igcsr32 stat_cmd; /* 0x04 - status, command */
igcsr32 class; /* 0x08 - class code, rev ID */
igcsr32 latency; /* 0x0C - header type, PCI latency */
igcsr32 bar0; /* 0x10 - BAR0 - AGP */
igcsr32 bar1; /* 0x14 - BAR1 - GART */
igcsr32 bar2; /* 0x18 - Power Management reg block */
igcsr32 rsrvd0[6]; /* 0x1C-0x33 reserved */
igcsr32 capptr; /* 0x34 - Capabilities pointer */
igcsr32 rsrvd1[2]; /* 0x38-0x3F reserved */
igcsr32 bacsr10; /* 0x40 - base address chip selects */
igcsr32 bacsr32; /* 0x44 - base address chip selects */
igcsr32 bacsr54_eccms761; /* 0x48 - 751: base addr. chip selects
761: ECC, mode/status */
igcsr32 rsrvd2[1]; /* 0x4C-0x4F reserved */
igcsr32 drammap; /* 0x50 - address mapping control */
igcsr32 dramtm; /* 0x54 - timing, driver strength */
igcsr32 dramms; /* 0x58 - DRAM mode/status */
igcsr32 rsrvd3[1]; /* 0x5C-0x5F reserved */
igcsr32 biu0; /* 0x60 - bus interface unit */
igcsr32 biusip; /* 0x64 - Serial initialisation pkt */
igcsr32 rsrvd4[2]; /* 0x68-0x6F reserved */
igcsr32 mro; /* 0x70 - memory request optimiser */
igcsr32 rsrvd5[3]; /* 0x74-0x7F reserved */
igcsr32 whami; /* 0x80 - who am I */
igcsr32 pciarb; /* 0x84 - PCI arbitration control */
igcsr32 pcicfg; /* 0x88 - PCI config status */
igcsr32 rsrvd6[4]; /* 0x8C-0x9B reserved */
igcsr32 pci_mem; /* 0x9C - PCI top of memory,
761 only */
/* AGP (bus 1) control registers */
igcsr32 agpcap; /* 0xA0 - AGP Capability Identifier */
igcsr32 agpstat; /* 0xA4 - AGP status register */
igcsr32 agpcmd; /* 0xA8 - AGP control register */
igcsr32 agpva; /* 0xAC - AGP Virtual Address Space */
igcsr32 agpmode; /* 0xB0 - AGP/GART mode control */
} Irongate0;
typedef struct {
igcsr32 dev_vendor; /* 0x00 - Device and Vendor IDs */
igcsr32 stat_cmd; /* 0x04 - Status and Command regs */
igcsr32 class; /* 0x08 - subclass, baseclass etc */
igcsr32 htype; /* 0x0C - header type (at 0x0E) */
igcsr32 rsrvd0[2]; /* 0x10-0x17 reserved */
igcsr32 busnos; /* 0x18 - Primary, secondary bus nos */
igcsr32 io_baselim_regs; /* 0x1C - IO base, IO lim, AGP status */
igcsr32 mem_baselim; /* 0x20 - memory base, memory lim */
igcsr32 pfmem_baselim; /* 0x24 - prefetchable base, lim */
igcsr32 rsrvd1[2]; /* 0x28-0x2F reserved */
igcsr32 io_baselim; /* 0x30 - IO base, IO limit */
igcsr32 rsrvd2[2]; /* 0x34-0x3B - reserved */
igcsr32 interrupt; /* 0x3C - interrupt, PCI bridge ctrl */
} Irongate1;
extern igcsr32 *IronECC;
/*
* Memory spaces:
*/
/* Irongate is consistent with a subset of the Tsunami memory map */
#ifdef USE_48_BIT_KSEG
#define IRONGATE_BIAS 0x80000000000UL
#else
#define IRONGATE_BIAS 0x10000000000UL
#endif
#define IRONGATE_MEM (IDENT_ADDR | IRONGATE_BIAS | 0x000000000UL)
#define IRONGATE_IACK_SC (IDENT_ADDR | IRONGATE_BIAS | 0x1F8000000UL)
#define IRONGATE_IO (IDENT_ADDR | IRONGATE_BIAS | 0x1FC000000UL)
#define IRONGATE_CONF (IDENT_ADDR | IRONGATE_BIAS | 0x1FE000000UL)
/*
* PCI Configuration space accesses are formed like so:
*
* 0x1FE << 24 | : 2 2 2 2 1 1 1 1 : 1 1 1 1 1 1 0 0 : 0 0 0 0 0 0 0 0 :
* : 3 2 1 0 9 8 7 6 : 5 4 3 2 1 0 9 8 : 7 6 5 4 3 2 1 0 :
* ---bus numer--- -device-- -fun- ---register----
*/
#define IGCSR(dev,fun,reg) ( IRONGATE_CONF | \
((dev)<<11) | \
((fun)<<8) | \
(reg) )
#define IRONGATE0 ((Irongate0 *) IGCSR(0, 0, 0))
#define IRONGATE1 ((Irongate1 *) IGCSR(1, 0, 0))
/*
* Data structure for handling IRONGATE machine checks:
* This is the standard OSF logout frame
*/
#define SCB_Q_SYSERR 0x620 /* OSF definitions */
#define SCB_Q_PROCERR 0x630
#define SCB_Q_SYSMCHK 0x660
#define SCB_Q_PROCMCHK 0x670
struct el_IRONGATE_sysdata_mcheck {
__u32 FrameSize; /* Bytes, including this field */
__u32 FrameFlags; /* <31> = Retry, <30> = Second Error */
__u32 CpuOffset; /* Offset to CPU-specific into */
__u32 SystemOffset; /* Offset to system-specific info */
__u32 MCHK_Code;
__u32 MCHK_Frame_Rev;
__u64 I_STAT;
__u64 DC_STAT;
__u64 C_ADDR;
__u64 DC1_SYNDROME;
__u64 DC0_SYNDROME;
__u64 C_STAT;
__u64 C_STS;
__u64 RESERVED0;
__u64 EXC_ADDR;
__u64 IER_CM;
__u64 ISUM;
__u64 MM_STAT;
__u64 PAL_BASE;
__u64 I_CTL;
__u64 PCTX;
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* IRONGATE (AMD-751) PCI/memory support chip for the EV6 (21264) and
* K7 can only use linear accesses to get at PCI memory and I/O spaces.
*/
/*
* Memory functions. All accesses are done through linear space.
*/
__EXTERN_INLINE void __iomem *irongate_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + IRONGATE_IO);
}
extern void __iomem *irongate_ioremap(unsigned long addr, unsigned long size);
extern void irongate_iounmap(volatile void __iomem *addr);
__EXTERN_INLINE int irongate_is_ioaddr(unsigned long addr)
{
return addr >= IRONGATE_MEM;
}
__EXTERN_INLINE int irongate_is_mmio(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr;
return addr < IRONGATE_IO || addr >= IRONGATE_CONF;
}
#undef __IO_PREFIX
#define __IO_PREFIX irongate
#define irongate_trivial_rw_bw 1
#define irongate_trivial_rw_lq 1
#define irongate_trivial_io_bw 1
#define irongate_trivial_io_lq 1
#define irongate_trivial_iounmap 0
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_IRONGATE__H__ */

View File

@@ -0,0 +1,361 @@
#ifndef __ALPHA_LCA__H__
#define __ALPHA_LCA__H__
#include <asm/system.h>
#include <asm/compiler.h>
/*
* Low Cost Alpha (LCA) definitions (these apply to 21066 and 21068,
* for example).
*
* This file is based on:
*
* DECchip 21066 and DECchip 21068 Alpha AXP Microprocessors
* Hardware Reference Manual; Digital Equipment Corp.; May 1994;
* Maynard, MA; Order Number: EC-N2681-71.
*/
/*
* NOTE: The LCA uses a Host Address Extension (HAE) register to access
* PCI addresses that are beyond the first 27 bits of address
* space. Updating the HAE requires an external cycle (and
* a memory barrier), which tends to be slow. Instead of updating
* it on each sparse memory access, we keep the current HAE value
* cached in variable cache_hae. Only if the cached HAE differs
* from the desired HAE value do we actually updated HAE register.
* The HAE register is preserved by the interrupt handler entry/exit
* code, so this scheme works even in the presence of interrupts.
*
* Dense memory space doesn't require the HAE, but is restricted to
* aligned 32 and 64 bit accesses. Special Cycle and Interrupt
* Acknowledge cycles may also require the use of the HAE. The LCA
* limits I/O address space to the bottom 24 bits of address space,
* but this easily covers the 16 bit ISA I/O address space.
*/
/*
* NOTE 2! The memory operations do not set any memory barriers, as
* it's not needed for cases like a frame buffer that is essentially
* memory-like. You need to do them by hand if the operations depend
* on ordering.
*
* Similarly, the port I/O operations do a "mb" only after a write
* operation: if an mb is needed before (as in the case of doing
* memory mapped I/O first, and then a port I/O operation to the same
* device), it needs to be done by hand.
*
* After the above has bitten me 100 times, I'll give up and just do
* the mb all the time, but right now I'm hoping this will work out.
* Avoiding mb's may potentially be a noticeable speed improvement,
* but I can't honestly say I've tested it.
*
* Handling interrupts that need to do mb's to synchronize to
* non-interrupts is another fun race area. Don't do it (because if
* you do, I'll have to do *everything* with interrupts disabled,
* ugh).
*/
/*
* Memory Controller registers:
*/
#define LCA_MEM_BCR0 (IDENT_ADDR + 0x120000000UL)
#define LCA_MEM_BCR1 (IDENT_ADDR + 0x120000008UL)
#define LCA_MEM_BCR2 (IDENT_ADDR + 0x120000010UL)
#define LCA_MEM_BCR3 (IDENT_ADDR + 0x120000018UL)
#define LCA_MEM_BMR0 (IDENT_ADDR + 0x120000020UL)
#define LCA_MEM_BMR1 (IDENT_ADDR + 0x120000028UL)
#define LCA_MEM_BMR2 (IDENT_ADDR + 0x120000030UL)
#define LCA_MEM_BMR3 (IDENT_ADDR + 0x120000038UL)
#define LCA_MEM_BTR0 (IDENT_ADDR + 0x120000040UL)
#define LCA_MEM_BTR1 (IDENT_ADDR + 0x120000048UL)
#define LCA_MEM_BTR2 (IDENT_ADDR + 0x120000050UL)
#define LCA_MEM_BTR3 (IDENT_ADDR + 0x120000058UL)
#define LCA_MEM_GTR (IDENT_ADDR + 0x120000060UL)
#define LCA_MEM_ESR (IDENT_ADDR + 0x120000068UL)
#define LCA_MEM_EAR (IDENT_ADDR + 0x120000070UL)
#define LCA_MEM_CAR (IDENT_ADDR + 0x120000078UL)
#define LCA_MEM_VGR (IDENT_ADDR + 0x120000080UL)
#define LCA_MEM_PLM (IDENT_ADDR + 0x120000088UL)
#define LCA_MEM_FOR (IDENT_ADDR + 0x120000090UL)
/*
* I/O Controller registers:
*/
#define LCA_IOC_HAE (IDENT_ADDR + 0x180000000UL)
#define LCA_IOC_CONF (IDENT_ADDR + 0x180000020UL)
#define LCA_IOC_STAT0 (IDENT_ADDR + 0x180000040UL)
#define LCA_IOC_STAT1 (IDENT_ADDR + 0x180000060UL)
#define LCA_IOC_TBIA (IDENT_ADDR + 0x180000080UL)
#define LCA_IOC_TB_ENA (IDENT_ADDR + 0x1800000a0UL)
#define LCA_IOC_SFT_RST (IDENT_ADDR + 0x1800000c0UL)
#define LCA_IOC_PAR_DIS (IDENT_ADDR + 0x1800000e0UL)
#define LCA_IOC_W_BASE0 (IDENT_ADDR + 0x180000100UL)
#define LCA_IOC_W_BASE1 (IDENT_ADDR + 0x180000120UL)
#define LCA_IOC_W_MASK0 (IDENT_ADDR + 0x180000140UL)
#define LCA_IOC_W_MASK1 (IDENT_ADDR + 0x180000160UL)
#define LCA_IOC_T_BASE0 (IDENT_ADDR + 0x180000180UL)
#define LCA_IOC_T_BASE1 (IDENT_ADDR + 0x1800001a0UL)
#define LCA_IOC_TB_TAG0 (IDENT_ADDR + 0x188000000UL)
#define LCA_IOC_TB_TAG1 (IDENT_ADDR + 0x188000020UL)
#define LCA_IOC_TB_TAG2 (IDENT_ADDR + 0x188000040UL)
#define LCA_IOC_TB_TAG3 (IDENT_ADDR + 0x188000060UL)
#define LCA_IOC_TB_TAG4 (IDENT_ADDR + 0x188000070UL)
#define LCA_IOC_TB_TAG5 (IDENT_ADDR + 0x1880000a0UL)
#define LCA_IOC_TB_TAG6 (IDENT_ADDR + 0x1880000c0UL)
#define LCA_IOC_TB_TAG7 (IDENT_ADDR + 0x1880000e0UL)
/*
* Memory spaces:
*/
#define LCA_IACK_SC (IDENT_ADDR + 0x1a0000000UL)
#define LCA_CONF (IDENT_ADDR + 0x1e0000000UL)
#define LCA_IO (IDENT_ADDR + 0x1c0000000UL)
#define LCA_SPARSE_MEM (IDENT_ADDR + 0x200000000UL)
#define LCA_DENSE_MEM (IDENT_ADDR + 0x300000000UL)
/*
* Bit definitions for I/O Controller status register 0:
*/
#define LCA_IOC_STAT0_CMD 0xf
#define LCA_IOC_STAT0_ERR (1<<4)
#define LCA_IOC_STAT0_LOST (1<<5)
#define LCA_IOC_STAT0_THIT (1<<6)
#define LCA_IOC_STAT0_TREF (1<<7)
#define LCA_IOC_STAT0_CODE_SHIFT 8
#define LCA_IOC_STAT0_CODE_MASK 0x7
#define LCA_IOC_STAT0_P_NBR_SHIFT 13
#define LCA_IOC_STAT0_P_NBR_MASK 0x7ffff
#define LCA_HAE_ADDRESS LCA_IOC_HAE
/* LCA PMR Power Management register defines */
#define LCA_PMR_ADDR (IDENT_ADDR + 0x120000098UL)
#define LCA_PMR_PDIV 0x7 /* Primary clock divisor */
#define LCA_PMR_ODIV 0x38 /* Override clock divisor */
#define LCA_PMR_INTO 0x40 /* Interrupt override */
#define LCA_PMR_DMAO 0x80 /* DMA override */
#define LCA_PMR_OCCEB 0xffff0000L /* Override cycle counter - even bits */
#define LCA_PMR_OCCOB 0xffff000000000000L /* Override cycle counter - even bits */
#define LCA_PMR_PRIMARY_MASK 0xfffffffffffffff8L
/* LCA PMR Macros */
#define LCA_READ_PMR (*(volatile unsigned long *)LCA_PMR_ADDR)
#define LCA_WRITE_PMR(d) (*((volatile unsigned long *)LCA_PMR_ADDR) = (d))
#define LCA_GET_PRIMARY(r) ((r) & LCA_PMR_PDIV)
#define LCA_GET_OVERRIDE(r) (((r) >> 3) & LCA_PMR_PDIV)
#define LCA_SET_PRIMARY_CLOCK(r, c) ((r) = (((r) & LCA_PMR_PRIMARY_MASK)|(c)))
/* LCA PMR Divisor values */
#define LCA_PMR_DIV_1 0x0
#define LCA_PMR_DIV_1_5 0x1
#define LCA_PMR_DIV_2 0x2
#define LCA_PMR_DIV_4 0x3
#define LCA_PMR_DIV_8 0x4
#define LCA_PMR_DIV_16 0x5
#define LCA_PMR_DIV_MIN DIV_1
#define LCA_PMR_DIV_MAX DIV_16
/*
* Data structure for handling LCA machine checks. Correctable errors
* result in a short logout frame, uncorrectable ones in a long one.
*/
struct el_lca_mcheck_short {
struct el_common h; /* common logout header */
unsigned long esr; /* error-status register */
unsigned long ear; /* error-address register */
unsigned long dc_stat; /* dcache status register */
unsigned long ioc_stat0; /* I/O controller status register 0 */
unsigned long ioc_stat1; /* I/O controller status register 1 */
};
struct el_lca_mcheck_long {
struct el_common h; /* common logout header */
unsigned long pt[31]; /* PAL temps */
unsigned long exc_addr; /* exception address */
unsigned long pad1[3];
unsigned long pal_base; /* PALcode base address */
unsigned long hier; /* hw interrupt enable */
unsigned long hirr; /* hw interrupt request */
unsigned long mm_csr; /* MMU control & status */
unsigned long dc_stat; /* data cache status */
unsigned long dc_addr; /* data cache addr register */
unsigned long abox_ctl; /* address box control register */
unsigned long esr; /* error status register */
unsigned long ear; /* error address register */
unsigned long car; /* cache control register */
unsigned long ioc_stat0; /* I/O controller status register 0 */
unsigned long ioc_stat1; /* I/O controller status register 1 */
unsigned long va; /* virtual address register */
};
union el_lca {
struct el_common * c;
struct el_lca_mcheck_long * l;
struct el_lca_mcheck_short * s;
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* Unlike Jensen, the Noname machines have no concept of local
* I/O---everything goes over the PCI bus.
*
* There is plenty room for optimization here. In particular,
* the Alpha's insb/insw/extb/extw should be useful in moving
* data to/from the right byte-lanes.
*/
#define vip volatile int __force *
#define vuip volatile unsigned int __force *
#define vulp volatile unsigned long __force *
#define LCA_SET_HAE \
do { \
if (addr >= (1UL << 24)) { \
unsigned long msb = addr & 0xf8000000; \
addr -= msb; \
set_hae(msb); \
} \
} while (0)
__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, base_and_type;
if (addr >= LCA_DENSE_MEM) {
addr -= LCA_DENSE_MEM;
LCA_SET_HAE;
base_and_type = LCA_SPARSE_MEM + 0x00;
} else {
addr -= LCA_IO;
base_and_type = LCA_IO + 0x00;
}
result = *(vip) ((addr << 5) + base_and_type);
return __kernel_extbl(result, addr & 3);
}
__EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long w, base_and_type;
if (addr >= LCA_DENSE_MEM) {
addr -= LCA_DENSE_MEM;
LCA_SET_HAE;
base_and_type = LCA_SPARSE_MEM + 0x00;
} else {
addr -= LCA_IO;
base_and_type = LCA_IO + 0x00;
}
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + base_and_type) = w;
}
__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, base_and_type;
if (addr >= LCA_DENSE_MEM) {
addr -= LCA_DENSE_MEM;
LCA_SET_HAE;
base_and_type = LCA_SPARSE_MEM + 0x08;
} else {
addr -= LCA_IO;
base_and_type = LCA_IO + 0x08;
}
result = *(vip) ((addr << 5) + base_and_type);
return __kernel_extwl(result, addr & 3);
}
__EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long w, base_and_type;
if (addr >= LCA_DENSE_MEM) {
addr -= LCA_DENSE_MEM;
LCA_SET_HAE;
base_and_type = LCA_SPARSE_MEM + 0x08;
} else {
addr -= LCA_IO;
base_and_type = LCA_IO + 0x08;
}
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + base_and_type) = w;
}
__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
if (addr < LCA_DENSE_MEM)
addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
return *(vuip)addr;
}
__EXTERN_INLINE void lca_iowrite32(u32 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
if (addr < LCA_DENSE_MEM)
addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
*(vuip)addr = b;
}
__EXTERN_INLINE void __iomem *lca_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + LCA_IO);
}
__EXTERN_INLINE void __iomem *lca_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + LCA_DENSE_MEM);
}
__EXTERN_INLINE int lca_is_ioaddr(unsigned long addr)
{
return addr >= IDENT_ADDR + 0x120000000UL;
}
__EXTERN_INLINE int lca_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr >= LCA_DENSE_MEM;
}
#undef vip
#undef vuip
#undef vulp
#undef __IO_PREFIX
#define __IO_PREFIX lca
#define lca_trivial_rw_bw 2
#define lca_trivial_rw_lq 1
#define lca_trivial_io_bw 0
#define lca_trivial_io_lq 0
#define lca_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_LCA__H__ */

View File

@@ -0,0 +1,378 @@
/*
* Marvel systems use the IO7 I/O chip provides PCI/PCIX/AGP access
*
* This file is based on:
*
* Marvel / EV7 System Programmer's Manual
* Revision 1.00
* 14 May 2001
*/
#ifndef __ALPHA_MARVEL__H__
#define __ALPHA_MARVEL__H__
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <asm/compiler.h>
#define MARVEL_MAX_PIDS 32 /* as long as we rely on 43-bit superpage */
#define MARVEL_IRQ_VEC_PE_SHIFT (10)
#define MARVEL_IRQ_VEC_IRQ_MASK ((1 << MARVEL_IRQ_VEC_PE_SHIFT) - 1)
#define MARVEL_NR_IRQS \
(16 + (MARVEL_MAX_PIDS * (1 << MARVEL_IRQ_VEC_PE_SHIFT)))
/*
* EV7 RBOX Registers
*/
typedef struct {
volatile unsigned long csr __attribute__((aligned(16)));
} ev7_csr;
typedef struct {
ev7_csr RBOX_CFG; /* 0x0000 */
ev7_csr RBOX_NSVC;
ev7_csr RBOX_EWVC;
ev7_csr RBOX_WHAMI;
ev7_csr RBOX_TCTL; /* 0x0040 */
ev7_csr RBOX_INT;
ev7_csr RBOX_IMASK;
ev7_csr RBOX_IREQ;
ev7_csr RBOX_INTQ; /* 0x0080 */
ev7_csr RBOX_INTA;
ev7_csr RBOX_IT;
ev7_csr RBOX_SCRATCH1;
ev7_csr RBOX_SCRATCH2; /* 0x00c0 */
ev7_csr RBOX_L_ERR;
} ev7_csrs;
/*
* EV7 CSR addressing macros
*/
#define EV7_MASK40(addr) ((addr) & ((1UL << 41) - 1))
#define EV7_KERN_ADDR(addr) ((void *)(IDENT_ADDR | EV7_MASK40(addr)))
#define EV7_PE_MASK 0x1ffUL /* 9 bits ( 256 + mem/io ) */
#define EV7_IPE(pe) ((~((long)(pe)) & EV7_PE_MASK) << 35)
#define EV7_CSR_PHYS(pe, off) (EV7_IPE(pe) | (0x7FFCUL << 20) | (off))
#define EV7_CSRS_PHYS(pe) (EV7_CSR_PHYS(pe, 0UL))
#define EV7_CSR_KERN(pe, off) (EV7_KERN_ADDR(EV7_CSR_PHYS(pe, off)))
#define EV7_CSRS_KERN(pe) (EV7_KERN_ADDR(EV7_CSRS_PHYS(pe)))
#define EV7_CSR_OFFSET(name) ((unsigned long)&((ev7_csrs *)NULL)->name.csr)
/*
* IO7 registers
*/
typedef struct {
volatile unsigned long csr __attribute__((aligned(64)));
} io7_csr;
typedef struct {
/* I/O Port Control Registers */
io7_csr POx_CTRL; /* 0x0000 */
io7_csr POx_CACHE_CTL;
io7_csr POx_TIMER;
io7_csr POx_IO_ADR_EXT;
io7_csr POx_MEM_ADR_EXT; /* 0x0100 */
io7_csr POx_XCAL_CTRL;
io7_csr rsvd1[2]; /* ?? spec doesn't show 0x180 */
io7_csr POx_DM_SOURCE; /* 0x0200 */
io7_csr POx_DM_DEST;
io7_csr POx_DM_SIZE;
io7_csr POx_DM_CTRL;
io7_csr rsvd2[4]; /* 0x0300 */
/* AGP Control Registers -- port 3 only */
io7_csr AGP_CAP_ID; /* 0x0400 */
io7_csr AGP_STAT;
io7_csr AGP_CMD;
io7_csr rsvd3;
/* I/O Port Monitor Registers */
io7_csr POx_MONCTL; /* 0x0500 */
io7_csr POx_CTRA;
io7_csr POx_CTRB;
io7_csr POx_CTR56;
io7_csr POx_SCRATCH; /* 0x0600 */
io7_csr POx_XTRA_A;
io7_csr POx_XTRA_TS;
io7_csr POx_XTRA_Z;
io7_csr rsvd4; /* 0x0700 */
io7_csr POx_THRESHA;
io7_csr POx_THRESHB;
io7_csr rsvd5[33];
/* System Address Space Window Control Registers */
io7_csr POx_WBASE[4]; /* 0x1000 */
io7_csr POx_WMASK[4];
io7_csr POx_TBASE[4];
io7_csr POx_SG_TBIA;
io7_csr POx_MSI_WBASE;
io7_csr rsvd6[50];
/* I/O Port Error Registers */
io7_csr POx_ERR_SUM;
io7_csr POx_FIRST_ERR;
io7_csr POx_MSK_HEI;
io7_csr POx_TLB_ERR;
io7_csr POx_SPL_COMPLT;
io7_csr POx_TRANS_SUM;
io7_csr POx_FRC_PCI_ERR;
io7_csr POx_MULT_ERR;
io7_csr rsvd7[8];
/* I/O Port End of Interrupt Registers */
io7_csr EOI_DAT;
io7_csr rsvd8[7];
io7_csr POx_IACK_SPECIAL;
io7_csr rsvd9[103];
} io7_ioport_csrs;
typedef struct {
io7_csr IO_ASIC_REV; /* 0x30.0000 */
io7_csr IO_SYS_REV;
io7_csr SER_CHAIN3;
io7_csr PO7_RST1;
io7_csr PO7_RST2; /* 0x30.0100 */
io7_csr POx_RST[4];
io7_csr IO7_DWNH;
io7_csr IO7_MAF;
io7_csr IO7_MAF_TO;
io7_csr IO7_ACC_CLUMP; /* 0x30.0300 */
io7_csr IO7_PMASK;
io7_csr IO7_IOMASK;
io7_csr IO7_UPH;
io7_csr IO7_UPH_TO; /* 0x30.0400 */
io7_csr RBX_IREQ_OFF;
io7_csr RBX_INTA_OFF;
io7_csr INT_RTY;
io7_csr PO7_MONCTL; /* 0x30.0500 */
io7_csr PO7_CTRA;
io7_csr PO7_CTRB;
io7_csr PO7_CTR56;
io7_csr PO7_SCRATCH; /* 0x30.0600 */
io7_csr PO7_XTRA_A;
io7_csr PO7_XTRA_TS;
io7_csr PO7_XTRA_Z;
io7_csr PO7_PMASK; /* 0x30.0700 */
io7_csr PO7_THRESHA;
io7_csr PO7_THRESHB;
io7_csr rsvd1[97];
io7_csr PO7_ERROR_SUM; /* 0x30.2000 */
io7_csr PO7_BHOLE_MASK;
io7_csr PO7_HEI_MSK;
io7_csr PO7_CRD_MSK;
io7_csr PO7_UNCRR_SYM; /* 0x30.2100 */
io7_csr PO7_CRRCT_SYM;
io7_csr PO7_ERR_PKT[2];
io7_csr PO7_UGBGE_SYM; /* 0x30.2200 */
io7_csr rsbv2[887];
io7_csr PO7_LSI_CTL[128]; /* 0x31.0000 */
io7_csr rsvd3[123];
io7_csr HLT_CTL; /* 0x31.3ec0 */
io7_csr HPI_CTL; /* 0x31.3f00 */
io7_csr CRD_CTL;
io7_csr STV_CTL;
io7_csr HEI_CTL;
io7_csr PO7_MSI_CTL[16]; /* 0x31.4000 */
io7_csr rsvd4[240];
/*
* Interrupt Diagnostic / Test
*/
struct {
io7_csr INT_PND;
io7_csr INT_CLR;
io7_csr INT_EOI;
io7_csr rsvd[29];
} INT_DIAG[4];
io7_csr rsvd5[125]; /* 0x31.a000 */
io7_csr MISC_PND; /* 0x31.b800 */
io7_csr rsvd6[31];
io7_csr MSI_PND[16]; /* 0x31.c000 */
io7_csr rsvd7[16];
io7_csr MSI_CLR[16]; /* 0x31.c800 */
} io7_port7_csrs;
/*
* IO7 DMA Window Base register (POx_WBASEx)
*/
#define wbase_m_ena 0x1
#define wbase_m_sg 0x2
#define wbase_m_dac 0x4
#define wbase_m_addr 0xFFF00000
union IO7_POx_WBASE {
struct {
unsigned ena : 1; /* <0> */
unsigned sg : 1; /* <1> */
unsigned dac : 1; /* <2> -- window 3 only */
unsigned rsvd1 : 17;
unsigned addr : 12; /* <31:20> */
unsigned rsvd2 : 32;
} bits;
unsigned as_long[2];
unsigned as_quad;
};
/*
* IO7 IID (Interrupt IDentifier) format
*
* For level-sensative interrupts, int_num is encoded as:
*
* bus/port slot/device INTx
* <7:5> <4:2> <1:0>
*/
union IO7_IID {
struct {
unsigned int_num : 9; /* <8:0> */
unsigned tpu_mask : 4; /* <12:9> rsvd */
unsigned msi : 1; /* 13 */
unsigned ipe : 10; /* <23:14> */
unsigned long rsvd : 40;
} bits;
unsigned int as_long[2];
unsigned long as_quad;
};
/*
* IO7 addressing macros
*/
#define IO7_KERN_ADDR(addr) (EV7_KERN_ADDR(addr))
#define IO7_PORT_MASK 0x07UL /* 3 bits of port */
#define IO7_IPE(pe) (EV7_IPE(pe))
#define IO7_IPORT(port) ((~((long)(port)) & IO7_PORT_MASK) << 32)
#define IO7_HOSE(pe, port) (IO7_IPE(pe) | IO7_IPORT(port))
#define IO7_MEM_PHYS(pe, port) (IO7_HOSE(pe, port) | 0x00000000UL)
#define IO7_CONF_PHYS(pe, port) (IO7_HOSE(pe, port) | 0xFE000000UL)
#define IO7_IO_PHYS(pe, port) (IO7_HOSE(pe, port) | 0xFF000000UL)
#define IO7_CSR_PHYS(pe, port, off) \
(IO7_HOSE(pe, port) | 0xFF800000UL | (off))
#define IO7_CSRS_PHYS(pe, port) (IO7_CSR_PHYS(pe, port, 0UL))
#define IO7_PORT7_CSRS_PHYS(pe) (IO7_CSR_PHYS(pe, 7, 0x300000UL))
#define IO7_MEM_KERN(pe, port) (IO7_KERN_ADDR(IO7_MEM_PHYS(pe, port)))
#define IO7_CONF_KERN(pe, port) (IO7_KERN_ADDR(IO7_CONF_PHYS(pe, port)))
#define IO7_IO_KERN(pe, port) (IO7_KERN_ADDR(IO7_IO_PHYS(pe, port)))
#define IO7_CSR_KERN(pe, port, off) (IO7_KERN_ADDR(IO7_CSR_PHYS(pe,port,off)))
#define IO7_CSRS_KERN(pe, port) (IO7_KERN_ADDR(IO7_CSRS_PHYS(pe, port)))
#define IO7_PORT7_CSRS_KERN(pe) (IO7_KERN_ADDR(IO7_PORT7_CSRS_PHYS(pe)))
#define IO7_PLL_RNGA(pll) (((pll) >> 3) & 0x7)
#define IO7_PLL_RNGB(pll) (((pll) >> 6) & 0x7)
#define IO7_MEM_SPACE (2UL * 1024 * 1024 * 1024) /* 2GB MEM */
#define IO7_IO_SPACE (8UL * 1024 * 1024) /* 8MB I/O */
/*
* Offset between ram physical addresses and pci64 DAC addresses
*/
#define IO7_DAC_OFFSET (1UL << 49)
/*
* This is needed to satisify the IO() macro used in initializing the machvec
*/
#define MARVEL_IACK_SC \
((unsigned long) \
(&(((io7_ioport_csrs *)IO7_CSRS_KERN(0, 0))->POx_IACK_SPECIAL)))
#ifdef __KERNEL__
/*
* IO7 structs
*/
#define IO7_NUM_PORTS 4
#define IO7_AGP_PORT 3
struct io7_port {
struct io7 *io7;
struct pci_controller *hose;
int enabled;
unsigned int port;
io7_ioport_csrs *csrs;
unsigned long saved_wbase[4];
unsigned long saved_wmask[4];
unsigned long saved_tbase[4];
};
struct io7 {
struct io7 *next;
unsigned int pe;
io7_port7_csrs *csrs;
struct io7_port ports[IO7_NUM_PORTS];
spinlock_t irq_lock;
};
#ifndef __EXTERN_INLINE
# define __EXTERN_INLINE extern inline
# define __IO_EXTERN_INLINE
#endif
/*
* I/O functions. All access through linear space.
*/
/*
* Memory functions. All accesses through linear space.
*/
#define vucp volatile unsigned char __force *
#define vusp volatile unsigned short __force *
extern unsigned int marvel_ioread8(void __iomem *);
extern void marvel_iowrite8(u8 b, void __iomem *);
__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr)
{
return __kernel_ldwu(*(vusp)addr);
}
__EXTERN_INLINE void marvel_iowrite16(u16 b, void __iomem *addr)
{
__kernel_stw(b, *(vusp)addr);
}
extern void __iomem *marvel_ioremap(unsigned long addr, unsigned long size);
extern void marvel_iounmap(volatile void __iomem *addr);
extern void __iomem *marvel_ioportmap (unsigned long addr);
__EXTERN_INLINE int marvel_is_ioaddr(unsigned long addr)
{
return (addr >> 40) & 1;
}
extern int marvel_is_mmio(const volatile void __iomem *);
#undef vucp
#undef vusp
#undef __IO_PREFIX
#define __IO_PREFIX marvel
#define marvel_trivial_rw_bw 1
#define marvel_trivial_rw_lq 1
#define marvel_trivial_io_bw 0
#define marvel_trivial_io_lq 1
#define marvel_trivial_iounmap 0
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
# undef __EXTERN_INLINE
# undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_MARVEL__H__ */

View File

@@ -0,0 +1,379 @@
#ifndef __ALPHA_MCPCIA__H__
#define __ALPHA_MCPCIA__H__
/* Define to experiment with fitting everything into one 128MB HAE window.
One window per bus, that is. */
#define MCPCIA_ONE_HAE_WINDOW 1
#include <linux/types.h>
#include <linux/pci.h>
#include <asm/compiler.h>
/*
* MCPCIA is the internal name for a core logic chipset which provides
* PCI access for the RAWHIDE family of systems.
*
* This file is based on:
*
* RAWHIDE System Programmer's Manual
* 16-May-96
* Rev. 1.4
*
*/
/*------------------------------------------------------------------------**
** **
** I/O procedures **
** **
** inport[b|w|t|l], outport[b|w|t|l] 8:16:24:32 IO xfers **
** inportbxt: 8 bits only **
** inport: alias of inportw **
** outport: alias of outportw **
** **
** inmem[b|w|t|l], outmem[b|w|t|l] 8:16:24:32 ISA memory xfers **
** inmembxt: 8 bits only **
** inmem: alias of inmemw **
** outmem: alias of outmemw **
** **
**------------------------------------------------------------------------*/
/* MCPCIA ADDRESS BIT DEFINITIONS
*
* 3333 3333 3322 2222 2222 1111 1111 11
* 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
* ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
* 1 000
* ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
* | |\|
* | Byte Enable --+ |
* | Transfer Length --+
* +-- IO space, not cached
*
* Byte Transfer
* Enable Length Transfer Byte Address
* adr<6:5> adr<4:3> Length Enable Adder
* ---------------------------------------------
* 00 00 Byte 1110 0x000
* 01 00 Byte 1101 0x020
* 10 00 Byte 1011 0x040
* 11 00 Byte 0111 0x060
*
* 00 01 Word 1100 0x008
* 01 01 Word 1001 0x028 <= Not supported in this code.
* 10 01 Word 0011 0x048
*
* 00 10 Tribyte 1000 0x010
* 01 10 Tribyte 0001 0x030
*
* 10 11 Longword 0000 0x058
*
* Note that byte enables are asserted low.
*
*/
#define MCPCIA_MID(m) ((unsigned long)(m) << 33)
/* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively.
Durango adds PCI2 and PCI3 at MID 6 and 7 respectively. */
#define MCPCIA_HOSE2MID(h) ((h) + 4)
#define MCPCIA_MEM_MASK 0x07ffffff /* SPARSE Mem region mask is 27 bits */
/*
* Memory spaces:
*/
#define MCPCIA_SPARSE(m) (IDENT_ADDR + 0xf000000000UL + MCPCIA_MID(m))
#define MCPCIA_DENSE(m) (IDENT_ADDR + 0xf100000000UL + MCPCIA_MID(m))
#define MCPCIA_IO(m) (IDENT_ADDR + 0xf180000000UL + MCPCIA_MID(m))
#define MCPCIA_CONF(m) (IDENT_ADDR + 0xf1c0000000UL + MCPCIA_MID(m))
#define MCPCIA_CSR(m) (IDENT_ADDR + 0xf1e0000000UL + MCPCIA_MID(m))
#define MCPCIA_IO_IACK(m) (IDENT_ADDR + 0xf1f0000000UL + MCPCIA_MID(m))
#define MCPCIA_DENSE_IO(m) (IDENT_ADDR + 0xe1fc000000UL + MCPCIA_MID(m))
#define MCPCIA_DENSE_CONF(m) (IDENT_ADDR + 0xe1fe000000UL + MCPCIA_MID(m))
/*
* General Registers
*/
#define MCPCIA_REV(m) (MCPCIA_CSR(m) + 0x000)
#define MCPCIA_WHOAMI(m) (MCPCIA_CSR(m) + 0x040)
#define MCPCIA_PCI_LAT(m) (MCPCIA_CSR(m) + 0x080)
#define MCPCIA_CAP_CTRL(m) (MCPCIA_CSR(m) + 0x100)
#define MCPCIA_HAE_MEM(m) (MCPCIA_CSR(m) + 0x400)
#define MCPCIA_HAE_IO(m) (MCPCIA_CSR(m) + 0x440)
#define _MCPCIA_IACK_SC(m) (MCPCIA_CSR(m) + 0x480)
#define MCPCIA_HAE_DENSE(m) (MCPCIA_CSR(m) + 0x4C0)
/*
* Interrupt Control registers
*/
#define MCPCIA_INT_CTL(m) (MCPCIA_CSR(m) + 0x500)
#define MCPCIA_INT_REQ(m) (MCPCIA_CSR(m) + 0x540)
#define MCPCIA_INT_TARG(m) (MCPCIA_CSR(m) + 0x580)
#define MCPCIA_INT_ADR(m) (MCPCIA_CSR(m) + 0x5C0)
#define MCPCIA_INT_ADR_EXT(m) (MCPCIA_CSR(m) + 0x600)
#define MCPCIA_INT_MASK0(m) (MCPCIA_CSR(m) + 0x640)
#define MCPCIA_INT_MASK1(m) (MCPCIA_CSR(m) + 0x680)
#define MCPCIA_INT_ACK0(m) (MCPCIA_CSR(m) + 0x10003f00)
#define MCPCIA_INT_ACK1(m) (MCPCIA_CSR(m) + 0x10003f40)
/*
* Performance Monitor registers
*/
#define MCPCIA_PERF_MON(m) (MCPCIA_CSR(m) + 0x300)
#define MCPCIA_PERF_CONT(m) (MCPCIA_CSR(m) + 0x340)
/*
* Diagnostic Registers
*/
#define MCPCIA_CAP_DIAG(m) (MCPCIA_CSR(m) + 0x700)
#define MCPCIA_TOP_OF_MEM(m) (MCPCIA_CSR(m) + 0x7C0)
/*
* Error registers
*/
#define MCPCIA_MC_ERR0(m) (MCPCIA_CSR(m) + 0x800)
#define MCPCIA_MC_ERR1(m) (MCPCIA_CSR(m) + 0x840)
#define MCPCIA_CAP_ERR(m) (MCPCIA_CSR(m) + 0x880)
#define MCPCIA_PCI_ERR1(m) (MCPCIA_CSR(m) + 0x1040)
#define MCPCIA_MDPA_STAT(m) (MCPCIA_CSR(m) + 0x4000)
#define MCPCIA_MDPA_SYN(m) (MCPCIA_CSR(m) + 0x4040)
#define MCPCIA_MDPA_DIAG(m) (MCPCIA_CSR(m) + 0x4080)
#define MCPCIA_MDPB_STAT(m) (MCPCIA_CSR(m) + 0x8000)
#define MCPCIA_MDPB_SYN(m) (MCPCIA_CSR(m) + 0x8040)
#define MCPCIA_MDPB_DIAG(m) (MCPCIA_CSR(m) + 0x8080)
/*
* PCI Address Translation Registers.
*/
#define MCPCIA_SG_TBIA(m) (MCPCIA_CSR(m) + 0x1300)
#define MCPCIA_HBASE(m) (MCPCIA_CSR(m) + 0x1340)
#define MCPCIA_W0_BASE(m) (MCPCIA_CSR(m) + 0x1400)
#define MCPCIA_W0_MASK(m) (MCPCIA_CSR(m) + 0x1440)
#define MCPCIA_T0_BASE(m) (MCPCIA_CSR(m) + 0x1480)
#define MCPCIA_W1_BASE(m) (MCPCIA_CSR(m) + 0x1500)
#define MCPCIA_W1_MASK(m) (MCPCIA_CSR(m) + 0x1540)
#define MCPCIA_T1_BASE(m) (MCPCIA_CSR(m) + 0x1580)
#define MCPCIA_W2_BASE(m) (MCPCIA_CSR(m) + 0x1600)
#define MCPCIA_W2_MASK(m) (MCPCIA_CSR(m) + 0x1640)
#define MCPCIA_T2_BASE(m) (MCPCIA_CSR(m) + 0x1680)
#define MCPCIA_W3_BASE(m) (MCPCIA_CSR(m) + 0x1700)
#define MCPCIA_W3_MASK(m) (MCPCIA_CSR(m) + 0x1740)
#define MCPCIA_T3_BASE(m) (MCPCIA_CSR(m) + 0x1780)
/* Hack! Only words for bus 0. */
#ifndef MCPCIA_ONE_HAE_WINDOW
#define MCPCIA_HAE_ADDRESS MCPCIA_HAE_MEM(4)
#endif
#define MCPCIA_IACK_SC _MCPCIA_IACK_SC(4)
/*
* The canonical non-remaped I/O and MEM addresses have these values
* subtracted out. This is arranged so that folks manipulating ISA
* devices can use their familiar numbers and have them map to bus 0.
*/
#define MCPCIA_IO_BIAS MCPCIA_IO(4)
#define MCPCIA_MEM_BIAS MCPCIA_DENSE(4)
/* Offset between ram physical addresses and pci64 DAC bus addresses. */
#define MCPCIA_DAC_OFFSET (1UL << 40)
/*
* Data structure for handling MCPCIA machine checks:
*/
struct el_MCPCIA_uncorrected_frame_mcheck {
struct el_common header;
struct el_common_EV5_uncorrectable_mcheck procdata;
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* MCPCIA, the RAWHIDE family PCI/memory support chipset for the EV5 (21164)
* and EV56 (21164a) processors, can use either a sparse address mapping
* scheme, or the so-called byte-word PCI address space, to get at PCI memory
* and I/O.
*
* Unfortunately, we can't use BWIO with EV5, so for now, we always use SPARSE.
*/
/*
* Memory functions. 64-bit and 32-bit accesses are done through
* dense memory space, everything else through sparse space.
*
* For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
* which gives 1Gbyte of accessible space which relates exactly
* to the amount of PCI memory mapping *into* system address space.
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
*
* 3 2 1
* 9876543210987654321098765432109876543210
* 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
* LL = Transfer length
*
* PCI Address:
*
* 3 2 1
* 10987654321098765432109876543210
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
*
*/
#define vip volatile int __force *
#define vuip volatile unsigned int __force *
#ifdef MCPCIA_ONE_HAE_WINDOW
#define MCPCIA_FROB_MMIO \
if (__mcpcia_is_mmio(hose)) { \
set_hae(hose & 0xffffffff); \
hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); \
}
#else
#define MCPCIA_FROB_MMIO \
if (__mcpcia_is_mmio(hose)) { \
hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); \
}
#endif
static inline int __mcpcia_is_mmio(unsigned long addr)
{
return (addr & 0x80000000UL) == 0;
}
__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
unsigned long result;
MCPCIA_FROB_MMIO;
result = *(vip) ((addr << 5) + hose + 0x00);
return __kernel_extbl(result, addr & 3);
}
__EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
unsigned long w;
MCPCIA_FROB_MMIO;
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + hose + 0x00) = w;
}
__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
unsigned long result;
MCPCIA_FROB_MMIO;
result = *(vip) ((addr << 5) + hose + 0x08);
return __kernel_extwl(result, addr & 3);
}
__EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
unsigned long w;
MCPCIA_FROB_MMIO;
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + hose + 0x08) = w;
}
__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr;
if (!__mcpcia_is_mmio(addr))
addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
return *(vuip)addr;
}
__EXTERN_INLINE void mcpcia_iowrite32(u32 b, void __iomem *xaddr)
{
unsigned long addr = (unsigned long)xaddr;
if (!__mcpcia_is_mmio(addr))
addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
*(vuip)addr = b;
}
__EXTERN_INLINE void __iomem *mcpcia_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + MCPCIA_IO_BIAS);
}
__EXTERN_INLINE void __iomem *mcpcia_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + MCPCIA_MEM_BIAS);
}
__EXTERN_INLINE int mcpcia_is_ioaddr(unsigned long addr)
{
return addr >= MCPCIA_SPARSE(0);
}
__EXTERN_INLINE int mcpcia_is_mmio(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
return __mcpcia_is_mmio(addr);
}
#undef MCPCIA_FROB_MMIO
#undef vip
#undef vuip
#undef __IO_PREFIX
#define __IO_PREFIX mcpcia
#define mcpcia_trivial_rw_bw 2
#define mcpcia_trivial_rw_lq 1
#define mcpcia_trivial_io_bw 0
#define mcpcia_trivial_io_lq 0
#define mcpcia_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_MCPCIA__H__ */

View File

@@ -0,0 +1,110 @@
#ifndef __ALPHA_POLARIS__H__
#define __ALPHA_POLARIS__H__
#include <linux/types.h>
#include <asm/compiler.h>
/*
* POLARIS is the internal name for a core logic chipset which provides
* memory controller and PCI access for the 21164PC chip based systems.
*
* This file is based on:
*
* Polaris System Controller
* Device Functional Specification
* 22-Jan-98
* Rev. 4.2
*
*/
/* Polaris memory regions */
#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000UL)
#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000UL)
#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000UL)
#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000UL)
#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000UL)
#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000UL)
#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000UL)
#define POLARIS_IACK_SC POLARIS_IACK_BASE
/* The Polaris command/status registers live in PCI Config space for
* bus 0/device 0. As such, they may be bytes, words, or doublewords.
*/
#define POLARIS_W_VENID (POLARIS_DENSE_CONFIG_BASE)
#define POLARIS_W_DEVID (POLARIS_DENSE_CONFIG_BASE+2)
#define POLARIS_W_CMD (POLARIS_DENSE_CONFIG_BASE+4)
#define POLARIS_W_STATUS (POLARIS_DENSE_CONFIG_BASE+6)
/*
* Data structure for handling POLARIS machine checks:
*/
struct el_POLARIS_sysdata_mcheck {
u_long psc_status;
u_long psc_pcictl0;
u_long psc_pcictl1;
u_long psc_pcictl2;
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* POLARIS, the PCI/memory support chipset for the PCA56 (21164PC)
* processors, can use either a sparse address mapping scheme, or the
* so-called byte-word PCI address space, to get at PCI memory and I/O.
*
* However, we will support only the BWX form.
*/
/*
* Memory functions. Polaris allows all accesses (byte/word
* as well as long/quad) to be done through dense space.
*
* We will only support DENSE access via BWX insns.
*/
__EXTERN_INLINE void __iomem *polaris_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + POLARIS_DENSE_IO_BASE);
}
__EXTERN_INLINE void __iomem *polaris_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + POLARIS_DENSE_MEM_BASE);
}
__EXTERN_INLINE int polaris_is_ioaddr(unsigned long addr)
{
return addr >= POLARIS_SPARSE_MEM_BASE;
}
__EXTERN_INLINE int polaris_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr < POLARIS_SPARSE_IO_BASE;
}
#undef __IO_PREFIX
#define __IO_PREFIX polaris
#define polaris_trivial_rw_bw 1
#define polaris_trivial_rw_lq 1
#define polaris_trivial_io_bw 1
#define polaris_trivial_io_lq 1
#define polaris_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_POLARIS__H__ */

View File

@@ -0,0 +1,628 @@
#ifndef __ALPHA_T2__H__
#define __ALPHA_T2__H__
#include <linux/config.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <asm/compiler.h>
#include <asm/system.h>
/*
* T2 is the internal name for the core logic chipset which provides
* memory controller and PCI access for the SABLE-based systems.
*
* This file is based on:
*
* SABLE I/O Specification
* Revision/Update Information: 1.3
*
* jestabro@amt.tay1.dec.com Initial Version.
*
*/
#define T2_MEM_R1_MASK 0x07ffffff /* Mem sparse region 1 mask is 26 bits */
/* GAMMA-SABLE is a SABLE with EV5-based CPUs */
/* All LYNX machines, EV4 or EV5, use the GAMMA bias also */
#define _GAMMA_BIAS 0x8000000000UL
#if defined(CONFIG_ALPHA_GENERIC)
#define GAMMA_BIAS alpha_mv.sys.t2.gamma_bias
#elif defined(CONFIG_ALPHA_GAMMA)
#define GAMMA_BIAS _GAMMA_BIAS
#else
#define GAMMA_BIAS 0
#endif
/*
* Memory spaces:
*/
#define T2_CONF (IDENT_ADDR + GAMMA_BIAS + 0x390000000UL)
#define T2_IO (IDENT_ADDR + GAMMA_BIAS + 0x3a0000000UL)
#define T2_SPARSE_MEM (IDENT_ADDR + GAMMA_BIAS + 0x200000000UL)
#define T2_DENSE_MEM (IDENT_ADDR + GAMMA_BIAS + 0x3c0000000UL)
#define T2_IOCSR (IDENT_ADDR + GAMMA_BIAS + 0x38e000000UL)
#define T2_CERR1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000020UL)
#define T2_CERR2 (IDENT_ADDR + GAMMA_BIAS + 0x38e000040UL)
#define T2_CERR3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000060UL)
#define T2_PERR1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000080UL)
#define T2_PERR2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0000a0UL)
#define T2_PSCR (IDENT_ADDR + GAMMA_BIAS + 0x38e0000c0UL)
#define T2_HAE_1 (IDENT_ADDR + GAMMA_BIAS + 0x38e0000e0UL)
#define T2_HAE_2 (IDENT_ADDR + GAMMA_BIAS + 0x38e000100UL)
#define T2_HBASE (IDENT_ADDR + GAMMA_BIAS + 0x38e000120UL)
#define T2_WBASE1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000140UL)
#define T2_WMASK1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000160UL)
#define T2_TBASE1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000180UL)
#define T2_WBASE2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0001a0UL)
#define T2_WMASK2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0001c0UL)
#define T2_TBASE2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0001e0UL)
#define T2_TLBBR (IDENT_ADDR + GAMMA_BIAS + 0x38e000200UL)
#define T2_IVR (IDENT_ADDR + GAMMA_BIAS + 0x38e000220UL)
#define T2_HAE_3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000240UL)
#define T2_HAE_4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000260UL)
/* The CSRs below are T3/T4 only */
#define T2_WBASE3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000280UL)
#define T2_WMASK3 (IDENT_ADDR + GAMMA_BIAS + 0x38e0002a0UL)
#define T2_TBASE3 (IDENT_ADDR + GAMMA_BIAS + 0x38e0002c0UL)
#define T2_TDR0 (IDENT_ADDR + GAMMA_BIAS + 0x38e000300UL)
#define T2_TDR1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000320UL)
#define T2_TDR2 (IDENT_ADDR + GAMMA_BIAS + 0x38e000340UL)
#define T2_TDR3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000360UL)
#define T2_TDR4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000380UL)
#define T2_TDR5 (IDENT_ADDR + GAMMA_BIAS + 0x38e0003a0UL)
#define T2_TDR6 (IDENT_ADDR + GAMMA_BIAS + 0x38e0003c0UL)
#define T2_TDR7 (IDENT_ADDR + GAMMA_BIAS + 0x38e0003e0UL)
#define T2_WBASE4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000400UL)
#define T2_WMASK4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000420UL)
#define T2_TBASE4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000440UL)
#define T2_AIR (IDENT_ADDR + GAMMA_BIAS + 0x38e000460UL)
#define T2_VAR (IDENT_ADDR + GAMMA_BIAS + 0x38e000480UL)
#define T2_DIR (IDENT_ADDR + GAMMA_BIAS + 0x38e0004a0UL)
#define T2_ICE (IDENT_ADDR + GAMMA_BIAS + 0x38e0004c0UL)
#define T2_HAE_ADDRESS T2_HAE_1
/* T2 CSRs are in the non-cachable primary IO space from 3.8000.0000 to
3.8fff.ffff
*
* +--------------+ 3 8000 0000
* | CPU 0 CSRs |
* +--------------+ 3 8100 0000
* | CPU 1 CSRs |
* +--------------+ 3 8200 0000
* | CPU 2 CSRs |
* +--------------+ 3 8300 0000
* | CPU 3 CSRs |
* +--------------+ 3 8400 0000
* | CPU Reserved |
* +--------------+ 3 8700 0000
* | Mem Reserved |
* +--------------+ 3 8800 0000
* | Mem 0 CSRs |
* +--------------+ 3 8900 0000
* | Mem 1 CSRs |
* +--------------+ 3 8a00 0000
* | Mem 2 CSRs |
* +--------------+ 3 8b00 0000
* | Mem 3 CSRs |
* +--------------+ 3 8c00 0000
* | Mem Reserved |
* +--------------+ 3 8e00 0000
* | PCI Bridge |
* +--------------+ 3 8f00 0000
* | Expansion IO |
* +--------------+ 3 9000 0000
*
*
*/
#define T2_CPU0_BASE (IDENT_ADDR + GAMMA_BIAS + 0x380000000L)
#define T2_CPU1_BASE (IDENT_ADDR + GAMMA_BIAS + 0x381000000L)
#define T2_CPU2_BASE (IDENT_ADDR + GAMMA_BIAS + 0x382000000L)
#define T2_CPU3_BASE (IDENT_ADDR + GAMMA_BIAS + 0x383000000L)
#define T2_CPUn_BASE(n) (T2_CPU0_BASE + (((n)&3) * 0x001000000L))
#define T2_MEM0_BASE (IDENT_ADDR + GAMMA_BIAS + 0x388000000L)
#define T2_MEM1_BASE (IDENT_ADDR + GAMMA_BIAS + 0x389000000L)
#define T2_MEM2_BASE (IDENT_ADDR + GAMMA_BIAS + 0x38a000000L)
#define T2_MEM3_BASE (IDENT_ADDR + GAMMA_BIAS + 0x38b000000L)
/*
* Sable CPU Module CSRS
*
* These are CSRs for hardware other than the CPU chip on the CPU module.
* The CPU module has Backup Cache control logic, Cbus control logic, and
* interrupt control logic on it. There is a duplicate tag store to speed
* up maintaining cache coherency.
*/
struct sable_cpu_csr {
unsigned long bcc; long fill_00[3]; /* Backup Cache Control */
unsigned long bcce; long fill_01[3]; /* Backup Cache Correctable Error */
unsigned long bccea; long fill_02[3]; /* B-Cache Corr Err Address Latch */
unsigned long bcue; long fill_03[3]; /* B-Cache Uncorrectable Error */
unsigned long bcuea; long fill_04[3]; /* B-Cache Uncorr Err Addr Latch */
unsigned long dter; long fill_05[3]; /* Duplicate Tag Error */
unsigned long cbctl; long fill_06[3]; /* CBus Control */
unsigned long cbe; long fill_07[3]; /* CBus Error */
unsigned long cbeal; long fill_08[3]; /* CBus Error Addr Latch low */
unsigned long cbeah; long fill_09[3]; /* CBus Error Addr Latch high */
unsigned long pmbx; long fill_10[3]; /* Processor Mailbox */
unsigned long ipir; long fill_11[3]; /* Inter-Processor Int Request */
unsigned long sic; long fill_12[3]; /* System Interrupt Clear */
unsigned long adlk; long fill_13[3]; /* Address Lock (LDxL/STxC) */
unsigned long madrl; long fill_14[3]; /* CBus Miss Address */
unsigned long rev; long fill_15[3]; /* CMIC Revision */
};
/*
* Data structure for handling T2 machine checks:
*/
struct el_t2_frame_header {
unsigned int elcf_fid; /* Frame ID (from above) */
unsigned int elcf_size; /* Size of frame in bytes */
};
struct el_t2_procdata_mcheck {
unsigned long elfmc_paltemp[32]; /* PAL TEMP REGS. */
/* EV4-specific fields */
unsigned long elfmc_exc_addr; /* Addr of excepting insn. */
unsigned long elfmc_exc_sum; /* Summary of arith traps. */
unsigned long elfmc_exc_mask; /* Exception mask (from exc_sum). */
unsigned long elfmc_iccsr; /* IBox hardware enables. */
unsigned long elfmc_pal_base; /* Base address for PALcode. */
unsigned long elfmc_hier; /* Hardware Interrupt Enable. */
unsigned long elfmc_hirr; /* Hardware Interrupt Request. */
unsigned long elfmc_mm_csr; /* D-stream fault info. */
unsigned long elfmc_dc_stat; /* D-cache status (ECC/Parity Err). */
unsigned long elfmc_dc_addr; /* EV3 Phys Addr for ECC/DPERR. */
unsigned long elfmc_abox_ctl; /* ABox Control Register. */
unsigned long elfmc_biu_stat; /* BIU Status. */
unsigned long elfmc_biu_addr; /* BUI Address. */
unsigned long elfmc_biu_ctl; /* BIU Control. */
unsigned long elfmc_fill_syndrome; /* For correcting ECC errors. */
unsigned long elfmc_fill_addr;/* Cache block which was being read. */
unsigned long elfmc_va; /* Effective VA of fault or miss. */
unsigned long elfmc_bc_tag; /* Backup Cache Tag Probe Results. */
};
/*
* Sable processor specific Machine Check Data segment.
*/
struct el_t2_logout_header {
unsigned int elfl_size; /* size in bytes of logout area. */
unsigned int elfl_sbz1:31; /* Should be zero. */
unsigned int elfl_retry:1; /* Retry flag. */
unsigned int elfl_procoffset; /* Processor-specific offset. */
unsigned int elfl_sysoffset; /* Offset of system-specific. */
unsigned int elfl_error_type; /* PAL error type code. */
unsigned int elfl_frame_rev; /* PAL Frame revision. */
};
struct el_t2_sysdata_mcheck {
unsigned long elcmc_bcc; /* CSR 0 */
unsigned long elcmc_bcce; /* CSR 1 */
unsigned long elcmc_bccea; /* CSR 2 */
unsigned long elcmc_bcue; /* CSR 3 */
unsigned long elcmc_bcuea; /* CSR 4 */
unsigned long elcmc_dter; /* CSR 5 */
unsigned long elcmc_cbctl; /* CSR 6 */
unsigned long elcmc_cbe; /* CSR 7 */
unsigned long elcmc_cbeal; /* CSR 8 */
unsigned long elcmc_cbeah; /* CSR 9 */
unsigned long elcmc_pmbx; /* CSR 10 */
unsigned long elcmc_ipir; /* CSR 11 */
unsigned long elcmc_sic; /* CSR 12 */
unsigned long elcmc_adlk; /* CSR 13 */
unsigned long elcmc_madrl; /* CSR 14 */
unsigned long elcmc_crrev4; /* CSR 15 */
};
/*
* Sable memory error frame - sable pfms section 3.42
*/
struct el_t2_data_memory {
struct el_t2_frame_header elcm_hdr; /* ID$MEM-FERR = 0x08 */
unsigned int elcm_module; /* Module id. */
unsigned int elcm_res04; /* Reserved. */
unsigned long elcm_merr; /* CSR0: Error Reg 1. */
unsigned long elcm_mcmd1; /* CSR1: Command Trap 1. */
unsigned long elcm_mcmd2; /* CSR2: Command Trap 2. */
unsigned long elcm_mconf; /* CSR3: Configuration. */
unsigned long elcm_medc1; /* CSR4: EDC Status 1. */
unsigned long elcm_medc2; /* CSR5: EDC Status 2. */
unsigned long elcm_medcc; /* CSR6: EDC Control. */
unsigned long elcm_msctl; /* CSR7: Stream Buffer Control. */
unsigned long elcm_mref; /* CSR8: Refresh Control. */
unsigned long elcm_filter; /* CSR9: CRD Filter Control. */
};
/*
* Sable other CPU error frame - sable pfms section 3.43
*/
struct el_t2_data_other_cpu {
short elco_cpuid; /* CPU ID */
short elco_res02[3];
unsigned long elco_bcc; /* CSR 0 */
unsigned long elco_bcce; /* CSR 1 */
unsigned long elco_bccea; /* CSR 2 */
unsigned long elco_bcue; /* CSR 3 */
unsigned long elco_bcuea; /* CSR 4 */
unsigned long elco_dter; /* CSR 5 */
unsigned long elco_cbctl; /* CSR 6 */
unsigned long elco_cbe; /* CSR 7 */
unsigned long elco_cbeal; /* CSR 8 */
unsigned long elco_cbeah; /* CSR 9 */
unsigned long elco_pmbx; /* CSR 10 */
unsigned long elco_ipir; /* CSR 11 */
unsigned long elco_sic; /* CSR 12 */
unsigned long elco_adlk; /* CSR 13 */
unsigned long elco_madrl; /* CSR 14 */
unsigned long elco_crrev4; /* CSR 15 */
};
/*
* Sable other CPU error frame - sable pfms section 3.44
*/
struct el_t2_data_t2{
struct el_t2_frame_header elct_hdr; /* ID$T2-FRAME */
unsigned long elct_iocsr; /* IO Control and Status Register */
unsigned long elct_cerr1; /* Cbus Error Register 1 */
unsigned long elct_cerr2; /* Cbus Error Register 2 */
unsigned long elct_cerr3; /* Cbus Error Register 3 */
unsigned long elct_perr1; /* PCI Error Register 1 */
unsigned long elct_perr2; /* PCI Error Register 2 */
unsigned long elct_hae0_1; /* High Address Extension Register 1 */
unsigned long elct_hae0_2; /* High Address Extension Register 2 */
unsigned long elct_hbase; /* High Base Register */
unsigned long elct_wbase1; /* Window Base Register 1 */
unsigned long elct_wmask1; /* Window Mask Register 1 */
unsigned long elct_tbase1; /* Translated Base Register 1 */
unsigned long elct_wbase2; /* Window Base Register 2 */
unsigned long elct_wmask2; /* Window Mask Register 2 */
unsigned long elct_tbase2; /* Translated Base Register 2 */
unsigned long elct_tdr0; /* TLB Data Register 0 */
unsigned long elct_tdr1; /* TLB Data Register 1 */
unsigned long elct_tdr2; /* TLB Data Register 2 */
unsigned long elct_tdr3; /* TLB Data Register 3 */
unsigned long elct_tdr4; /* TLB Data Register 4 */
unsigned long elct_tdr5; /* TLB Data Register 5 */
unsigned long elct_tdr6; /* TLB Data Register 6 */
unsigned long elct_tdr7; /* TLB Data Register 7 */
};
/*
* Sable error log data structure - sable pfms section 3.40
*/
struct el_t2_data_corrected {
unsigned long elcpb_biu_stat;
unsigned long elcpb_biu_addr;
unsigned long elcpb_biu_ctl;
unsigned long elcpb_fill_syndrome;
unsigned long elcpb_fill_addr;
unsigned long elcpb_bc_tag;
};
/*
* Sable error log data structure
* Note there are 4 memory slots on sable (see t2.h)
*/
struct el_t2_frame_mcheck {
struct el_t2_frame_header elfmc_header; /* ID$P-FRAME_MCHECK */
struct el_t2_logout_header elfmc_hdr;
struct el_t2_procdata_mcheck elfmc_procdata;
struct el_t2_sysdata_mcheck elfmc_sysdata;
struct el_t2_data_t2 elfmc_t2data;
struct el_t2_data_memory elfmc_memdata[4];
struct el_t2_frame_header elfmc_footer; /* empty */
};
/*
* Sable error log data structures on memory errors
*/
struct el_t2_frame_corrected {
struct el_t2_frame_header elfcc_header; /* ID$P-BC-COR */
struct el_t2_logout_header elfcc_hdr;
struct el_t2_data_corrected elfcc_procdata;
/* struct el_t2_data_t2 elfcc_t2data; */
/* struct el_t2_data_memory elfcc_memdata[4]; */
struct el_t2_frame_header elfcc_footer; /* empty */
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* T2 (the core logic PCI/memory support chipset for the SABLE
* series of processors uses a sparse address mapping scheme to
* get at PCI memory and I/O.
*/
#define vip volatile int *
#define vuip volatile unsigned int *
static inline u8 t2_inb(unsigned long addr)
{
long result = *(vip) ((addr << 5) + T2_IO + 0x00);
return __kernel_extbl(result, addr & 3);
}
static inline void t2_outb(u8 b, unsigned long addr)
{
unsigned long w;
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + T2_IO + 0x00) = w;
mb();
}
static inline u16 t2_inw(unsigned long addr)
{
long result = *(vip) ((addr << 5) + T2_IO + 0x08);
return __kernel_extwl(result, addr & 3);
}
static inline void t2_outw(u16 b, unsigned long addr)
{
unsigned long w;
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + T2_IO + 0x08) = w;
mb();
}
static inline u32 t2_inl(unsigned long addr)
{
return *(vuip) ((addr << 5) + T2_IO + 0x18);
}
static inline void t2_outl(u32 b, unsigned long addr)
{
*(vuip) ((addr << 5) + T2_IO + 0x18) = b;
mb();
}
/*
* Memory functions.
*
* For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
* which gives 1Gbyte of accessible space which relates exactly
* to the amount of PCI memory mapping *into* system address space.
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
*
* 3 2 1
* 9876543210987654321098765432109876543210
* 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
* LL = Transfer length
*
* PCI Address:
*
* 3 2 1
* 10987654321098765432109876543210
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
*
*/
#define t2_set_hae { \
msb = addr >> 27; \
addr &= T2_MEM_R1_MASK; \
set_hae(msb); \
}
static spinlock_t t2_hae_lock = SPIN_LOCK_UNLOCKED;
__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, msb;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00);
spin_unlock_irqrestore(&t2_hae_lock, flags);
return __kernel_extbl(result, addr & 3);
}
__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, msb;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08);
spin_unlock_irqrestore(&t2_hae_lock, flags);
return __kernel_extwl(result, addr & 3);
}
/*
* On SABLE with T2, we must use SPARSE memory even for 32-bit access,
* because we cannot access all of DENSE without changing its HAE.
*/
__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long result, msb;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18);
spin_unlock_irqrestore(&t2_hae_lock, flags);
return result & 0xffffffffUL;
}
__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long r0, r1, work, msb;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
work = (addr << 5) + T2_SPARSE_MEM + 0x18;
r0 = *(vuip)(work);
r1 = *(vuip)(work + (4 << 5));
spin_unlock_irqrestore(&t2_hae_lock, flags);
return r1 << 32 | r0;
}
__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long msb, w;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w;
spin_unlock_irqrestore(&t2_hae_lock, flags);
}
__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long msb, w;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w;
spin_unlock_irqrestore(&t2_hae_lock, flags);
}
/*
* On SABLE with T2, we must use SPARSE memory even for 32-bit access,
* because we cannot access all of DENSE without changing its HAE.
*/
__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long msb;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b;
spin_unlock_irqrestore(&t2_hae_lock, flags);
}
__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long msb, work;
unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags);
t2_set_hae;
work = (addr << 5) + T2_SPARSE_MEM + 0x18;
*(vuip)work = b;
*(vuip)(work + (4 << 5)) = b >> 32;
spin_unlock_irqrestore(&t2_hae_lock, flags);
}
__EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + T2_IO);
}
__EXTERN_INLINE void __iomem *t2_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + T2_DENSE_MEM);
}
__EXTERN_INLINE int t2_is_ioaddr(unsigned long addr)
{
return (long)addr >= 0;
}
__EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr >= T2_DENSE_MEM;
}
/* New-style ioread interface. The mmio routines are so ugly for T2 that
it doesn't make sense to merge the pio and mmio routines. */
#define IOPORT(OS, NS) \
__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \
{ \
if (t2_is_mmio(xaddr)) \
return t2_read##OS(xaddr - T2_DENSE_MEM); \
else \
return t2_in##OS((unsigned long)xaddr - T2_IO); \
} \
__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \
{ \
if (t2_is_mmio(xaddr)) \
t2_write##OS(b, xaddr - T2_DENSE_MEM); \
else \
t2_out##OS(b, (unsigned long)xaddr - T2_IO); \
}
IOPORT(b, 8)
IOPORT(w, 16)
IOPORT(l, 32)
#undef IOPORT
#undef vip
#undef vuip
#undef __IO_PREFIX
#define __IO_PREFIX t2
#define t2_trivial_rw_bw 0
#define t2_trivial_rw_lq 0
#define t2_trivial_io_bw 0
#define t2_trivial_io_lq 0
#define t2_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_T2__H__ */

View File

@@ -0,0 +1,415 @@
#ifndef __ALPHA_TITAN__H__
#define __ALPHA_TITAN__H__
#include <linux/types.h>
#include <linux/pci.h>
#include <asm/compiler.h>
/*
* TITAN is the internal names for a core logic chipset which provides
* memory controller and PCI/AGP access for 21264 based systems.
*
* This file is based on:
*
* Titan Chipset Engineering Specification
* Revision 0.12
* 13 July 1999
*
*/
/* XXX: Do we need to conditionalize on this? */
#ifdef USE_48_BIT_KSEG
#define TI_BIAS 0x80000000000UL
#else
#define TI_BIAS 0x10000000000UL
#endif
/*
* CChip, DChip, and PChip registers
*/
typedef struct {
volatile unsigned long csr __attribute__((aligned(64)));
} titan_64;
typedef struct {
titan_64 csc;
titan_64 mtr;
titan_64 misc;
titan_64 mpd;
titan_64 aar0;
titan_64 aar1;
titan_64 aar2;
titan_64 aar3;
titan_64 dim0;
titan_64 dim1;
titan_64 dir0;
titan_64 dir1;
titan_64 drir;
titan_64 prben;
titan_64 iic0;
titan_64 iic1;
titan_64 mpr0;
titan_64 mpr1;
titan_64 mpr2;
titan_64 mpr3;
titan_64 rsvd[2];
titan_64 ttr;
titan_64 tdr;
titan_64 dim2;
titan_64 dim3;
titan_64 dir2;
titan_64 dir3;
titan_64 iic2;
titan_64 iic3;
titan_64 pwr;
titan_64 reserved[17];
titan_64 cmonctla;
titan_64 cmonctlb;
titan_64 cmoncnt01;
titan_64 cmoncnt23;
titan_64 cpen;
} titan_cchip;
typedef struct {
titan_64 dsc;
titan_64 str;
titan_64 drev;
titan_64 dsc2;
} titan_dchip;
typedef struct {
titan_64 wsba[4];
titan_64 wsm[4];
titan_64 tba[4];
titan_64 pctl;
titan_64 plat;
titan_64 reserved0[2];
union {
struct {
titan_64 serror;
titan_64 serren;
titan_64 serrset;
titan_64 reserved0;
titan_64 gperror;
titan_64 gperren;
titan_64 gperrset;
titan_64 reserved1;
titan_64 gtlbiv;
titan_64 gtlbia;
titan_64 reserved2[2];
titan_64 sctl;
titan_64 reserved3[3];
} g;
struct {
titan_64 agperror;
titan_64 agperren;
titan_64 agperrset;
titan_64 agplastwr;
titan_64 aperror;
titan_64 aperren;
titan_64 aperrset;
titan_64 reserved0;
titan_64 atlbiv;
titan_64 atlbia;
titan_64 reserved1[6];
} a;
} port_specific;
titan_64 sprst;
titan_64 reserved1[31];
} titan_pachip_port;
typedef struct {
titan_pachip_port g_port;
titan_pachip_port a_port;
} titan_pachip;
#define TITAN_cchip ((titan_cchip *)(IDENT_ADDR+TI_BIAS+0x1A0000000UL))
#define TITAN_dchip ((titan_dchip *)(IDENT_ADDR+TI_BIAS+0x1B0000800UL))
#define TITAN_pachip0 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x180000000UL))
#define TITAN_pachip1 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x380000000UL))
extern unsigned TITAN_agp;
extern int TITAN_bootcpu;
/*
* TITAN PA-chip Window Space Base Address register.
* (WSBA[0-2])
*/
#define wsba_m_ena 0x1
#define wsba_m_sg 0x2
#define wsba_m_addr 0xFFF00000
#define wmask_k_sz1gb 0x3FF00000
union TPAchipWSBA {
struct {
unsigned wsba_v_ena : 1;
unsigned wsba_v_sg : 1;
unsigned wsba_v_rsvd1 : 18;
unsigned wsba_v_addr : 12;
unsigned wsba_v_rsvd2 : 32;
} wsba_r_bits;
int wsba_q_whole [2];
};
/*
* TITAN PA-chip Control Register
* This definition covers both the G-Port GPCTL and the A-PORT APCTL.
* Bits <51:0> are the same in both cases. APCTL<63:52> are only
* applicable to AGP.
*/
#define pctl_m_fbtb 0x00000001
#define pctl_m_thdis 0x00000002
#define pctl_m_chaindis 0x00000004
#define pctl_m_tgtlat 0x00000018
#define pctl_m_hole 0x00000020
#define pctl_m_mwin 0x00000040
#define pctl_m_arbena 0x00000080
#define pctl_m_prigrp 0x0000FF00
#define pctl_m_ppri 0x00010000
#define pctl_m_pcispd66 0x00020000
#define pctl_m_cngstlt 0x003C0000
#define pctl_m_ptpdesten 0x3FC00000
#define pctl_m_dpcen 0x40000000
#define pctl_m_apcen 0x0000000080000000UL
#define pctl_m_dcrtv 0x0000000300000000UL
#define pctl_m_en_stepping 0x0000000400000000UL
#define apctl_m_rsvd1 0x000FFFF800000000UL
#define apctl_m_agp_rate 0x0030000000000000UL
#define apctl_m_agp_sba_en 0x0040000000000000UL
#define apctl_m_agp_en 0x0080000000000000UL
#define apctl_m_rsvd2 0x0100000000000000UL
#define apctl_m_agp_present 0x0200000000000000UL
#define apctl_agp_hp_rd 0x1C00000000000000UL
#define apctl_agp_lp_rd 0xE000000000000000UL
#define gpctl_m_rsvd 0xFFFFFFF800000000UL
union TPAchipPCTL {
struct {
unsigned pctl_v_fbtb : 1; /* A/G [0] */
unsigned pctl_v_thdis : 1; /* A/G [1] */
unsigned pctl_v_chaindis : 1; /* A/G [2] */
unsigned pctl_v_tgtlat : 2; /* A/G [4:3] */
unsigned pctl_v_hole : 1; /* A/G [5] */
unsigned pctl_v_mwin : 1; /* A/G [6] */
unsigned pctl_v_arbena : 1; /* A/G [7] */
unsigned pctl_v_prigrp : 8; /* A/G [15:8] */
unsigned pctl_v_ppri : 1; /* A/G [16] */
unsigned pctl_v_pcispd66 : 1; /* A/G [17] */
unsigned pctl_v_cngstlt : 4; /* A/G [21:18] */
unsigned pctl_v_ptpdesten : 8; /* A/G [29:22] */
unsigned pctl_v_dpcen : 1; /* A/G [30] */
unsigned pctl_v_apcen : 1; /* A/G [31] */
unsigned pctl_v_dcrtv : 2; /* A/G [33:32] */
unsigned pctl_v_en_stepping :1; /* A/G [34] */
unsigned apctl_v_rsvd1 : 17; /* A [51:35] */
unsigned apctl_v_agp_rate : 2; /* A [53:52] */
unsigned apctl_v_agp_sba_en : 1; /* A [54] */
unsigned apctl_v_agp_en : 1; /* A [55] */
unsigned apctl_v_rsvd2 : 1; /* A [56] */
unsigned apctl_v_agp_present : 1; /* A [57] */
unsigned apctl_v_agp_hp_rd : 3; /* A [60:58] */
unsigned apctl_v_agp_lp_rd : 3; /* A [63:61] */
} pctl_r_bits;
unsigned int pctl_l_whole [2];
unsigned long pctl_q_whole;
};
/*
* SERROR / SERREN / SERRSET
*/
union TPAchipSERR {
struct {
unsigned serr_v_lost_uecc : 1; /* [0] */
unsigned serr_v_uecc : 1; /* [1] */
unsigned serr_v_cre : 1; /* [2] */
unsigned serr_v_nxio : 1; /* [3] */
unsigned serr_v_lost_cre : 1; /* [4] */
unsigned serr_v_rsvd0 : 10; /* [14:5] */
unsigned serr_v_addr : 32; /* [46:15] */
unsigned serr_v_rsvd1 : 5; /* [51:47] */
unsigned serr_v_source : 2; /* [53:52] */
unsigned serr_v_cmd : 2; /* [55:54] */
unsigned serr_v_syn : 8; /* [63:56] */
} serr_r_bits;
unsigned int serr_l_whole[2];
unsigned long serr_q_whole;
};
/*
* GPERROR / APERROR / GPERREN / APERREN / GPERRSET / APERRSET
*/
union TPAchipPERR {
struct {
unsigned long perr_v_lost : 1; /* [0] */
unsigned long perr_v_serr : 1; /* [1] */
unsigned long perr_v_perr : 1; /* [2] */
unsigned long perr_v_dcrto : 1; /* [3] */
unsigned long perr_v_sge : 1; /* [4] */
unsigned long perr_v_ape : 1; /* [5] */
unsigned long perr_v_ta : 1; /* [6] */
unsigned long perr_v_dpe : 1; /* [7] */
unsigned long perr_v_nds : 1; /* [8] */
unsigned long perr_v_iptpr : 1; /* [9] */
unsigned long perr_v_iptpw : 1; /* [10] */
unsigned long perr_v_rsvd0 : 3; /* [13:11] */
unsigned long perr_v_addr : 33; /* [46:14] */
unsigned long perr_v_dac : 1; /* [47] */
unsigned long perr_v_mwin : 1; /* [48] */
unsigned long perr_v_rsvd1 : 3; /* [51:49] */
unsigned long perr_v_cmd : 4; /* [55:52] */
unsigned long perr_v_rsvd2 : 8; /* [63:56] */
} perr_r_bits;
unsigned int perr_l_whole[2];
unsigned long perr_q_whole;
};
/*
* AGPERROR / AGPERREN / AGPERRSET
*/
union TPAchipAGPERR {
struct {
unsigned agperr_v_lost : 1; /* [0] */
unsigned agperr_v_lpqfull : 1; /* [1] */
unsigned apgerr_v_hpqfull : 1; /* [2] */
unsigned agperr_v_rescmd : 1; /* [3] */
unsigned agperr_v_ipte : 1; /* [4] */
unsigned agperr_v_ptp : 1; /* [5] */
unsigned agperr_v_nowindow : 1; /* [6] */
unsigned agperr_v_rsvd0 : 8; /* [14:7] */
unsigned agperr_v_addr : 32; /* [46:15] */
unsigned agperr_v_rsvd1 : 1; /* [47] */
unsigned agperr_v_dac : 1; /* [48] */
unsigned agperr_v_mwin : 1; /* [49] */
unsigned agperr_v_cmd : 3; /* [52:50] */
unsigned agperr_v_length : 6; /* [58:53] */
unsigned agperr_v_fence : 1; /* [59] */
unsigned agperr_v_rsvd2 : 4; /* [63:60] */
} agperr_r_bits;
unsigned int agperr_l_whole[2];
unsigned long agperr_q_whole;
};
/*
* Memory spaces:
* Hose numbers are assigned as follows:
* 0 - pachip 0 / G Port
* 1 - pachip 1 / G Port
* 2 - pachip 0 / A Port
* 3 - pachip 1 / A Port
*/
#define TITAN_HOSE_SHIFT (33)
#define TITAN_HOSE(h) (((unsigned long)(h)) << TITAN_HOSE_SHIFT)
#define TITAN_BASE (IDENT_ADDR + TI_BIAS)
#define TITAN_MEM(h) (TITAN_BASE+TITAN_HOSE(h)+0x000000000UL)
#define _TITAN_IACK_SC(h) (TITAN_BASE+TITAN_HOSE(h)+0x1F8000000UL)
#define TITAN_IO(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FC000000UL)
#define TITAN_CONF(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FE000000UL)
#define TITAN_HOSE_MASK TITAN_HOSE(3)
#define TITAN_IACK_SC _TITAN_IACK_SC(0) /* hack! */
/*
* The canonical non-remaped I/O and MEM addresses have these values
* subtracted out. This is arranged so that folks manipulating ISA
* devices can use their familiar numbers and have them map to bus 0.
*/
#define TITAN_IO_BIAS TITAN_IO(0)
#define TITAN_MEM_BIAS TITAN_MEM(0)
/* The IO address space is larger than 0xffff */
#define TITAN_IO_SPACE (TITAN_CONF(0) - TITAN_IO(0))
/* TIG Space */
#define TITAN_TIG_SPACE (TITAN_BASE + 0x100000000UL)
/* Offset between ram physical addresses and pci64 DAC bus addresses. */
/* ??? Just a guess. Ought to confirm it hasn't been moved. */
#define TITAN_DAC_OFFSET (1UL << 40)
/*
* Data structure for handling TITAN machine checks:
*/
#define SCB_Q_SYSERR 0x620
#define SCB_Q_PROCERR 0x630
#define SCB_Q_SYSMCHK 0x660
#define SCB_Q_PROCMCHK 0x670
#define SCB_Q_SYSEVENT 0x680 /* environmental / system management */
struct el_TITAN_sysdata_mcheck {
u64 summary; /* 0x00 */
u64 c_dirx; /* 0x08 */
u64 c_misc; /* 0x10 */
u64 p0_serror; /* 0x18 */
u64 p0_gperror; /* 0x20 */
u64 p0_aperror; /* 0x28 */
u64 p0_agperror;/* 0x30 */
u64 p1_serror; /* 0x38 */
u64 p1_gperror; /* 0x40 */
u64 p1_aperror; /* 0x48 */
u64 p1_agperror;/* 0x50 */
};
/*
* System area for a privateer 680 environmental/system management mcheck
*/
struct el_PRIVATEER_envdata_mcheck {
u64 summary; /* 0x00 */
u64 c_dirx; /* 0x08 */
u64 smir; /* 0x10 */
u64 cpuir; /* 0x18 */
u64 psir; /* 0x20 */
u64 fault; /* 0x28 */
u64 sys_doors; /* 0x30 */
u64 temp_warn; /* 0x38 */
u64 fan_ctrl; /* 0x40 */
u64 code; /* 0x48 */
u64 reserved; /* 0x50 */
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* TITAN, a 21??? PCI/memory support chipset for the EV6 (21264)
* can only use linear accesses to get at PCI/AGP memory and I/O spaces.
*/
/*
* Memory functions. all accesses are done through linear space.
*/
__EXTERN_INLINE void __iomem *titan_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + TITAN_IO_BIAS);
}
extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size);
extern void titan_iounmap(volatile void __iomem *addr);
__EXTERN_INLINE int titan_is_ioaddr(unsigned long addr)
{
return addr >= TITAN_BASE;
}
extern int titan_is_mmio(const volatile void __iomem *addr);
#undef __IO_PREFIX
#define __IO_PREFIX titan
#define titan_trivial_rw_bw 1
#define titan_trivial_rw_lq 1
#define titan_trivial_io_bw 1
#define titan_trivial_io_lq 1
#define titan_trivial_iounmap 0
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_TITAN__H__ */

View File

@@ -0,0 +1,344 @@
#ifndef __ALPHA_TSUNAMI__H__
#define __ALPHA_TSUNAMI__H__
#include <linux/types.h>
#include <asm/compiler.h>
/*
* TSUNAMI/TYPHOON are the internal names for the core logic chipset which
* provides memory controller and PCI access for the 21264 based systems.
*
* This file is based on:
*
* Tsunami System Programmers Manual
* Preliminary, Chapters 2-5
*
*/
/* XXX: Do we need to conditionalize on this? */
#ifdef USE_48_BIT_KSEG
#define TS_BIAS 0x80000000000UL
#else
#define TS_BIAS 0x10000000000UL
#endif
/*
* CChip, DChip, and PChip registers
*/
typedef struct {
volatile unsigned long csr __attribute__((aligned(64)));
} tsunami_64;
typedef struct {
tsunami_64 csc;
tsunami_64 mtr;
tsunami_64 misc;
tsunami_64 mpd;
tsunami_64 aar0;
tsunami_64 aar1;
tsunami_64 aar2;
tsunami_64 aar3;
tsunami_64 dim0;
tsunami_64 dim1;
tsunami_64 dir0;
tsunami_64 dir1;
tsunami_64 drir;
tsunami_64 prben;
tsunami_64 iic; /* a.k.a. iic0 */
tsunami_64 wdr; /* a.k.a. iic1 */
tsunami_64 mpr0;
tsunami_64 mpr1;
tsunami_64 mpr2;
tsunami_64 mpr3;
tsunami_64 mctl;
tsunami_64 __pad1;
tsunami_64 ttr;
tsunami_64 tdr;
tsunami_64 dim2;
tsunami_64 dim3;
tsunami_64 dir2;
tsunami_64 dir3;
tsunami_64 iic2;
tsunami_64 iic3;
} tsunami_cchip;
typedef struct {
tsunami_64 dsc;
tsunami_64 str;
tsunami_64 drev;
} tsunami_dchip;
typedef struct {
tsunami_64 wsba[4];
tsunami_64 wsm[4];
tsunami_64 tba[4];
tsunami_64 pctl;
tsunami_64 plat;
tsunami_64 reserved;
tsunami_64 perror;
tsunami_64 perrmask;
tsunami_64 perrset;
tsunami_64 tlbiv;
tsunami_64 tlbia;
tsunami_64 pmonctl;
tsunami_64 pmoncnt;
} tsunami_pchip;
#define TSUNAMI_cchip ((tsunami_cchip *)(IDENT_ADDR+TS_BIAS+0x1A0000000UL))
#define TSUNAMI_dchip ((tsunami_dchip *)(IDENT_ADDR+TS_BIAS+0x1B0000800UL))
#define TSUNAMI_pchip0 ((tsunami_pchip *)(IDENT_ADDR+TS_BIAS+0x180000000UL))
#define TSUNAMI_pchip1 ((tsunami_pchip *)(IDENT_ADDR+TS_BIAS+0x380000000UL))
extern int TSUNAMI_bootcpu;
/*
* TSUNAMI Pchip Error register.
*/
#define perror_m_lost 0x1
#define perror_m_serr 0x2
#define perror_m_perr 0x4
#define perror_m_dcrto 0x8
#define perror_m_sge 0x10
#define perror_m_ape 0x20
#define perror_m_ta 0x40
#define perror_m_rdpe 0x80
#define perror_m_nds 0x100
#define perror_m_rto 0x200
#define perror_m_uecc 0x400
#define perror_m_cre 0x800
#define perror_m_addrl 0xFFFFFFFF0000UL
#define perror_m_addrh 0x7000000000000UL
#define perror_m_cmd 0xF0000000000000UL
#define perror_m_syn 0xFF00000000000000UL
union TPchipPERROR {
struct {
unsigned int perror_v_lost : 1;
unsigned perror_v_serr : 1;
unsigned perror_v_perr : 1;
unsigned perror_v_dcrto : 1;
unsigned perror_v_sge : 1;
unsigned perror_v_ape : 1;
unsigned perror_v_ta : 1;
unsigned perror_v_rdpe : 1;
unsigned perror_v_nds : 1;
unsigned perror_v_rto : 1;
unsigned perror_v_uecc : 1;
unsigned perror_v_cre : 1;
unsigned perror_v_rsvd1 : 4;
unsigned perror_v_addrl : 32;
unsigned perror_v_addrh : 3;
unsigned perror_v_rsvd2 : 1;
unsigned perror_v_cmd : 4;
unsigned perror_v_syn : 8;
} perror_r_bits;
int perror_q_whole [2];
};
/*
* TSUNAMI Pchip Window Space Base Address register.
*/
#define wsba_m_ena 0x1
#define wsba_m_sg 0x2
#define wsba_m_ptp 0x4
#define wsba_m_addr 0xFFF00000
#define wmask_k_sz1gb 0x3FF00000
union TPchipWSBA {
struct {
unsigned wsba_v_ena : 1;
unsigned wsba_v_sg : 1;
unsigned wsba_v_ptp : 1;
unsigned wsba_v_rsvd1 : 17;
unsigned wsba_v_addr : 12;
unsigned wsba_v_rsvd2 : 32;
} wsba_r_bits;
int wsba_q_whole [2];
};
/*
* TSUNAMI Pchip Control Register
*/
#define pctl_m_fdsc 0x1
#define pctl_m_fbtb 0x2
#define pctl_m_thdis 0x4
#define pctl_m_chaindis 0x8
#define pctl_m_tgtlat 0x10
#define pctl_m_hole 0x20
#define pctl_m_mwin 0x40
#define pctl_m_arbena 0x80
#define pctl_m_prigrp 0x7F00
#define pctl_m_ppri 0x8000
#define pctl_m_rsvd1 0x30000
#define pctl_m_eccen 0x40000
#define pctl_m_padm 0x80000
#define pctl_m_cdqmax 0xF00000
#define pctl_m_rev 0xFF000000
#define pctl_m_crqmax 0xF00000000UL
#define pctl_m_ptpmax 0xF000000000UL
#define pctl_m_pclkx 0x30000000000UL
#define pctl_m_fdsdis 0x40000000000UL
#define pctl_m_fdwdis 0x80000000000UL
#define pctl_m_ptevrfy 0x100000000000UL
#define pctl_m_rpp 0x200000000000UL
#define pctl_m_pid 0xC00000000000UL
#define pctl_m_rsvd2 0xFFFF000000000000UL
union TPchipPCTL {
struct {
unsigned pctl_v_fdsc : 1;
unsigned pctl_v_fbtb : 1;
unsigned pctl_v_thdis : 1;
unsigned pctl_v_chaindis : 1;
unsigned pctl_v_tgtlat : 1;
unsigned pctl_v_hole : 1;
unsigned pctl_v_mwin : 1;
unsigned pctl_v_arbena : 1;
unsigned pctl_v_prigrp : 7;
unsigned pctl_v_ppri : 1;
unsigned pctl_v_rsvd1 : 2;
unsigned pctl_v_eccen : 1;
unsigned pctl_v_padm : 1;
unsigned pctl_v_cdqmax : 4;
unsigned pctl_v_rev : 8;
unsigned pctl_v_crqmax : 4;
unsigned pctl_v_ptpmax : 4;
unsigned pctl_v_pclkx : 2;
unsigned pctl_v_fdsdis : 1;
unsigned pctl_v_fdwdis : 1;
unsigned pctl_v_ptevrfy : 1;
unsigned pctl_v_rpp : 1;
unsigned pctl_v_pid : 2;
unsigned pctl_v_rsvd2 : 16;
} pctl_r_bits;
int pctl_q_whole [2];
};
/*
* TSUNAMI Pchip Error Mask Register.
*/
#define perrmask_m_lost 0x1
#define perrmask_m_serr 0x2
#define perrmask_m_perr 0x4
#define perrmask_m_dcrto 0x8
#define perrmask_m_sge 0x10
#define perrmask_m_ape 0x20
#define perrmask_m_ta 0x40
#define perrmask_m_rdpe 0x80
#define perrmask_m_nds 0x100
#define perrmask_m_rto 0x200
#define perrmask_m_uecc 0x400
#define perrmask_m_cre 0x800
#define perrmask_m_rsvd 0xFFFFFFFFFFFFF000UL
union TPchipPERRMASK {
struct {
unsigned int perrmask_v_lost : 1;
unsigned perrmask_v_serr : 1;
unsigned perrmask_v_perr : 1;
unsigned perrmask_v_dcrto : 1;
unsigned perrmask_v_sge : 1;
unsigned perrmask_v_ape : 1;
unsigned perrmask_v_ta : 1;
unsigned perrmask_v_rdpe : 1;
unsigned perrmask_v_nds : 1;
unsigned perrmask_v_rto : 1;
unsigned perrmask_v_uecc : 1;
unsigned perrmask_v_cre : 1;
unsigned perrmask_v_rsvd1 : 20;
unsigned perrmask_v_rsvd2 : 32;
} perrmask_r_bits;
int perrmask_q_whole [2];
};
/*
* Memory spaces:
*/
#define TSUNAMI_HOSE(h) (((unsigned long)(h)) << 33)
#define TSUNAMI_BASE (IDENT_ADDR + TS_BIAS)
#define TSUNAMI_MEM(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x000000000UL)
#define _TSUNAMI_IACK_SC(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1F8000000UL)
#define TSUNAMI_IO(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FC000000UL)
#define TSUNAMI_CONF(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FE000000UL)
#define TSUNAMI_IACK_SC _TSUNAMI_IACK_SC(0) /* hack! */
/*
* The canonical non-remaped I/O and MEM addresses have these values
* subtracted out. This is arranged so that folks manipulating ISA
* devices can use their familiar numbers and have them map to bus 0.
*/
#define TSUNAMI_IO_BIAS TSUNAMI_IO(0)
#define TSUNAMI_MEM_BIAS TSUNAMI_MEM(0)
/* The IO address space is larger than 0xffff */
#define TSUNAMI_IO_SPACE (TSUNAMI_CONF(0) - TSUNAMI_IO(0))
/* Offset between ram physical addresses and pci64 DAC bus addresses. */
#define TSUNAMI_DAC_OFFSET (1UL << 40)
/*
* Data structure for handling TSUNAMI machine checks:
*/
struct el_TSUNAMI_sysdata_mcheck {
};
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* I/O functions:
*
* TSUNAMI, the 21??? PCI/memory support chipset for the EV6 (21264)
* can only use linear accesses to get at PCI memory and I/O spaces.
*/
/*
* Memory functions. all accesses are done through linear space.
*/
__EXTERN_INLINE void __iomem *tsunami_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + TSUNAMI_IO_BIAS);
}
__EXTERN_INLINE void __iomem *tsunami_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + TSUNAMI_MEM_BIAS);
}
__EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
{
return addr >= TSUNAMI_BASE;
}
__EXTERN_INLINE int tsunami_is_mmio(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
return (addr & 0x100000000UL) == 0;
}
#undef __IO_PREFIX
#define __IO_PREFIX tsunami
#define tsunami_trivial_rw_bw 1
#define tsunami_trivial_rw_lq 1
#define tsunami_trivial_io_bw 1
#define tsunami_trivial_io_lq 1
#define tsunami_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_TSUNAMI__H__ */

View File

@@ -0,0 +1,318 @@
#ifndef __ALPHA_WILDFIRE__H__
#define __ALPHA_WILDFIRE__H__
#include <linux/types.h>
#include <asm/compiler.h>
#define WILDFIRE_MAX_QBB 8 /* more than 8 requires other mods */
#define WILDFIRE_PCA_PER_QBB 4
#define WILDFIRE_IRQ_PER_PCA 64
#define WILDFIRE_NR_IRQS \
(WILDFIRE_MAX_QBB * WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA)
extern unsigned char wildfire_hard_qbb_map[WILDFIRE_MAX_QBB];
extern unsigned char wildfire_soft_qbb_map[WILDFIRE_MAX_QBB];
#define QBB_MAP_EMPTY 0xff
extern unsigned long wildfire_hard_qbb_mask;
extern unsigned long wildfire_soft_qbb_mask;
extern unsigned long wildfire_gp_mask;
extern unsigned long wildfire_hs_mask;
extern unsigned long wildfire_iop_mask;
extern unsigned long wildfire_ior_mask;
extern unsigned long wildfire_pca_mask;
extern unsigned long wildfire_cpu_mask;
extern unsigned long wildfire_mem_mask;
#define WILDFIRE_QBB_EXISTS(qbbno) (wildfire_soft_qbb_mask & (1 << (qbbno)))
#define WILDFIRE_MEM_EXISTS(qbbno) (wildfire_mem_mask & (0xf << ((qbbno) << 2)))
#define WILDFIRE_PCA_EXISTS(qbbno, pcano) \
(wildfire_pca_mask & (1 << (((qbbno) << 2) + (pcano))))
typedef struct {
volatile unsigned long csr __attribute__((aligned(64)));
} wildfire_64;
typedef struct {
volatile unsigned long csr __attribute__((aligned(256)));
} wildfire_256;
typedef struct {
volatile unsigned long csr __attribute__((aligned(2048)));
} wildfire_2k;
typedef struct {
wildfire_64 qsd_whami;
wildfire_64 qsd_rev;
wildfire_64 qsd_port_present;
wildfire_64 qsd_port_active;
wildfire_64 qsd_fault_ena;
wildfire_64 qsd_cpu_int_ena;
wildfire_64 qsd_mem_config;
wildfire_64 qsd_err_sum;
wildfire_64 ce_sum[4];
wildfire_64 dev_init[4];
wildfire_64 it_int[4];
wildfire_64 ip_int[4];
wildfire_64 uce_sum[4];
wildfire_64 se_sum__non_dev_int[4];
wildfire_64 scratch[4];
wildfire_64 qsd_timer;
wildfire_64 qsd_diag;
} wildfire_qsd;
typedef struct {
wildfire_256 qsd_whami;
wildfire_256 __pad1;
wildfire_256 ce_sum;
wildfire_256 dev_init;
wildfire_256 it_int;
wildfire_256 ip_int;
wildfire_256 uce_sum;
wildfire_256 se_sum;
} wildfire_fast_qsd;
typedef struct {
wildfire_2k qsa_qbb_id;
wildfire_2k __pad1;
wildfire_2k qsa_port_ena;
wildfire_2k qsa_scratch;
wildfire_2k qsa_config[5];
wildfire_2k qsa_ref_int;
wildfire_2k qsa_qbb_pop[2];
wildfire_2k qsa_dtag_fc;
wildfire_2k __pad2[3];
wildfire_2k qsa_diag;
wildfire_2k qsa_diag_lock[4];
wildfire_2k __pad3[11];
wildfire_2k qsa_cpu_err_sum;
wildfire_2k qsa_misc_err_sum;
wildfire_2k qsa_tmo_err_sum;
wildfire_2k qsa_err_ena;
wildfire_2k qsa_tmo_config;
wildfire_2k qsa_ill_cmd_err_sum;
wildfire_2k __pad4[26];
wildfire_2k qsa_busy_mask;
wildfire_2k qsa_arr_valid;
wildfire_2k __pad5[2];
wildfire_2k qsa_port_map[4];
wildfire_2k qsa_arr_addr[8];
wildfire_2k qsa_arr_mask[8];
} wildfire_qsa;
typedef struct {
wildfire_64 ioa_config;
wildfire_64 iod_config;
wildfire_64 iop_switch_credits;
wildfire_64 __pad1;
wildfire_64 iop_hose_credits;
wildfire_64 __pad2[11];
struct {
wildfire_64 __pad3;
wildfire_64 init;
} iop_hose[4];
wildfire_64 ioa_hose_0_ctrl;
wildfire_64 iod_hose_0_ctrl;
wildfire_64 ioa_hose_1_ctrl;
wildfire_64 iod_hose_1_ctrl;
wildfire_64 ioa_hose_2_ctrl;
wildfire_64 iod_hose_2_ctrl;
wildfire_64 ioa_hose_3_ctrl;
wildfire_64 iod_hose_3_ctrl;
struct {
wildfire_64 target;
wildfire_64 __pad4;
} iop_dev_int[4];
wildfire_64 iop_err_int_target;
wildfire_64 __pad5[7];
wildfire_64 iop_qbb_err_sum;
wildfire_64 __pad6;
wildfire_64 iop_qbb_se_sum;
wildfire_64 __pad7;
wildfire_64 ioa_err_sum;
wildfire_64 iod_err_sum;
wildfire_64 __pad8[4];
wildfire_64 ioa_diag_force_err;
wildfire_64 iod_diag_force_err;
wildfire_64 __pad9[4];
wildfire_64 iop_diag_send_err_int;
wildfire_64 __pad10[15];
wildfire_64 ioa_scratch;
wildfire_64 iod_scratch;
} wildfire_iop;
typedef struct {
wildfire_2k gpa_qbb_map[4];
wildfire_2k gpa_mem_pop_map;
wildfire_2k gpa_scratch;
wildfire_2k gpa_diag;
wildfire_2k gpa_config_0;
wildfire_2k __pad1;
wildfire_2k gpa_init_id;
wildfire_2k gpa_config_2;
/* not complete */
} wildfire_gp;
typedef struct {
wildfire_64 pca_what_am_i;
wildfire_64 pca_err_sum;
wildfire_64 pca_diag_force_err;
wildfire_64 pca_diag_send_err_int;
wildfire_64 pca_hose_credits;
wildfire_64 pca_scratch;
wildfire_64 pca_micro_addr;
wildfire_64 pca_micro_data;
wildfire_64 pca_pend_int;
wildfire_64 pca_sent_int;
wildfire_64 __pad1;
wildfire_64 pca_stdio_edge_level;
wildfire_64 __pad2[52];
struct {
wildfire_64 target;
wildfire_64 enable;
} pca_int[4];
wildfire_64 __pad3[56];
wildfire_64 pca_alt_sent_int[32];
} wildfire_pca;
typedef struct {
wildfire_64 ne_what_am_i;
/* not complete */
} wildfire_ne;
typedef struct {
wildfire_64 fe_what_am_i;
/* not complete */
} wildfire_fe;
typedef struct {
wildfire_64 pci_io_addr_ext;
wildfire_64 pci_ctrl;
wildfire_64 pci_err_sum;
wildfire_64 pci_err_addr;
wildfire_64 pci_stall_cnt;
wildfire_64 pci_iack_special;
wildfire_64 __pad1[2];
wildfire_64 pci_pend_int;
wildfire_64 pci_sent_int;
wildfire_64 __pad2[54];
struct {
wildfire_64 wbase;
wildfire_64 wmask;
wildfire_64 tbase;
} pci_window[4];
wildfire_64 pci_flush_tlb;
wildfire_64 pci_perf_mon;
} wildfire_pci;
#define WILDFIRE_ENTITY_SHIFT 18
#define WILDFIRE_GP_ENTITY (0x10UL << WILDFIRE_ENTITY_SHIFT)
#define WILDFIRE_IOP_ENTITY (0x08UL << WILDFIRE_ENTITY_SHIFT)
#define WILDFIRE_QSA_ENTITY (0x04UL << WILDFIRE_ENTITY_SHIFT)
#define WILDFIRE_QSD_ENTITY_SLOW (0x05UL << WILDFIRE_ENTITY_SHIFT)
#define WILDFIRE_QSD_ENTITY_FAST (0x01UL << WILDFIRE_ENTITY_SHIFT)
#define WILDFIRE_PCA_ENTITY(pca) ((0xc|(pca))<<WILDFIRE_ENTITY_SHIFT)
#define WILDFIRE_BASE (IDENT_ADDR | (1UL << 40))
#define WILDFIRE_QBB_MASK 0x0fUL /* for now, only 4 bits/16 QBBs */
#define WILDFIRE_QBB(q) ((~((long)(q)) & WILDFIRE_QBB_MASK) << 36)
#define WILDFIRE_HOSE(h) ((long)(h) << 33)
#define WILDFIRE_QBB_IO(q) (WILDFIRE_BASE | WILDFIRE_QBB(q))
#define WILDFIRE_QBB_HOSE(q,h) (WILDFIRE_QBB_IO(q) | WILDFIRE_HOSE(h))
#define WILDFIRE_MEM(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x000000000UL)
#define WILDFIRE_CONF(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FE000000UL)
#define WILDFIRE_IO(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FF000000UL)
#define WILDFIRE_qsd(q) \
((wildfire_qsd *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSD_ENTITY_SLOW|(((1UL<<13)-1)<<23)))
#define WILDFIRE_fast_qsd() \
((wildfire_fast_qsd *)(WILDFIRE_QBB_IO(0)|WILDFIRE_QSD_ENTITY_FAST|(((1UL<<13)-1)<<23)))
#define WILDFIRE_qsa(q) \
((wildfire_qsa *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSA_ENTITY|(((1UL<<13)-1)<<23)))
#define WILDFIRE_iop(q) \
((wildfire_iop *)(WILDFIRE_QBB_IO(q)|WILDFIRE_IOP_ENTITY|(((1UL<<13)-1)<<23)))
#define WILDFIRE_gp(q) \
((wildfire_gp *)(WILDFIRE_QBB_IO(q)|WILDFIRE_GP_ENTITY|(((1UL<<13)-1)<<23)))
#define WILDFIRE_pca(q,pca) \
((wildfire_pca *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)))
#define WILDFIRE_ne(q,pca) \
((wildfire_ne *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(1UL<<16)))
#define WILDFIRE_fe(q,pca) \
((wildfire_fe *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(3UL<<15)))
#define WILDFIRE_pci(q,h) \
((wildfire_pci *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(((h)&6)>>1)|((((h)&1)|2)<<16)|(((1UL<<13)-1)<<23)))
#define WILDFIRE_IO_BIAS WILDFIRE_IO(0,0)
#define WILDFIRE_MEM_BIAS WILDFIRE_MEM(0,0) /* ??? */
/* The IO address space is larger than 0xffff */
#define WILDFIRE_IO_SPACE (8UL*1024*1024)
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* Memory functions. all accesses are done through linear space.
*/
__EXTERN_INLINE void __iomem *wildfire_ioportmap(unsigned long addr)
{
return (void __iomem *)(addr + WILDFIRE_IO_BIAS);
}
__EXTERN_INLINE void __iomem *wildfire_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + WILDFIRE_MEM_BIAS);
}
__EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr)
{
return addr >= WILDFIRE_BASE;
}
__EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long)addr;
return (addr & 0x100000000UL) == 0;
}
#undef __IO_PREFIX
#define __IO_PREFIX wildfire
#define wildfire_trivial_rw_bw 1
#define wildfire_trivial_rw_lq 1
#define wildfire_trivial_io_bw 1
#define wildfire_trivial_io_lq 1
#define wildfire_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_WILDFIRE__H__ */

View File

@@ -0,0 +1,9 @@
#ifndef _ALPHA_CURRENT_H
#define _ALPHA_CURRENT_H
#include <linux/thread_info.h>
#define get_current() (current_thread_info()->task + 0)
#define current get_current()
#endif /* _ALPHA_CURRENT_H */

View File

@@ -0,0 +1,10 @@
#ifndef __ALPHA_DELAY_H
#define __ALPHA_DELAY_H
extern void __delay(int loops);
extern void udelay(unsigned long usecs);
extern void ndelay(unsigned long nsecs);
#define ndelay ndelay
#endif /* defined(__ALPHA_DELAY_H) */

View File

@@ -0,0 +1 @@
#include <asm-generic/div64.h>

View File

@@ -0,0 +1,63 @@
#ifndef _ALPHA_DMA_MAPPING_H
#define _ALPHA_DMA_MAPPING_H
#include <linux/config.h>
#ifdef CONFIG_PCI
#include <linux/pci.h>
#define dma_map_single(dev, va, size, dir) \
pci_map_single(alpha_gendev_to_pci(dev), va, size, dir)
#define dma_unmap_single(dev, addr, size, dir) \
pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir)
#define dma_alloc_coherent(dev, size, addr, gfp) \
pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr)
#define dma_free_coherent(dev, size, va, addr) \
pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr)
#define dma_map_page(dev, page, off, size, dir) \
pci_map_single(alpha_gendev_to_pci(dev), page, off, size, dir)
#define dma_unmap_page(dev, addr, size, dir) \
pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir)
#define dma_map_sg(dev, sg, nents, dir) \
pci_map_sg(alpha_gendev_to_pci(dev), sg, nents, dir)
#define dma_unmap_sg(dev, sg, nents, dir) \
pci_unmap_sg(alpha_gendev_to_pci(dev), sg, nents, dir)
#define dma_supported(dev, mask) \
pci_dma_supported(alpha_gendev_to_pci(dev), mask)
#else /* no PCI - no IOMMU. */
void *dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, int gfp);
int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction direction);
#define dma_free_coherent(dev, size, va, addr) \
free_pages((unsigned long)va, get_order(size))
#define dma_supported(dev, mask) (mask < 0x00ffffffUL ? 0 : 1)
#define dma_map_single(dev, va, size, dir) virt_to_phys(va)
#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off)
#define dma_unmap_single(dev, addr, size, dir) do { } while (0)
#define dma_unmap_page(dev, addr, size, dir) do { } while (0)
#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0)
#endif /* !CONFIG_PCI */
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
#define dma_is_consistent(dev) (1)
int dma_set_mask(struct device *dev, u64 mask);
#define dma_sync_single_for_cpu(dev, addr, size, dir) do { } while (0)
#define dma_sync_single_for_device(dev, addr, size, dir) do { } while (0)
#define dma_sync_single_range(dev, addr, off, size, dir) do { } while (0)
#define dma_sync_sg_for_cpu(dev, sg, nents, dir) do { } while (0)
#define dma_sync_sg_for_device(dev, sg, nents, dir) do { } while (0)
#define dma_cache_sync(va, size, dir) do { } while (0)
#define dma_get_cache_alignment() L1_CACHE_BYTES
#endif /* _ALPHA_DMA_MAPPING_H */

View File

@@ -0,0 +1,377 @@
/*
* include/asm-alpha/dma.h
*
* This is essentially the same as the i386 DMA stuff, as the AlphaPCs
* use ISA-compatible dma. The only extension is support for high-page
* registers that allow to set the top 8 bits of a 32-bit DMA address.
* This register should be written last when setting up a DMA address
* as this will also enable DMA across 64 KB boundaries.
*/
/* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $
* linux/include/asm/dma.h: Defines for using and allocating dma channels.
* Written by Hennus Bergman, 1992.
* High DMA channel support & info by Hannu Savolainen
* and John Boyd, Nov. 1992.
*/
#ifndef _ASM_DMA_H
#define _ASM_DMA_H
#include <linux/config.h>
#include <linux/spinlock.h>
#include <asm/io.h>
#define dma_outb outb
#define dma_inb inb
/*
* NOTES about DMA transfers:
*
* controller 1: channels 0-3, byte operations, ports 00-1F
* controller 2: channels 4-7, word operations, ports C0-DF
*
* - ALL registers are 8 bits only, regardless of transfer size
* - channel 4 is not used - cascades 1 into 2.
* - channels 0-3 are byte - addresses/counts are for physical bytes
* - channels 5-7 are word - addresses/counts are for physical words
* - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
* - transfer count loaded to registers is 1 less than actual count
* - controller 2 offsets are all even (2x offsets for controller 1)
* - page registers for 5-7 don't use data bit 0, represent 128K pages
* - page registers for 0-3 use bit 0, represent 64K pages
*
* DMA transfers are limited to the lower 16MB of _physical_ memory.
* Note that addresses loaded into registers must be _physical_ addresses,
* not logical addresses (which may differ if paging is active).
*
* Address mapping for channels 0-3:
*
* A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
* | ... | | ... | | ... |
* | ... | | ... | | ... |
* | ... | | ... | | ... |
* P7 ... P0 A7 ... A0 A7 ... A0
* | Page | Addr MSB | Addr LSB | (DMA registers)
*
* Address mapping for channels 5-7:
*
* A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
* | ... | \ \ ... \ \ \ ... \ \
* | ... | \ \ ... \ \ \ ... \ (not used)
* | ... | \ \ ... \ \ \ ... \
* P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
* | Page | Addr MSB | Addr LSB | (DMA registers)
*
* Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
* and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
* the hardware level, so odd-byte transfers aren't possible).
*
* Transfer count (_not # bytes_) is limited to 64K, represented as actual
* count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
* and up to 128K bytes may be transferred on channels 5-7 in one operation.
*
*/
#define MAX_DMA_CHANNELS 8
/*
ISA DMA limitations on Alpha platforms,
These may be due to SIO (PCI<->ISA bridge) chipset limitation, or
just a wiring limit.
*/
/* The maximum address for ISA DMA transfer on Alpha XL, due to an
hardware SIO limitation, is 64MB.
*/
#define ALPHA_XL_MAX_ISA_DMA_ADDRESS 0x04000000UL
/* The maximum address for ISA DMA transfer on RUFFIAN,
due to an hardware SIO limitation, is 16MB.
*/
#define ALPHA_RUFFIAN_MAX_ISA_DMA_ADDRESS 0x01000000UL
/* The maximum address for ISA DMA transfer on SABLE, and some ALCORs,
due to an hardware SIO chip limitation, is 2GB.
*/
#define ALPHA_SABLE_MAX_ISA_DMA_ADDRESS 0x80000000UL
#define ALPHA_ALCOR_MAX_ISA_DMA_ADDRESS 0x80000000UL
/*
Maximum address for all the others is the complete 32-bit bus
address space.
*/
#define ALPHA_MAX_ISA_DMA_ADDRESS 0x100000000UL
#ifdef CONFIG_ALPHA_GENERIC
# define MAX_ISA_DMA_ADDRESS (alpha_mv.max_isa_dma_address)
#else
# if defined(CONFIG_ALPHA_XL)
# define MAX_ISA_DMA_ADDRESS ALPHA_XL_MAX_ISA_DMA_ADDRESS
# elif defined(CONFIG_ALPHA_RUFFIAN)
# define MAX_ISA_DMA_ADDRESS ALPHA_RUFFIAN_MAX_ISA_DMA_ADDRESS
# elif defined(CONFIG_ALPHA_SABLE)
# define MAX_ISA_DMA_ADDRESS ALPHA_SABLE_MAX_ISA_DMA_ADDRESS
# elif defined(CONFIG_ALPHA_ALCOR)
# define MAX_ISA_DMA_ADDRESS ALPHA_ALCOR_MAX_ISA_DMA_ADDRESS
# else
# define MAX_ISA_DMA_ADDRESS ALPHA_MAX_ISA_DMA_ADDRESS
# endif
#endif
/* If we have the iommu, we don't have any address limitations on DMA.
Otherwise (Nautilus, RX164), we have to have 0-16 Mb DMA zone
like i386. */
#define MAX_DMA_ADDRESS (alpha_mv.mv_pci_tbi ? \
~0UL : IDENT_ADDR + 0x01000000)
/* 8237 DMA controllers */
#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
/* DMA controller registers */
#define DMA1_CMD_REG 0x08 /* command register (w) */
#define DMA1_STAT_REG 0x08 /* status register (r) */
#define DMA1_REQ_REG 0x09 /* request register (w) */
#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
#define DMA1_MODE_REG 0x0B /* mode register (w) */
#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
#define DMA1_EXT_MODE_REG (0x400 | DMA1_MODE_REG)
#define DMA2_CMD_REG 0xD0 /* command register (w) */
#define DMA2_STAT_REG 0xD0 /* status register (r) */
#define DMA2_REQ_REG 0xD2 /* request register (w) */
#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
#define DMA2_MODE_REG 0xD6 /* mode register (w) */
#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
#define DMA2_EXT_MODE_REG (0x400 | DMA2_MODE_REG)
#define DMA_ADDR_0 0x00 /* DMA address registers */
#define DMA_ADDR_1 0x02
#define DMA_ADDR_2 0x04
#define DMA_ADDR_3 0x06
#define DMA_ADDR_4 0xC0
#define DMA_ADDR_5 0xC4
#define DMA_ADDR_6 0xC8
#define DMA_ADDR_7 0xCC
#define DMA_CNT_0 0x01 /* DMA count registers */
#define DMA_CNT_1 0x03
#define DMA_CNT_2 0x05
#define DMA_CNT_3 0x07
#define DMA_CNT_4 0xC2
#define DMA_CNT_5 0xC6
#define DMA_CNT_6 0xCA
#define DMA_CNT_7 0xCE
#define DMA_PAGE_0 0x87 /* DMA page registers */
#define DMA_PAGE_1 0x83
#define DMA_PAGE_2 0x81
#define DMA_PAGE_3 0x82
#define DMA_PAGE_5 0x8B
#define DMA_PAGE_6 0x89
#define DMA_PAGE_7 0x8A
#define DMA_HIPAGE_0 (0x400 | DMA_PAGE_0)
#define DMA_HIPAGE_1 (0x400 | DMA_PAGE_1)
#define DMA_HIPAGE_2 (0x400 | DMA_PAGE_2)
#define DMA_HIPAGE_3 (0x400 | DMA_PAGE_3)
#define DMA_HIPAGE_4 (0x400 | DMA_PAGE_4)
#define DMA_HIPAGE_5 (0x400 | DMA_PAGE_5)
#define DMA_HIPAGE_6 (0x400 | DMA_PAGE_6)
#define DMA_HIPAGE_7 (0x400 | DMA_PAGE_7)
#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
#define DMA_AUTOINIT 0x10
extern spinlock_t dma_spin_lock;
static __inline__ unsigned long claim_dma_lock(void)
{
unsigned long flags;
spin_lock_irqsave(&dma_spin_lock, flags);
return flags;
}
static __inline__ void release_dma_lock(unsigned long flags)
{
spin_unlock_irqrestore(&dma_spin_lock, flags);
}
/* enable/disable a specific DMA channel */
static __inline__ void enable_dma(unsigned int dmanr)
{
if (dmanr<=3)
dma_outb(dmanr, DMA1_MASK_REG);
else
dma_outb(dmanr & 3, DMA2_MASK_REG);
}
static __inline__ void disable_dma(unsigned int dmanr)
{
if (dmanr<=3)
dma_outb(dmanr | 4, DMA1_MASK_REG);
else
dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
}
/* Clear the 'DMA Pointer Flip Flop'.
* Write 0 for LSB/MSB, 1 for MSB/LSB access.
* Use this once to initialize the FF to a known state.
* After that, keep track of it. :-)
* --- In order to do that, the DMA routines below should ---
* --- only be used while interrupts are disabled! ---
*/
static __inline__ void clear_dma_ff(unsigned int dmanr)
{
if (dmanr<=3)
dma_outb(0, DMA1_CLEAR_FF_REG);
else
dma_outb(0, DMA2_CLEAR_FF_REG);
}
/* set mode (above) for a specific DMA channel */
static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
{
if (dmanr<=3)
dma_outb(mode | dmanr, DMA1_MODE_REG);
else
dma_outb(mode | (dmanr&3), DMA2_MODE_REG);
}
/* set extended mode for a specific DMA channel */
static __inline__ void set_dma_ext_mode(unsigned int dmanr, char ext_mode)
{
if (dmanr<=3)
dma_outb(ext_mode | dmanr, DMA1_EXT_MODE_REG);
else
dma_outb(ext_mode | (dmanr&3), DMA2_EXT_MODE_REG);
}
/* Set only the page register bits of the transfer address.
* This is used for successive transfers when we know the contents of
* the lower 16 bits of the DMA current address register.
*/
static __inline__ void set_dma_page(unsigned int dmanr, unsigned int pagenr)
{
switch(dmanr) {
case 0:
dma_outb(pagenr, DMA_PAGE_0);
dma_outb((pagenr >> 8), DMA_HIPAGE_0);
break;
case 1:
dma_outb(pagenr, DMA_PAGE_1);
dma_outb((pagenr >> 8), DMA_HIPAGE_1);
break;
case 2:
dma_outb(pagenr, DMA_PAGE_2);
dma_outb((pagenr >> 8), DMA_HIPAGE_2);
break;
case 3:
dma_outb(pagenr, DMA_PAGE_3);
dma_outb((pagenr >> 8), DMA_HIPAGE_3);
break;
case 5:
dma_outb(pagenr & 0xfe, DMA_PAGE_5);
dma_outb((pagenr >> 8), DMA_HIPAGE_5);
break;
case 6:
dma_outb(pagenr & 0xfe, DMA_PAGE_6);
dma_outb((pagenr >> 8), DMA_HIPAGE_6);
break;
case 7:
dma_outb(pagenr & 0xfe, DMA_PAGE_7);
dma_outb((pagenr >> 8), DMA_HIPAGE_7);
break;
}
}
/* Set transfer address & page bits for specific DMA channel.
* Assumes dma flipflop is clear.
*/
static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
{
if (dmanr <= 3) {
dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
} else {
dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
}
set_dma_page(dmanr, a>>16); /* set hipage last to enable 32-bit mode */
}
/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
* a specific DMA channel.
* You must ensure the parameters are valid.
* NOTE: from a manual: "the number of transfers is one more
* than the initial word count"! This is taken into account.
* Assumes dma flip-flop is clear.
* NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
*/
static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
{
count--;
if (dmanr <= 3) {
dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
} else {
dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
}
}
/* Get DMA residue count. After a DMA transfer, this
* should return zero. Reading this while a DMA transfer is
* still in progress will return unpredictable results.
* If called before the channel has been used, it may return 1.
* Otherwise, it returns the number of _bytes_ left to transfer.
*
* Assumes DMA flip-flop is clear.
*/
static __inline__ int get_dma_residue(unsigned int dmanr)
{
unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
: ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
/* using short to get 16-bit wrap around */
unsigned short count;
count = 1 + dma_inb(io_port);
count += dma_inb(io_port) << 8;
return (dmanr<=3)? count : (count<<1);
}
/* These are in kernel/dma.c: */
extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
#define KERNEL_HAVE_CHECK_DMA
extern int check_dma(unsigned int dmanr);
/* From PCI */
#ifdef CONFIG_PCI
extern int isa_dma_bridge_buggy;
#else
#define isa_dma_bridge_buggy (0)
#endif
#endif /* _ASM_DMA_H */

View File

@@ -0,0 +1,185 @@
#ifndef __ASM_ALPHA_ELF_H
#define __ASM_ALPHA_ELF_H
/* Special values for the st_other field in the symbol table. */
#define STO_ALPHA_NOPV 0x80
#define STO_ALPHA_STD_GPLOAD 0x88
/*
* Alpha ELF relocation types
*/
#define R_ALPHA_NONE 0 /* No reloc */
#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
#define R_ALPHA_BRSGP 28
#define R_ALPHA_TLSGD 29
#define R_ALPHA_TLS_LDM 30
#define R_ALPHA_DTPMOD64 31
#define R_ALPHA_GOTDTPREL 32
#define R_ALPHA_DTPREL64 33
#define R_ALPHA_DTPRELHI 34
#define R_ALPHA_DTPRELLO 35
#define R_ALPHA_DTPREL16 36
#define R_ALPHA_GOTTPREL 37
#define R_ALPHA_TPREL64 38
#define R_ALPHA_TPRELHI 39
#define R_ALPHA_TPRELLO 40
#define R_ALPHA_TPREL16 41
#define SHF_ALPHA_GPREL 0x10000000
/* Legal values for e_flags field of Elf64_Ehdr. */
#define EF_ALPHA_32BIT 1 /* All addresses are below 2GB */
/*
* ELF register definitions..
*/
/*
* The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
* I have no idea why that is so. For now, we just leave it at 33
* (32 general regs + processor status word).
*/
#define ELF_NGREG 33
#define ELF_NFPREG 32
typedef unsigned long elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
/*
* These are used to set parameters in the core dumps.
*/
#define ELF_CLASS ELFCLASS64
#define ELF_DATA ELFDATA2LSB
#define ELF_ARCH EM_ALPHA
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 8192
/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
use of this is to invoke "./ld.so someprog" to test out a new version of
the loader. We need to make sure that it is out of the way of the program
that it will "exec", and that there is sufficient room for the brk. */
#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
/* $0 is set by ld.so to a pointer to a function which might be
registered using atexit. This provides a mean for the dynamic
linker to call DT_FINI functions for shared libraries that have
been loaded before the code runs.
So that we can use the same startup file with static executables,
we start programs with a value of 0 to indicate that there is no
such function. */
#define ELF_PLAT_INIT(_r, load_addr) _r->r0 = 0
/* The registers are layed out in pt_regs for PAL and syscall
convenience. Re-order them for the linear elf_gregset_t. */
struct pt_regs;
struct thread_info;
struct task_struct;
extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
struct thread_info *ti);
#define ELF_CORE_COPY_REGS(DEST, REGS) \
dump_elf_thread(DEST, REGS, current_thread_info());
/* Similar, but for a thread other than current. */
extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
#define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
dump_elf_task(*(DEST), TASK)
/* Similar, but for the FP registers. */
extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
#define ELF_CORE_COPY_FPREGS(TASK, DEST) \
dump_elf_task_fp(*(DEST), TASK)
/* This yields a mask that user programs can use to figure out what
instruction set this CPU supports. This is trivial on Alpha,
but not so on other machines. */
#define ELF_HWCAP (~amask(-1))
/* This yields a string that ld.so will use to load implementation
specific libraries for optimization. This is more specific in
intent than poking at uname or /proc/cpuinfo. */
#define ELF_PLATFORM \
({ \
enum implver_enum i_ = implver(); \
( i_ == IMPLVER_EV4 ? "ev4" \
: i_ == IMPLVER_EV5 \
? (amask(AMASK_BWX) ? "ev5" : "ev56") \
: amask (AMASK_CIX) ? "ev6" : "ev67"); \
})
/* Reserve these numbers for any future use of a VDSO. */
#if 0
#define AT_SYSINFO 32
#define AT_SYSINFO_EHDR 33
#endif
/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
value is -1, then the cache doesn't exist. Otherwise:
bit 0-3: Cache set-associativity; 0 means fully associative.
bit 4-7: Log2 of cacheline size.
bit 8-31: Size of the entire cache >> 8.
bit 32-63: Reserved.
*/
#define AT_L1I_CACHESHAPE 34
#define AT_L1D_CACHESHAPE 35
#define AT_L2_CACHESHAPE 36
#define AT_L3_CACHESHAPE 37
#ifdef __KERNEL__
#define SET_PERSONALITY(EX, IBCS2) \
set_personality(((EX).e_flags & EF_ALPHA_32BIT) \
? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
extern int alpha_l1i_cacheshape;
extern int alpha_l1d_cacheshape;
extern int alpha_l2_cacheshape;
extern int alpha_l3_cacheshape;
#define ARCH_DLINFO \
do { \
NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape); \
NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape); \
NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape); \
NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape); \
} while (0)
#endif /* __KERNEL__ */
#endif /* __ASM_ALPHA_ELF_H */

View File

@@ -0,0 +1,118 @@
/*
* linux/include/asm-alpha/err_common.h
*
* Copyright (C) 2000 Jeff Wiedemeier (Compaq Computer Corporation)
*
* Contains declarations and macros to support Alpha error handling
* implementations.
*/
#ifndef __ALPHA_ERR_COMMON_H
#define __ALPHA_ERR_COMMON_H 1
/*
* SCB Vector definitions
*/
#define SCB_Q_SYSERR 0x620
#define SCB_Q_PROCERR 0x630
#define SCB_Q_SYSMCHK 0x660
#define SCB_Q_PROCMCHK 0x670
#define SCB_Q_SYSEVENT 0x680
/*
* Disposition definitions for logout frame parser
*/
#define MCHK_DISPOSITION_UNKNOWN_ERROR 0x00
#define MCHK_DISPOSITION_REPORT 0x01
#define MCHK_DISPOSITION_DISMISS 0x02
/*
* Error Log definitions
*/
/*
* Types
*/
#define EL_CLASS__TERMINATION (0)
# define EL_TYPE__TERMINATION__TERMINATION (0)
#define EL_CLASS__HEADER (5)
# define EL_TYPE__HEADER__SYSTEM_ERROR_FRAME (1)
# define EL_TYPE__HEADER__SYSTEM_EVENT_FRAME (2)
# define EL_TYPE__HEADER__HALT_FRAME (3)
# define EL_TYPE__HEADER__LOGOUT_FRAME (19)
#define EL_CLASS__GENERAL_NOTIFICATION (9)
#define EL_CLASS__PCI_ERROR_FRAME (11)
#define EL_CLASS__REGATTA_FAMILY (12)
# define EL_TYPE__REGATTA__PROCESSOR_ERROR_FRAME (1)
# define EL_TYPE__REGATTA__SYSTEM_ERROR_FRAME (2)
# define EL_TYPE__REGATTA__ENVIRONMENTAL_FRAME (3)
# define EL_TYPE__REGATTA__TITAN_PCHIP0_EXTENDED (8)
# define EL_TYPE__REGATTA__TITAN_PCHIP1_EXTENDED (9)
# define EL_TYPE__REGATTA__TITAN_MEMORY_EXTENDED (10)
# define EL_TYPE__REGATTA__PROCESSOR_DBL_ERROR_HALT (11)
# define EL_TYPE__REGATTA__SYSTEM_DBL_ERROR_HALT (12)
#define EL_CLASS__PAL (14)
# define EL_TYPE__PAL__LOGOUT_FRAME (1)
# define EL_TYPE__PAL__EV7_PROCESSOR (4)
# define EL_TYPE__PAL__EV7_ZBOX (5)
# define EL_TYPE__PAL__EV7_RBOX (6)
# define EL_TYPE__PAL__EV7_IO (7)
# define EL_TYPE__PAL__ENV__AMBIENT_TEMPERATURE (10)
# define EL_TYPE__PAL__ENV__AIRMOVER_FAN (11)
# define EL_TYPE__PAL__ENV__VOLTAGE (12)
# define EL_TYPE__PAL__ENV__INTRUSION (13)
# define EL_TYPE__PAL__ENV__POWER_SUPPLY (14)
# define EL_TYPE__PAL__ENV__LAN (15)
# define EL_TYPE__PAL__ENV__HOT_PLUG (16)
union el_timestamp {
struct {
u8 second;
u8 minute;
u8 hour;
u8 day;
u8 month;
u8 year;
} b;
u64 as_int;
};
struct el_subpacket {
u16 length; /* length of header (in bytes) */
u16 class; /* header class and type... */
u16 type; /* ...determine content */
u16 revision; /* header revision */
union {
struct { /* Class 5, Type 1 - System Error */
u32 frame_length;
u32 frame_packet_count;
} sys_err;
struct { /* Class 5, Type 2 - System Event */
union el_timestamp timestamp;
u32 frame_length;
u32 frame_packet_count;
} sys_event;
struct { /* Class 5, Type 3 - Double Error Halt */
u16 halt_code;
u16 reserved;
union el_timestamp timestamp;
u32 frame_length;
u32 frame_packet_count;
} err_halt;
struct { /* Clasee 5, Type 19 - Logout Frame Header */
u32 frame_length;
u32 frame_flags;
u32 cpu_offset;
u32 system_offset;
} logout_header;
struct { /* Class 12 - Regatta */
u64 cpuid;
u64 data_start[1];
} regatta_frame;
struct { /* Raw */
u64 data_start[1];
} raw;
} by_type;
};
#endif /* __ALPHA_ERR_COMMON_H */

View File

@@ -0,0 +1,6 @@
#ifndef __ALPHA_ERR_EV6_H
#define __ALPHA_ERR_EV6_H 1
/* Dummy include for now. */
#endif /* __ALPHA_ERR_EV6_H */

View File

@@ -0,0 +1,202 @@
#ifndef __ALPHA_ERR_EV7_H
#define __ALPHA_ERR_EV7_H 1
/*
* Data for el packet class PAL (14), type LOGOUT_FRAME (1)
*/
struct ev7_pal_logout_subpacket {
u32 mchk_code;
u32 subpacket_count;
u64 whami;
u64 rbox_whami;
u64 rbox_int;
u64 exc_addr;
union el_timestamp timestamp;
u64 halt_code;
u64 reserved;
};
/*
* Data for el packet class PAL (14), type EV7_PROCESSOR (4)
*/
struct ev7_pal_processor_subpacket {
u64 i_stat;
u64 dc_stat;
u64 c_addr;
u64 c_syndrome_1;
u64 c_syndrome_0;
u64 c_stat;
u64 c_sts;
u64 mm_stat;
u64 exc_addr;
u64 ier_cm;
u64 isum;
u64 pal_base;
u64 i_ctl;
u64 process_context;
u64 cbox_ctl;
u64 cbox_stp_ctl;
u64 cbox_acc_ctl;
u64 cbox_lcl_set;
u64 cbox_gbl_set;
u64 bbox_ctl;
u64 bbox_err_sts;
u64 bbox_err_idx;
u64 cbox_ddp_err_sts;
u64 bbox_dat_rmp;
u64 reserved[2];
};
/*
* Data for el packet class PAL (14), type EV7_ZBOX (5)
*/
struct ev7_pal_zbox_subpacket {
u32 zbox0_dram_err_status_1;
u32 zbox0_dram_err_status_2;
u32 zbox0_dram_err_status_3;
u32 zbox0_dram_err_ctl;
u32 zbox0_dram_err_adr;
u32 zbox0_dift_timeout;
u32 zbox0_dram_mapper_ctl;
u32 zbox0_frc_err_adr;
u32 zbox0_dift_err_status;
u32 reserved1;
u32 zbox1_dram_err_status_1;
u32 zbox1_dram_err_status_2;
u32 zbox1_dram_err_status_3;
u32 zbox1_dram_err_ctl;
u32 zbox1_dram_err_adr;
u32 zbox1_dift_timeout;
u32 zbox1_dram_mapper_ctl;
u32 zbox1_frc_err_adr;
u32 zbox1_dift_err_status;
u32 reserved2;
u64 cbox_ctl;
u64 cbox_stp_ctl;
u64 zbox0_error_pa;
u64 zbox1_error_pa;
u64 zbox0_ored_syndrome;
u64 zbox1_ored_syndrome;
u64 reserved3[2];
};
/*
* Data for el packet class PAL (14), type EV7_RBOX (6)
*/
struct ev7_pal_rbox_subpacket {
u64 rbox_cfg;
u64 rbox_n_cfg;
u64 rbox_s_cfg;
u64 rbox_e_cfg;
u64 rbox_w_cfg;
u64 rbox_n_err;
u64 rbox_s_err;
u64 rbox_e_err;
u64 rbox_w_err;
u64 rbox_io_cfg;
u64 rbox_io_err;
u64 rbox_l_err;
u64 rbox_whoami;
u64 rbox_imask;
u64 rbox_intq;
u64 rbox_int;
u64 reserved[2];
};
/*
* Data for el packet class PAL (14), type EV7_IO (7)
*/
struct ev7_pal_io_one_port {
u64 pox_err_sum;
u64 pox_tlb_err;
u64 pox_spl_cmplt;
u64 pox_trans_sum;
u64 pox_first_err;
u64 pox_mult_err;
u64 pox_dm_source;
u64 pox_dm_dest;
u64 pox_dm_size;
u64 pox_dm_ctrl;
u64 reserved;
};
struct ev7_pal_io_subpacket {
u64 io_asic_rev;
u64 io_sys_rev;
u64 io7_uph;
u64 hpi_ctl;
u64 crd_ctl;
u64 hei_ctl;
u64 po7_error_sum;
u64 po7_uncrr_sym;
u64 po7_crrct_sym;
u64 po7_ugbge_sym;
u64 po7_err_pkt0;
u64 po7_err_pkt1;
u64 reserved[2];
struct ev7_pal_io_one_port ports[4];
};
/*
* Environmental subpacket. Data used for el packets:
* class PAL (14), type AMBIENT_TEMPERATURE (10)
* class PAL (14), type AIRMOVER_FAN (11)
* class PAL (14), type VOLTAGE (12)
* class PAL (14), type INTRUSION (13)
* class PAL (14), type POWER_SUPPLY (14)
* class PAL (14), type LAN (15)
* class PAL (14), type HOT_PLUG (16)
*/
struct ev7_pal_environmental_subpacket {
u16 cabinet;
u16 drawer;
u16 reserved1[2];
u8 module_type;
u8 unit_id; /* unit reporting condition */
u8 reserved2;
u8 condition; /* condition reported */
};
/*
* Convert environmental type to index
*/
static inline int ev7_lf_env_index(int type)
{
BUG_ON((type < EL_TYPE__PAL__ENV__AMBIENT_TEMPERATURE)
|| (type > EL_TYPE__PAL__ENV__HOT_PLUG));
return type - EL_TYPE__PAL__ENV__AMBIENT_TEMPERATURE;
}
/*
* Data for generic el packet class PAL.
*/
struct ev7_pal_subpacket {
union {
struct ev7_pal_logout_subpacket logout; /* Type 1 */
struct ev7_pal_processor_subpacket ev7; /* Type 4 */
struct ev7_pal_zbox_subpacket zbox; /* Type 5 */
struct ev7_pal_rbox_subpacket rbox; /* Type 6 */
struct ev7_pal_io_subpacket io; /* Type 7 */
struct ev7_pal_environmental_subpacket env; /* Type 10-16 */
u64 as_quad[1]; /* Raw u64 */
} by_type;
};
/*
* Struct to contain collected logout from subpackets.
*/
struct ev7_lf_subpackets {
struct ev7_pal_logout_subpacket *logout; /* Type 1 */
struct ev7_pal_processor_subpacket *ev7; /* Type 4 */
struct ev7_pal_zbox_subpacket *zbox; /* Type 5 */
struct ev7_pal_rbox_subpacket *rbox; /* Type 6 */
struct ev7_pal_io_subpacket *io; /* Type 7 */
struct ev7_pal_environmental_subpacket *env[7]; /* Type 10-16 */
unsigned int io_pid;
};
#endif /* __ALPHA_ERR_EV7_H */

View File

@@ -0,0 +1,119 @@
#ifndef _ALPHA_ERRNO_H
#define _ALPHA_ERRNO_H
#include <asm-generic/errno-base.h>
#undef EAGAIN /* 11 in errno-base.h */
#define EDEADLK 11 /* Resource deadlock would occur */
#define EAGAIN 35 /* Try again */
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Cannot assign requested address */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection because of reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Transport endpoint is already connected */
#define ENOTCONN 57 /* Transport endpoint is not connected */
#define ESHUTDOWN 58 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 59 /* Too many references: cannot splice */
#define ETIMEDOUT 60 /* Connection timed out */
#define ECONNREFUSED 61 /* Connection refused */
#define ELOOP 62 /* Too many symbolic links encountered */
#define ENAMETOOLONG 63 /* File name too long */
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#define ENOTEMPTY 66 /* Directory not empty */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Quota exceeded */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Object is remote */
#define ENOLCK 77 /* No record locks available */
#define ENOSYS 78 /* Function not implemented */
#define ENOMSG 80 /* No message of desired type */
#define EIDRM 81 /* Identifier removed */
#define ENOSR 82 /* Out of streams resources */
#define ETIME 83 /* Timer expired */
#define EBADMSG 84 /* Not a data message */
#define EPROTO 85 /* Protocol error */
#define ENODATA 86 /* No data available */
#define ENOSTR 87 /* Device not a stream */
#define ENOPKG 92 /* Package not installed */
#define EILSEQ 116 /* Illegal byte sequence */
/* The following are just random noise.. */
#define ECHRNG 88 /* Channel number out of range */
#define EL2NSYNC 89 /* Level 2 not synchronized */
#define EL3HLT 90 /* Level 3 halted */
#define EL3RST 91 /* Level 3 reset */
#define ELNRNG 93 /* Link number out of range */
#define EUNATCH 94 /* Protocol driver not attached */
#define ENOCSI 95 /* No CSI structure available */
#define EL2HLT 96 /* Level 2 halted */
#define EBADE 97 /* Invalid exchange */
#define EBADR 98 /* Invalid request descriptor */
#define EXFULL 99 /* Exchange full */
#define ENOANO 100 /* No anode */
#define EBADRQC 101 /* Invalid request code */
#define EBADSLT 102 /* Invalid slot */
#define EDEADLOCK EDEADLK
#define EBFONT 104 /* Bad font file format */
#define ENONET 105 /* Machine is not on the network */
#define ENOLINK 106 /* Link has been severed */
#define EADV 107 /* Advertise error */
#define ESRMNT 108 /* Srmount error */
#define ECOMM 109 /* Communication error on send */
#define EMULTIHOP 110 /* Multihop attempted */
#define EDOTDOT 111 /* RFS specific error */
#define EOVERFLOW 112 /* Value too large for defined data type */
#define ENOTUNIQ 113 /* Name not unique on network */
#define EBADFD 114 /* File descriptor in bad state */
#define EREMCHG 115 /* Remote address changed */
#define EUCLEAN 117 /* Structure needs cleaning */
#define ENOTNAM 118 /* Not a XENIX named type file */
#define ENAVAIL 119 /* No XENIX semaphores available */
#define EISNAM 120 /* Is a named type file */
#define EREMOTEIO 121 /* Remote I/O error */
#define ELIBACC 122 /* Can not access a needed shared library */
#define ELIBBAD 123 /* Accessing a corrupted shared library */
#define ELIBSCN 124 /* .lib section in a.out corrupted */
#define ELIBMAX 125 /* Attempting to link in too many shared libraries */
#define ELIBEXEC 126 /* Cannot exec a shared library directly */
#define ERESTART 127 /* Interrupted system call should be restarted */
#define ESTRPIPE 128 /* Streams pipe error */
#define ENOMEDIUM 129 /* No medium found */
#define EMEDIUMTYPE 130 /* Wrong medium type */
#define ECANCELED 131 /* Operation Cancelled */
#define ENOKEY 132 /* Required key not available */
#define EKEYEXPIRED 133 /* Key has expired */
#define EKEYREVOKED 134 /* Key has been revoked */
#define EKEYREJECTED 135 /* Key was rejected by service */
#endif

View File

@@ -0,0 +1,75 @@
#ifndef _ALPHA_FCNTL_H
#define _ALPHA_FCNTL_H
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
#define O_ACCMODE 0003
#define O_RDONLY 00
#define O_WRONLY 01
#define O_RDWR 02
#define O_CREAT 01000 /* not fcntl */
#define O_TRUNC 02000 /* not fcntl */
#define O_EXCL 04000 /* not fcntl */
#define O_NOCTTY 010000 /* not fcntl */
#define O_NONBLOCK 00004
#define O_APPEND 00010
#define O_NDELAY O_NONBLOCK
#define O_SYNC 040000
#define FASYNC 020000 /* fcntl, for BSD compatibility */
#define O_DIRECTORY 0100000 /* must be a directory */
#define O_NOFOLLOW 0200000 /* don't follow links */
#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
#define O_NOATIME 04000000
#define F_DUPFD 0 /* dup */
#define F_GETFD 1 /* get close_on_exec */
#define F_SETFD 2 /* set/clear close_on_exec */
#define F_GETFL 3 /* get file->f_flags */
#define F_SETFL 4 /* set file->f_flags */
#define F_GETLK 7
#define F_SETLK 8
#define F_SETLKW 9
#define F_SETOWN 5 /* for sockets. */
#define F_GETOWN 6 /* for sockets. */
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* for posix fcntl() and lockf() */
#define F_RDLCK 1
#define F_WRLCK 2
#define F_UNLCK 8
/* for old implementation of bsd flock () */
#define F_EXLCK 16 /* or 3 */
#define F_SHLCK 32 /* or 4 */
#define F_INPROGRESS 64
/* operations for bsd flock(), also used by the kernel implementation */
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* or'd with one of the above to prevent
blocking */
#define LOCK_UN 8 /* remove lock */
#define LOCK_MAND 32 /* This is a mandatory flock */
#define LOCK_READ 64 /* ... Which allows concurrent read operations */
#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
struct flock {
short l_type;
short l_whence;
__kernel_off_t l_start;
__kernel_off_t l_len;
__kernel_pid_t l_pid;
};
#define F_LINUX_SPECIFIC_BASE 1024
#endif

View File

@@ -0,0 +1,119 @@
/*
* Architecture specific parts of the Floppy driver
*
* 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) 1995
*/
#ifndef __ASM_ALPHA_FLOPPY_H
#define __ASM_ALPHA_FLOPPY_H
#include <linux/config.h>
#define fd_inb(port) inb_p(port)
#define fd_outb(value,port) outb_p(value,port)
#define fd_enable_dma() enable_dma(FLOPPY_DMA)
#define fd_disable_dma() disable_dma(FLOPPY_DMA)
#define fd_request_dma() request_dma(FLOPPY_DMA,"floppy")
#define fd_free_dma() free_dma(FLOPPY_DMA)
#define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
#define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode)
#define fd_set_dma_addr(addr) set_dma_addr(FLOPPY_DMA,virt_to_bus(addr))
#define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
#define fd_cacheflush(addr,size) /* nothing */
#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
SA_INTERRUPT|SA_SAMPLE_RANDOM, \
"floppy", NULL)
#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
#ifdef CONFIG_PCI
#include <linux/pci.h>
#define fd_dma_setup(addr,size,mode,io) alpha_fd_dma_setup(addr,size,mode,io)
static __inline__ int
alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
{
static unsigned long prev_size;
static dma_addr_t bus_addr = 0;
static char *prev_addr;
static int prev_dir;
int dir;
dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
if (bus_addr
&& (addr != prev_addr || size != prev_size || dir != prev_dir)) {
/* different from last time -- unmap prev */
pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir);
bus_addr = 0;
}
if (!bus_addr) /* need to map it */
bus_addr = pci_map_single(isa_bridge, addr, size, dir);
/* remember this one as prev */
prev_addr = addr;
prev_size = size;
prev_dir = dir;
fd_clear_dma_ff();
fd_cacheflush(addr, size);
fd_set_dma_mode(mode);
set_dma_addr(FLOPPY_DMA, bus_addr);
fd_set_dma_count(size);
virtual_dma_port = io;
fd_enable_dma();
return 0;
}
#endif /* CONFIG_PCI */
__inline__ void virtual_dma_init(void)
{
/* Nothing to do on an Alpha */
}
static int FDC1 = 0x3f0;
static int FDC2 = -1;
/*
* Again, the CMOS information doesn't work on the alpha..
*/
#define FLOPPY0_TYPE 6
#define FLOPPY1_TYPE 0
#define N_FDC 2
#define N_DRIVE 8
#define FLOPPY_MOTOR_MASK 0xf0
/*
* Most Alphas have no problems with floppy DMA crossing 64k borders,
* except for certain ones, like XL and RUFFIAN.
*
* However, the test is simple and fast, and this *is* floppy, after all,
* so we do it for all platforms, just to make sure.
*
* This is advantageous in other circumstances as well, as in moving
* about the PCI DMA windows and forcing the floppy to start doing
* scatter-gather when it never had before, and there *is* a problem
* on that platform... ;-}
*/
static inline unsigned long CROSS_64KB(void *a, unsigned long s)
{
unsigned long p = (unsigned long)a;
return ((p + s - 1) ^ p) & ~0xffffUL;
}
#define EXTRA_FLOPPY_PARAMS
#endif /* __ASM_ALPHA_FLOPPY_H */

View File

@@ -0,0 +1,193 @@
#ifndef __ASM_ALPHA_FPU_H
#define __ASM_ALPHA_FPU_H
/*
* Alpha floating-point control register defines:
*/
#define FPCR_DNOD (1UL<<47) /* denorm INV trap disable */
#define FPCR_DNZ (1UL<<48) /* denorms to zero */
#define FPCR_INVD (1UL<<49) /* invalid op disable (opt.) */
#define FPCR_DZED (1UL<<50) /* division by zero disable (opt.) */
#define FPCR_OVFD (1UL<<51) /* overflow disable (optional) */
#define FPCR_INV (1UL<<52) /* invalid operation */
#define FPCR_DZE (1UL<<53) /* division by zero */
#define FPCR_OVF (1UL<<54) /* overflow */
#define FPCR_UNF (1UL<<55) /* underflow */
#define FPCR_INE (1UL<<56) /* inexact */
#define FPCR_IOV (1UL<<57) /* integer overflow */
#define FPCR_UNDZ (1UL<<60) /* underflow to zero (opt.) */
#define FPCR_UNFD (1UL<<61) /* underflow disable (opt.) */
#define FPCR_INED (1UL<<62) /* inexact disable (opt.) */
#define FPCR_SUM (1UL<<63) /* summary bit */
#define FPCR_DYN_SHIFT 58 /* first dynamic rounding mode bit */
#define FPCR_DYN_CHOPPED (0x0UL << FPCR_DYN_SHIFT) /* towards 0 */
#define FPCR_DYN_MINUS (0x1UL << FPCR_DYN_SHIFT) /* towards -INF */
#define FPCR_DYN_NORMAL (0x2UL << FPCR_DYN_SHIFT) /* towards nearest */
#define FPCR_DYN_PLUS (0x3UL << FPCR_DYN_SHIFT) /* towards +INF */
#define FPCR_DYN_MASK (0x3UL << FPCR_DYN_SHIFT)
#define FPCR_MASK 0xffff800000000000L
/*
* IEEE trap enables are implemented in software. These per-thread
* bits are stored in the "ieee_state" field of "struct thread_info".
* Thus, the bits are defined so as not to conflict with the
* floating-point enable bit (which is architected). On top of that,
* we want to make these bits compatible with OSF/1 so
* ieee_set_fp_control() etc. can be implemented easily and
* compatibly. The corresponding definitions are in
* /usr/include/machine/fpu.h under OSF/1.
*/
#define IEEE_TRAP_ENABLE_INV (1UL<<1) /* invalid op */
#define IEEE_TRAP_ENABLE_DZE (1UL<<2) /* division by zero */
#define IEEE_TRAP_ENABLE_OVF (1UL<<3) /* overflow */
#define IEEE_TRAP_ENABLE_UNF (1UL<<4) /* underflow */
#define IEEE_TRAP_ENABLE_INE (1UL<<5) /* inexact */
#define IEEE_TRAP_ENABLE_DNO (1UL<<6) /* denorm */
#define IEEE_TRAP_ENABLE_MASK (IEEE_TRAP_ENABLE_INV | IEEE_TRAP_ENABLE_DZE |\
IEEE_TRAP_ENABLE_OVF | IEEE_TRAP_ENABLE_UNF |\
IEEE_TRAP_ENABLE_INE | IEEE_TRAP_ENABLE_DNO)
/* Denorm and Underflow flushing */
#define IEEE_MAP_DMZ (1UL<<12) /* Map denorm inputs to zero */
#define IEEE_MAP_UMZ (1UL<<13) /* Map underflowed outputs to zero */
#define IEEE_MAP_MASK (IEEE_MAP_DMZ | IEEE_MAP_UMZ)
/* status bits coming from fpcr: */
#define IEEE_STATUS_INV (1UL<<17)
#define IEEE_STATUS_DZE (1UL<<18)
#define IEEE_STATUS_OVF (1UL<<19)
#define IEEE_STATUS_UNF (1UL<<20)
#define IEEE_STATUS_INE (1UL<<21)
#define IEEE_STATUS_DNO (1UL<<22)
#define IEEE_STATUS_MASK (IEEE_STATUS_INV | IEEE_STATUS_DZE | \
IEEE_STATUS_OVF | IEEE_STATUS_UNF | \
IEEE_STATUS_INE | IEEE_STATUS_DNO)
#define IEEE_SW_MASK (IEEE_TRAP_ENABLE_MASK | \
IEEE_STATUS_MASK | IEEE_MAP_MASK)
#define IEEE_CURRENT_RM_SHIFT 32
#define IEEE_CURRENT_RM_MASK (3UL<<IEEE_CURRENT_RM_SHIFT)
#define IEEE_STATUS_TO_EXCSUM_SHIFT 16
#define IEEE_INHERIT (1UL<<63) /* inherit on thread create? */
/*
* Convert the software IEEE trap enable and status bits into the
* hardware fpcr format.
*
* Digital Unix engineers receive my thanks for not defining the
* software bits identical to the hardware bits. The chip designers
* receive my thanks for making all the not-implemented fpcr bits
* RAZ forcing us to use system calls to read/write this value.
*/
static inline unsigned long
ieee_swcr_to_fpcr(unsigned long sw)
{
unsigned long fp;
fp = (sw & IEEE_STATUS_MASK) << 35;
fp |= (sw & IEEE_MAP_DMZ) << 36;
fp |= (sw & IEEE_STATUS_MASK ? FPCR_SUM : 0);
fp |= (~sw & (IEEE_TRAP_ENABLE_INV
| IEEE_TRAP_ENABLE_DZE
| IEEE_TRAP_ENABLE_OVF)) << 48;
fp |= (~sw & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE)) << 57;
fp |= (sw & IEEE_MAP_UMZ ? FPCR_UNDZ | FPCR_UNFD : 0);
fp |= (~sw & IEEE_TRAP_ENABLE_DNO) << 41;
return fp;
}
static inline unsigned long
ieee_fpcr_to_swcr(unsigned long fp)
{
unsigned long sw;
sw = (fp >> 35) & IEEE_STATUS_MASK;
sw |= (fp >> 36) & IEEE_MAP_DMZ;
sw |= (~fp >> 48) & (IEEE_TRAP_ENABLE_INV
| IEEE_TRAP_ENABLE_DZE
| IEEE_TRAP_ENABLE_OVF);
sw |= (~fp >> 57) & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE);
sw |= (fp >> 47) & IEEE_MAP_UMZ;
sw |= (~fp >> 41) & IEEE_TRAP_ENABLE_DNO;
return sw;
}
#ifdef __KERNEL__
/* The following two functions don't need trapb/excb instructions
around the mf_fpcr/mt_fpcr instructions because (a) the kernel
never generates arithmetic faults and (b) call_pal instructions
are implied trap barriers. */
static inline unsigned long
rdfpcr(void)
{
unsigned long tmp, ret;
#if defined(__alpha_cix__) || defined(__alpha_fix__)
__asm__ __volatile__ (
"ftoit $f0,%0\n\t"
"mf_fpcr $f0\n\t"
"ftoit $f0,%1\n\t"
"itoft %0,$f0"
: "=r"(tmp), "=r"(ret));
#else
__asm__ __volatile__ (
"stt $f0,%0\n\t"
"mf_fpcr $f0\n\t"
"stt $f0,%1\n\t"
"ldt $f0,%0"
: "=m"(tmp), "=m"(ret));
#endif
return ret;
}
static inline void
wrfpcr(unsigned long val)
{
unsigned long tmp;
#if defined(__alpha_cix__) || defined(__alpha_fix__)
__asm__ __volatile__ (
"ftoit $f0,%0\n\t"
"itoft %1,$f0\n\t"
"mt_fpcr $f0\n\t"
"itoft %0,$f0"
: "=&r"(tmp) : "r"(val));
#else
__asm__ __volatile__ (
"stt $f0,%0\n\t"
"ldt $f0,%1\n\t"
"mt_fpcr $f0\n\t"
"ldt $f0,%0"
: "=m"(tmp) : "m"(val));
#endif
}
static inline unsigned long
swcr_update_status(unsigned long swcr, unsigned long fpcr)
{
/* EV6 implements most of the bits in hardware. Collect
the acrued exception bits from the real fpcr. */
if (implver() == IMPLVER_EV6) {
swcr &= ~IEEE_STATUS_MASK;
swcr |= (fpcr >> 35) & IEEE_STATUS_MASK;
}
return swcr;
}
extern unsigned long alpha_read_fp_reg (unsigned long reg);
extern void alpha_write_fp_reg (unsigned long reg, unsigned long val);
extern unsigned long alpha_read_fp_reg_s (unsigned long reg);
extern void alpha_write_fp_reg_s (unsigned long reg, unsigned long val);
#endif /* __KERNEL__ */
#endif /* __ASM_ALPHA_FPU_H */

View File

@@ -0,0 +1,58 @@
#ifndef __ALPHA_GCT_H
#define __ALPHA_GCT_H
typedef u64 gct_id;
typedef u64 gct6_handle;
typedef struct __gct6_node {
u8 type;
u8 subtype;
u16 size;
u32 hd_extension;
gct6_handle owner;
gct6_handle active_user;
gct_id id;
u64 flags;
u16 rev;
u16 change_counter;
u16 max_child;
u16 reserved1;
gct6_handle saved_owner;
gct6_handle affinity;
gct6_handle parent;
gct6_handle next;
gct6_handle prev;
gct6_handle child;
u64 fw_flags;
u64 os_usage;
u64 fru_id;
u32 checksum;
u32 magic; /* 'GLXY' */
} gct6_node;
typedef struct {
u8 type;
u8 subtype;
void (*callout)(gct6_node *);
} gct6_search_struct;
#define GCT_NODE_MAGIC 0x59584c47 /* 'GLXY' */
/*
* node types
*/
#define GCT_TYPE_HOSE 0x0E
/*
* node subtypes
*/
#define GCT_SUBTYPE_IO_PORT_MODULE 0x2C
#define GCT_NODE_PTR(off) ((gct6_node *)((char *)hwrpb + \
hwrpb->frut_offset + \
(gct6_handle)(off))) \
int gct6_find_nodes(gct6_node *, gct6_search_struct *);
#endif /* __ALPHA_GCT_H */

View File

@@ -0,0 +1,37 @@
#ifndef _ASMAXP_GENTRAP_H
#define _ASMAXP_GENTRAP_H
/*
* Definitions for gentrap causes. They are generated by user-level
* programs and therefore should be compatible with the corresponding
* OSF/1 definitions.
*/
#define GEN_INTOVF -1 /* integer overflow */
#define GEN_INTDIV -2 /* integer division by zero */
#define GEN_FLTOVF -3 /* fp overflow */
#define GEN_FLTDIV -4 /* fp division by zero */
#define GEN_FLTUND -5 /* fp underflow */
#define GEN_FLTINV -6 /* invalid fp operand */
#define GEN_FLTINE -7 /* inexact fp operand */
#define GEN_DECOVF -8 /* decimal overflow (for COBOL??) */
#define GEN_DECDIV -9 /* decimal division by zero */
#define GEN_DECINV -10 /* invalid decimal operand */
#define GEN_ROPRAND -11 /* reserved operand */
#define GEN_ASSERTERR -12 /* assertion error */
#define GEN_NULPTRERR -13 /* null pointer error */
#define GEN_STKOVF -14 /* stack overflow */
#define GEN_STRLENERR -15 /* string length error */
#define GEN_SUBSTRERR -16 /* substring error */
#define GEN_RANGERR -17 /* range error */
#define GEN_SUBRNG -18
#define GEN_SUBRNG1 -19
#define GEN_SUBRNG2 -20
#define GEN_SUBRNG3 -21 /* these report range errors for */
#define GEN_SUBRNG4 -22 /* subscripting (indexing) at levels 0..7 */
#define GEN_SUBRNG5 -23
#define GEN_SUBRNG6 -24
#define GEN_SUBRNG7 -25
/* the remaining codes (-26..-1023) are reserved. */
#endif /* _ASMAXP_GENTRAP_H */

View File

@@ -0,0 +1,42 @@
#ifndef _ALPHA_HARDIRQ_H
#define _ALPHA_HARDIRQ_H
#include <linux/config.h>
#include <linux/threads.h>
#include <linux/cache.h>
/* entry.S is sensitive to the offsets of these fields */
typedef struct {
unsigned long __softirq_pending;
unsigned int __syscall_count;
unsigned long idle_timestamp;
struct task_struct * __ksoftirqd_task;
} ____cacheline_aligned irq_cpustat_t;
#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
#define HARDIRQ_BITS 12
/*
* The hardirq mask has to be large enough to have
* space for potentially nestable IRQ sources in the system
* to nest on a single CPU. On Alpha, interrupts are masked at the CPU
* by IPL as well as at the system level. We only have 8 IPLs (UNIX PALcode)
* so we really only have 8 nestable IRQs, but allow some overhead
*/
#if (1 << HARDIRQ_BITS) < 16
#error HARDIRQ_BITS is too low!
#endif
#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
#define irq_exit() \
do { \
preempt_count() -= IRQ_EXIT_OFFSET; \
if (!in_interrupt() && \
softirq_pending(smp_processor_id())) \
do_softirq(); \
preempt_enable_no_resched(); \
} while (0)
#endif /* _ALPHA_HARDIRQ_H */

View File

@@ -0,0 +1 @@
#include <asm-generic/hdreg.h>

View File

@@ -0,0 +1,16 @@
#ifndef _ALPHA_HW_IRQ_H
#define _ALPHA_HW_IRQ_H
#include <linux/config.h>
static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
extern volatile unsigned long irq_err_count;
#ifdef CONFIG_ALPHA_GENERIC
#define ACTUAL_NR_IRQS alpha_mv.nr_irqs
#else
#define ACTUAL_NR_IRQS NR_IRQS
#endif
#endif

View File

@@ -0,0 +1,220 @@
#ifndef __ALPHA_HWRPB_H
#define __ALPHA_HWRPB_H
#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000)
/*
* DEC processor types for Alpha systems. Found in HWRPB.
* These values are architected.
*/
#define EV3_CPU 1 /* EV3 */
#define EV4_CPU 2 /* EV4 (21064) */
#define LCA4_CPU 4 /* LCA4 (21066/21068) */
#define EV5_CPU 5 /* EV5 (21164) */
#define EV45_CPU 6 /* EV4.5 (21064/xxx) */
#define EV56_CPU 7 /* EV5.6 (21164) */
#define EV6_CPU 8 /* EV6 (21264) */
#define PCA56_CPU 9 /* PCA56 (21164PC) */
#define PCA57_CPU 10 /* PCA57 (notyet) */
#define EV67_CPU 11 /* EV67 (21264A) */
#define EV68CB_CPU 12 /* EV68CB (21264C) */
#define EV68AL_CPU 13 /* EV68AL (21264B) */
#define EV68CX_CPU 14 /* EV68CX (21264D) */
#define EV7_CPU 15 /* EV7 (21364) */
#define EV79_CPU 16 /* EV79 (21364??) */
#define EV69_CPU 17 /* EV69 (21264/EV69A) */
/*
* DEC system types for Alpha systems. Found in HWRPB.
* These values are architected.
*/
#define ST_ADU 1 /* Alpha ADU systype */
#define ST_DEC_4000 2 /* Cobra systype */
#define ST_DEC_7000 3 /* Ruby systype */
#define ST_DEC_3000_500 4 /* Flamingo systype */
#define ST_DEC_2000_300 6 /* Jensen systype */
#define ST_DEC_3000_300 7 /* Pelican systype */
#define ST_DEC_2100_A500 9 /* Sable systype */
#define ST_DEC_AXPVME_64 10 /* AXPvme system type */
#define ST_DEC_AXPPCI_33 11 /* NoName system type */
#define ST_DEC_TLASER 12 /* Turbolaser systype */
#define ST_DEC_2100_A50 13 /* Avanti systype */
#define ST_DEC_MUSTANG 14 /* Mustang systype */
#define ST_DEC_ALCOR 15 /* Alcor (EV5) systype */
#define ST_DEC_1000 17 /* Mikasa systype */
#define ST_DEC_EB64 18 /* EB64 systype */
#define ST_DEC_EB66 19 /* EB66 systype */
#define ST_DEC_EB64P 20 /* EB64+ systype */
#define ST_DEC_BURNS 21 /* laptop systype */
#define ST_DEC_RAWHIDE 22 /* Rawhide systype */
#define ST_DEC_K2 23 /* K2 systype */
#define ST_DEC_LYNX 24 /* Lynx systype */
#define ST_DEC_XL 25 /* Alpha XL systype */
#define ST_DEC_EB164 26 /* EB164 systype */
#define ST_DEC_NORITAKE 27 /* Noritake systype */
#define ST_DEC_CORTEX 28 /* Cortex systype */
#define ST_DEC_MIATA 30 /* Miata systype */
#define ST_DEC_XXM 31 /* XXM systype */
#define ST_DEC_TAKARA 32 /* Takara systype */
#define ST_DEC_YUKON 33 /* Yukon systype */
#define ST_DEC_TSUNAMI 34 /* Tsunami systype */
#define ST_DEC_WILDFIRE 35 /* Wildfire systype */
#define ST_DEC_CUSCO 36 /* CUSCO systype */
#define ST_DEC_EIGER 37 /* Eiger systype */
#define ST_DEC_TITAN 38 /* Titan systype */
#define ST_DEC_MARVEL 39 /* Marvel systype */
/* UNOFFICIAL!!! */
#define ST_UNOFFICIAL_BIAS 100
#define ST_DTI_RUFFIAN 101 /* RUFFIAN systype */
/* Alpha Processor, Inc. systems */
#define ST_API_BIAS 200
#define ST_API_NAUTILUS 201 /* UP1000 systype */
struct pcb_struct {
unsigned long ksp;
unsigned long usp;
unsigned long ptbr;
unsigned int pcc;
unsigned int asn;
unsigned long unique;
unsigned long flags;
unsigned long res1, res2;
};
struct percpu_struct {
unsigned long hwpcb[16];
unsigned long flags;
unsigned long pal_mem_size;
unsigned long pal_scratch_size;
unsigned long pal_mem_pa;
unsigned long pal_scratch_pa;
unsigned long pal_revision;
unsigned long type;
unsigned long variation;
unsigned long revision;
unsigned long serial_no[2];
unsigned long logout_area_pa;
unsigned long logout_area_len;
unsigned long halt_PCBB;
unsigned long halt_PC;
unsigned long halt_PS;
unsigned long halt_arg;
unsigned long halt_ra;
unsigned long halt_pv;
unsigned long halt_reason;
unsigned long res;
unsigned long ipc_buffer[21];
unsigned long palcode_avail[16];
unsigned long compatibility;
unsigned long console_data_log_pa;
unsigned long console_data_log_length;
unsigned long bcache_info;
};
struct procdesc_struct {
unsigned long weird_vms_stuff;
unsigned long address;
};
struct vf_map_struct {
unsigned long va;
unsigned long pa;
unsigned long count;
};
struct crb_struct {
struct procdesc_struct * dispatch_va;
struct procdesc_struct * dispatch_pa;
struct procdesc_struct * fixup_va;
struct procdesc_struct * fixup_pa;
/* virtual->physical map */
unsigned long map_entries;
unsigned long map_pages;
struct vf_map_struct map[1];
};
struct memclust_struct {
unsigned long start_pfn;
unsigned long numpages;
unsigned long numtested;
unsigned long bitmap_va;
unsigned long bitmap_pa;
unsigned long bitmap_chksum;
unsigned long usage;
};
struct memdesc_struct {
unsigned long chksum;
unsigned long optional_pa;
unsigned long numclusters;
struct memclust_struct cluster[0];
};
struct dsr_struct {
long smm; /* SMM nubber used by LMF */
unsigned long lurt_off; /* offset to LURT table */
unsigned long sysname_off; /* offset to sysname char count */
};
struct hwrpb_struct {
unsigned long phys_addr; /* check: physical address of the hwrpb */
unsigned long id; /* check: "HWRPB\0\0\0" */
unsigned long revision;
unsigned long size; /* size of hwrpb */
unsigned long cpuid;
unsigned long pagesize; /* 8192, I hope */
unsigned long pa_bits; /* number of physical address bits */
unsigned long max_asn;
unsigned char ssn[16]; /* system serial number: big bother is watching */
unsigned long sys_type;
unsigned long sys_variation;
unsigned long sys_revision;
unsigned long intr_freq; /* interval clock frequency * 4096 */
unsigned long cycle_freq; /* cycle counter frequency */
unsigned long vptb; /* Virtual Page Table Base address */
unsigned long res1;
unsigned long tbhb_offset; /* Translation Buffer Hint Block */
unsigned long nr_processors;
unsigned long processor_size;
unsigned long processor_offset;
unsigned long ctb_nr;
unsigned long ctb_size; /* console terminal block size */
unsigned long ctbt_offset; /* console terminal block table offset */
unsigned long crb_offset; /* console callback routine block */
unsigned long mddt_offset; /* memory data descriptor table */
unsigned long cdb_offset; /* configuration data block (or NULL) */
unsigned long frut_offset; /* FRU table (or NULL) */
void (*save_terminal)(unsigned long);
unsigned long save_terminal_data;
void (*restore_terminal)(unsigned long);
unsigned long restore_terminal_data;
void (*CPU_restart)(unsigned long);
unsigned long CPU_restart_data;
unsigned long res2;
unsigned long res3;
unsigned long chksum;
unsigned long rxrdy;
unsigned long txrdy;
unsigned long dsr_offset; /* "Dynamic System Recognition Data Block Table" */
};
#ifdef __KERNEL__
extern struct hwrpb_struct *hwrpb;
static inline void
hwrpb_update_checksum(struct hwrpb_struct *h)
{
unsigned long sum = 0, *l;
for (l = (unsigned long *) h; l < (unsigned long *) &h->chksum; ++l)
sum += *l;
h->chksum = sum;
}
#endif /* __KERNEL__ */
#endif /* __ALPHA_HWRPB_H */

View File

@@ -0,0 +1,61 @@
/*
* linux/include/asm-alpha/ide.h
*
* Copyright (C) 1994-1996 Linus Torvalds & authors
*/
/*
* This file contains the alpha architecture specific IDE code.
*/
#ifndef __ASMalpha_IDE_H
#define __ASMalpha_IDE_H
#ifdef __KERNEL__
#include <linux/config.h>
#ifndef MAX_HWIFS
#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
#endif
#define IDE_ARCH_OBSOLETE_DEFAULTS
static inline int ide_default_irq(unsigned long base)
{
switch (base) {
case 0x1f0: return 14;
case 0x170: return 15;
case 0x1e8: return 11;
case 0x168: return 10;
default:
return 0;
}
}
static inline unsigned long ide_default_io_base(int index)
{
switch (index) {
case 0: return 0x1f0;
case 1: return 0x170;
case 2: return 0x1e8;
case 3: return 0x168;
default:
return 0;
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_PCI
#define ide_init_default_irq(base) (0)
#else
#define ide_init_default_irq(base) ide_default_irq(base)
#endif
#include <asm-generic/ide_iops.h>
#endif /* __KERNEL__ */
#endif /* __ASMalpha_IDE_H */

View File

@@ -0,0 +1,671 @@
#ifndef __ALPHA_IO_H
#define __ALPHA_IO_H
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/kernel.h>
#include <asm/compiler.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/machvec.h>
#include <asm/hwrpb.h>
/* The generic header contains only prototypes. Including it ensures that
the implementation we have here matches that interface. */
#include <asm-generic/iomap.h>
/* We don't use IO slowdowns on the Alpha, but.. */
#define __SLOW_DOWN_IO do { } while (0)
#define SLOW_DOWN_IO do { } while (0)
/*
* Virtual -> physical identity mapping starts at this offset
*/
#ifdef USE_48_BIT_KSEG
#define IDENT_ADDR 0xffff800000000000UL
#else
#define IDENT_ADDR 0xfffffc0000000000UL
#endif
/*
* We try to avoid hae updates (thus the cache), but when we
* do need to update the hae, we need to do it atomically, so
* that any interrupts wouldn't get confused with the hae
* register not being up-to-date with respect to the hardware
* value.
*/
static inline void __set_hae(unsigned long new_hae)
{
unsigned long flags;
local_irq_save(flags);
alpha_mv.hae_cache = new_hae;
*alpha_mv.hae_register = new_hae;
mb();
/* Re-read to make sure it was written. */
new_hae = *alpha_mv.hae_register;
local_irq_restore(flags);
}
static inline void set_hae(unsigned long new_hae)
{
if (new_hae != alpha_mv.hae_cache)
__set_hae(new_hae);
}
/*
* Change virtual addresses to physical addresses and vv.
*/
#ifdef USE_48_BIT_KSEG
static inline unsigned long virt_to_phys(void *address)
{
return (unsigned long)address - IDENT_ADDR;
}
static inline void * phys_to_virt(unsigned long address)
{
return (void *) (address + IDENT_ADDR);
}
#else
static inline unsigned long virt_to_phys(void *address)
{
unsigned long phys = (unsigned long)address;
/* Sign-extend from bit 41. */
phys <<= (64 - 41);
phys = (long)phys >> (64 - 41);
/* Crop to the physical address width of the processor. */
phys &= (1ul << hwrpb->pa_bits) - 1;
return phys;
}
static inline void * phys_to_virt(unsigned long address)
{
return (void *)(IDENT_ADDR + (address & ((1ul << 41) - 1)));
}
#endif
#define page_to_phys(page) page_to_pa(page)
/* This depends on working iommu. */
#define BIO_VMERGE_BOUNDARY (alpha_mv.mv_pci_tbi ? PAGE_SIZE : 0)
/* Maximum PIO space address supported? */
#define IO_SPACE_LIMIT 0xffff
/*
* Change addresses as seen by the kernel (virtual) to addresses as
* seen by a device (bus), and vice versa.
*
* Note that this only works for a limited range of kernel addresses,
* and very well may not span all memory. Consider this interface
* deprecated in favour of the mapping functions in <asm/pci.h>.
*/
extern unsigned long __direct_map_base;
extern unsigned long __direct_map_size;
static inline unsigned long virt_to_bus(void *address)
{
unsigned long phys = virt_to_phys(address);
unsigned long bus = phys + __direct_map_base;
return phys <= __direct_map_size ? bus : 0;
}
static inline void *bus_to_virt(unsigned long address)
{
void *virt;
/* This check is a sanity check but also ensures that bus address 0
maps to virtual address 0 which is useful to detect null pointers
(the NCR driver is much simpler if NULL pointers are preserved). */
address -= __direct_map_base;
virt = phys_to_virt(address);
return (long)address <= 0 ? NULL : virt;
}
/*
* There are different chipsets to interface the Alpha CPUs to the world.
*/
#define IO_CONCAT(a,b) _IO_CONCAT(a,b)
#define _IO_CONCAT(a,b) a ## _ ## b
#ifdef CONFIG_ALPHA_GENERIC
/* In a generic kernel, we always go through the machine vector. */
#define REMAP1(TYPE, NAME, QUAL) \
static inline TYPE generic_##NAME(QUAL void __iomem *addr) \
{ \
return alpha_mv.mv_##NAME(addr); \
}
#define REMAP2(TYPE, NAME, QUAL) \
static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \
{ \
alpha_mv.mv_##NAME(b, addr); \
}
REMAP1(unsigned int, ioread8, /**/)
REMAP1(unsigned int, ioread16, /**/)
REMAP1(unsigned int, ioread32, /**/)
REMAP1(u8, readb, const volatile)
REMAP1(u16, readw, const volatile)
REMAP1(u32, readl, const volatile)
REMAP1(u64, readq, const volatile)
REMAP2(u8, iowrite8, /**/)
REMAP2(u16, iowrite16, /**/)
REMAP2(u32, iowrite32, /**/)
REMAP2(u8, writeb, volatile)
REMAP2(u16, writew, volatile)
REMAP2(u32, writel, volatile)
REMAP2(u64, writeq, volatile)
#undef REMAP1
#undef REMAP2
static inline void __iomem *generic_ioportmap(unsigned long a)
{
return alpha_mv.mv_ioportmap(a);
}
static inline void __iomem *generic_ioremap(unsigned long a, unsigned long s)
{
return alpha_mv.mv_ioremap(a, s);
}
static inline void generic_iounmap(volatile void __iomem *a)
{
return alpha_mv.mv_iounmap(a);
}
static inline int generic_is_ioaddr(unsigned long a)
{
return alpha_mv.mv_is_ioaddr(a);
}
static inline int generic_is_mmio(const volatile void __iomem *a)
{
return alpha_mv.mv_is_mmio(a);
}
#define __IO_PREFIX generic
#define generic_trivial_rw_bw 0
#define generic_trivial_rw_lq 0
#define generic_trivial_io_bw 0
#define generic_trivial_io_lq 0
#define generic_trivial_iounmap 0
#else
#if defined(CONFIG_ALPHA_APECS)
# include <asm/core_apecs.h>
#elif defined(CONFIG_ALPHA_CIA)
# include <asm/core_cia.h>
#elif defined(CONFIG_ALPHA_IRONGATE)
# include <asm/core_irongate.h>
#elif defined(CONFIG_ALPHA_JENSEN)
# include <asm/jensen.h>
#elif defined(CONFIG_ALPHA_LCA)
# include <asm/core_lca.h>
#elif defined(CONFIG_ALPHA_MARVEL)
# include <asm/core_marvel.h>
#elif defined(CONFIG_ALPHA_MCPCIA)
# include <asm/core_mcpcia.h>
#elif defined(CONFIG_ALPHA_POLARIS)
# include <asm/core_polaris.h>
#elif defined(CONFIG_ALPHA_T2)
# include <asm/core_t2.h>
#elif defined(CONFIG_ALPHA_TSUNAMI)
# include <asm/core_tsunami.h>
#elif defined(CONFIG_ALPHA_TITAN)
# include <asm/core_titan.h>
#elif defined(CONFIG_ALPHA_WILDFIRE)
# include <asm/core_wildfire.h>
#else
#error "What system is this?"
#endif
#endif /* GENERIC */
/*
* We always have external versions of these routines.
*/
extern u8 inb(unsigned long port);
extern u16 inw(unsigned long port);
extern u32 inl(unsigned long port);
extern void outb(u8 b, unsigned long port);
extern void outw(u16 b, unsigned long port);
extern void outl(u32 b, unsigned long port);
extern u8 readb(const volatile void __iomem *addr);
extern u16 readw(const volatile void __iomem *addr);
extern u32 readl(const volatile void __iomem *addr);
extern u64 readq(const volatile void __iomem *addr);
extern void writeb(u8 b, volatile void __iomem *addr);
extern void writew(u16 b, volatile void __iomem *addr);
extern void writel(u32 b, volatile void __iomem *addr);
extern void writeq(u64 b, volatile void __iomem *addr);
extern u8 __raw_readb(const volatile void __iomem *addr);
extern u16 __raw_readw(const volatile void __iomem *addr);
extern u32 __raw_readl(const volatile void __iomem *addr);
extern u64 __raw_readq(const volatile void __iomem *addr);
extern void __raw_writeb(u8 b, volatile void __iomem *addr);
extern void __raw_writew(u16 b, volatile void __iomem *addr);
extern void __raw_writel(u32 b, volatile void __iomem *addr);
extern void __raw_writeq(u64 b, volatile void __iomem *addr);
/*
* Mapping from port numbers to __iomem space is pretty easy.
*/
/* These two have to be extern inline because of the extern prototype from
<asm-generic/iomap.h>. It is not legal to mix "extern" and "static" for
the same declaration. */
extern inline void __iomem *ioport_map(unsigned long port, unsigned int size)
{
return IO_CONCAT(__IO_PREFIX,ioportmap) (port);
}
extern inline void ioport_unmap(void __iomem *addr)
{
}
static inline void __iomem *ioremap(unsigned long port, unsigned long size)
{
return IO_CONCAT(__IO_PREFIX,ioremap) (port, size);
}
static inline void __iomem *__ioremap(unsigned long port, unsigned long size,
unsigned long flags)
{
return ioremap(port, size);
}
static inline void __iomem * ioremap_nocache(unsigned long offset,
unsigned long size)
{
return ioremap(offset, size);
}
static inline void iounmap(volatile void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,iounmap)(addr);
}
static inline int __is_ioaddr(unsigned long addr)
{
return IO_CONCAT(__IO_PREFIX,is_ioaddr)(addr);
}
#define __is_ioaddr(a) __is_ioaddr((unsigned long)(a))
static inline int __is_mmio(const volatile void __iomem *addr)
{
return IO_CONCAT(__IO_PREFIX,is_mmio)(addr);
}
/*
* If the actual I/O bits are sufficiently trivial, then expand inline.
*/
#if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
extern inline unsigned int ioread8(void __iomem *addr)
{
unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread8)(addr);
mb();
return ret;
}
extern inline unsigned int ioread16(void __iomem *addr)
{
unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread16)(addr);
mb();
return ret;
}
extern inline void iowrite8(u8 b, void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
mb();
}
extern inline void iowrite16(u16 b, void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
mb();
}
extern inline u8 inb(unsigned long port)
{
return ioread8(ioport_map(port, 1));
}
extern inline u16 inw(unsigned long port)
{
return ioread16(ioport_map(port, 2));
}
extern inline void outb(u8 b, unsigned long port)
{
iowrite8(b, ioport_map(port, 1));
}
extern inline void outw(u16 b, unsigned long port)
{
iowrite16(b, ioport_map(port, 2));
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
extern inline unsigned int ioread32(void __iomem *addr)
{
unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread32)(addr);
mb();
return ret;
}
extern inline void iowrite32(u32 b, void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
mb();
}
extern inline u32 inl(unsigned long port)
{
return ioread32(ioport_map(port, 4));
}
extern inline void outl(u32 b, unsigned long port)
{
iowrite32(b, ioport_map(port, 4));
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
extern inline u8 __raw_readb(const volatile void __iomem *addr)
{
return IO_CONCAT(__IO_PREFIX,readb)(addr);
}
extern inline u16 __raw_readw(const volatile void __iomem *addr)
{
return IO_CONCAT(__IO_PREFIX,readw)(addr);
}
extern inline void __raw_writeb(u8 b, volatile void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,writeb)(b, addr);
}
extern inline void __raw_writew(u16 b, volatile void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,writew)(b, addr);
}
extern inline u8 readb(const volatile void __iomem *addr)
{
u8 ret = __raw_readb(addr);
mb();
return ret;
}
extern inline u16 readw(const volatile void __iomem *addr)
{
u16 ret = __raw_readw(addr);
mb();
return ret;
}
extern inline void writeb(u8 b, volatile void __iomem *addr)
{
__raw_writeb(b, addr);
mb();
}
extern inline void writew(u16 b, volatile void __iomem *addr)
{
__raw_writew(b, addr);
mb();
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1
extern inline u32 __raw_readl(const volatile void __iomem *addr)
{
return IO_CONCAT(__IO_PREFIX,readl)(addr);
}
extern inline u64 __raw_readq(const volatile void __iomem *addr)
{
return IO_CONCAT(__IO_PREFIX,readq)(addr);
}
extern inline void __raw_writel(u32 b, volatile void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,writel)(b, addr);
}
extern inline void __raw_writeq(u64 b, volatile void __iomem *addr)
{
IO_CONCAT(__IO_PREFIX,writeq)(b, addr);
}
extern inline u32 readl(const volatile void __iomem *addr)
{
u32 ret = __raw_readl(addr);
mb();
return ret;
}
extern inline u64 readq(const volatile void __iomem *addr)
{
u64 ret = __raw_readq(addr);
mb();
return ret;
}
extern inline void writel(u32 b, volatile void __iomem *addr)
{
__raw_writel(b, addr);
mb();
}
extern inline void writeq(u64 b, volatile void __iomem *addr)
{
__raw_writeq(b, addr);
mb();
}
#endif
#define inb_p inb
#define inw_p inw
#define inl_p inl
#define outb_p outb
#define outw_p outw
#define outl_p outl
#define readb_relaxed(addr) __raw_readb(addr)
#define readw_relaxed(addr) __raw_readw(addr)
#define readl_relaxed(addr) __raw_readl(addr)
#define readq_relaxed(addr) __raw_readq(addr)
#define mmiowb()
/*
* String version of IO memory access ops:
*/
extern void memcpy_fromio(void *, const volatile void __iomem *, long);
extern void memcpy_toio(volatile void __iomem *, const void *, long);
extern void _memset_c_io(volatile void __iomem *, unsigned long, long);
static inline void memset_io(volatile void __iomem *addr, u8 c, long len)
{
_memset_c_io(addr, 0x0101010101010101UL * c, len);
}
#define __HAVE_ARCH_MEMSETW_IO
static inline void memsetw_io(volatile void __iomem *addr, u16 c, long len)
{
_memset_c_io(addr, 0x0001000100010001UL * c, len);
}
/*
* String versions of in/out ops:
*/
extern void insb (unsigned long port, void *dst, unsigned long count);
extern void insw (unsigned long port, void *dst, unsigned long count);
extern void insl (unsigned long port, void *dst, unsigned long count);
extern void outsb (unsigned long port, const void *src, unsigned long count);
extern void outsw (unsigned long port, const void *src, unsigned long count);
extern void outsl (unsigned long port, const void *src, unsigned long count);
/*
* XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and
* just copy it. The net code will then do the checksum later. Presently
* only used by some shared memory 8390 Ethernet cards anyway.
*/
#define eth_io_copy_and_sum(skb,src,len,unused) \
memcpy_fromio((skb)->data,src,len)
#define isa_eth_io_copy_and_sum(skb,src,len,unused) \
isa_memcpy_fromio((skb)->data,src,len)
static inline int
check_signature(const volatile void __iomem *io_addr,
const unsigned char *signature, int length)
{
do {
if (readb(io_addr) != *signature)
return 0;
io_addr++;
signature++;
} while (--length);
return 1;
}
/*
* ISA space is mapped to some machine-specific location on Alpha.
* Call into the existing hooks to get the address translated.
*/
static inline u8
isa_readb(unsigned long offset)
{
void __iomem *addr = ioremap(offset, 1);
u8 ret = readb(addr);
iounmap(addr);
return ret;
}
static inline u16
isa_readw(unsigned long offset)
{
void __iomem *addr = ioremap(offset, 2);
u16 ret = readw(addr);
iounmap(addr);
return ret;
}
static inline u32
isa_readl(unsigned long offset)
{
void __iomem *addr = ioremap(offset, 2);
u32 ret = readl(addr);
iounmap(addr);
return ret;
}
static inline void
isa_writeb(u8 b, unsigned long offset)
{
void __iomem *addr = ioremap(offset, 2);
writeb(b, addr);
iounmap(addr);
}
static inline void
isa_writew(u16 w, unsigned long offset)
{
void __iomem *addr = ioremap(offset, 2);
writew(w, addr);
iounmap(addr);
}
static inline void
isa_writel(u32 l, unsigned long offset)
{
void __iomem *addr = ioremap(offset, 2);
writel(l, addr);
iounmap(addr);
}
static inline void
isa_memset_io(unsigned long offset, u8 val, long n)
{
void __iomem *addr = ioremap(offset, n);
memset_io(addr, val, n);
iounmap(addr);
}
static inline void
isa_memcpy_fromio(void *dest, unsigned long offset, long n)
{
void __iomem *addr = ioremap(offset, n);
memcpy_fromio(dest, addr, n);
iounmap(addr);
}
static inline void
isa_memcpy_toio(unsigned long offset, const void *src, long n)
{
void __iomem *addr = ioremap(offset, n);
memcpy_toio(addr, src, n);
iounmap(addr);
}
/*
* The Alpha Jensen hardware for some rather strange reason puts
* the RTC clock at 0x170 instead of 0x70. Probably due to some
* misguided idea about using 0x70 for NMI stuff.
*
* These defines will override the defaults when doing RTC queries
*/
#ifdef CONFIG_ALPHA_GENERIC
# define RTC_PORT(x) ((x) + alpha_mv.rtc_port)
#else
# ifdef CONFIG_ALPHA_JENSEN
# define RTC_PORT(x) (0x170+(x))
# else
# define RTC_PORT(x) (0x70 + (x))
# endif
#endif
#define RTC_ALWAYS_BCD 0
/* Nothing to do */
#define dma_cache_inv(_start,_size) do { } while (0)
#define dma_cache_wback(_start,_size) do { } while (0)
#define dma_cache_wback_inv(_start,_size) do { } while (0)
/*
* Some mucking forons use if[n]def writeq to check if platform has it.
* It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
* to play with; for now just use cpp anti-recursion logics and make sure
* that damn thing is defined and expands to itself.
*/
#define writeq writeq
#define readq readq
#endif /* __KERNEL__ */
#endif /* __ALPHA_IO_H */

View File

@@ -0,0 +1,127 @@
/* Trivial implementations of basic i/o routines. Assumes that all
of the hard work has been done by ioremap and ioportmap, and that
access to i/o space is linear. */
/* This file may be included multiple times. */
#if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
__EXTERN_INLINE unsigned int
IO_CONCAT(__IO_PREFIX,ioread8)(void __iomem *a)
{
return __kernel_ldbu(*(volatile u8 __force *)a);
}
__EXTERN_INLINE unsigned int
IO_CONCAT(__IO_PREFIX,ioread16)(void __iomem *a)
{
return __kernel_ldwu(*(volatile u16 __force *)a);
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,iowrite8)(u8 b, void __iomem *a)
{
__kernel_stb(b, *(volatile u8 __force *)a);
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)
{
__kernel_stb(b, *(volatile u16 __force *)a);
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
__EXTERN_INLINE unsigned int
IO_CONCAT(__IO_PREFIX,ioread32)(void __iomem *a)
{
return *(volatile u32 __force *)a;
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,iowrite32)(u32 b, void __iomem *a)
{
*(volatile u32 __force *)a = b;
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
__EXTERN_INLINE u8
IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a)
{
return __kernel_ldbu(*(const volatile u8 __force *)a);
}
__EXTERN_INLINE u16
IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a)
{
return __kernel_ldwu(*(const volatile u16 __force *)a);
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a)
{
__kernel_stb(b, *(volatile u8 __force *)a);
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
{
__kernel_stb(b, *(volatile u16 __force *)a);
}
#elif IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 2
__EXTERN_INLINE u8
IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a)
{
return IO_CONCAT(__IO_PREFIX,ioread8)((void __iomem *)a);
}
__EXTERN_INLINE u16
IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a)
{
return IO_CONCAT(__IO_PREFIX,ioread16)((void __iomem *)a);
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a)
{
IO_CONCAT(__IO_PREFIX,iowrite8)(b, (void __iomem *)a);
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
{
IO_CONCAT(__IO_PREFIX,iowrite16)(b, (void __iomem *)a);
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1
__EXTERN_INLINE u32
IO_CONCAT(__IO_PREFIX,readl)(const volatile void __iomem *a)
{
return *(const volatile u32 __force *)a;
}
__EXTERN_INLINE u64
IO_CONCAT(__IO_PREFIX,readq)(const volatile void __iomem *a)
{
return *(const volatile u64 __force *)a;
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,writel)(u32 b, volatile void __iomem *a)
{
*(volatile u32 __force *)a = b;
}
__EXTERN_INLINE void
IO_CONCAT(__IO_PREFIX,writeq)(u64 b, volatile void __iomem *a)
{
*(volatile u64 __force *)a = b;
}
#endif
#if IO_CONCAT(__IO_PREFIX,trivial_iounmap)
__EXTERN_INLINE void IO_CONCAT(__IO_PREFIX,iounmap)(volatile void __iomem *a)
{
}
#endif

View File

@@ -0,0 +1,66 @@
#ifndef _ALPHA_IOCTL_H
#define _ALPHA_IOCTL_H
/*
* The original linux ioctl numbering scheme was just a general
* "anything goes" setup, where more or less random numbers were
* assigned. Sorry, I was clueless when I started out on this.
*
* On the alpha, we'll try to clean it up a bit, using a more sane
* ioctl numbering, and also trying to be compatible with OSF/1 in
* the process. I'd like to clean it up for the i386 as well, but
* it's so painful recognizing both the new and the old numbers..
*/
#define _IOC_NRBITS 8
#define _IOC_TYPEBITS 8
#define _IOC_SIZEBITS 13
#define _IOC_DIRBITS 3
#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
#define _IOC_NRSHIFT 0
#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
/*
* Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
* And this turns out useful to catch old ioctl numbers in header
* files for us.
*/
#define _IOC_NONE 1U
#define _IOC_READ 2U
#define _IOC_WRITE 4U
#define _IOC(dir,type,nr,size) \
((unsigned int) \
(((dir) << _IOC_DIRSHIFT) | \
((type) << _IOC_TYPESHIFT) | \
((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT)))
/* used to create numbers */
#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
/* used to decode them.. */
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
/* ...and for the drivers/sound files... */
#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
#endif /* _ALPHA_IOCTL_H */

View File

@@ -0,0 +1,112 @@
#ifndef _ASM_ALPHA_IOCTLS_H
#define _ASM_ALPHA_IOCTLS_H
#include <asm/ioctl.h>
#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
#define FIOASYNC _IOW('f', 125, int)
#define FIONBIO _IOW('f', 126, int)
#define FIONREAD _IOR('f', 127, int)
#define TIOCINQ FIONREAD
#define FIOQSIZE _IOR('f', 128, loff_t)
#define TIOCGETP _IOR('t', 8, struct sgttyb)
#define TIOCSETP _IOW('t', 9, struct sgttyb)
#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
#define TIOCSETC _IOW('t', 17, struct tchars)
#define TIOCGETC _IOR('t', 18, struct tchars)
#define TCGETS _IOR('t', 19, struct termios)
#define TCSETS _IOW('t', 20, struct termios)
#define TCSETSW _IOW('t', 21, struct termios)
#define TCSETSF _IOW('t', 22, struct termios)
#define TCGETA _IOR('t', 23, struct termio)
#define TCSETA _IOW('t', 24, struct termio)
#define TCSETAW _IOW('t', 25, struct termio)
#define TCSETAF _IOW('t', 28, struct termio)
#define TCSBRK _IO('t', 29)
#define TCXONC _IO('t', 30)
#define TCFLSH _IO('t', 31)
#define TIOCSWINSZ _IOW('t', 103, struct winsize)
#define TIOCGWINSZ _IOR('t', 104, struct winsize)
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
#define TIOCGLTC _IOR('t', 116, struct ltchars)
#define TIOCSLTC _IOW('t', 117, struct ltchars)
#define TIOCSPGRP _IOW('t', 118, int)
#define TIOCGPGRP _IOR('t', 119, int)
#define TIOCEXCL 0x540C
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E
#define TIOCSTI 0x5412
#define TIOCMGET 0x5415
#define TIOCMBIS 0x5416
#define TIOCMBIC 0x5417
#define TIOCMSET 0x5418
# define TIOCM_LE 0x001
# define TIOCM_DTR 0x002
# define TIOCM_RTS 0x004
# define TIOCM_ST 0x008
# define TIOCM_SR 0x010
# define TIOCM_CTS 0x020
# define TIOCM_CAR 0x040
# define TIOCM_RNG 0x080
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
# define TIOCM_OUT1 0x2000
# define TIOCM_OUT2 0x4000
# define TIOCM_LOOP 0x8000
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
#define TIOCLINUX 0x541C
#define TIOCCONS 0x541D
#define TIOCGSERIAL 0x541E
#define TIOCSSERIAL 0x541F
#define TIOCPKT 0x5420
# define TIOCPKT_DATA 0
# define TIOCPKT_FLUSHREAD 1
# define TIOCPKT_FLUSHWRITE 2
# define TIOCPKT_STOP 4
# define TIOCPKT_START 8
# define TIOCPKT_NOSTOP 16
# define TIOCPKT_DOSTOP 32
#define TIOCNOTTY 0x5422
#define TIOCSETD 0x5423
#define TIOCGETD 0x5424
#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
#define TIOCSBRK 0x5427 /* BSD compatibility */
#define TIOCCBRK 0x5428 /* BSD compatibility */
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
#define TIOCSERGETLSR 0x5459 /* Get line status register */
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
#define TIOCSERGETMULTI 0x545A /* Get multiport config */
#define TIOCSERSETMULTI 0x545B /* Set multiport config */
#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
#endif /* _ASM_ALPHA_IOCTLS_H */

View File

@@ -0,0 +1,28 @@
#ifndef _ALPHA_IPCBUF_H
#define _ALPHA_IPCBUF_H
/*
* The ipc64_perm structure for alpha architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* Pad space is left for:
* - 32-bit seq
* - 2 miscellaneous 64-bit values
*/
struct ipc64_perm
{
__kernel_key_t key;
__kernel_uid_t uid;
__kernel_gid_t gid;
__kernel_uid_t cuid;
__kernel_gid_t cgid;
__kernel_mode_t mode;
unsigned short seq;
unsigned short __pad1;
unsigned long __unused1;
unsigned long __unused2;
};
#endif /* _ALPHA_IPCBUF_H */

View File

@@ -0,0 +1,100 @@
#ifndef _ALPHA_IRQ_H
#define _ALPHA_IRQ_H
/*
* linux/include/alpha/irq.h
*
* (C) 1994 Linus Torvalds
*/
#include <linux/linkage.h>
#include <linux/config.h>
#if defined(CONFIG_ALPHA_GENERIC)
/* Here NR_IRQS is not exact, but rather an upper bound. This is used
many places throughout the kernel to size static arrays. That's ok,
we'll use alpha_mv.nr_irqs when we want the real thing. */
/* When LEGACY_START_ADDRESS is selected, we leave out:
TITAN
WILDFIRE
MARVEL
This helps keep the kernel object size reasonable for the majority
of machines.
*/
# if defined(CONFIG_ALPHA_LEGACY_START_ADDRESS)
# define NR_IRQS (128) /* max is RAWHIDE/TAKARA */
# else
# define NR_IRQS (32768 + 16) /* marvel - 32 pids */
# endif
#elif defined(CONFIG_ALPHA_CABRIOLET) || \
defined(CONFIG_ALPHA_EB66P) || \
defined(CONFIG_ALPHA_EB164) || \
defined(CONFIG_ALPHA_PC164) || \
defined(CONFIG_ALPHA_LX164)
# define NR_IRQS 35
#elif defined(CONFIG_ALPHA_EB66) || \
defined(CONFIG_ALPHA_EB64P) || \
defined(CONFIG_ALPHA_MIKASA)
# define NR_IRQS 32
#elif defined(CONFIG_ALPHA_ALCOR) || \
defined(CONFIG_ALPHA_MIATA) || \
defined(CONFIG_ALPHA_RUFFIAN) || \
defined(CONFIG_ALPHA_RX164) || \
defined(CONFIG_ALPHA_NORITAKE)
# define NR_IRQS 48
#elif defined(CONFIG_ALPHA_SABLE) || \
defined(CONFIG_ALPHA_SX164)
# define NR_IRQS 40
#elif defined(CONFIG_ALPHA_DP264) || \
defined(CONFIG_ALPHA_LYNX) || \
defined(CONFIG_ALPHA_SHARK) || \
defined(CONFIG_ALPHA_EIGER)
# define NR_IRQS 64
#elif defined(CONFIG_ALPHA_TITAN)
#define NR_IRQS 80
#elif defined(CONFIG_ALPHA_RAWHIDE) || \
defined(CONFIG_ALPHA_TAKARA)
# define NR_IRQS 128
#elif defined(CONFIG_ALPHA_WILDFIRE)
# define NR_IRQS 2048 /* enuff for 8 QBBs */
#elif defined(CONFIG_ALPHA_MARVEL)
# define NR_IRQS (32768 + 16) /* marvel - 32 pids*/
#else /* everyone else */
# define NR_IRQS 16
#endif
static __inline__ int irq_canonicalize(int irq)
{
/*
* XXX is this true for all Alpha's? The old serial driver
* did it this way for years without any complaints, so....
*/
return ((irq == 2) ? 9 : irq);
}
extern void disable_irq(unsigned int);
extern void disable_irq_nosync(unsigned int);
extern void enable_irq(unsigned int);
struct pt_regs;
extern void (*perf_irq)(unsigned long, struct pt_regs *);
struct irqaction;
int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
#endif /* _ALPHA_IRQ_H */

View File

@@ -0,0 +1,346 @@
#ifndef __ALPHA_JENSEN_H
#define __ALPHA_JENSEN_H
#include <asm/compiler.h>
/*
* Defines for the AlphaPC EISA IO and memory address space.
*/
/*
* NOTE! The memory operations do not set any memory barriers, as it's
* not needed for cases like a frame buffer that is essentially memory-like.
* You need to do them by hand if the operations depend on ordering.
*
* Similarly, the port IO operations do a "mb" only after a write operation:
* if an mb is needed before (as in the case of doing memory mapped IO
* first, and then a port IO operation to the same device), it needs to be
* done by hand.
*
* After the above has bitten me 100 times, I'll give up and just do the
* mb all the time, but right now I'm hoping this will work out. Avoiding
* mb's may potentially be a noticeable speed improvement, but I can't
* honestly say I've tested it.
*
* Handling interrupts that need to do mb's to synchronize to non-interrupts
* is another fun race area. Don't do it (because if you do, I'll have to
* do *everything* with interrupts disabled, ugh).
*/
/*
* EISA Interrupt Acknowledge address
*/
#define EISA_INTA (IDENT_ADDR + 0x100000000UL)
/*
* FEPROM addresses
*/
#define EISA_FEPROM0 (IDENT_ADDR + 0x180000000UL)
#define EISA_FEPROM1 (IDENT_ADDR + 0x1A0000000UL)
/*
* VL82C106 base address
*/
#define EISA_VL82C106 (IDENT_ADDR + 0x1C0000000UL)
/*
* EISA "Host Address Extension" address (bits 25-31 of the EISA address)
*/
#define EISA_HAE (IDENT_ADDR + 0x1D0000000UL)
/*
* "SYSCTL" register address
*/
#define EISA_SYSCTL (IDENT_ADDR + 0x1E0000000UL)
/*
* "spare" register address
*/
#define EISA_SPARE (IDENT_ADDR + 0x1F0000000UL)
/*
* EISA memory address offset
*/
#define EISA_MEM (IDENT_ADDR + 0x200000000UL)
/*
* EISA IO address offset
*/
#define EISA_IO (IDENT_ADDR + 0x300000000UL)
#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __IO_EXTERN_INLINE
#endif
/*
* Handle the "host address register". This needs to be set
* to the high 7 bits of the EISA address. This is also needed
* for EISA IO addresses, which are only 16 bits wide (the
* hae needs to be set to 0).
*
* HAE isn't needed for the local IO operations, though.
*/
#define JENSEN_HAE_ADDRESS EISA_HAE
#define JENSEN_HAE_MASK 0x1ffffff
__EXTERN_INLINE void jensen_set_hae(unsigned long addr)
{
/* hae on the Jensen is bits 31:25 shifted right */
addr >>= 25;
if (addr != alpha_mv.hae_cache)
set_hae(addr);
}
#define vuip volatile unsigned int *
/*
* IO functions
*
* The "local" functions are those that don't go out to the EISA bus,
* but instead act on the VL82C106 chip directly.. This is mainly the
* keyboard, RTC, printer and first two serial lines..
*
* The local stuff makes for some complications, but it seems to be
* gone in the PCI version. I hope I can get DEC suckered^H^H^H^H^H^H^H^H
* convinced that I need one of the newer machines.
*/
static inline unsigned int jensen_local_inb(unsigned long addr)
{
return 0xff & *(vuip)((addr << 9) + EISA_VL82C106);
}
static inline void jensen_local_outb(u8 b, unsigned long addr)
{
*(vuip)((addr << 9) + EISA_VL82C106) = b;
mb();
}
static inline unsigned int jensen_bus_inb(unsigned long addr)
{
long result;
jensen_set_hae(0);
result = *(volatile int *)((addr << 7) + EISA_IO + 0x00);
return __kernel_extbl(result, addr & 3);
}
static inline void jensen_bus_outb(u8 b, unsigned long addr)
{
jensen_set_hae(0);
*(vuip)((addr << 7) + EISA_IO + 0x00) = b * 0x01010101;
mb();
}
/*
* It seems gcc is not very good at optimizing away logical
* operations that result in operations across inline functions.
* Which is why this is a macro.
*/
#define jensen_is_local(addr) ( \
/* keyboard */ (addr == 0x60 || addr == 0x64) || \
/* RTC */ (addr == 0x170 || addr == 0x171) || \
/* mb COM2 */ (addr >= 0x2f8 && addr <= 0x2ff) || \
/* mb LPT1 */ (addr >= 0x3bc && addr <= 0x3be) || \
/* mb COM2 */ (addr >= 0x3f8 && addr <= 0x3ff))
__EXTERN_INLINE u8 jensen_inb(unsigned long addr)
{
if (jensen_is_local(addr))
return jensen_local_inb(addr);
else
return jensen_bus_inb(addr);
}
__EXTERN_INLINE void jensen_outb(u8 b, unsigned long addr)
{
if (jensen_is_local(addr))
jensen_local_outb(b, addr);
else
jensen_bus_outb(b, addr);
}
__EXTERN_INLINE u16 jensen_inw(unsigned long addr)
{
long result;
jensen_set_hae(0);
result = *(volatile int *) ((addr << 7) + EISA_IO + 0x20);
result >>= (addr & 3) * 8;
return 0xffffUL & result;
}
__EXTERN_INLINE u32 jensen_inl(unsigned long addr)
{
jensen_set_hae(0);
return *(vuip) ((addr << 7) + EISA_IO + 0x60);
}
__EXTERN_INLINE void jensen_outw(u16 b, unsigned long addr)
{
jensen_set_hae(0);
*(vuip) ((addr << 7) + EISA_IO + 0x20) = b * 0x00010001;
mb();
}
__EXTERN_INLINE void jensen_outl(u32 b, unsigned long addr)
{
jensen_set_hae(0);
*(vuip) ((addr << 7) + EISA_IO + 0x60) = b;
mb();
}
/*
* Memory functions.
*/
__EXTERN_INLINE u8 jensen_readb(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
long result;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x00);
result >>= (addr & 3) * 8;
return 0xffUL & result;
}
__EXTERN_INLINE u16 jensen_readw(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
long result;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x20);
result >>= (addr & 3) * 8;
return 0xffffUL & result;
}
__EXTERN_INLINE u32 jensen_readl(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
return *(vuip) ((addr << 7) + EISA_MEM + 0x60);
}
__EXTERN_INLINE u64 jensen_readq(const volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
unsigned long r0, r1;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
addr = (addr << 7) + EISA_MEM + 0x60;
r0 = *(vuip) (addr);
r1 = *(vuip) (addr + (4 << 7));
return r1 << 32 | r0;
}
__EXTERN_INLINE void jensen_writeb(u8 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
*(vuip) ((addr << 7) + EISA_MEM + 0x00) = b * 0x01010101;
}
__EXTERN_INLINE void jensen_writew(u16 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
*(vuip) ((addr << 7) + EISA_MEM + 0x20) = b * 0x00010001;
}
__EXTERN_INLINE void jensen_writel(u32 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
*(vuip) ((addr << 7) + EISA_MEM + 0x60) = b;
}
__EXTERN_INLINE void jensen_writeq(u64 b, volatile void __iomem *xaddr)
{
unsigned long addr = (unsigned long) xaddr;
jensen_set_hae(addr);
addr &= JENSEN_HAE_MASK;
addr = (addr << 7) + EISA_MEM + 0x60;
*(vuip) (addr) = b;
*(vuip) (addr + (4 << 7)) = b >> 32;
}
__EXTERN_INLINE void __iomem *jensen_ioportmap(unsigned long addr)
{
return (void __iomem *)addr;
}
__EXTERN_INLINE void __iomem *jensen_ioremap(unsigned long addr,
unsigned long size)
{
return (void __iomem *)(addr + 0x100000000ul);
}
__EXTERN_INLINE int jensen_is_ioaddr(unsigned long addr)
{
return (long)addr >= 0;
}
__EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)
{
return (unsigned long)addr >= 0x100000000ul;
}
/* New-style ioread interface. All the routines are so ugly for Jensen
that it doesn't make sense to merge them. */
#define IOPORT(OS, NS) \
__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \
{ \
if (jensen_is_mmio(xaddr)) \
return jensen_read##OS(xaddr - 0x100000000ul); \
else \
return jensen_in##OS((unsigned long)xaddr); \
} \
__EXTERN_INLINE void jensen_iowrite##NS(u##NS b, void __iomem *xaddr) \
{ \
if (jensen_is_mmio(xaddr)) \
jensen_write##OS(b, xaddr - 0x100000000ul); \
else \
jensen_out##OS(b, (unsigned long)xaddr); \
}
IOPORT(b, 8)
IOPORT(w, 16)
IOPORT(l, 32)
#undef IOPORT
#undef vuip
#undef __IO_PREFIX
#define __IO_PREFIX jensen
#define jensen_trivial_rw_bw 0
#define jensen_trivial_rw_lq 0
#define jensen_trivial_io_bw 0
#define jensen_trivial_io_lq 0
#define jensen_trivial_iounmap 1
#include <asm/io_trivial.h>
#ifdef __IO_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __IO_EXTERN_INLINE
#endif
#endif /* __KERNEL__ */
#endif /* __ALPHA_JENSEN_H */

View File

@@ -0,0 +1,33 @@
#ifndef _ASM_KMAP_TYPES_H
#define _ASM_KMAP_TYPES_H
/* Dummy header just to define km_type. */
#include <linux/config.h>
#ifdef CONFIG_DEBUG_HIGHMEM
# define D(n) __KM_FENCE_##n ,
#else
# define D(n)
#endif
enum km_type {
D(0) KM_BOUNCE_READ,
D(1) KM_SKB_SUNRPC_DATA,
D(2) KM_SKB_DATA_SOFTIRQ,
D(3) KM_USER0,
D(4) KM_USER1,
D(5) KM_BIO_SRC_IRQ,
D(6) KM_BIO_DST_IRQ,
D(7) KM_PTE0,
D(8) KM_PTE1,
D(9) KM_IRQ0,
D(10) KM_IRQ1,
D(11) KM_SOFTIRQ0,
D(12) KM_SOFTIRQ1,
D(13) KM_TYPE_NR
};
#undef D
#endif

View File

@@ -0,0 +1,6 @@
#ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H
/* Nothing to see here... */
#endif

View File

@@ -0,0 +1,40 @@
#ifndef _ALPHA_LOCAL_H
#define _ALPHA_LOCAL_H
#include <linux/percpu.h>
#include <asm/atomic.h>
typedef atomic64_t local_t;
#define LOCAL_INIT(i) ATOMIC64_INIT(i)
#define local_read(v) atomic64_read(v)
#define local_set(v,i) atomic64_set(v,i)
#define local_inc(v) atomic64_inc(v)
#define local_dec(v) atomic64_dec(v)
#define local_add(i, v) atomic64_add(i, v)
#define local_sub(i, v) atomic64_sub(i, v)
#define __local_inc(v) ((v)->counter++)
#define __local_dec(v) ((v)->counter++)
#define __local_add(i,v) ((v)->counter+=(i))
#define __local_sub(i,v) ((v)->counter-=(i))
/* Use these for per-cpu local_t variables: on some archs they are
* much more efficient than these naive implementations. Note they take
* a variable, not an address.
*/
#define cpu_local_read(v) local_read(&__get_cpu_var(v))
#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
#endif /* _ALPHA_LOCAL_H */

View File

@@ -0,0 +1,136 @@
#ifndef __ALPHA_MACHVEC_H
#define __ALPHA_MACHVEC_H 1
#include <linux/config.h>
#include <linux/types.h>
/*
* This file gets pulled in by asm/io.h from user space. We don't
* want most of this escaping.
*/
#ifdef __KERNEL__
/* The following structure vectors all of the I/O and IRQ manipulation
from the generic kernel to the hardware specific backend. */
struct task_struct;
struct mm_struct;
struct pt_regs;
struct vm_area_struct;
struct linux_hose_info;
struct pci_dev;
struct pci_ops;
struct pci_controller;
struct _alpha_agp_info;
struct alpha_machine_vector
{
/* This "belongs" down below with the rest of the runtime
variables, but it is convenient for entry.S if these
two slots are at the beginning of the struct. */
unsigned long hae_cache;
unsigned long *hae_register;
int nr_irqs;
int rtc_port;
unsigned int max_asn;
unsigned long max_isa_dma_address;
unsigned long irq_probe_mask;
unsigned long iack_sc;
unsigned long min_io_address;
unsigned long min_mem_address;
unsigned long pci_dac_offset;
void (*mv_pci_tbi)(struct pci_controller *hose,
dma_addr_t start, dma_addr_t end);
unsigned int (*mv_ioread8)(void __iomem *);
unsigned int (*mv_ioread16)(void __iomem *);
unsigned int (*mv_ioread32)(void __iomem *);
void (*mv_iowrite8)(u8, void __iomem *);
void (*mv_iowrite16)(u16, void __iomem *);
void (*mv_iowrite32)(u32, void __iomem *);
u8 (*mv_readb)(const volatile void __iomem *);
u16 (*mv_readw)(const volatile void __iomem *);
u32 (*mv_readl)(const volatile void __iomem *);
u64 (*mv_readq)(const volatile void __iomem *);
void (*mv_writeb)(u8, volatile void __iomem *);
void (*mv_writew)(u16, volatile void __iomem *);
void (*mv_writel)(u32, volatile void __iomem *);
void (*mv_writeq)(u64, volatile void __iomem *);
void __iomem *(*mv_ioportmap)(unsigned long);
void __iomem *(*mv_ioremap)(unsigned long, unsigned long);
void (*mv_iounmap)(volatile void __iomem *);
int (*mv_is_ioaddr)(unsigned long);
int (*mv_is_mmio)(const volatile void __iomem *);
void (*mv_switch_mm)(struct mm_struct *, struct mm_struct *,
struct task_struct *);
void (*mv_activate_mm)(struct mm_struct *, struct mm_struct *);
void (*mv_flush_tlb_current)(struct mm_struct *);
void (*mv_flush_tlb_current_page)(struct mm_struct * mm,
struct vm_area_struct *vma,
unsigned long addr);
void (*update_irq_hw)(unsigned long, unsigned long, int);
void (*ack_irq)(unsigned long);
void (*device_interrupt)(unsigned long vector, struct pt_regs *regs);
void (*machine_check)(u64 vector, u64 la, struct pt_regs *regs);
void (*smp_callin)(void);
void (*init_arch)(void);
void (*init_irq)(void);
void (*init_rtc)(void);
void (*init_pci)(void);
void (*kill_arch)(int);
u8 (*pci_swizzle)(struct pci_dev *, u8 *);
int (*pci_map_irq)(struct pci_dev *, u8, u8);
struct pci_ops *pci_ops;
struct _alpha_agp_info *(*agp_info)(void);
const char *vector_name;
/* NUMA information */
int (*pa_to_nid)(unsigned long);
int (*cpuid_to_nid)(int);
unsigned long (*node_mem_start)(int);
unsigned long (*node_mem_size)(int);
/* System specific parameters. */
union {
struct {
unsigned long gru_int_req_bits;
} cia;
struct {
unsigned long gamma_bias;
} t2;
struct {
unsigned int route_tab;
} sio;
} sys;
};
extern struct alpha_machine_vector alpha_mv;
#ifdef CONFIG_ALPHA_GENERIC
extern int alpha_using_srm;
#else
#ifdef CONFIG_ALPHA_SRM
#define alpha_using_srm 1
#else
#define alpha_using_srm 0
#endif
#endif /* GENERIC */
#endif
#endif /* __ALPHA_MACHVEC_H */

View File

@@ -0,0 +1,27 @@
/*
* Machine dependent access functions for RTC registers.
*/
#ifndef __ASM_ALPHA_MC146818RTC_H
#define __ASM_ALPHA_MC146818RTC_H
#include <asm/io.h>
#ifndef RTC_PORT
#define RTC_PORT(x) (0x70 + (x))
#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
#endif
/*
* The yet supported machines all access the RTC index register via
* an ISA port access but the way to access the date register differs ...
*/
#define CMOS_READ(addr) ({ \
outb_p((addr),RTC_PORT(0)); \
inb_p(RTC_PORT(1)); \
})
#define CMOS_WRITE(val, addr) ({ \
outb_p((addr),RTC_PORT(0)); \
outb_p((val),RTC_PORT(1)); \
})
#endif /* __ASM_ALPHA_MC146818RTC_H */

View File

@@ -0,0 +1,13 @@
/* $Id: md.h,v 1.1 1997/12/15 15:11:48 jj Exp $
* md.h: High speed xor_block operation for RAID4/5
*
*/
#ifndef __ASM_MD_H
#define __ASM_MD_H
/* #define HAVE_ARCH_XORBLOCK */
#define MD_XORBLOCK_ALIGNMENT sizeof(long)
#endif /* __ASM_MD_H */

View File

@@ -0,0 +1,50 @@
#ifndef __ALPHA_MMAN_H__
#define __ALPHA_MMAN_H__
#define PROT_READ 0x1 /* page can be read */
#define PROT_WRITE 0x2 /* page can be written */
#define PROT_EXEC 0x4 /* page can be executed */
#define PROT_SEM 0x8 /* page may be used for atomic ops */
#define PROT_NONE 0x0 /* page can not be accessed */
#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
#define MAP_SHARED 0x01 /* Share changes */
#define MAP_PRIVATE 0x02 /* Changes are private */
#define MAP_TYPE 0x0f /* Mask for type of mapping (OSF/1 is _wrong_) */
#define MAP_FIXED 0x100 /* Interpret addr exactly */
#define MAP_ANONYMOUS 0x10 /* don't use a file */
/* not used by linux, but here to make sure we don't clash with OSF/1 defines */
#define _MAP_HASSEMAPHORE 0x0200
#define _MAP_INHERIT 0x0400
#define _MAP_UNALIGNED 0x0800
/* These are linux-specific */
#define MAP_GROWSDOWN 0x01000 /* stack-like segment */
#define MAP_DENYWRITE 0x02000 /* ETXTBSY */
#define MAP_EXECUTABLE 0x04000 /* mark it as an executable */
#define MAP_LOCKED 0x08000 /* lock the mapping */
#define MAP_NORESERVE 0x10000 /* don't check for reservations */
#define MAP_POPULATE 0x20000 /* populate (prefault) pagetables */
#define MAP_NONBLOCK 0x40000 /* do not block on IO */
#define MS_ASYNC 1 /* sync memory asynchronously */
#define MS_SYNC 2 /* synchronous memory sync */
#define MS_INVALIDATE 4 /* invalidate the caches */
#define MCL_CURRENT 8192 /* lock all currently mapped pages */
#define MCL_FUTURE 16384 /* lock all additions to address space */
#define MADV_NORMAL 0 /* no further special treatment */
#define MADV_RANDOM 1 /* expect random page references */
#define MADV_SEQUENTIAL 2 /* expect sequential page references */
#define MADV_WILLNEED 3 /* will need these pages */
#define MADV_SPACEAVAIL 5 /* ensure resources are available */
#define MADV_DONTNEED 6 /* don't need these pages */
/* compatibility flags */
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FILE 0
#endif /* __ALPHA_MMAN_H__ */

View File

@@ -0,0 +1,7 @@
#ifndef __ALPHA_MMU_H
#define __ALPHA_MMU_H
/* The alpha MMU context is one "unsigned long" bitmap per CPU */
typedef unsigned long mm_context_t[NR_CPUS];
#endif

View File

@@ -0,0 +1,261 @@
#ifndef __ALPHA_MMU_CONTEXT_H
#define __ALPHA_MMU_CONTEXT_H
/*
* get a new mmu context..
*
* Copyright (C) 1996, Linus Torvalds
*/
#include <linux/config.h>
#include <asm/system.h>
#include <asm/machvec.h>
#include <asm/compiler.h>
/*
* Force a context reload. This is needed when we change the page
* table pointer or when we update the ASN of the current process.
*/
/* Don't get into trouble with dueling __EXTERN_INLINEs. */
#ifndef __EXTERN_INLINE
#include <asm/io.h>
#endif
extern inline unsigned long
__reload_thread(struct pcb_struct *pcb)
{
register unsigned long a0 __asm__("$16");
register unsigned long v0 __asm__("$0");
a0 = virt_to_phys(pcb);
__asm__ __volatile__(
"call_pal %2 #__reload_thread"
: "=r"(v0), "=r"(a0)
: "i"(PAL_swpctx), "r"(a0)
: "$1", "$22", "$23", "$24", "$25");
return v0;
}
/*
* The maximum ASN's the processor supports. On the EV4 this is 63
* but the PAL-code doesn't actually use this information. On the
* EV5 this is 127, and EV6 has 255.
*
* On the EV4, the ASNs are more-or-less useless anyway, as they are
* only used as an icache tag, not for TB entries. On the EV5 and EV6,
* ASN's also validate the TB entries, and thus make a lot more sense.
*
* The EV4 ASN's don't even match the architecture manual, ugh. And
* I quote: "If a processor implements address space numbers (ASNs),
* and the old PTE has the Address Space Match (ASM) bit clear (ASNs
* in use) and the Valid bit set, then entries can also effectively be
* made coherent by assigning a new, unused ASN to the currently
* running process and not reusing the previous ASN before calling the
* appropriate PALcode routine to invalidate the translation buffer (TB)".
*
* In short, the EV4 has a "kind of" ASN capability, but it doesn't actually
* work correctly and can thus not be used (explaining the lack of PAL-code
* support).
*/
#define EV4_MAX_ASN 63
#define EV5_MAX_ASN 127
#define EV6_MAX_ASN 255
#ifdef CONFIG_ALPHA_GENERIC
# define MAX_ASN (alpha_mv.max_asn)
#else
# ifdef CONFIG_ALPHA_EV4
# define MAX_ASN EV4_MAX_ASN
# elif defined(CONFIG_ALPHA_EV5)
# define MAX_ASN EV5_MAX_ASN
# else
# define MAX_ASN EV6_MAX_ASN
# endif
#endif
/*
* cpu_last_asn(processor):
* 63 0
* +-------------+----------------+--------------+
* | asn version | this processor | hardware asn |
* +-------------+----------------+--------------+
*/
#ifdef CONFIG_SMP
#include <asm/smp.h>
#define cpu_last_asn(cpuid) (cpu_data[cpuid].last_asn)
#else
extern unsigned long last_asn;
#define cpu_last_asn(cpuid) last_asn
#endif /* CONFIG_SMP */
#define WIDTH_HARDWARE_ASN 8
#define ASN_FIRST_VERSION (1UL << WIDTH_HARDWARE_ASN)
#define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1)
/*
* NOTE! The way this is set up, the high bits of the "asn_cache" (and
* the "mm->context") are the ASN _version_ code. A version of 0 is
* always considered invalid, so to invalidate another process you only
* need to do "p->mm->context = 0".
*
* If we need more ASN's than the processor has, we invalidate the old
* user TLB's (tbiap()) and start a new ASN version. That will automatically
* force a new asn for any other processes the next time they want to
* run.
*/
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
#define __MMU_EXTERN_INLINE
#endif
static inline unsigned long
__get_new_mm_context(struct mm_struct *mm, long cpu)
{
unsigned long asn = cpu_last_asn(cpu);
unsigned long next = asn + 1;
if ((asn & HARDWARE_ASN_MASK) >= MAX_ASN) {
tbiap();
imb();
next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION;
}
cpu_last_asn(cpu) = next;
return next;
}
__EXTERN_INLINE void
ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
struct task_struct *next)
{
/* Check if our ASN is of an older version, and thus invalid. */
unsigned long asn;
unsigned long mmc;
long cpu = smp_processor_id();
#ifdef CONFIG_SMP
cpu_data[cpu].asn_lock = 1;
barrier();
#endif
asn = cpu_last_asn(cpu);
mmc = next_mm->context[cpu];
if ((mmc ^ asn) & ~HARDWARE_ASN_MASK) {
mmc = __get_new_mm_context(next_mm, cpu);
next_mm->context[cpu] = mmc;
}
#ifdef CONFIG_SMP
else
cpu_data[cpu].need_new_asn = 1;
#endif
/* Always update the PCB ASN. Another thread may have allocated
a new mm->context (via flush_tlb_mm) without the ASN serial
number wrapping. We have no way to detect when this is needed. */
next->thread_info->pcb.asn = mmc & HARDWARE_ASN_MASK;
}
__EXTERN_INLINE void
ev4_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
struct task_struct *next)
{
/* As described, ASN's are broken for TLB usage. But we can
optimize for switching between threads -- if the mm is
unchanged from current we needn't flush. */
/* ??? May not be needed because EV4 PALcode recognizes that
ASN's are broken and does a tbiap itself on swpctx, under
the "Must set ASN or flush" rule. At least this is true
for a 1992 SRM, reports Joseph Martin (jmartin@hlo.dec.com).
I'm going to leave this here anyway, just to Be Sure. -- r~ */
if (prev_mm != next_mm)
tbiap();
/* Do continue to allocate ASNs, because we can still use them
to avoid flushing the icache. */
ev5_switch_mm(prev_mm, next_mm, next);
}
extern void __load_new_mm_context(struct mm_struct *);
#ifdef CONFIG_SMP
#define check_mmu_context() \
do { \
int cpu = smp_processor_id(); \
cpu_data[cpu].asn_lock = 0; \
barrier(); \
if (cpu_data[cpu].need_new_asn) { \
struct mm_struct * mm = current->active_mm; \
cpu_data[cpu].need_new_asn = 0; \
if (!mm->context[cpu]) \
__load_new_mm_context(mm); \
} \
} while(0)
#else
#define check_mmu_context() do { } while(0)
#endif
__EXTERN_INLINE void
ev5_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
{
__load_new_mm_context(next_mm);
}
__EXTERN_INLINE void
ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
{
__load_new_mm_context(next_mm);
tbiap();
}
#define deactivate_mm(tsk,mm) do { } while (0)
#ifdef CONFIG_ALPHA_GENERIC
# define switch_mm(a,b,c) alpha_mv.mv_switch_mm((a),(b),(c))
# define activate_mm(x,y) alpha_mv.mv_activate_mm((x),(y))
#else
# ifdef CONFIG_ALPHA_EV4
# define switch_mm(a,b,c) ev4_switch_mm((a),(b),(c))
# define activate_mm(x,y) ev4_activate_mm((x),(y))
# else
# define switch_mm(a,b,c) ev5_switch_mm((a),(b),(c))
# define activate_mm(x,y) ev5_activate_mm((x),(y))
# endif
#endif
extern inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
int i;
for (i = 0; i < NR_CPUS; i++)
if (cpu_online(i))
mm->context[i] = 0;
if (tsk != current)
tsk->thread_info->pcb.ptbr
= ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
return 0;
}
extern inline void
destroy_context(struct mm_struct *mm)
{
/* Nothing to do. */
}
static inline void
enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
{
tsk->thread_info->pcb.ptbr
= ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
}
#ifdef __MMU_EXTERN_INLINE
#undef __EXTERN_INLINE
#undef __MMU_EXTERN_INLINE
#endif
#endif /* __ALPHA_MMU_CONTEXT_H */

View File

@@ -0,0 +1,131 @@
/*
* Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
* Adapted for the alpha wildfire architecture Jan 2001.
*/
#ifndef _ASM_MMZONE_H_
#define _ASM_MMZONE_H_
#include <linux/config.h>
#include <asm/smp.h>
struct bootmem_data_t; /* stupid forward decl. */
/*
* Following are macros that are specific to this numa platform.
*/
extern pg_data_t node_data[];
#define alpha_pa_to_nid(pa) \
(alpha_mv.pa_to_nid \
? alpha_mv.pa_to_nid(pa) \
: (0))
#define node_mem_start(nid) \
(alpha_mv.node_mem_start \
? alpha_mv.node_mem_start(nid) \
: (0UL))
#define node_mem_size(nid) \
(alpha_mv.node_mem_size \
? alpha_mv.node_mem_size(nid) \
: ((nid) ? (0UL) : (~0UL)))
#define pa_to_nid(pa) alpha_pa_to_nid(pa)
#define NODE_DATA(nid) (&node_data[(nid)])
#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
#if 1
#define PLAT_NODE_DATA_LOCALNR(p, n) \
(((p) >> PAGE_SHIFT) - PLAT_NODE_DATA(n)->gendata.node_start_pfn)
#else
static inline unsigned long
PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
{
unsigned long temp;
temp = p >> PAGE_SHIFT;
return temp - PLAT_NODE_DATA(n)->gendata.node_start_pfn;
}
#endif
#ifdef CONFIG_DISCONTIGMEM
/*
* Following are macros that each numa implementation must define.
*/
/*
* Given a kernel address, find the home node of the underlying memory.
*/
#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
#define local_mapnr(kvaddr) \
((__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)))
/*
* Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
* and returns the kaddr corresponding to first physical page in the
* node's mem_map.
*/
#define LOCAL_BASE_ADDR(kaddr) \
((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn \
<< PAGE_SHIFT))
/* XXX: FIXME -- wli */
#define kern_addr_valid(kaddr) (0)
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr)
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32))
#define pte_pfn(pte) (pte_val(pte) >> 32)
#define mk_pte(page, pgprot) \
({ \
pte_t pte; \
unsigned long pfn; \
\
pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \
pfn += page_zone(page)->zone_start_pfn << 32; \
pte_val(pte) = pfn | pgprot_val(pgprot); \
\
pte; \
})
#define pte_page(x) \
({ \
unsigned long kvirt; \
struct page * __xx; \
\
kvirt = (unsigned long)__va(pte_val(x) >> (32-PAGE_SHIFT)); \
__xx = virt_to_page(kvirt); \
\
__xx; \
})
#define pfn_to_page(pfn) \
({ \
unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \
(node_mem_map(kvaddr_to_nid(kaddr)) + local_mapnr(kaddr)); \
})
#define page_to_pfn(page) \
((page) - page_zone(page)->zone_mem_map + \
(page_zone(page)->zone_start_pfn))
#define page_to_pa(page) \
((( (page) - page_zone(page)->zone_mem_map ) \
+ page_zone(page)->zone_start_pfn) << PAGE_SHIFT)
#define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT))
#define pfn_valid(pfn) \
(((pfn) - node_start_pfn(pfn_to_nid(pfn))) < \
node_spanned_pages(pfn_to_nid(pfn))) \
#define virt_addr_valid(kaddr) pfn_valid((__pa(kaddr) >> PAGE_SHIFT))
#endif /* CONFIG_DISCONTIGMEM */
#endif /* _ASM_MMZONE_H_ */

View File

@@ -0,0 +1,23 @@
#ifndef _ALPHA_MODULE_H
#define _ALPHA_MODULE_H
struct mod_arch_specific
{
unsigned int gotsecindex;
};
#define Elf_Sym Elf64_Sym
#define Elf_Shdr Elf64_Shdr
#define Elf_Ehdr Elf64_Ehdr
#define Elf_Phdr Elf64_Phdr
#define Elf_Dyn Elf64_Dyn
#define Elf_Rel Elf64_Rel
#define Elf_Rela Elf64_Rela
#define ARCH_SHF_SMALL SHF_ALPHA_GPREL
#ifdef MODULE
asm(".section .got,\"aws\",@progbits; .align 3; .previous");
#endif
#endif /*_ALPHA_MODULE_H*/

View File

@@ -0,0 +1,27 @@
#ifndef _ALPHA_MSGBUF_H
#define _ALPHA_MSGBUF_H
/*
* The msqid64_ds structure for alpha architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* Pad space is left for:
* - 2 miscellaneous 64-bit values
*/
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 /* _ALPHA_MSGBUF_H */

Some files were not shown because too many files have changed in this diff Show More