aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h217
-rw-r--r--include/acpi/acdebug.h231
-rw-r--r--include/acpi/acdisasm.h445
-rw-r--r--include/acpi/acdispat.h345
-rw-r--r--include/acpi/acevents.h216
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acglobal.h387
-rw-r--r--include/acpi/achware.h131
-rw-r--r--include/acpi/acinterp.h529
-rw-r--r--include/acpi/aclocal.h1044
-rw-r--r--include/acpi/acmacros.h693
-rw-r--r--include/acpi/acnamesp.h321
-rw-r--r--include/acpi/acobject.h446
-rw-r--r--include/acpi/acopcode.h323
-rw-r--r--include/acpi/acoutput.h103
-rw-r--r--include/acpi/acparser.h234
-rw-r--r--include/acpi/acpi.h31
-rw-r--r--include/acpi/acpiosxf.h13
-rw-r--r--include/acpi/acpixf.h100
-rw-r--r--include/acpi/acpredef.h371
-rw-r--r--include/acpi/acresrc.h336
-rw-r--r--include/acpi/acrestyp.h405
-rw-r--r--include/acpi/acstruct.h228
-rw-r--r--include/acpi/actables.h115
-rw-r--r--include/acpi/actbl.h25
-rw-r--r--include/acpi/actbl1.h2
-rw-r--r--include/acpi/actypes.h557
-rw-r--r--include/acpi/acutils.h585
-rw-r--r--include/acpi/amlcode.h494
-rw-r--r--include/acpi/amlresrc.h311
-rw-r--r--include/acpi/platform/acenv.h45
-rw-r--r--include/acpi/platform/aclinux.h4
-rw-r--r--include/linux/acpi.h17
-rw-r--r--include/linux/async_tx.h17
-rw-r--r--include/linux/atmel-mci.h6
-rw-r--r--include/linux/auxvec.h6
-rw-r--r--include/linux/backlight.h16
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/can/core.h2
-rw-r--r--include/linux/cgroup.h61
-rw-r--r--include/linux/cpuset.h10
-rw-r--r--include/linux/dmaengine.h181
-rw-r--r--include/linux/dw_dmac.h31
-rw-r--r--include/linux/ext2_fs.h24
-rw-r--r--include/linux/ext2_fs_sb.h4
-rw-r--r--include/linux/ext3_fs.h52
-rw-r--r--include/linux/ext3_fs_sb.h5
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/if_vlan.h19
-rw-r--r--include/linux/ioprio.h2
-rw-r--r--include/linux/jbd.h15
-rw-r--r--include/linux/jbd2.h38
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/memcontrol.h154
-rw-r--r--include/linux/mm_inline.h22
-rw-r--r--include/linux/mmzone.h24
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/ftl.h38
-rw-r--r--include/linux/mtd/map.h1
-rw-r--r--include/linux/mtd/mtd.h75
-rw-r--r--include/linux/mtd/nand.h7
-rw-r--r--include/linux/mtd/partitions.h6
-rw-r--r--include/linux/mtd/pfow.h159
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/mtd/qinfo.h91
-rw-r--r--include/linux/mtd/sharpsl.h20
-rw-r--r--include/linux/netdevice.h9
-rw-r--r--include/linux/nwpserial.h18
-rw-r--r--include/linux/oprofile.h18
-rw-r--r--include/linux/page_cgroup.h52
-rw-r--r--include/linux/pci_hotplug.h1
-rw-r--r--include/linux/pid.h18
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/raid/md_k.h20
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/raid/raid0.h10
-rw-r--r--include/linux/regulator/consumer.h8
-rw-r--r--include/linux/regulator/driver.h37
-rw-r--r--include/linux/regulator/machine.h41
-rw-r--r--include/linux/res_counter.h8
-rw-r--r--include/linux/serial_core.h3
-rw-r--r--include/linux/spi/tdo24m.h13
-rw-r--r--include/linux/suspend.h13
-rw-r--r--include/linux/swap.h25
-rw-r--r--include/net/netdma.h11
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/wimax.h3
-rw-r--r--include/scsi/scsi_transport_fc.h1
-rw-r--r--include/xen/xenbus.h2
91 files changed, 1953 insertions, 8781 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
deleted file mode 100644
index 29feee27f0ea..000000000000
--- a/include/acpi/acconfig.h
+++ /dev/null
@@ -1,217 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acconfig.h - Global configuration constants
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACCONFIG_H
45#define _ACCONFIG_H
46
47/******************************************************************************
48 *
49 * Configuration options
50 *
51 *****************************************************************************/
52
53/*
54 * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the
55 * ACPI subsystem. This includes the DEBUG_PRINT output
56 * statements. When disabled, all DEBUG_PRINT
57 * statements are compiled out.
58 *
59 * ACPI_APPLICATION - Use this switch if the subsystem is going to be run
60 * at the application level.
61 *
62 */
63
64/* Current ACPICA subsystem version in YYYYMMDD format */
65
66#define ACPI_CA_VERSION 0x20080926
67
68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
70 * but there is a large base of ASL/AML code in existing machines that check
71 * for the string below. The use of this string usually guarantees that
72 * the ASL will execute down the most tested code path. Also, there is some
73 * code that will not execute the _OSI method unless _OS matches the string
74 * below. Therefore, change this string at your own risk.
75 */
76#define ACPI_OS_NAME "Microsoft Windows NT"
77
78/* Maximum objects in the various object caches */
79
80#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
81#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
82#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
83#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
84#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
85
86/*
87 * Should the subsystem abort the loading of an ACPI table if the
88 * table checksum is incorrect?
89 */
90#define ACPI_CHECKSUM_ABORT FALSE
91
92/******************************************************************************
93 *
94 * Subsystem Constants
95 *
96 *****************************************************************************/
97
98/* Version of ACPI supported */
99
100#define ACPI_CA_SUPPORT_LEVEL 3
101
102/* Maximum count for a semaphore object */
103
104#define ACPI_MAX_SEMAPHORE_COUNT 256
105
106/* Maximum object reference count (detects object deletion issues) */
107
108#define ACPI_MAX_REFERENCE_COUNT 0x1000
109
110/* Size of cached memory mapping for system memory operation region */
111
112#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
113
114/* owner_id tracking. 8 entries allows for 255 owner_ids */
115
116#define ACPI_NUM_OWNERID_MASKS 8
117
118/* Size of the root table array is increased by this increment */
119
120#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
121
122/******************************************************************************
123 *
124 * ACPI Specification constants (Do not change unless the specification changes)
125 *
126 *****************************************************************************/
127
128/* Number of distinct GPE register blocks and register width */
129
130#define ACPI_MAX_GPE_BLOCKS 2
131#define ACPI_GPE_REGISTER_WIDTH 8
132
133/* Method info (in WALK_STATE), containing local variables and argumetns */
134
135#define ACPI_METHOD_NUM_LOCALS 8
136#define ACPI_METHOD_MAX_LOCAL 7
137
138#define ACPI_METHOD_NUM_ARGS 7
139#define ACPI_METHOD_MAX_ARG 6
140
141/* Length of _HID, _UID, _CID, and UUID values */
142
143#define ACPI_DEVICE_ID_LENGTH 0x09
144#define ACPI_MAX_CID_LENGTH 48
145#define ACPI_UUID_LENGTH 16
146
147/*
148 * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
149 */
150#define ACPI_OBJ_NUM_OPERANDS 8
151#define ACPI_OBJ_MAX_OPERAND 7
152
153/* Number of elements in the Result Stack frame, can be an arbitrary value */
154
155#define ACPI_RESULTS_FRAME_OBJ_NUM 8
156
157/*
158 * Maximal number of elements the Result Stack can contain,
159 * it may be an arbitray value not exceeding the types of
160 * result_size and result_count (now u8).
161 */
162#define ACPI_RESULTS_OBJ_NUM_MAX 255
163
164/* Names within the namespace are 4 bytes long */
165
166#define ACPI_NAME_SIZE 4
167#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
168#define ACPI_PATH_SEPARATOR '.'
169
170/* Sizes for ACPI table headers */
171
172#define ACPI_OEM_ID_SIZE 6
173#define ACPI_OEM_TABLE_ID_SIZE 8
174
175/* Constants used in searching for the RSDP in low memory */
176
177#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
178#define ACPI_EBDA_PTR_LENGTH 2
179#define ACPI_EBDA_WINDOW_SIZE 1024
180#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */
181#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000
182#define ACPI_RSDP_SCAN_STEP 16
183
184/* Operation regions */
185
186#define ACPI_NUM_PREDEFINED_REGIONS 8
187#define ACPI_USER_REGION_BEGIN 0x80
188
189/* Maximum space_ids for Operation Regions */
190
191#define ACPI_MAX_ADDRESS_SPACE 255
192
193/* Array sizes. Used for range checking also */
194
195#define ACPI_MAX_MATCH_OPCODE 5
196
197/* RSDP checksums */
198
199#define ACPI_RSDP_CHECKSUM_LENGTH 20
200#define ACPI_RSDP_XCHECKSUM_LENGTH 36
201
202/* SMBus bidirectional buffer size */
203
204#define ACPI_SMBUS_BUFFER_SIZE 34
205
206/******************************************************************************
207 *
208 * ACPI AML Debugger
209 *
210 *****************************************************************************/
211
212#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
213
214#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
215#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
216
217#endif /* _ACCONFIG_H */
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
deleted file mode 100644
index 62c59df3b86c..000000000000
--- a/include/acpi/acdebug.h
+++ /dev/null
@@ -1,231 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acdebug.h - ACPI/AML debugger
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACDEBUG_H__
45#define __ACDEBUG_H__
46
47#define ACPI_DEBUG_BUFFER_SIZE 4196
48
49struct command_info {
50 char *name; /* Command Name */
51 u8 min_args; /* Minimum arguments required */
52};
53
54struct argument_info {
55 char *name; /* Argument Name */
56};
57
58#define PARAM_LIST(pl) pl
59#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
60#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
61 acpi_os_printf PARAM_LIST(fp);}
62
63#define EX_NO_SINGLE_STEP 1
64#define EX_SINGLE_STEP 2
65
66/*
67 * dbxface - external debugger interfaces
68 */
69acpi_status acpi_db_initialize(void);
70
71void acpi_db_terminate(void);
72
73acpi_status
74acpi_db_single_step(struct acpi_walk_state *walk_state,
75 union acpi_parse_object *op, u32 op_type);
76
77/*
78 * dbcmds - debug commands and output routines
79 */
80acpi_status acpi_db_disassemble_method(char *name);
81
82void acpi_db_display_table_info(char *table_arg);
83
84void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg);
85
86void
87acpi_db_set_method_breakpoint(char *location,
88 struct acpi_walk_state *walk_state,
89 union acpi_parse_object *op);
90
91void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
92
93void acpi_db_get_bus_info(void);
94
95void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
96
97void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
98
99void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
100
101void acpi_db_send_notify(char *name, u32 value);
102
103void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
104
105acpi_status
106acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
107
108acpi_status acpi_db_find_name_in_namespace(char *name_arg);
109
110void acpi_db_set_scope(char *name);
111
112acpi_status acpi_db_sleep(char *object_arg);
113
114void acpi_db_find_references(char *object_arg);
115
116void acpi_db_display_locks(void);
117
118void acpi_db_display_resources(char *object_arg);
119
120void acpi_db_display_gpes(void);
121
122void acpi_db_check_integrity(void);
123
124void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
125
126void acpi_db_check_predefined_names(void);
127
128void acpi_db_batch_execute(void);
129
130/*
131 * dbdisply - debug display commands
132 */
133void acpi_db_display_method_info(union acpi_parse_object *op);
134
135void acpi_db_decode_and_display_object(char *target, char *output_type);
136
137void
138acpi_db_display_result_object(union acpi_operand_object *obj_desc,
139 struct acpi_walk_state *walk_state);
140
141acpi_status acpi_db_display_all_methods(char *display_count_arg);
142
143void acpi_db_display_arguments(void);
144
145void acpi_db_display_locals(void);
146
147void acpi_db_display_results(void);
148
149void acpi_db_display_calling_tree(void);
150
151void acpi_db_display_object_type(char *object_arg);
152
153void
154acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
155 struct acpi_walk_state *walk_state);
156
157void acpi_db_check_predefined_names(void);
158
159void acpi_db_batch_execute(void);
160
161/*
162 * dbexec - debugger control method execution
163 */
164void acpi_db_execute(char *name, char **args, u32 flags);
165
166void
167acpi_db_create_execution_threads(char *num_threads_arg,
168 char *num_loops_arg, char *method_name_arg);
169
170#ifdef ACPI_DBG_TRACK_ALLOCATIONS
171u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
172#endif
173
174/*
175 * dbfileio - Debugger file I/O commands
176 */
177acpi_object_type
178acpi_db_match_argument(char *user_argument, struct argument_info *arguments);
179
180void acpi_db_close_debug_file(void);
181
182void acpi_db_open_debug_file(char *name);
183
184acpi_status acpi_db_load_acpi_table(char *filename);
185
186acpi_status
187acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table);
188
189acpi_status
190acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table);
191
192/*
193 * dbhistry - debugger HISTORY command
194 */
195void acpi_db_add_to_history(char *command_line);
196
197void acpi_db_display_history(void);
198
199char *acpi_db_get_from_history(char *command_num_arg);
200
201/*
202 * dbinput - user front-end to the AML debugger
203 */
204acpi_status
205acpi_db_command_dispatch(char *input_buffer,
206 struct acpi_walk_state *walk_state,
207 union acpi_parse_object *op);
208
209void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
210
211/*
212 * dbstats - Generation and display of ACPI table statistics
213 */
214void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
215
216acpi_status acpi_db_display_statistics(char *type_arg);
217
218/*
219 * dbutils - AML debugger utilities
220 */
221void acpi_db_set_output_destination(u32 where);
222
223void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
224
225void acpi_db_prep_namestring(char *name);
226
227struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
228
229void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
230
231#endif /* __ACDEBUG_H__ */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
deleted file mode 100644
index 0c1ed387073c..000000000000
--- a/include/acpi/acdisasm.h
+++ /dev/null
@@ -1,445 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acdisasm.h - AML disassembler
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACDISASM_H__
45#define __ACDISASM_H__
46
47#include "amlresrc.h"
48
49#define BLOCK_NONE 0
50#define BLOCK_PAREN 1
51#define BLOCK_BRACE 2
52#define BLOCK_COMMA_LIST 4
53#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
54
55struct acpi_external_list {
56 char *path;
57 char *internal_path;
58 struct acpi_external_list *next;
59 u32 value;
60 u16 length;
61 u8 type;
62};
63
64extern struct acpi_external_list *acpi_gbl_external_list;
65
66typedef const struct acpi_dmtable_info {
67 u8 opcode;
68 u8 offset;
69 char *name;
70
71} acpi_dmtable_info;
72
73/*
74 * Values for Opcode above.
75 * Note: 0-7 must not change, used as a flag shift value
76 */
77#define ACPI_DMT_FLAG0 0
78#define ACPI_DMT_FLAG1 1
79#define ACPI_DMT_FLAG2 2
80#define ACPI_DMT_FLAG3 3
81#define ACPI_DMT_FLAG4 4
82#define ACPI_DMT_FLAG5 5
83#define ACPI_DMT_FLAG6 6
84#define ACPI_DMT_FLAG7 7
85#define ACPI_DMT_FLAGS0 8
86#define ACPI_DMT_FLAGS2 9
87#define ACPI_DMT_UINT8 10
88#define ACPI_DMT_UINT16 11
89#define ACPI_DMT_UINT24 12
90#define ACPI_DMT_UINT32 13
91#define ACPI_DMT_UINT56 14
92#define ACPI_DMT_UINT64 15
93#define ACPI_DMT_STRING 16
94#define ACPI_DMT_NAME4 17
95#define ACPI_DMT_NAME6 18
96#define ACPI_DMT_NAME8 19
97#define ACPI_DMT_CHKSUM 20
98#define ACPI_DMT_SPACEID 21
99#define ACPI_DMT_GAS 22
100#define ACPI_DMT_ASF 23
101#define ACPI_DMT_DMAR 24
102#define ACPI_DMT_HEST 25
103#define ACPI_DMT_HESTNTFY 26
104#define ACPI_DMT_HESTNTYP 27
105#define ACPI_DMT_MADT 28
106#define ACPI_DMT_SRAT 29
107#define ACPI_DMT_EXIT 30
108#define ACPI_DMT_SIG 31
109
110typedef
111void (*acpi_dmtable_handler) (struct acpi_table_header * table);
112
113struct acpi_dmtable_data {
114 char *signature;
115 struct acpi_dmtable_info *table_info;
116 acpi_dmtable_handler table_handler;
117 char *name;
118};
119
120struct acpi_op_walk_info {
121 u32 level;
122 u32 last_level;
123 u32 count;
124 u32 bit_offset;
125 u32 flags;
126 struct acpi_walk_state *walk_state;
127};
128
129typedef
130acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
131 u32 level, void *context);
132
133struct acpi_resource_tag {
134 u32 bit_index;
135 char *tag;
136};
137
138/* Strings used for decoding flags to ASL keywords */
139
140extern const char *acpi_gbl_word_decode[];
141extern const char *acpi_gbl_irq_decode[];
142extern const char *acpi_gbl_lock_rule[];
143extern const char *acpi_gbl_access_types[];
144extern const char *acpi_gbl_update_rules[];
145extern const char *acpi_gbl_match_ops[];
146
147extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
148extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
149extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[];
150extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
151extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[];
152extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
153extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
154extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
155extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
156extern struct acpi_dmtable_info acpi_dm_table_info_bert[];
157extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
158extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
159extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
160extern struct acpi_dmtable_info acpi_dm_table_info_dmar[];
161extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[];
162extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[];
163extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[];
164extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];
165extern struct acpi_dmtable_info acpi_dm_table_info_dmar2[];
166extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
167extern struct acpi_dmtable_info acpi_dm_table_info_einj[];
168extern struct acpi_dmtable_info acpi_dm_table_info_einj0[];
169extern struct acpi_dmtable_info acpi_dm_table_info_erst[];
170extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
171extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
172extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
173extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
174extern struct acpi_dmtable_info acpi_dm_table_info_header[];
175extern struct acpi_dmtable_info acpi_dm_table_info_hest[];
176extern struct acpi_dmtable_info acpi_dm_table_info_hest9[];
177extern struct acpi_dmtable_info acpi_dm_table_info_hest_notify[];
178extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
179extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
180extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
181extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
182extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
183extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
184extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
185extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
186extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
187extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
188extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
189extern struct acpi_dmtable_info acpi_dm_table_info_madt9[];
190extern struct acpi_dmtable_info acpi_dm_table_info_madt10[];
191extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
192extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
193extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
194extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
195extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
196extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
197extern struct acpi_dmtable_info acpi_dm_table_info_slic[];
198extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
199extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
200extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
201extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
202extern struct acpi_dmtable_info acpi_dm_table_info_srat_hdr[];
203extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
204extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
205extern struct acpi_dmtable_info acpi_dm_table_info_srat2[];
206extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
207extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
208
209/*
210 * dmtable
211 */
212void acpi_dm_dump_data_table(struct acpi_table_header *table);
213
214acpi_status
215acpi_dm_dump_table(u32 table_length,
216 u32 table_offset,
217 void *table,
218 u32 sub_table_length, struct acpi_dmtable_info *info);
219
220void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
221
222void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
223
224/*
225 * dmtbdump
226 */
227void acpi_dm_dump_asf(struct acpi_table_header *table);
228
229void acpi_dm_dump_cpep(struct acpi_table_header *table);
230
231void acpi_dm_dump_dmar(struct acpi_table_header *table);
232
233void acpi_dm_dump_einj(struct acpi_table_header *table);
234
235void acpi_dm_dump_erst(struct acpi_table_header *table);
236
237void acpi_dm_dump_fadt(struct acpi_table_header *table);
238
239void acpi_dm_dump_hest(struct acpi_table_header *table);
240
241void acpi_dm_dump_mcfg(struct acpi_table_header *table);
242
243void acpi_dm_dump_madt(struct acpi_table_header *table);
244
245u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
246
247void acpi_dm_dump_rsdt(struct acpi_table_header *table);
248
249void acpi_dm_dump_slit(struct acpi_table_header *table);
250
251void acpi_dm_dump_srat(struct acpi_table_header *table);
252
253void acpi_dm_dump_xsdt(struct acpi_table_header *table);
254
255/*
256 * dmwalk
257 */
258void
259acpi_dm_disassemble(struct acpi_walk_state *walk_state,
260 union acpi_parse_object *origin, u32 num_opcodes);
261
262void
263acpi_dm_walk_parse_tree(union acpi_parse_object *op,
264 asl_walk_callback descending_callback,
265 asl_walk_callback ascending_callback, void *context);
266
267/*
268 * dmopcode
269 */
270void
271acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
272 struct acpi_op_walk_info *info,
273 union acpi_parse_object *op);
274
275void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
276
277u32 acpi_dm_list_type(union acpi_parse_object *op);
278
279void acpi_dm_method_flags(union acpi_parse_object *op);
280
281void acpi_dm_field_flags(union acpi_parse_object *op);
282
283void acpi_dm_address_space(u8 space_id);
284
285void acpi_dm_region_flags(union acpi_parse_object *op);
286
287void acpi_dm_match_op(union acpi_parse_object *op);
288
289u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
290
291void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
292
293/*
294 * dmnames
295 */
296u32 acpi_dm_dump_name(char *name);
297
298acpi_status
299acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
300 union acpi_parse_object *op);
301
302void acpi_dm_namestring(char *name);
303
304/*
305 * dmobject
306 */
307void
308acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
309 struct acpi_walk_state *walk_state);
310
311void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
312
313void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
314
315void
316acpi_dm_dump_method_info(acpi_status status,
317 struct acpi_walk_state *walk_state,
318 union acpi_parse_object *op);
319
320/*
321 * dmbuffer
322 */
323void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
324
325void
326acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
327
328void acpi_dm_is_eisa_id(union acpi_parse_object *op);
329
330void acpi_dm_eisa_id(u32 encoded_id);
331
332u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
333
334u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
335
336/*
337 * dmresrc
338 */
339void acpi_dm_dump_integer8(u8 value, char *name);
340
341void acpi_dm_dump_integer16(u16 value, char *name);
342
343void acpi_dm_dump_integer32(u32 value, char *name);
344
345void acpi_dm_dump_integer64(u64 value, char *name);
346
347void
348acpi_dm_resource_template(struct acpi_op_walk_info *info,
349 union acpi_parse_object *op,
350 u8 * byte_data, u32 byte_count);
351
352acpi_status acpi_dm_is_resource_template(union acpi_parse_object *op);
353
354void acpi_dm_indent(u32 level);
355
356void acpi_dm_bit_list(u16 mask);
357
358void acpi_dm_decode_attribute(u8 attribute);
359
360void acpi_dm_descriptor_name(void);
361
362/*
363 * dmresrcl
364 */
365void
366acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
367
368void
369acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
370
371void
372acpi_dm_extended_descriptor(union aml_resource *resource,
373 u32 length, u32 level);
374
375void
376acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
377
378void
379acpi_dm_memory24_descriptor(union aml_resource *resource,
380 u32 length, u32 level);
381
382void
383acpi_dm_memory32_descriptor(union aml_resource *resource,
384 u32 length, u32 level);
385
386void
387acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
388 u32 length, u32 level);
389
390void
391acpi_dm_generic_register_descriptor(union aml_resource *resource,
392 u32 length, u32 level);
393
394void
395acpi_dm_interrupt_descriptor(union aml_resource *resource,
396 u32 length, u32 level);
397
398void
399acpi_dm_vendor_large_descriptor(union aml_resource *resource,
400 u32 length, u32 level);
401
402void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
403
404/*
405 * dmresrcs
406 */
407void
408acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
409
410void
411acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
412
413void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
414
415void
416acpi_dm_fixed_io_descriptor(union aml_resource *resource,
417 u32 length, u32 level);
418
419void
420acpi_dm_start_dependent_descriptor(union aml_resource *resource,
421 u32 length, u32 level);
422
423void
424acpi_dm_end_dependent_descriptor(union aml_resource *resource,
425 u32 length, u32 level);
426
427void
428acpi_dm_vendor_small_descriptor(union aml_resource *resource,
429 u32 length, u32 level);
430
431/*
432 * dmutils
433 */
434void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
435
436/*
437 * dmrestag
438 */
439void acpi_dm_find_resources(union acpi_parse_object *root);
440
441void
442acpi_dm_check_resource_reference(union acpi_parse_object *op,
443 struct acpi_walk_state *walk_state);
444
445#endif /* __ACDISASM_H__ */
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
deleted file mode 100644
index 6291904be01e..000000000000
--- a/include/acpi/acdispat.h
+++ /dev/null
@@ -1,345 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acdispat.h - dispatcher (parser to interpreter interface)
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACDISPAT_H_
45#define _ACDISPAT_H_
46
47#define NAMEOF_LOCAL_NTE "__L0"
48#define NAMEOF_ARG_NTE "__A0"
49
50/*
51 * dsopcode - support for late evaluation
52 */
53acpi_status
54acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc);
55
56acpi_status
57acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc);
58
59acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc);
60
61acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc);
62
63acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc);
64
65acpi_status
66acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
67 union acpi_parse_object *op);
68
69acpi_status
70acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
71 union acpi_parse_object *op);
72
73acpi_status
74acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
75 union acpi_parse_object *op);
76
77acpi_status
78acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
79 union acpi_parse_object *op,
80 union acpi_operand_object *obj_desc);
81
82acpi_status
83acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
84 union acpi_parse_object *op);
85
86acpi_status acpi_ds_initialize_region(acpi_handle obj_handle);
87
88/*
89 * dsctrl - Parser/Interpreter interface, control stack routines
90 */
91acpi_status
92acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
93 union acpi_parse_object *op);
94
95acpi_status
96acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
97 union acpi_parse_object *op);
98
99/*
100 * dsexec - Parser/Interpreter interface, method execution callbacks
101 */
102acpi_status
103acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
104 union acpi_operand_object *result_obj);
105
106acpi_status
107acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
108 union acpi_parse_object **out_op);
109
110acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state);
111
112/*
113 * dsfield - Parser/Interpreter interface for AML fields
114 */
115acpi_status
116acpi_ds_create_field(union acpi_parse_object *op,
117 struct acpi_namespace_node *region_node,
118 struct acpi_walk_state *walk_state);
119
120acpi_status
121acpi_ds_create_bank_field(union acpi_parse_object *op,
122 struct acpi_namespace_node *region_node,
123 struct acpi_walk_state *walk_state);
124
125acpi_status
126acpi_ds_create_index_field(union acpi_parse_object *op,
127 struct acpi_namespace_node *region_node,
128 struct acpi_walk_state *walk_state);
129
130acpi_status
131acpi_ds_create_buffer_field(union acpi_parse_object *op,
132 struct acpi_walk_state *walk_state);
133
134acpi_status
135acpi_ds_init_field_objects(union acpi_parse_object *op,
136 struct acpi_walk_state *walk_state);
137
138/*
139 * dsload - Parser/Interpreter interface, namespace load callbacks
140 */
141acpi_status
142acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
143 union acpi_parse_object **out_op);
144
145acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state);
146
147acpi_status
148acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
149 union acpi_parse_object **out_op);
150
151acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state);
152
153acpi_status
154acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
155
156/*
157 * dsmthdat - method data (locals/args)
158 */
159acpi_status
160acpi_ds_store_object_to_local(u8 type,
161 u32 index,
162 union acpi_operand_object *src_desc,
163 struct acpi_walk_state *walk_state);
164
165acpi_status
166acpi_ds_method_data_get_entry(u16 opcode,
167 u32 index,
168 struct acpi_walk_state *walk_state,
169 union acpi_operand_object ***node);
170
171void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
172
173u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
174
175acpi_status
176acpi_ds_method_data_get_value(u8 type,
177 u32 index,
178 struct acpi_walk_state *walk_state,
179 union acpi_operand_object **dest_desc);
180
181acpi_status
182acpi_ds_method_data_init_args(union acpi_operand_object **params,
183 u32 max_param_count,
184 struct acpi_walk_state *walk_state);
185
186acpi_status
187acpi_ds_method_data_get_node(u8 type,
188 u32 index,
189 struct acpi_walk_state *walk_state,
190 struct acpi_namespace_node **node);
191
192void acpi_ds_method_data_init(struct acpi_walk_state *walk_state);
193
194/*
195 * dsmethod - Parser/Interpreter interface - control method parsing
196 */
197acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node);
198
199acpi_status
200acpi_ds_call_control_method(struct acpi_thread_state *thread,
201 struct acpi_walk_state *walk_state,
202 union acpi_parse_object *op);
203
204acpi_status
205acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
206 union acpi_operand_object *return_desc);
207
208void
209acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
210 struct acpi_walk_state *walk_state);
211
212acpi_status
213acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
214 union acpi_operand_object *obj_desc,
215 struct acpi_walk_state *walk_state);
216
217acpi_status
218acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state);
219
220/*
221 * dsinit
222 */
223acpi_status
224acpi_ds_initialize_objects(u32 table_index,
225 struct acpi_namespace_node *start_node);
226
227/*
228 * dsobject - Parser/Interpreter interface - object initialization and conversion
229 */
230acpi_status
231acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
232 union acpi_parse_object *op,
233 u32 buffer_length,
234 union acpi_operand_object **obj_desc_ptr);
235
236acpi_status
237acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
238 union acpi_parse_object *op,
239 u32 package_length,
240 union acpi_operand_object **obj_desc);
241
242acpi_status
243acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
244 union acpi_parse_object *op,
245 u16 opcode, union acpi_operand_object **obj_desc);
246
247acpi_status
248acpi_ds_create_node(struct acpi_walk_state *walk_state,
249 struct acpi_namespace_node *node,
250 union acpi_parse_object *op);
251
252/*
253 * dsutils - Parser/Interpreter interface utility routines
254 */
255void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state);
256
257u8
258acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
259 struct acpi_walk_state *walk_state,
260 u8 add_reference);
261
262u8
263acpi_ds_is_result_used(union acpi_parse_object *op,
264 struct acpi_walk_state *walk_state);
265
266void
267acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
268 union acpi_operand_object *result_obj,
269 struct acpi_walk_state *walk_state);
270
271acpi_status
272acpi_ds_create_operand(struct acpi_walk_state *walk_state,
273 union acpi_parse_object *arg, u32 args_remaining);
274
275acpi_status
276acpi_ds_create_operands(struct acpi_walk_state *walk_state,
277 union acpi_parse_object *first_arg);
278
279acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state);
280
281void acpi_ds_clear_operands(struct acpi_walk_state *walk_state);
282
283acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state);
284
285/*
286 * dswscope - Scope Stack manipulation
287 */
288acpi_status
289acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
290 acpi_object_type type,
291 struct acpi_walk_state *walk_state);
292
293acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state);
294
295void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state);
296
297/*
298 * dswstate - parser WALK_STATE management routines
299 */
300acpi_status
301acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
302
303acpi_status
304acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
305
306struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object
307 *origin, union acpi_operand_object
308 *mth_desc, struct acpi_thread_state
309 *thread);
310
311acpi_status
312acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
313 union acpi_parse_object *op,
314 struct acpi_namespace_node *method_node,
315 u8 * aml_start,
316 u32 aml_length,
317 struct acpi_evaluate_info *info, u8 pass_number);
318
319void
320acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
321 struct acpi_walk_state *walk_state);
322
323void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state);
324
325struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state
326 *thread);
327
328void
329acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
330 struct acpi_thread_state *thread);
331
332acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state);
333
334struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
335 *thread);
336
337acpi_status
338acpi_ds_result_pop(union acpi_operand_object **object,
339 struct acpi_walk_state *walk_state);
340
341acpi_status
342acpi_ds_result_push(union acpi_operand_object *object,
343 struct acpi_walk_state *walk_state);
344
345#endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
deleted file mode 100644
index d5d099bf349c..000000000000
--- a/include/acpi/acevents.h
+++ /dev/null
@@ -1,216 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acevents.h - Event subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACEVENTS_H__
45#define __ACEVENTS_H__
46
47/*
48 * evevent
49 */
50acpi_status acpi_ev_initialize_events(void);
51
52acpi_status acpi_ev_install_xrupt_handlers(void);
53
54acpi_status acpi_ev_install_fadt_gpes(void);
55
56u32 acpi_ev_fixed_event_detect(void);
57
58/*
59 * evmisc
60 */
61u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node);
62
63acpi_status acpi_ev_acquire_global_lock(u16 timeout);
64
65acpi_status acpi_ev_release_global_lock(void);
66
67acpi_status acpi_ev_init_global_lock_handler(void);
68
69u32 acpi_ev_get_gpe_number_index(u32 gpe_number);
70
71acpi_status
72acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
73 u32 notify_value);
74
75/*
76 * evgpe - GPE handling and dispatch
77 */
78acpi_status
79acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
80 u8 type);
81
82acpi_status
83acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
84 u8 write_to_hardware);
85
86acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
87
88struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
89 u32 gpe_number);
90
91/*
92 * evgpeblk
93 */
94u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
95
96acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
97
98acpi_status
99acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
100 struct acpi_gpe_block_info *gpe_block);
101
102acpi_status
103acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
104 struct acpi_generic_address *gpe_block_address,
105 u32 register_count,
106 u8 gpe_block_base_number,
107 u32 interrupt_number,
108 struct acpi_gpe_block_info **return_gpe_block);
109
110acpi_status
111acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
112 struct acpi_gpe_block_info *gpe_block);
113
114acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block);
115
116u32
117acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info,
118 u32 gpe_number);
119
120u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
121
122acpi_status
123acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type);
124
125acpi_status
126acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info);
127
128acpi_status acpi_ev_gpe_initialize(void);
129
130/*
131 * evregion - Address Space handling
132 */
133acpi_status acpi_ev_install_region_handlers(void);
134
135acpi_status acpi_ev_initialize_op_regions(void);
136
137acpi_status
138acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
139 u32 function,
140 acpi_physical_address address,
141 u32 bit_width, acpi_integer * value);
142
143acpi_status
144acpi_ev_attach_region(union acpi_operand_object *handler_obj,
145 union acpi_operand_object *region_obj,
146 u8 acpi_ns_is_locked);
147
148void
149acpi_ev_detach_region(union acpi_operand_object *region_obj,
150 u8 acpi_ns_is_locked);
151
152acpi_status
153acpi_ev_install_space_handler(struct acpi_namespace_node *node,
154 acpi_adr_space_type space_id,
155 acpi_adr_space_handler handler,
156 acpi_adr_space_setup setup, void *context);
157
158acpi_status
159acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
160 acpi_adr_space_type space_id);
161
162acpi_status
163acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
164
165/*
166 * evregini - Region initialization and setup
167 */
168acpi_status
169acpi_ev_system_memory_region_setup(acpi_handle handle,
170 u32 function,
171 void *handler_context,
172 void **region_context);
173
174acpi_status
175acpi_ev_io_space_region_setup(acpi_handle handle,
176 u32 function,
177 void *handler_context, void **region_context);
178
179acpi_status
180acpi_ev_pci_config_region_setup(acpi_handle handle,
181 u32 function,
182 void *handler_context, void **region_context);
183
184acpi_status
185acpi_ev_cmos_region_setup(acpi_handle handle,
186 u32 function,
187 void *handler_context, void **region_context);
188
189acpi_status
190acpi_ev_pci_bar_region_setup(acpi_handle handle,
191 u32 function,
192 void *handler_context, void **region_context);
193
194acpi_status
195acpi_ev_default_region_setup(acpi_handle handle,
196 u32 function,
197 void *handler_context, void **region_context);
198
199acpi_status
200acpi_ev_initialize_region(union acpi_operand_object *region_obj,
201 u8 acpi_ns_locked);
202
203/*
204 * evsci - SCI (System Control Interrupt) handling/dispatch
205 */
206u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context);
207
208u32 acpi_ev_install_sci_handler(void);
209
210acpi_status acpi_ev_remove_sci_handler(void);
211
212u32 acpi_ev_initialize_sCI(u32 program_sCI);
213
214void acpi_ev_terminate(void);
215
216#endif /* __ACEVENTS_H__ */
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 84f5cb242863..eda04546cdf6 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -153,8 +153,9 @@
153#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML) 153#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML)
154#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML) 154#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML)
155#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML) 155#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML)
156#define AE_AML_INFINITE_LOOP (acpi_status) (0x0021 | AE_CODE_AML)
156 157
157#define AE_CODE_AML_MAX 0x0020 158#define AE_CODE_AML_MAX 0x0021
158 159
159/* 160/*
160 * Internal exceptions used for control 161 * Internal exceptions used for control
@@ -175,6 +176,8 @@
175 176
176#define AE_CODE_CTRL_MAX 0x000D 177#define AE_CODE_CTRL_MAX 0x000D
177 178
179/* Exception strings for acpi_format_exception */
180
178#ifdef DEFINE_ACPI_GLOBALS 181#ifdef DEFINE_ACPI_GLOBALS
179 182
180/* 183/*
@@ -267,6 +270,7 @@ char const *acpi_gbl_exception_names_aml[] = {
267 "AE_AML_CIRCULAR_REFERENCE", 270 "AE_AML_CIRCULAR_REFERENCE",
268 "AE_AML_BAD_RESOURCE_LENGTH", 271 "AE_AML_BAD_RESOURCE_LENGTH",
269 "AE_AML_ILLEGAL_ADDRESS", 272 "AE_AML_ILLEGAL_ADDRESS",
273 "AE_AML_INFINITE_LOOP"
270}; 274};
271 275
272char const *acpi_gbl_exception_names_ctrl[] = { 276char const *acpi_gbl_exception_names_ctrl[] = {
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
deleted file mode 100644
index 15dda46b70d1..000000000000
--- a/include/acpi/acglobal.h
+++ /dev/null
@@ -1,387 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acglobal.h - Declarations for global variables
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACGLOBAL_H__
45#define __ACGLOBAL_H__
46
47/*
48 * Ensure that the globals are actually defined and initialized only once.
49 *
50 * The use of these macros allows a single list of globals (here) in order
51 * to simplify maintenance of the code.
52 */
53#ifdef DEFINE_ACPI_GLOBALS
54#define ACPI_EXTERN
55#define ACPI_INIT_GLOBAL(a,b) a=b
56#else
57#define ACPI_EXTERN extern
58#define ACPI_INIT_GLOBAL(a,b) a
59#endif
60
61/*****************************************************************************
62 *
63 * Runtime configuration (static defaults that can be overriden at runtime)
64 *
65 ****************************************************************************/
66
67/*
68 * Enable "slack" in the AML interpreter? Default is FALSE, and the
69 * interpreter strictly follows the ACPI specification. Setting to TRUE
70 * allows the interpreter to ignore certain errors and/or bad AML constructs.
71 *
72 * Currently, these features are enabled by this flag:
73 *
74 * 1) Allow "implicit return" of last value in a control method
75 * 2) Allow access beyond the end of an operation region
76 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
77 * 4) Allow ANY object type to be a source operand for the Store() operator
78 * 5) Allow unresolved references (invalid target name) in package objects
79 * 6) Enable warning messages for behavior that is not ACPI spec compliant
80 */
81ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
82
83/*
84 * Automatically serialize ALL control methods? Default is FALSE, meaning
85 * to use the Serialized/not_serialized method flags on a per method basis.
86 * Only change this if the ASL code is poorly written and cannot handle
87 * reentrancy even though methods are marked "NotSerialized".
88 */
89ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
90
91/*
92 * Create the predefined _OSI method in the namespace? Default is TRUE
93 * because ACPI CA is fully compatible with other ACPI implementations.
94 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
95 */
96ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
97
98/*
99 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
100 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
101 * be enabled just before going to sleep.
102 */
103ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
104
105/*****************************************************************************
106 *
107 * Debug support
108 *
109 ****************************************************************************/
110
111/* Runtime configuration of debug print levels */
112
113extern u32 acpi_dbg_level;
114extern u32 acpi_dbg_layer;
115
116/* Procedure nesting level for debug output */
117
118extern u32 acpi_gbl_nesting_level;
119
120/* Support for dynamic control method tracing mechanism */
121
122ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
123ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
124ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
125ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
126ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
127ACPI_EXTERN u32 acpi_gbl_trace_flags;
128
129/*****************************************************************************
130 *
131 * ACPI Table globals
132 *
133 ****************************************************************************/
134
135/*
136 * acpi_gbl_root_table_list is the master list of ACPI tables found in the
137 * RSDT/XSDT.
138 *
139 * acpi_gbl_FADT is a local copy of the FADT, converted to a common format.
140 */
141ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
142ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
143extern u8 acpi_gbl_permanent_mmap;
144
145/* These addresses are calculated from FADT address values */
146
147ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
148ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
149
150/*
151 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
152 * determined by the revision of the DSDT: If the DSDT revision is less than
153 * 2, use only the lower 32 bits of the internal 64-bit Integer.
154 */
155ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
156ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
157ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
158
159/*****************************************************************************
160 *
161 * Mutual exlusion within ACPICA subsystem
162 *
163 ****************************************************************************/
164
165/*
166 * Predefined mutex objects. This array contains the
167 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
168 * (The table maps local handles to the real OS handles)
169 */
170ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
171
172/*
173 * Global lock mutex is an actual AML mutex object
174 * Global lock semaphore works in conjunction with the HW global lock
175 */
176ACPI_EXTERN union acpi_operand_object *acpi_gbl_global_lock_mutex;
177ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;
178ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
179ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
180ACPI_EXTERN u8 acpi_gbl_global_lock_present;
181
182/*
183 * Spinlocks are used for interfaces that can be possibly called at
184 * interrupt level
185 */
186ACPI_EXTERN spinlock_t _acpi_gbl_gpe_lock; /* For GPE data structs and registers */
187ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */
188#define acpi_gbl_gpe_lock &_acpi_gbl_gpe_lock
189#define acpi_gbl_hardware_lock &_acpi_gbl_hardware_lock
190
191/*****************************************************************************
192 *
193 * Miscellaneous globals
194 *
195 ****************************************************************************/
196
197#ifdef ACPI_DBG_TRACK_ALLOCATIONS
198
199/* Lists for tracking memory allocations */
200
201ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
202ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
203ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
204#endif
205
206/* Object caches */
207
208ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
209ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
210ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
211ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
212ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
213
214/* Global handlers */
215
216ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
217ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
218ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
219ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
220ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler;
221ACPI_EXTERN void *acpi_gbl_table_handler_context;
222ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
223
224/* Owner ID support */
225
226ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS];
227ACPI_EXTERN u8 acpi_gbl_last_owner_id_index;
228ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset;
229
230/* Misc */
231
232ACPI_EXTERN u32 acpi_gbl_original_mode;
233ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
234ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
235ACPI_EXTERN u32 acpi_gbl_ps_find_count;
236ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
237ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
238ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
239ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
240ACPI_EXTERN u8 acpi_gbl_events_initialized;
241ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
242
243#ifndef DEFINE_ACPI_GLOBALS
244
245/* Other miscellaneous */
246
247extern u8 acpi_gbl_shutdown;
248extern u32 acpi_gbl_startup_flags;
249extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
250extern const char *acpi_gbl_highest_dstate_names[4];
251extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
252extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
253
254#endif
255
256/* Exception codes */
257
258extern char const *acpi_gbl_exception_names_env[];
259extern char const *acpi_gbl_exception_names_pgm[];
260extern char const *acpi_gbl_exception_names_tbl[];
261extern char const *acpi_gbl_exception_names_aml[];
262extern char const *acpi_gbl_exception_names_ctrl[];
263
264/*****************************************************************************
265 *
266 * Namespace globals
267 *
268 ****************************************************************************/
269
270#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
271#define NUM_PREDEFINED_NAMES 10
272#else
273#define NUM_PREDEFINED_NAMES 9
274#endif
275
276ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;
277ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;
278ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;
279
280extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];
281extern const struct acpi_predefined_names
282 acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];
283
284#ifdef ACPI_DEBUG_OUTPUT
285ACPI_EXTERN u32 acpi_gbl_current_node_count;
286ACPI_EXTERN u32 acpi_gbl_current_node_size;
287ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count;
288ACPI_EXTERN acpi_size *acpi_gbl_entry_stack_pointer;
289ACPI_EXTERN acpi_size *acpi_gbl_lowest_stack_pointer;
290ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
291#endif
292
293/*****************************************************************************
294 *
295 * Interpreter globals
296 *
297 ****************************************************************************/
298
299ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
300
301/* Control method single step flag */
302
303ACPI_EXTERN u8 acpi_gbl_cm_single_step;
304
305/*****************************************************************************
306 *
307 * Hardware globals
308 *
309 ****************************************************************************/
310
311extern struct acpi_bit_register_info
312 acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
313ACPI_EXTERN u8 acpi_gbl_sleep_type_a;
314ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
315
316/*****************************************************************************
317 *
318 * Event and GPE globals
319 *
320 ****************************************************************************/
321
322extern struct acpi_fixed_event_info
323 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
324ACPI_EXTERN struct acpi_fixed_event_handler
325 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
326ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
327ACPI_EXTERN struct acpi_gpe_block_info
328*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
329
330/*****************************************************************************
331 *
332 * Debugger globals
333 *
334 ****************************************************************************/
335
336ACPI_EXTERN u8 acpi_gbl_db_output_flags;
337
338#ifdef ACPI_DISASSEMBLER
339
340ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
341ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
342#endif
343
344#ifdef ACPI_DEBUGGER
345
346extern u8 acpi_gbl_method_executing;
347extern u8 acpi_gbl_abort_method;
348extern u8 acpi_gbl_db_terminate_threads;
349
350ACPI_EXTERN int optind;
351ACPI_EXTERN char *optarg;
352
353ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
354ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
355ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
356
357ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
358ACPI_EXTERN char acpi_gbl_db_line_buf[80];
359ACPI_EXTERN char acpi_gbl_db_parsed_buf[80];
360ACPI_EXTERN char acpi_gbl_db_scope_buf[40];
361ACPI_EXTERN char acpi_gbl_db_debug_filename[40];
362ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
363ACPI_EXTERN char *acpi_gbl_db_buffer;
364ACPI_EXTERN char *acpi_gbl_db_filename;
365ACPI_EXTERN u32 acpi_gbl_db_debug_level;
366ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
367ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr;
368ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;
369
370/*
371 * Statistic globals
372 */
373ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
374ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
375ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;
376ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;
377ACPI_EXTERN u32 acpi_gbl_num_nodes;
378ACPI_EXTERN u32 acpi_gbl_num_objects;
379
380ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree;
381ACPI_EXTERN u32 acpi_gbl_size_of_method_trees;
382ACPI_EXTERN u32 acpi_gbl_size_of_node_entries;
383ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
384
385#endif /* ACPI_DEBUGGER */
386
387#endif /* __ACGLOBAL_H__ */
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
deleted file mode 100644
index 97a72b193276..000000000000
--- a/include/acpi/achware.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/******************************************************************************
2 *
3 * Name: achware.h -- hardware specific interfaces
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACHWARE_H__
45#define __ACHWARE_H__
46
47/* PM Timer ticks per second (HZ) */
48
49#define PM_TIMER_FREQUENCY 3579545
50
51/* Values for the _SST reserved method */
52
53#define ACPI_SST_INDICATOR_OFF 0
54#define ACPI_SST_WORKING 1
55#define ACPI_SST_WAKING 2
56#define ACPI_SST_SLEEPING 3
57#define ACPI_SST_SLEEP_CONTEXT 4
58
59/* Prototypes */
60
61/*
62 * hwacpi - high level functions
63 */
64acpi_status acpi_hw_set_mode(u32 mode);
65
66u32 acpi_hw_get_mode(void);
67
68/*
69 * hwregs - ACPI Register I/O
70 */
71struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
72
73acpi_status
74acpi_hw_register_read(u32 register_id, u32 * return_value);
75
76acpi_status acpi_hw_register_write(u32 register_id, u32 value);
77
78acpi_status
79acpi_hw_low_level_read(u32 width,
80 u32 * value, struct acpi_generic_address *reg);
81
82acpi_status
83acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg);
84
85acpi_status acpi_hw_clear_acpi_status(void);
86
87/*
88 * hwgpe - GPE support
89 */
90acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
91
92acpi_status
93acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
94
95acpi_status
96acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
97 struct acpi_gpe_block_info *gpe_block);
98
99acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
100
101acpi_status
102acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
103 struct acpi_gpe_block_info *gpe_block);
104
105acpi_status
106acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
107 acpi_event_status * event_status);
108
109acpi_status acpi_hw_disable_all_gpes(void);
110
111acpi_status acpi_hw_enable_all_runtime_gpes(void);
112
113acpi_status acpi_hw_enable_all_wakeup_gpes(void);
114
115acpi_status
116acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
117 struct acpi_gpe_block_info *gpe_block);
118
119#ifdef ACPI_FUTURE_USAGE
120/*
121 * hwtimer - ACPI Timer prototypes
122 */
123acpi_status acpi_get_timer_resolution(u32 * resolution);
124
125acpi_status acpi_get_timer(u32 * ticks);
126
127acpi_status
128acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed);
129#endif /* ACPI_FUTURE_USAGE */
130
131#endif /* __ACHWARE_H__ */
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
deleted file mode 100644
index e8db7a3143a5..000000000000
--- a/include/acpi/acinterp.h
+++ /dev/null
@@ -1,529 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACINTERP_H__
45#define __ACINTERP_H__
46
47#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
48
49/* Macros for tables used for debug output */
50
51#define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f)
52#define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f)
53#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info))
54
55/*
56 * If possible, pack the following structures to byte alignment, since we
57 * don't care about performance for debug output. Two cases where we cannot
58 * pack the structures:
59 *
60 * 1) Hardware does not support misaligned memory transfers
61 * 2) Compiler does not support pointers within packed structures
62 */
63#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
64#pragma pack(1)
65#endif
66
67typedef const struct acpi_exdump_info {
68 u8 opcode;
69 u8 offset;
70 char *name;
71
72} acpi_exdump_info;
73
74/* Values for the Opcode field above */
75
76#define ACPI_EXD_INIT 0
77#define ACPI_EXD_TYPE 1
78#define ACPI_EXD_UINT8 2
79#define ACPI_EXD_UINT16 3
80#define ACPI_EXD_UINT32 4
81#define ACPI_EXD_UINT64 5
82#define ACPI_EXD_LITERAL 6
83#define ACPI_EXD_POINTER 7
84#define ACPI_EXD_ADDRESS 8
85#define ACPI_EXD_STRING 9
86#define ACPI_EXD_BUFFER 10
87#define ACPI_EXD_PACKAGE 11
88#define ACPI_EXD_FIELD 12
89#define ACPI_EXD_REFERENCE 13
90
91/* restore default alignment */
92
93#pragma pack()
94
95/*
96 * exconvrt - object conversion
97 */
98acpi_status
99acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
100 union acpi_operand_object **result_desc, u32 flags);
101
102acpi_status
103acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
104 union acpi_operand_object **result_desc);
105
106acpi_status
107acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
108 union acpi_operand_object **result_desc, u32 type);
109
110/* Types for ->String conversion */
111
112#define ACPI_EXPLICIT_BYTE_COPY 0x00000000
113#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
114#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
115#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
116
117acpi_status
118acpi_ex_convert_to_target_type(acpi_object_type destination_type,
119 union acpi_operand_object *source_desc,
120 union acpi_operand_object **result_desc,
121 struct acpi_walk_state *walk_state);
122
123/*
124 * exfield - ACPI AML (p-code) execution - field manipulation
125 */
126acpi_status
127acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
128 u32 buffer_length, u32 * datum_count);
129
130acpi_status
131acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
132 acpi_integer mask,
133 acpi_integer field_value,
134 u32 field_datum_byte_offset);
135
136void
137acpi_ex_get_buffer_datum(acpi_integer * datum,
138 void *buffer,
139 u32 buffer_length,
140 u32 byte_granularity, u32 buffer_offset);
141
142void
143acpi_ex_set_buffer_datum(acpi_integer merged_datum,
144 void *buffer,
145 u32 buffer_length,
146 u32 byte_granularity, u32 buffer_offset);
147
148acpi_status
149acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
150 union acpi_operand_object *obj_desc,
151 union acpi_operand_object **ret_buffer_desc);
152
153acpi_status
154acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
155 union acpi_operand_object *obj_desc,
156 union acpi_operand_object **result_desc);
157
158/*
159 * exfldio - low level field I/O
160 */
161acpi_status
162acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
163 void *buffer, u32 buffer_length);
164
165acpi_status
166acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
167 void *buffer, u32 buffer_length);
168
169acpi_status
170acpi_ex_access_region(union acpi_operand_object *obj_desc,
171 u32 field_datum_byte_offset,
172 acpi_integer * value, u32 read_write);
173
174/*
175 * exmisc - misc support routines
176 */
177acpi_status
178acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
179 union acpi_operand_object **return_desc,
180 struct acpi_walk_state *walk_state);
181
182acpi_status
183acpi_ex_concat_template(union acpi_operand_object *obj_desc,
184 union acpi_operand_object *obj_desc2,
185 union acpi_operand_object **actual_return_desc,
186 struct acpi_walk_state *walk_state);
187
188acpi_status
189acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
190 union acpi_operand_object *obj_desc2,
191 union acpi_operand_object **actual_return_desc,
192 struct acpi_walk_state *walk_state);
193
194acpi_status
195acpi_ex_do_logical_numeric_op(u16 opcode,
196 acpi_integer integer0,
197 acpi_integer integer1, u8 * logical_result);
198
199acpi_status
200acpi_ex_do_logical_op(u16 opcode,
201 union acpi_operand_object *operand0,
202 union acpi_operand_object *operand1, u8 * logical_result);
203
204acpi_integer
205acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);
206
207acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
208
209acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);
210
211acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);
212
213acpi_status
214acpi_ex_create_region(u8 * aml_start,
215 u32 aml_length,
216 u8 region_space, struct acpi_walk_state *walk_state);
217
218acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);
219
220acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);
221
222acpi_status
223acpi_ex_create_method(u8 * aml_start,
224 u32 aml_length, struct acpi_walk_state *walk_state);
225
226/*
227 * exconfig - dynamic table load/unload
228 */
229acpi_status
230acpi_ex_load_op(union acpi_operand_object *obj_desc,
231 union acpi_operand_object *target,
232 struct acpi_walk_state *walk_state);
233
234acpi_status
235acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
236 union acpi_operand_object **return_desc);
237
238acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);
239
240/*
241 * exmutex - mutex support
242 */
243acpi_status
244acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
245 union acpi_operand_object *obj_desc,
246 struct acpi_walk_state *walk_state);
247
248acpi_status
249acpi_ex_acquire_mutex_object(u16 timeout,
250 union acpi_operand_object *obj_desc,
251 acpi_thread_id thread_id);
252
253acpi_status
254acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
255 struct acpi_walk_state *walk_state);
256
257acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc);
258
259void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
260
261void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);
262
263/*
264 * exprep - ACPI AML execution - prep utilities
265 */
266acpi_status
267acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
268 u8 field_flags,
269 u8 field_attribute,
270 u32 field_bit_position, u32 field_bit_length);
271
272acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);
273
274/*
275 * exsystem - Interface to OS services
276 */
277acpi_status
278acpi_ex_system_do_notify_op(union acpi_operand_object *value,
279 union acpi_operand_object *obj_desc);
280
281acpi_status acpi_ex_system_do_suspend(acpi_integer time);
282
283acpi_status acpi_ex_system_do_stall(u32 time);
284
285acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
286
287acpi_status
288acpi_ex_system_wait_event(union acpi_operand_object *time,
289 union acpi_operand_object *obj_desc);
290
291acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
292
293acpi_status
294acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout);
295
296acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout);
297
298/*
299 * exoparg1 - ACPI AML execution, 1 operand
300 */
301acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);
302
303acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);
304
305acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);
306
307acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);
308
309acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);
310
311/*
312 * exoparg2 - ACPI AML execution, 2 operands
313 */
314acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);
315
316acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);
317
318acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);
319
320acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);
321
322/*
323 * exoparg3 - ACPI AML execution, 3 operands
324 */
325acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);
326
327acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);
328
329/*
330 * exoparg6 - ACPI AML execution, 6 operands
331 */
332acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);
333
334/*
335 * exresolv - Object resolution and get value functions
336 */
337acpi_status
338acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
339 struct acpi_walk_state *walk_state);
340
341acpi_status
342acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
343 union acpi_operand_object *operand,
344 acpi_object_type * return_type,
345 union acpi_operand_object **return_desc);
346
347/*
348 * exresnte - resolve namespace node
349 */
350acpi_status
351acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
352 struct acpi_walk_state *walk_state);
353
354/*
355 * exresop - resolve operand to value
356 */
357acpi_status
358acpi_ex_resolve_operands(u16 opcode,
359 union acpi_operand_object **stack_ptr,
360 struct acpi_walk_state *walk_state);
361
362/*
363 * exdump - Interpreter debug output routines
364 */
365void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
366
367void
368acpi_ex_dump_operands(union acpi_operand_object **operands,
369 const char *opcode_name, u32 num_opcodes);
370
371#ifdef ACPI_FUTURE_USAGE
372void
373acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
374
375void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
376#endif /* ACPI_FUTURE_USAGE */
377
378/*
379 * exnames - AML namestring support
380 */
381acpi_status
382acpi_ex_get_name_string(acpi_object_type data_type,
383 u8 * in_aml_address,
384 char **out_name_string, u32 * out_name_length);
385
386/*
387 * exstore - Object store support
388 */
389acpi_status
390acpi_ex_store(union acpi_operand_object *val_desc,
391 union acpi_operand_object *dest_desc,
392 struct acpi_walk_state *walk_state);
393
394acpi_status
395acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
396 struct acpi_namespace_node *node,
397 struct acpi_walk_state *walk_state,
398 u8 implicit_conversion);
399
400#define ACPI_IMPLICIT_CONVERSION TRUE
401#define ACPI_NO_IMPLICIT_CONVERSION FALSE
402
403/*
404 * exstoren - resolve/store object
405 */
406acpi_status
407acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
408 acpi_object_type target_type,
409 struct acpi_walk_state *walk_state);
410
411acpi_status
412acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
413 union acpi_operand_object *dest_desc,
414 union acpi_operand_object **new_desc,
415 struct acpi_walk_state *walk_state);
416
417/*
418 * exstorob - store object - buffer/string
419 */
420acpi_status
421acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
422 union acpi_operand_object *target_desc);
423
424acpi_status
425acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
426 union acpi_operand_object *target_desc);
427
428/*
429 * excopy - object copy
430 */
431acpi_status
432acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
433 union acpi_operand_object *target_desc);
434
435acpi_status
436acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
437 union acpi_operand_object *target_desc);
438
439acpi_status
440acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
441 struct acpi_namespace_node *node);
442
443acpi_status
444acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
445 union acpi_operand_object *target_desc);
446
447/*
448 * exutils - interpreter/scanner utilities
449 */
450void acpi_ex_enter_interpreter(void);
451
452void acpi_ex_exit_interpreter(void);
453
454void acpi_ex_reacquire_interpreter(void);
455
456void acpi_ex_relinquish_interpreter(void);
457
458void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
459
460void acpi_ex_acquire_global_lock(u32 rule);
461
462void acpi_ex_release_global_lock(u32 rule);
463
464void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string);
465
466void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string);
467
468/*
469 * exregion - default op_region handlers
470 */
471acpi_status
472acpi_ex_system_memory_space_handler(u32 function,
473 acpi_physical_address address,
474 u32 bit_width,
475 acpi_integer * value,
476 void *handler_context,
477 void *region_context);
478
479acpi_status
480acpi_ex_system_io_space_handler(u32 function,
481 acpi_physical_address address,
482 u32 bit_width,
483 acpi_integer * value,
484 void *handler_context, void *region_context);
485
486acpi_status
487acpi_ex_pci_config_space_handler(u32 function,
488 acpi_physical_address address,
489 u32 bit_width,
490 acpi_integer * value,
491 void *handler_context, void *region_context);
492
493acpi_status
494acpi_ex_cmos_space_handler(u32 function,
495 acpi_physical_address address,
496 u32 bit_width,
497 acpi_integer * value,
498 void *handler_context, void *region_context);
499
500acpi_status
501acpi_ex_pci_bar_space_handler(u32 function,
502 acpi_physical_address address,
503 u32 bit_width,
504 acpi_integer * value,
505 void *handler_context, void *region_context);
506
507acpi_status
508acpi_ex_embedded_controller_space_handler(u32 function,
509 acpi_physical_address address,
510 u32 bit_width,
511 acpi_integer * value,
512 void *handler_context,
513 void *region_context);
514
515acpi_status
516acpi_ex_sm_bus_space_handler(u32 function,
517 acpi_physical_address address,
518 u32 bit_width,
519 acpi_integer * value,
520 void *handler_context, void *region_context);
521
522acpi_status
523acpi_ex_data_table_space_handler(u32 function,
524 acpi_physical_address address,
525 u32 bit_width,
526 acpi_integer * value,
527 void *handler_context, void *region_context);
528
529#endif /* __INTERP_H__ */
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
deleted file mode 100644
index ecab527cf78e..000000000000
--- a/include/acpi/aclocal.h
+++ /dev/null
@@ -1,1044 +0,0 @@
1/******************************************************************************
2 *
3 * Name: aclocal.h - Internal data types used across the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACLOCAL_H__
45#define __ACLOCAL_H__
46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
49#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
50#define ACPI_DO_NOT_WAIT 0
51#define ACPI_SERIALIZED 0xFF
52
53typedef u32 acpi_mutex_handle;
54#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
55
56/* Total number of aml opcodes defined */
57
58#define AML_NUM_OPCODES 0x7F
59
60/* Forward declarations */
61
62struct acpi_walk_state;
63struct acpi_obj_mutex;
64union acpi_parse_object;
65
66/*****************************************************************************
67 *
68 * Mutex typedefs and structs
69 *
70 ****************************************************************************/
71
72/*
73 * Predefined handles for the mutex objects used within the subsystem
74 * All mutex objects are automatically created by acpi_ut_mutex_initialize.
75 *
76 * The acquire/release ordering protocol is implied via this list. Mutexes
77 * with a lower value must be acquired before mutexes with a higher value.
78 *
79 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
80 * table below also!
81 */
82#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
83#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
84#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
85#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
86#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
87#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
88#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
89#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
90
91#define ACPI_MAX_MUTEX 7
92#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
93
94#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
95#ifdef DEFINE_ACPI_GLOBALS
96
97/* Debug names for the mutexes above */
98
99static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
100 "ACPI_MTX_Interpreter",
101 "ACPI_MTX_Namespace",
102 "ACPI_MTX_Tables",
103 "ACPI_MTX_Events",
104 "ACPI_MTX_Caches",
105 "ACPI_MTX_Memory",
106 "ACPI_MTX_CommandComplete",
107 "ACPI_MTX_CommandReady"
108};
109
110#endif
111#endif
112
113/*
114 * Predefined handles for spinlocks used within the subsystem.
115 * These spinlocks are created by acpi_ut_mutex_initialize
116 */
117#define ACPI_LOCK_GPES 0
118#define ACPI_LOCK_HARDWARE 1
119
120#define ACPI_MAX_LOCK 1
121#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
122
123/* Owner IDs are used to track namespace nodes for selective deletion */
124
125typedef u8 acpi_owner_id;
126#define ACPI_OWNER_ID_MAX 0xFF
127
128/* This Thread ID means that the mutex is not in use (unlocked) */
129
130#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
131
132/* Table for the global mutexes */
133
134struct acpi_mutex_info {
135 acpi_mutex mutex;
136 u32 use_count;
137 acpi_thread_id thread_id;
138};
139
140/* Lock flag parameter for various interfaces */
141
142#define ACPI_MTX_DO_NOT_LOCK 0
143#define ACPI_MTX_LOCK 1
144
145/* Field access granularities */
146
147#define ACPI_FIELD_BYTE_GRANULARITY 1
148#define ACPI_FIELD_WORD_GRANULARITY 2
149#define ACPI_FIELD_DWORD_GRANULARITY 4
150#define ACPI_FIELD_QWORD_GRANULARITY 8
151
152#define ACPI_ENTRY_NOT_FOUND NULL
153
154/*****************************************************************************
155 *
156 * Namespace typedefs and structs
157 *
158 ****************************************************************************/
159
160/* Operational modes of the AML interpreter/scanner */
161
162typedef enum {
163 ACPI_IMODE_LOAD_PASS1 = 0x01,
164 ACPI_IMODE_LOAD_PASS2 = 0x02,
165 ACPI_IMODE_EXECUTE = 0x03
166} acpi_interpreter_mode;
167
168union acpi_name_union {
169 u32 integer;
170 char ascii[4];
171};
172
173/*
174 * The Namespace Node describes a named object that appears in the AML.
175 * descriptor_type is used to differentiate between internal descriptors.
176 *
177 * The node is optimized for both 32-bit and 64-bit platforms:
178 * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
179 *
180 * Note: The descriptor_type and Type fields must appear in the identical
181 * position in both the struct acpi_namespace_node and union acpi_operand_object
182 * structures.
183 */
184struct acpi_namespace_node {
185 union acpi_operand_object *object; /* Interpreter object */
186 u8 descriptor_type; /* Differentiate object descriptor types */
187 u8 type; /* ACPI Type associated with this name */
188 u8 flags; /* Miscellaneous flags */
189 acpi_owner_id owner_id; /* Node creator */
190 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
191 struct acpi_namespace_node *child; /* First child */
192 struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
193
194 /*
195 * The following fields are used by the ASL compiler and disassembler only
196 */
197#ifdef ACPI_LARGE_NAMESPACE_NODE
198 union acpi_parse_object *op;
199 u32 value;
200 u32 length;
201#endif
202};
203
204/* Namespace Node flags */
205
206#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
207#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
208#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
209#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
210#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
211#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
212
213#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */
214#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */
215#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */
216#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */
217#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */
218
219/*
220 * ACPI Table Descriptor. One per ACPI table
221 */
222struct acpi_table_desc {
223 acpi_physical_address address;
224 struct acpi_table_header *pointer;
225 u32 length; /* Length fixed at 32 bits */
226 union acpi_name_union signature;
227 acpi_owner_id owner_id;
228 u8 flags;
229};
230
231/* Flags for above */
232
233#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
234#define ACPI_TABLE_ORIGIN_MAPPED (1)
235#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
236#define ACPI_TABLE_ORIGIN_MASK (3)
237#define ACPI_TABLE_IS_LOADED (4)
238
239/* One internal RSDT for table management */
240
241struct acpi_internal_rsdt {
242 struct acpi_table_desc *tables;
243 u32 count;
244 u32 size;
245 u8 flags;
246};
247
248/* Flags for above */
249
250#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
251#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
252#define ACPI_ROOT_ALLOW_RESIZE (2)
253
254/* Predefined (fixed) table indexes */
255
256#define ACPI_TABLE_INDEX_DSDT (0)
257#define ACPI_TABLE_INDEX_FACS (1)
258
259struct acpi_find_context {
260 char *search_for;
261 acpi_handle *list;
262 u32 *count;
263};
264
265struct acpi_ns_search_data {
266 struct acpi_namespace_node *node;
267};
268
269/*
270 * Predefined Namespace items
271 */
272struct acpi_predefined_names {
273 char *name;
274 u8 type;
275 char *val;
276};
277
278/* Object types used during package copies */
279
280#define ACPI_COPY_TYPE_SIMPLE 0
281#define ACPI_COPY_TYPE_PACKAGE 1
282
283/* Info structure used to convert external<->internal namestrings */
284
285struct acpi_namestring_info {
286 const char *external_name;
287 const char *next_external_char;
288 char *internal_name;
289 u32 length;
290 u32 num_segments;
291 u32 num_carats;
292 u8 fully_qualified;
293};
294
295/* Field creation info */
296
297struct acpi_create_field_info {
298 struct acpi_namespace_node *region_node;
299 struct acpi_namespace_node *field_node;
300 struct acpi_namespace_node *register_node;
301 struct acpi_namespace_node *data_register_node;
302 u32 bank_value;
303 u32 field_bit_position;
304 u32 field_bit_length;
305 u8 field_flags;
306 u8 attribute;
307 u8 field_type;
308};
309
310typedef
311acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
312
313/*
314 * Bitmapped ACPI types. Used internally only
315 */
316#define ACPI_BTYPE_ANY 0x00000000
317#define ACPI_BTYPE_INTEGER 0x00000001
318#define ACPI_BTYPE_STRING 0x00000002
319#define ACPI_BTYPE_BUFFER 0x00000004
320#define ACPI_BTYPE_PACKAGE 0x00000008
321#define ACPI_BTYPE_FIELD_UNIT 0x00000010
322#define ACPI_BTYPE_DEVICE 0x00000020
323#define ACPI_BTYPE_EVENT 0x00000040
324#define ACPI_BTYPE_METHOD 0x00000080
325#define ACPI_BTYPE_MUTEX 0x00000100
326#define ACPI_BTYPE_REGION 0x00000200
327#define ACPI_BTYPE_POWER 0x00000400
328#define ACPI_BTYPE_PROCESSOR 0x00000800
329#define ACPI_BTYPE_THERMAL 0x00001000
330#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
331#define ACPI_BTYPE_DDB_HANDLE 0x00004000
332#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
333#define ACPI_BTYPE_REFERENCE 0x00010000
334#define ACPI_BTYPE_RESOURCE 0x00020000
335
336#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
337
338#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
339#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
340#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
341#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
342#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
343
344/*
345 * Information structure for ACPI predefined names.
346 * Each entry in the table contains the following items:
347 *
348 * Name - The ACPI reserved name
349 * param_count - Number of arguments to the method
350 * expected_return_btypes - Allowed type(s) for the return value
351 */
352struct acpi_name_info {
353 char name[ACPI_NAME_SIZE];
354 u8 param_count;
355 u8 expected_btypes;
356};
357
358/*
359 * Secondary information structures for ACPI predefined objects that return
360 * package objects. This structure appears as the next entry in the table
361 * after the NAME_INFO structure above.
362 *
363 * The reason for this is to minimize the size of the predefined name table.
364 */
365
366/*
367 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
368 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
369 */
370struct acpi_package_info {
371 u8 type;
372 u8 object_type1;
373 u8 count1;
374 u8 object_type2;
375 u8 count2;
376 u8 reserved;
377};
378
379/* Used for ACPI_PTYPE2_FIXED */
380
381struct acpi_package_info2 {
382 u8 type;
383 u8 count;
384 u8 object_type[4];
385};
386
387/* Used for ACPI_PTYPE1_OPTION */
388
389struct acpi_package_info3 {
390 u8 type;
391 u8 count;
392 u8 object_type[2];
393 u8 tail_object_type;
394 u8 reserved;
395};
396
397union acpi_predefined_info {
398 struct acpi_name_info info;
399 struct acpi_package_info ret_info;
400 struct acpi_package_info2 ret_info2;
401 struct acpi_package_info3 ret_info3;
402};
403
404/*
405 * Bitmapped return value types
406 * Note: the actual data types must be contiguous, a loop in nspredef.c
407 * depends on this.
408 */
409#define ACPI_RTYPE_ANY 0x00
410#define ACPI_RTYPE_NONE 0x01
411#define ACPI_RTYPE_INTEGER 0x02
412#define ACPI_RTYPE_STRING 0x04
413#define ACPI_RTYPE_BUFFER 0x08
414#define ACPI_RTYPE_PACKAGE 0x10
415#define ACPI_RTYPE_REFERENCE 0x20
416#define ACPI_RTYPE_ALL 0x3F
417
418#define ACPI_NUM_RTYPES 5 /* Number of actual object types */
419
420/*****************************************************************************
421 *
422 * Event typedefs and structs
423 *
424 ****************************************************************************/
425
426/* Dispatch info for each GPE -- either a method or handler, cannot be both */
427
428struct acpi_handler_info {
429 acpi_event_handler address; /* Address of handler, if any */
430 void *context; /* Context to be passed to handler */
431 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
432};
433
434union acpi_gpe_dispatch_info {
435 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
436 struct acpi_handler_info *handler;
437};
438
439/*
440 * Information about a GPE, one per each GPE in an array.
441 * NOTE: Important to keep this struct as small as possible.
442 */
443struct acpi_gpe_event_info {
444 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
445 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
446 u8 flags; /* Misc info about this GPE */
447 u8 gpe_number; /* This GPE */
448};
449
450/* Information about a GPE register pair, one per each status/enable pair in an array */
451
452struct acpi_gpe_register_info {
453 struct acpi_generic_address status_address; /* Address of status reg */
454 struct acpi_generic_address enable_address; /* Address of enable reg */
455 u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
456 u8 enable_for_run; /* GPEs to keep enabled when running */
457 u8 base_gpe_number; /* Base GPE number for this register */
458};
459
460/*
461 * Information about a GPE register block, one per each installed block --
462 * GPE0, GPE1, and one per each installed GPE Block Device.
463 */
464struct acpi_gpe_block_info {
465 struct acpi_namespace_node *node;
466 struct acpi_gpe_block_info *previous;
467 struct acpi_gpe_block_info *next;
468 struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
469 struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
470 struct acpi_gpe_event_info *event_info; /* One for each GPE */
471 struct acpi_generic_address block_address; /* Base address of the block */
472 u32 register_count; /* Number of register pairs in block */
473 u8 block_base_number; /* Base GPE number for this block */
474};
475
476/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
477
478struct acpi_gpe_xrupt_info {
479 struct acpi_gpe_xrupt_info *previous;
480 struct acpi_gpe_xrupt_info *next;
481 struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
482 u32 interrupt_number; /* System interrupt number */
483};
484
485struct acpi_gpe_walk_info {
486 struct acpi_namespace_node *gpe_device;
487 struct acpi_gpe_block_info *gpe_block;
488};
489
490typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
491 gpe_xrupt_info,
492 struct acpi_gpe_block_info *
493 gpe_block);
494
495/* Information about each particular fixed event */
496
497struct acpi_fixed_event_handler {
498 acpi_event_handler handler; /* Address of handler. */
499 void *context; /* Context to be passed to handler */
500};
501
502struct acpi_fixed_event_info {
503 u8 status_register_id;
504 u8 enable_register_id;
505 u16 status_bit_mask;
506 u16 enable_bit_mask;
507};
508
509/* Information used during field processing */
510
511struct acpi_field_info {
512 u8 skip_field;
513 u8 field_flag;
514 u32 pkg_length;
515};
516
517/*****************************************************************************
518 *
519 * Generic "state" object for stacks
520 *
521 ****************************************************************************/
522
523#define ACPI_CONTROL_NORMAL 0xC0
524#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
525#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
526#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
527#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
528
529#define ACPI_STATE_COMMON \
530 void *next; \
531 u8 descriptor_type; /* To differentiate various internal objs */\
532 u8 flags; \
533 u16 value; \
534 u16 state;
535
536 /* There are 2 bytes available here until the next natural alignment boundary */
537
538struct acpi_common_state {
539ACPI_STATE_COMMON};
540
541/*
542 * Update state - used to traverse complex objects such as packages
543 */
544struct acpi_update_state {
545 ACPI_STATE_COMMON union acpi_operand_object *object;
546};
547
548/*
549 * Pkg state - used to traverse nested package structures
550 */
551struct acpi_pkg_state {
552 ACPI_STATE_COMMON u16 index;
553 union acpi_operand_object *source_object;
554 union acpi_operand_object *dest_object;
555 struct acpi_walk_state *walk_state;
556 void *this_target_obj;
557 u32 num_packages;
558};
559
560/*
561 * Control state - one per if/else and while constructs.
562 * Allows nesting of these constructs
563 */
564struct acpi_control_state {
565 ACPI_STATE_COMMON u16 opcode;
566 union acpi_parse_object *predicate_op;
567 u8 *aml_predicate_start; /* Start of if/while predicate */
568 u8 *package_end; /* End of if/while block */
569};
570
571/*
572 * Scope state - current scope during namespace lookups
573 */
574struct acpi_scope_state {
575 ACPI_STATE_COMMON struct acpi_namespace_node *node;
576};
577
578struct acpi_pscope_state {
579 ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
580 union acpi_parse_object *op; /* Current op being parsed */
581 u8 *arg_end; /* Current argument end */
582 u8 *pkg_end; /* Current package end */
583 u32 arg_list; /* Next argument to parse */
584};
585
586/*
587 * Thread state - one per thread across multiple walk states. Multiple walk
588 * states are created when there are nested control methods executing.
589 */
590struct acpi_thread_state {
591 ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
592 struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
593 union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
594 acpi_thread_id thread_id; /* Running thread ID */
595};
596
597/*
598 * Result values - used to accumulate the results of nested
599 * AML arguments
600 */
601struct acpi_result_values {
602 ACPI_STATE_COMMON
603 union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
604};
605
606typedef
607acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
608 union acpi_parse_object ** out_op);
609
610typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
611
612/*
613 * Notify info - used to pass info to the deferred notify
614 * handler/dispatcher.
615 */
616struct acpi_notify_info {
617 ACPI_STATE_COMMON struct acpi_namespace_node *node;
618 union acpi_operand_object *handler_obj;
619};
620
621/* Generic state is union of structs above */
622
623union acpi_generic_state {
624 struct acpi_common_state common;
625 struct acpi_control_state control;
626 struct acpi_update_state update;
627 struct acpi_scope_state scope;
628 struct acpi_pscope_state parse_scope;
629 struct acpi_pkg_state pkg;
630 struct acpi_thread_state thread;
631 struct acpi_result_values results;
632 struct acpi_notify_info notify;
633};
634
635/*****************************************************************************
636 *
637 * Interpreter typedefs and structs
638 *
639 ****************************************************************************/
640
641typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
642
643/*****************************************************************************
644 *
645 * Parser typedefs and structs
646 *
647 ****************************************************************************/
648
649/*
650 * AML opcode, name, and argument layout
651 */
652struct acpi_opcode_info {
653#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
654 char *name; /* Opcode name (disassembler/debug only) */
655#endif
656 u32 parse_args; /* Grammar/Parse time arguments */
657 u32 runtime_args; /* Interpret time arguments */
658 u16 flags; /* Misc flags */
659 u8 object_type; /* Corresponding internal object type */
660 u8 class; /* Opcode class */
661 u8 type; /* Opcode type */
662};
663
664union acpi_parse_value {
665 acpi_integer integer; /* Integer constant (Up to 64 bits) */
666 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
667 u32 size; /* bytelist or field size */
668 char *string; /* NULL terminated string */
669 u8 *buffer; /* buffer or string */
670 char *name; /* NULL terminated string */
671 union acpi_parse_object *arg; /* arguments and contained ops */
672};
673
674#define ACPI_PARSE_COMMON \
675 union acpi_parse_object *parent; /* Parent op */\
676 u8 descriptor_type; /* To differentiate various internal objs */\
677 u8 flags; /* Type of Op */\
678 u16 aml_opcode; /* AML opcode */\
679 u32 aml_offset; /* Offset of declaration in AML */\
680 union acpi_parse_object *next; /* Next op */\
681 struct acpi_namespace_node *node; /* For use by interpreter */\
682 union acpi_parse_value value; /* Value or args associated with the opcode */\
683 u8 arg_list_length; /* Number of elements in the arg list */\
684 ACPI_DISASM_ONLY_MEMBERS (\
685 u8 disasm_flags; /* Used during AML disassembly */\
686 u8 disasm_opcode; /* Subtype used for disassembly */\
687 char aml_op_name[16]) /* Op name (debug only) */
688
689#define ACPI_DASM_BUFFER 0x00
690#define ACPI_DASM_RESOURCE 0x01
691#define ACPI_DASM_STRING 0x02
692#define ACPI_DASM_UNICODE 0x03
693#define ACPI_DASM_EISAID 0x04
694#define ACPI_DASM_MATCHOP 0x05
695#define ACPI_DASM_LNOT_PREFIX 0x06
696#define ACPI_DASM_LNOT_SUFFIX 0x07
697#define ACPI_DASM_IGNORE 0x08
698
699/*
700 * Generic operation (for example: If, While, Store)
701 */
702struct acpi_parse_obj_common {
703ACPI_PARSE_COMMON};
704
705/*
706 * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
707 * and bytelists.
708 */
709struct acpi_parse_obj_named {
710 ACPI_PARSE_COMMON u8 *path;
711 u8 *data; /* AML body or bytelist data */
712 u32 length; /* AML length */
713 u32 name; /* 4-byte name or zero if no name */
714};
715
716/* This version is used by the i_aSL compiler only */
717
718#define ACPI_MAX_PARSEOP_NAME 20
719
720struct acpi_parse_obj_asl {
721 ACPI_PARSE_COMMON union acpi_parse_object *child;
722 union acpi_parse_object *parent_method;
723 char *filename;
724 char *external_name;
725 char *namepath;
726 char name_seg[4];
727 u32 extra_value;
728 u32 column;
729 u32 line_number;
730 u32 logical_line_number;
731 u32 logical_byte_offset;
732 u32 end_line;
733 u32 end_logical_line;
734 u32 acpi_btype;
735 u32 aml_length;
736 u32 aml_subtree_length;
737 u32 final_aml_length;
738 u32 final_aml_offset;
739 u32 compile_flags;
740 u16 parse_opcode;
741 u8 aml_opcode_length;
742 u8 aml_pkg_len_bytes;
743 u8 extra;
744 char parse_op_name[ACPI_MAX_PARSEOP_NAME];
745};
746
747union acpi_parse_object {
748 struct acpi_parse_obj_common common;
749 struct acpi_parse_obj_named named;
750 struct acpi_parse_obj_asl asl;
751};
752
753/*
754 * Parse state - one state per parser invocation and each control
755 * method.
756 */
757struct acpi_parse_state {
758 u8 *aml_start; /* First AML byte */
759 u8 *aml; /* Next AML byte */
760 u8 *aml_end; /* (last + 1) AML byte */
761 u8 *pkg_start; /* Current package begin */
762 u8 *pkg_end; /* Current package end */
763 union acpi_parse_object *start_op; /* Root of parse tree */
764 struct acpi_namespace_node *start_node;
765 union acpi_generic_state *scope; /* Current scope */
766 union acpi_parse_object *start_scope;
767 u32 aml_size;
768};
769
770/* Parse object flags */
771
772#define ACPI_PARSEOP_GENERIC 0x01
773#define ACPI_PARSEOP_NAMED 0x02
774#define ACPI_PARSEOP_DEFERRED 0x04
775#define ACPI_PARSEOP_BYTELIST 0x08
776#define ACPI_PARSEOP_IN_STACK 0x10
777#define ACPI_PARSEOP_TARGET 0x20
778#define ACPI_PARSEOP_IN_CACHE 0x80
779
780/* Parse object disasm_flags */
781
782#define ACPI_PARSEOP_IGNORE 0x01
783#define ACPI_PARSEOP_PARAMLIST 0x02
784#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
785#define ACPI_PARSEOP_SPECIAL 0x10
786
787/*****************************************************************************
788 *
789 * Hardware (ACPI registers) and PNP
790 *
791 ****************************************************************************/
792
793#define PCI_ROOT_HID_STRING "PNP0A03"
794#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
795
796struct acpi_bit_register_info {
797 u8 parent_register;
798 u8 bit_position;
799 u16 access_bit_mask;
800};
801
802/*
803 * Some ACPI registers have bits that must be ignored -- meaning that they
804 * must be preserved.
805 */
806#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
807#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */
808
809/*
810 * Register IDs
811 * These are the full ACPI registers
812 */
813#define ACPI_REGISTER_PM1_STATUS 0x01
814#define ACPI_REGISTER_PM1_ENABLE 0x02
815#define ACPI_REGISTER_PM1_CONTROL 0x03
816#define ACPI_REGISTER_PM1A_CONTROL 0x04
817#define ACPI_REGISTER_PM1B_CONTROL 0x05
818#define ACPI_REGISTER_PM2_CONTROL 0x06
819#define ACPI_REGISTER_PM_TIMER 0x07
820#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
821#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
822
823/* Masks used to access the bit_registers */
824
825#define ACPI_BITMASK_TIMER_STATUS 0x0001
826#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
827#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
828#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
829#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
830#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
831#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
832#define ACPI_BITMASK_WAKE_STATUS 0x8000
833
834#define ACPI_BITMASK_ALL_FIXED_STATUS (\
835 ACPI_BITMASK_TIMER_STATUS | \
836 ACPI_BITMASK_BUS_MASTER_STATUS | \
837 ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
838 ACPI_BITMASK_POWER_BUTTON_STATUS | \
839 ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
840 ACPI_BITMASK_RT_CLOCK_STATUS | \
841 ACPI_BITMASK_WAKE_STATUS)
842
843#define ACPI_BITMASK_TIMER_ENABLE 0x0001
844#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
845#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
846#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
847#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
848#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
849
850#define ACPI_BITMASK_SCI_ENABLE 0x0001
851#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
852#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
853#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00
854#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
855
856#define ACPI_BITMASK_ARB_DISABLE 0x0001
857
858/* Raw bit position of each bit_register */
859
860#define ACPI_BITPOSITION_TIMER_STATUS 0x00
861#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
862#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
863#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
864#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
865#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
866#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
867#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
868
869#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
870#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
871#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
872#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
873#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
874#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
875
876#define ACPI_BITPOSITION_SCI_ENABLE 0x00
877#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
878#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
879#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A
880#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
881
882#define ACPI_BITPOSITION_ARB_DISABLE 0x00
883
884/*****************************************************************************
885 *
886 * Resource descriptors
887 *
888 ****************************************************************************/
889
890/* resource_type values */
891
892#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
893#define ACPI_ADDRESS_TYPE_IO_RANGE 1
894#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
895
896/* Resource descriptor types and masks */
897
898#define ACPI_RESOURCE_NAME_LARGE 0x80
899#define ACPI_RESOURCE_NAME_SMALL 0x00
900
901#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
902#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
903#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
904
905/*
906 * Small resource descriptor "names" as defined by the ACPI specification.
907 * Note: Bits 2:0 are used for the descriptor length
908 */
909#define ACPI_RESOURCE_NAME_IRQ 0x20
910#define ACPI_RESOURCE_NAME_DMA 0x28
911#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
912#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
913#define ACPI_RESOURCE_NAME_IO 0x40
914#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
915#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
916#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
917#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
918#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
919#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
920#define ACPI_RESOURCE_NAME_END_TAG 0x78
921
922/*
923 * Large resource descriptor "names" as defined by the ACPI specification.
924 * Note: includes the Large Descriptor bit in bit[7]
925 */
926#define ACPI_RESOURCE_NAME_MEMORY24 0x81
927#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
928#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
929#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
930#define ACPI_RESOURCE_NAME_MEMORY32 0x85
931#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
932#define ACPI_RESOURCE_NAME_ADDRESS32 0x87
933#define ACPI_RESOURCE_NAME_ADDRESS16 0x88
934#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
935#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
936#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
937#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
938
939/*****************************************************************************
940 *
941 * Miscellaneous
942 *
943 ****************************************************************************/
944
945#define ACPI_ASCII_ZERO 0x30
946
947/*****************************************************************************
948 *
949 * Debugger
950 *
951 ****************************************************************************/
952
953struct acpi_db_method_info {
954 acpi_handle main_thread_gate;
955 acpi_handle thread_complete_gate;
956 u32 *threads;
957 u32 num_threads;
958 u32 num_created;
959 u32 num_completed;
960
961 char *name;
962 u32 flags;
963 u32 num_loops;
964 char pathname[128];
965 char **args;
966
967 /*
968 * Arguments to be passed to method for the command
969 * Threads -
970 * the Number of threads, ID of current thread and
971 * Index of current thread inside all them created.
972 */
973 char init_args;
974 char *arguments[4];
975 char num_threads_str[11];
976 char id_of_thread_str[11];
977 char index_of_thread_str[11];
978};
979
980struct acpi_integrity_info {
981 u32 nodes;
982 u32 objects;
983};
984
985#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
986#define ACPI_DB_CONSOLE_OUTPUT 0x02
987#define ACPI_DB_DUPLICATE_OUTPUT 0x03
988
989/*****************************************************************************
990 *
991 * Debug
992 *
993 ****************************************************************************/
994
995/* Entry for a memory allocation (debug only) */
996
997#define ACPI_MEM_MALLOC 0
998#define ACPI_MEM_CALLOC 1
999#define ACPI_MAX_MODULE_NAME 16
1000
1001#define ACPI_COMMON_DEBUG_MEM_HEADER \
1002 struct acpi_debug_mem_block *previous; \
1003 struct acpi_debug_mem_block *next; \
1004 u32 size; \
1005 u32 component; \
1006 u32 line; \
1007 char module[ACPI_MAX_MODULE_NAME]; \
1008 u8 alloc_type;
1009
1010struct acpi_debug_mem_header {
1011ACPI_COMMON_DEBUG_MEM_HEADER};
1012
1013struct acpi_debug_mem_block {
1014 ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
1015};
1016
1017#define ACPI_MEM_LIST_GLOBAL 0
1018#define ACPI_MEM_LIST_NSNODE 1
1019#define ACPI_MEM_LIST_MAX 1
1020#define ACPI_NUM_MEM_LISTS 2
1021
1022struct acpi_memory_list {
1023 char *list_name;
1024 void *list_head;
1025 u16 object_size;
1026 u16 max_depth;
1027 u16 current_depth;
1028 u16 link_offset;
1029
1030#ifdef ACPI_DBG_TRACK_ALLOCATIONS
1031
1032 /* Statistics for debug memory tracking only */
1033
1034 u32 total_allocated;
1035 u32 total_freed;
1036 u32 max_occupied;
1037 u32 total_size;
1038 u32 current_total_size;
1039 u32 requests;
1040 u32 hits;
1041#endif
1042};
1043
1044#endif /* __ACLOCAL_H__ */
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
deleted file mode 100644
index 1954c9d1d012..000000000000
--- a/include/acpi/acmacros.h
+++ /dev/null
@@ -1,693 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acmacros.h - C macros for the entire subsystem.
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACMACROS_H__
45#define __ACMACROS_H__
46
47/*
48 * Data manipulation macros
49 */
50#define ACPI_LOWORD(l) ((u16)(u32)(l))
51#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
52#define ACPI_LOBYTE(l) ((u8)(u16)(l))
53#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
54
55#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
58#define ACPI_MAX(a,b) (((a)>(b))?(a):(b))
59
60/* Size calculation */
61
62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
63
64/*
65 * Extract data using a pointer. Any more than a byte and we
66 * get into potential aligment issues -- see the STORE macros below.
67 * Use with care.
68 */
69#define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr)
70#define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr)
71#define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr)
72#define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr)
73#define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr)
74#define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr)
75#define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr)
76#define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr)
77
78/*
79 * Pointer manipulation
80 */
81#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p))
82#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p))
83#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
84#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
85
86/* Pointer/Integer type conversions */
87
88#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i)
89#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
90#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
91#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
92#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
93
94#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
95#define ACPI_COMPARE_NAME(a, b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
96#else
97#define ACPI_COMPARE_NAME(a, b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
98#endif
99
100/*
101 * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
102 */
103struct acpi_integer_overlay {
104 u32 lo_dword;
105 u32 hi_dword;
106};
107
108#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
109#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
110
111/*
112 * printf() format helpers
113 */
114
115/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
116
117#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i)
118
119#if ACPI_MACHINE_WIDTH == 64
120#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i)
121#else
122#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i)
123#endif
124
125/*
126 * Macros for moving data around to/from buffers that are possibly unaligned.
127 * If the hardware supports the transfer of unaligned data, just do the store.
128 * Otherwise, we have to move one byte at a time.
129 */
130#ifdef ACPI_BIG_ENDIAN
131/*
132 * Macros for big-endian machines
133 */
134
135/* These macros reverse the bytes during the move, converting little-endian to big endian */
136
137 /* Big Endian <== Little Endian */
138 /* Hi...Lo Lo...Hi */
139/* 16-bit source, 16/32/64 destination */
140
141#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
142 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
143
144#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\
145 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
146 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
147
148#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
149 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
150 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
151
152/* 32-bit source, 16/32/64 destination */
153
154#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
155
156#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
157 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
158 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
159 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
160
161#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
162 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
163 ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
164 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
165 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
166
167/* 64-bit source, 16/32/64 destination */
168
169#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
170
171#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
172
173#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
174 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
175 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
176 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
177 (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
178 (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
179 (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
180 (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
181#else
182/*
183 * Macros for little-endian machines
184 */
185
186#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
187
188/* The hardware supports unaligned transfers, just do the little-endian move */
189
190/* 16-bit source, 16/32/64 destination */
191
192#define ACPI_MOVE_16_TO_16(d, s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
193#define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
194#define ACPI_MOVE_16_TO_64(d, s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
195
196/* 32-bit source, 16/32/64 destination */
197
198#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
199#define ACPI_MOVE_32_TO_32(d, s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
200#define ACPI_MOVE_32_TO_64(d, s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
201
202/* 64-bit source, 16/32/64 destination */
203
204#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
205#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
206#define ACPI_MOVE_64_TO_64(d, s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
207
208#else
209/*
210 * The hardware does not support unaligned transfers. We must move the
211 * data one byte at a time. These macros work whether the source or
212 * the destination (or both) is/are unaligned. (Little-endian move)
213 */
214
215/* 16-bit source, 16/32/64 destination */
216
217#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
218 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
219
220#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
221#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
222
223/* 32-bit source, 16/32/64 destination */
224
225#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
226
227#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
228 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
229 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
230 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
231
232#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);}
233
234/* 64-bit source, 16/32/64 destination */
235
236#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
237#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
238#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
239 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
240 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
241 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
242 (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
243 (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
244 (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
245 (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
246#endif
247#endif
248
249/* Macros based on machine integer width */
250
251#if ACPI_MACHINE_WIDTH == 32
252#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s)
253
254#elif ACPI_MACHINE_WIDTH == 64
255#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s)
256
257#else
258#error unknown ACPI_MACHINE_WIDTH
259#endif
260
261/*
262 * Fast power-of-two math macros for non-optimized compilers
263 */
264#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2)))
265#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2)))
266#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
267
268#define ACPI_DIV_2(a) _ACPI_DIV(a, 1)
269#define ACPI_MUL_2(a) _ACPI_MUL(a, 1)
270#define ACPI_MOD_2(a) _ACPI_MOD(a, 2)
271
272#define ACPI_DIV_4(a) _ACPI_DIV(a, 2)
273#define ACPI_MUL_4(a) _ACPI_MUL(a, 2)
274#define ACPI_MOD_4(a) _ACPI_MOD(a, 4)
275
276#define ACPI_DIV_8(a) _ACPI_DIV(a, 3)
277#define ACPI_MUL_8(a) _ACPI_MUL(a, 3)
278#define ACPI_MOD_8(a) _ACPI_MOD(a, 8)
279
280#define ACPI_DIV_16(a) _ACPI_DIV(a, 4)
281#define ACPI_MUL_16(a) _ACPI_MUL(a, 4)
282#define ACPI_MOD_16(a) _ACPI_MOD(a, 16)
283
284#define ACPI_DIV_32(a) _ACPI_DIV(a, 5)
285#define ACPI_MUL_32(a) _ACPI_MUL(a, 5)
286#define ACPI_MOD_32(a) _ACPI_MOD(a, 32)
287
288/*
289 * Rounding macros (Power of two boundaries only)
290 */
291#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \
292 (~(((acpi_size) boundary)-1)))
293
294#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \
295 (((acpi_size) boundary)-1)) & \
296 (~(((acpi_size) boundary)-1)))
297
298/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
299
300#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4)
301#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8)
302#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size))
303
304#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4)
305#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8)
306#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size))
307
308#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
309#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
310
311#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
312
313/* Generic (non-power-of-two) rounding */
314
315#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
316
317#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
318
319/*
320 * Bitmask creation
321 * Bit positions start at zero.
322 * MASK_BITS_ABOVE creates a mask starting AT the position and above
323 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
324 */
325#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
326#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
327
328/* Bitfields within ACPI registers */
329
330#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
331#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
332
333#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask))
334
335/*
336 * A struct acpi_namespace_node can appear in some contexts
337 * where a pointer to a union acpi_operand_object can also
338 * appear. This macro is used to distinguish them.
339 *
340 * The "Descriptor" field is the first field in both structures.
341 */
342#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
343#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
344
345/* Macro to test the object type */
346
347#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)
348
349/*
350 * Macros for the master AML opcode table
351 */
352#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
353#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
354 {name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
355#else
356#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
357 {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
358#endif
359
360#ifdef ACPI_DISASSEMBLER
361#define ACPI_DISASM_ONLY_MEMBERS(a) a;
362#else
363#define ACPI_DISASM_ONLY_MEMBERS(a)
364#endif
365
366#define ARG_TYPE_WIDTH 5
367#define ARG_1(x) ((u32)(x))
368#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))
369#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH))
370#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH))
371#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH))
372#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))
373
374#define ARGI_LIST1(a) (ARG_1(a))
375#define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a))
376#define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
377#define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
378#define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
379#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))
380
381#define ARGP_LIST1(a) (ARG_1(a))
382#define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b))
383#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
384#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
385#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
386#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))
387
388#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F))
389#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))
390
391#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
392/*
393 * Module name is include in both debug and non-debug versions primarily for
394 * error messages. The __FILE__ macro is not very useful for this, because it
395 * often includes the entire pathname to the module
396 */
397#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
398#else
399#define ACPI_MODULE_NAME(name)
400#endif
401
402/*
403 * Ascii error messages can be configured out
404 */
405#ifndef ACPI_NO_ERROR_MESSAGES
406#define AE_INFO _acpi_module_name, __LINE__
407
408/*
409 * Error reporting. Callers module and line number are inserted by AE_INFO,
410 * the plist contains a set of parens to allow variable-length lists.
411 * These macros are used for both the debug and non-debug versions of the code.
412 */
413#define ACPI_INFO(plist) acpi_ut_info plist
414#define ACPI_WARNING(plist) acpi_ut_warning plist
415#define ACPI_EXCEPTION(plist) acpi_ut_exception plist
416#define ACPI_ERROR(plist) acpi_ut_error plist
417#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
418#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
419
420#else
421
422/* No error messages */
423
424#define ACPI_INFO(plist)
425#define ACPI_WARNING(plist)
426#define ACPI_EXCEPTION(plist)
427#define ACPI_ERROR(plist)
428#define ACPI_ERROR_NAMESPACE(s, e)
429#define ACPI_ERROR_METHOD(s, n, p, e)
430#endif
431
432/*
433 * Debug macros that are conditionally compiled
434 */
435#ifdef ACPI_DEBUG_OUTPUT
436
437/*
438 * Common parameters used for debug output functions:
439 * line number, function name, module(file) name, component ID
440 */
441#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
442
443/*
444 * Function entry tracing
445 */
446
447/*
448 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
449 * define it now. This is the case where there the compiler does not support
450 * a __func__ macro or equivalent.
451 */
452#ifndef ACPI_GET_FUNCTION_NAME
453#define ACPI_GET_FUNCTION_NAME _acpi_function_name
454/*
455 * The Name parameter should be the procedure name as a quoted string.
456 * The function name is also used by the function exit macros below.
457 * Note: (const char) is used to be compatible with the debug interfaces
458 * and macros such as __func__.
459 */
460#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
461
462#else
463/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
464
465#define ACPI_FUNCTION_NAME(name)
466#endif
467
468#ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE
469
470#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
471 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
472#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
473 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b)
474#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \
475 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)
476#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \
477 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
478
479#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
480
481/*
482 * Function exit tracing.
483 * WARNING: These macros include a return statement. This is usually considered
484 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
485 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
486 * so that "_AcpiFunctionName" is defined.
487 *
488 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
489 * about these constructs.
490 */
491#ifdef ACPI_USE_DO_WHILE_0
492#define ACPI_DO_WHILE0(a) do a while(0)
493#else
494#define ACPI_DO_WHILE0(a) a
495#endif
496
497#define return_VOID ACPI_DO_WHILE0 ({ \
498 acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
499 return;})
500/*
501 * There are two versions of most of the return macros. The default version is
502 * safer, since it avoids side-effects by guaranteeing that the argument will
503 * not be evaluated twice.
504 *
505 * A less-safe version of the macros is provided for optional use if the
506 * compiler uses excessive CPU stack (for example, this may happen in the
507 * debug case if code optimzation is disabled.)
508 */
509#ifndef ACPI_SIMPLE_RETURN_MACROS
510
511#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
512 register acpi_status _s = (s); \
513 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \
514 return (_s); })
515#define return_PTR(s) ACPI_DO_WHILE0 ({ \
516 register void *_s = (void *) (s); \
517 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
518 return (_s); })
519#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
520 register acpi_integer _s = (s); \
521 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
522 return (_s); })
523#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
524 register u8 _s = (u8) (s); \
525 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
526 return (_s); })
527#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
528 register u32 _s = (u32) (s); \
529 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
530 return (_s); })
531#else /* Use original less-safe macros */
532
533#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
534 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \
535 return((s)); })
536#define return_PTR(s) ACPI_DO_WHILE0 ({ \
537 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
538 return((s)); })
539#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
540 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \
541 return((s)); })
542#define return_UINT8(s) return_VALUE(s)
543#define return_UINT32(s) return_VALUE(s)
544
545#endif /* ACPI_SIMPLE_RETURN_MACROS */
546
547#else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */
548
549#define ACPI_FUNCTION_TRACE(a)
550#define ACPI_FUNCTION_TRACE_PTR(a,b)
551#define ACPI_FUNCTION_TRACE_U32(a,b)
552#define ACPI_FUNCTION_TRACE_STR(a,b)
553#define ACPI_FUNCTION_EXIT
554#define ACPI_FUNCTION_STATUS_EXIT(s)
555#define ACPI_FUNCTION_VALUE_EXIT(s)
556#define ACPI_FUNCTION_TRACE(a)
557#define ACPI_FUNCTION_ENTRY()
558
559#define return_VOID return
560#define return_ACPI_STATUS(s) return(s)
561#define return_VALUE(s) return(s)
562#define return_UINT8(s) return(s)
563#define return_UINT32(s) return(s)
564#define return_PTR(s) return(s)
565
566#endif /* CONFIG_ACPI_DEBUG_FUNC_TRACE */
567
568/* Conditional execution */
569
570#define ACPI_DEBUG_EXEC(a) a
571#define ACPI_NORMAL_EXEC(a)
572
573#define ACPI_DEBUG_DEFINE(a) a;
574#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
575#define _VERBOSE_STRUCTURES
576
577/* Stack and buffer dumping */
578
579#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
580#define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c)
581
582#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
583#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
584#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
585#define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
586
587/*
588 * Master debug print macros
589 * Print iff:
590 * 1) Debug print for the current component is enabled
591 * 2) Debug error level or trace level for the print statement is enabled
592 */
593#define ACPI_DEBUG_PRINT(plist) acpi_ut_debug_print plist
594#define ACPI_DEBUG_PRINT_RAW(plist) acpi_ut_debug_print_raw plist
595
596#else
597/*
598 * This is the non-debug case -- make everything go away,
599 * leaving no executable debug code!
600 */
601#define ACPI_DEBUG_EXEC(a)
602#define ACPI_NORMAL_EXEC(a) a;
603
604#define ACPI_DEBUG_DEFINE(a) do { } while(0)
605#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)
606#define ACPI_FUNCTION_NAME(a) do { } while(0)
607#define ACPI_FUNCTION_TRACE(a) do { } while(0)
608#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0)
609#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0)
610#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0)
611#define ACPI_FUNCTION_EXIT do { } while(0)
612#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)
613#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
614#define ACPI_FUNCTION_ENTRY() do { } while(0)
615#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
616#define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0)
617#define ACPI_DUMP_ENTRY(a, b) do { } while(0)
618#define ACPI_DUMP_TABLES(a, b) do { } while(0)
619#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0)
620#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
621#define ACPI_DUMP_BUFFER(a, b) do { } while(0)
622#define ACPI_DEBUG_PRINT(pl) do { } while(0)
623#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0)
624
625#define return_VOID return
626#define return_ACPI_STATUS(s) return(s)
627#define return_VALUE(s) return(s)
628#define return_UINT8(s) return(s)
629#define return_UINT32(s) return(s)
630#define return_PTR(s) return(s)
631
632#endif
633
634/*
635 * Some code only gets executed when the debugger is built in.
636 * Note that this is entirely independent of whether the
637 * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
638 */
639#ifdef ACPI_DEBUGGER
640#define ACPI_DEBUGGER_EXEC(a) a
641#else
642#define ACPI_DEBUGGER_EXEC(a)
643#endif
644
645#ifdef ACPI_DEBUG_OUTPUT
646/*
647 * 1) Set name to blanks
648 * 2) Copy the object name
649 */
650#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
651 ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
652#else
653
654#define ACPI_ADD_OBJECT_NAME(a,b)
655#endif
656
657/*
658 * Memory allocation tracking (DEBUG ONLY)
659 */
660#define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__
661
662#ifndef ACPI_DBG_TRACK_ALLOCATIONS
663
664/* Memory allocation */
665
666#ifndef ACPI_ALLOCATE
667#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS)
668#endif
669#ifndef ACPI_ALLOCATE_ZEROED
670#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS)
671#endif
672#ifndef ACPI_FREE
673#define ACPI_FREE(a) acpio_os_free(a)
674#endif
675#define ACPI_MEM_TRACKING(a)
676
677#else
678
679/* Memory allocation */
680
681#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
682#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
683#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
684#define ACPI_MEM_TRACKING(a) a
685
686#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
687
688/* Preemption point */
689#ifndef ACPI_PREEMPTION_POINT
690#define ACPI_PREEMPTION_POINT() /* no preemption */
691#endif
692
693#endif /* ACMACROS_H */
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
deleted file mode 100644
index db4e6f677855..000000000000
--- a/include/acpi/acnamesp.h
+++ /dev/null
@@ -1,321 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACNAMESP_H__
45#define __ACNAMESP_H__
46
47/* To search the entire name space, pass this as search_base */
48
49#define ACPI_NS_ALL ((acpi_handle)0)
50
51/*
52 * Elements of acpi_ns_properties are bit significant
53 * and should be one-to-one with values of acpi_object_type
54 */
55#define ACPI_NS_NORMAL 0
56#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
57#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
58
59/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
60
61#define ACPI_NS_NO_UPSEARCH 0
62#define ACPI_NS_SEARCH_PARENT 0x01
63#define ACPI_NS_DONT_OPEN_SCOPE 0x02
64#define ACPI_NS_NO_PEER_SEARCH 0x04
65#define ACPI_NS_ERROR_IF_FOUND 0x08
66#define ACPI_NS_PREFIX_IS_SCOPE 0x10
67#define ACPI_NS_EXTERNAL 0x20
68#define ACPI_NS_TEMPORARY 0x40
69
70/* Flags for acpi_ns_walk_namespace */
71
72#define ACPI_NS_WALK_NO_UNLOCK 0
73#define ACPI_NS_WALK_UNLOCK 0x01
74#define ACPI_NS_WALK_TEMP_NODES 0x02
75
76/*
77 * nsinit - Namespace initialization
78 */
79acpi_status acpi_ns_initialize_objects(void);
80
81acpi_status acpi_ns_initialize_devices(void);
82
83/*
84 * nsload - Namespace loading
85 */
86acpi_status acpi_ns_load_namespace(void);
87
88acpi_status
89acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node);
90
91/*
92 * nswalk - walk the namespace
93 */
94acpi_status
95acpi_ns_walk_namespace(acpi_object_type type,
96 acpi_handle start_object,
97 u32 max_depth,
98 u32 flags,
99 acpi_walk_callback user_function,
100 void *context, void **return_value);
101
102struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node
103 *parent, struct acpi_namespace_node
104 *child);
105
106/*
107 * nsparse - table parsing
108 */
109acpi_status
110acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
111
112acpi_status
113acpi_ns_one_complete_parse(u32 pass_number,
114 u32 table_index,
115 struct acpi_namespace_node *start_node);
116
117/*
118 * nsaccess - Top-level namespace access
119 */
120acpi_status acpi_ns_root_initialize(void);
121
122acpi_status
123acpi_ns_lookup(union acpi_generic_state *scope_info,
124 char *name,
125 acpi_object_type type,
126 acpi_interpreter_mode interpreter_mode,
127 u32 flags,
128 struct acpi_walk_state *walk_state,
129 struct acpi_namespace_node **ret_node);
130
131/*
132 * nsalloc - Named object allocation/deallocation
133 */
134struct acpi_namespace_node *acpi_ns_create_node(u32 name);
135
136void acpi_ns_delete_node(struct acpi_namespace_node *node);
137
138void
139acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
140
141void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
142
143void acpi_ns_detach_object(struct acpi_namespace_node *node);
144
145void acpi_ns_delete_children(struct acpi_namespace_node *parent);
146
147int acpi_ns_compare_names(char *name1, char *name2);
148
149/*
150 * nsdump - Namespace dump/print utilities
151 */
152#ifdef ACPI_FUTURE_USAGE
153void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
154#endif /* ACPI_FUTURE_USAGE */
155
156void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
157
158void
159acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
160
161void acpi_ns_print_pathname(u32 num_segments, char *pathname);
162
163acpi_status
164acpi_ns_dump_one_object(acpi_handle obj_handle,
165 u32 level, void *context, void **return_value);
166
167#ifdef ACPI_FUTURE_USAGE
168void
169acpi_ns_dump_objects(acpi_object_type type,
170 u8 display_type,
171 u32 max_depth,
172 acpi_owner_id owner_id, acpi_handle start_handle);
173#endif /* ACPI_FUTURE_USAGE */
174
175/*
176 * nseval - Namespace evaluation functions
177 */
178acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
179
180/*
181 * nspredef - Support for predefined/reserved names
182 */
183acpi_status
184acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
185 union acpi_operand_object *return_object);
186
187const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
188 acpi_namespace_node
189 *node);
190
191void
192acpi_ns_check_parameter_count(char *pathname,
193 struct acpi_namespace_node *node,
194 const union acpi_predefined_info *info);
195
196/*
197 * nsnames - Name and Scope manipulation
198 */
199u32 acpi_ns_opens_scope(acpi_object_type type);
200
201acpi_status
202acpi_ns_build_external_path(struct acpi_namespace_node *node,
203 acpi_size size, char *name_buffer);
204
205char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
206
207char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
208
209acpi_status
210acpi_ns_handle_to_pathname(acpi_handle target_handle,
211 struct acpi_buffer *buffer);
212
213u8
214acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
215
216acpi_status
217acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
218 const char *external_pathname,
219 u32 flags, struct acpi_namespace_node **out_node);
220
221acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
222
223/*
224 * nsobject - Object management for namespace nodes
225 */
226acpi_status
227acpi_ns_attach_object(struct acpi_namespace_node *node,
228 union acpi_operand_object *object, acpi_object_type type);
229
230union acpi_operand_object *acpi_ns_get_attached_object(struct
231 acpi_namespace_node
232 *node);
233
234union acpi_operand_object *acpi_ns_get_secondary_object(union
235 acpi_operand_object
236 *obj_desc);
237
238acpi_status
239acpi_ns_attach_data(struct acpi_namespace_node *node,
240 acpi_object_handler handler, void *data);
241
242acpi_status
243acpi_ns_detach_data(struct acpi_namespace_node *node,
244 acpi_object_handler handler);
245
246acpi_status
247acpi_ns_get_attached_data(struct acpi_namespace_node *node,
248 acpi_object_handler handler, void **data);
249
250/*
251 * nssearch - Namespace searching and entry
252 */
253acpi_status
254acpi_ns_search_and_enter(u32 entry_name,
255 struct acpi_walk_state *walk_state,
256 struct acpi_namespace_node *node,
257 acpi_interpreter_mode interpreter_mode,
258 acpi_object_type type,
259 u32 flags, struct acpi_namespace_node **ret_node);
260
261acpi_status
262acpi_ns_search_one_scope(u32 entry_name,
263 struct acpi_namespace_node *node,
264 acpi_object_type type,
265 struct acpi_namespace_node **ret_node);
266
267void
268acpi_ns_install_node(struct acpi_walk_state *walk_state,
269 struct acpi_namespace_node *parent_node,
270 struct acpi_namespace_node *node, acpi_object_type type);
271
272/*
273 * nsutils - Utility functions
274 */
275u8 acpi_ns_valid_root_prefix(char prefix);
276
277acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
278
279u32 acpi_ns_local(acpi_object_type type);
280
281void
282acpi_ns_report_error(const char *module_name,
283 u32 line_number,
284 const char *internal_name, acpi_status lookup_status);
285
286void
287acpi_ns_report_method_error(const char *module_name,
288 u32 line_number,
289 const char *message,
290 struct acpi_namespace_node *node,
291 const char *path, acpi_status lookup_status);
292
293void
294acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
295
296acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
297
298void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
299
300acpi_status
301acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
302
303acpi_status
304acpi_ns_externalize_name(u32 internal_name_length,
305 const char *internal_name,
306 u32 * converted_name_length, char **converted_name);
307
308struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);
309
310acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
311
312void acpi_ns_terminate(void);
313
314struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
315 *node);
316
317struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
318 acpi_namespace_node
319 *node);
320
321#endif /* __ACNAMESP_H__ */
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
deleted file mode 100644
index eb6f038b03d9..000000000000
--- a/include/acpi/acobject.h
+++ /dev/null
@@ -1,446 +0,0 @@
1
2/******************************************************************************
3 *
4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#ifndef _ACOBJECT_H
46#define _ACOBJECT_H
47
48/* acpisrc:struct_defs -- for acpisrc conversion */
49
50/*
51 * The union acpi_operand_object is used to pass AML operands from the dispatcher
52 * to the interpreter, and to keep track of the various handlers such as
53 * address space handlers and notify handlers. The object is a constant
54 * size in order to allow it to be cached and reused.
55 *
56 * Note: The object is optimized to be aligned and will not work if it is
57 * byte-packed.
58 */
59#if ACPI_MACHINE_WIDTH == 64
60#pragma pack(8)
61#else
62#pragma pack(4)
63#endif
64
65/*******************************************************************************
66 *
67 * Common Descriptors
68 *
69 ******************************************************************************/
70
71/*
72 * Common area for all objects.
73 *
74 * descriptor_type is used to differentiate between internal descriptors, and
75 * must be in the same place across all descriptors
76 *
77 * Note: The descriptor_type and Type fields must appear in the identical
78 * position in both the struct acpi_namespace_node and union acpi_operand_object
79 * structures.
80 */
81#define ACPI_OBJECT_COMMON_HEADER \
82 union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
83 u8 descriptor_type; /* To differentiate various internal objs */\
84 u8 type; /* acpi_object_type */\
85 u16 reference_count; /* For object deletion management */\
86 u8 flags;
87 /*
88 * Note: There are 3 bytes available here before the
89 * next natural alignment boundary (for both 32/64 cases)
90 */
91
92/* Values for Flag byte above */
93
94#define AOPOBJ_AML_CONSTANT 0x01
95#define AOPOBJ_STATIC_POINTER 0x02
96#define AOPOBJ_DATA_VALID 0x04
97#define AOPOBJ_OBJECT_INITIALIZED 0x08
98#define AOPOBJ_SETUP_COMPLETE 0x10
99#define AOPOBJ_SINGLE_DATUM 0x20
100#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
101
102/******************************************************************************
103 *
104 * Basic data types
105 *
106 *****************************************************************************/
107
108struct acpi_object_common {
109ACPI_OBJECT_COMMON_HEADER};
110
111struct acpi_object_integer {
112 ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */
113 acpi_integer value;
114};
115
116/*
117 * Note: The String and Buffer object must be identical through the Pointer
118 * and length elements. There is code that depends on this.
119 *
120 * Fields common to both Strings and Buffers
121 */
122#define ACPI_COMMON_BUFFER_INFO(_type) \
123 _type *pointer; \
124 u32 length;
125
126struct acpi_object_string { /* Null terminated, ASCII characters only */
127 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
128};
129
130struct acpi_object_buffer {
131 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */
132 u32 aml_length;
133 u8 *aml_start;
134 struct acpi_namespace_node *node; /* Link back to parent node */
135};
136
137struct acpi_object_package {
138 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */
139 union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
140 u8 *aml_start;
141 u32 aml_length;
142 u32 count; /* # of elements in package */
143};
144
145/******************************************************************************
146 *
147 * Complex data types
148 *
149 *****************************************************************************/
150
151struct acpi_object_event {
152 ACPI_OBJECT_COMMON_HEADER acpi_semaphore os_semaphore; /* Actual OS synchronization object */
153};
154
155struct acpi_object_mutex {
156 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
157 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
158 acpi_mutex os_mutex; /* Actual OS synchronization object */
159 acpi_thread_id thread_id; /* Current owner of the mutex */
160 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */
161 union acpi_operand_object *prev; /* Link for list of acquired mutexes */
162 union acpi_operand_object *next; /* Link for list of acquired mutexes */
163 struct acpi_namespace_node *node; /* Containing namespace node */
164 u8 original_sync_level; /* Owner's original sync level (0-15) */
165};
166
167struct acpi_object_region {
168 ACPI_OBJECT_COMMON_HEADER u8 space_id;
169 struct acpi_namespace_node *node; /* Containing namespace node */
170 union acpi_operand_object *handler; /* Handler for region access */
171 union acpi_operand_object *next;
172 acpi_physical_address address;
173 u32 length;
174};
175
176struct acpi_object_method {
177 ACPI_OBJECT_COMMON_HEADER u8 method_flags;
178 u8 param_count;
179 u8 sync_level;
180 union acpi_operand_object *mutex;
181 u8 *aml_start;
182 ACPI_INTERNAL_METHOD implementation;
183 u32 aml_length;
184 u8 thread_count;
185 acpi_owner_id owner_id;
186};
187
188/******************************************************************************
189 *
190 * Objects that can be notified. All share a common notify_info area.
191 *
192 *****************************************************************************/
193
194/*
195 * Common fields for objects that support ASL notifications
196 */
197#define ACPI_COMMON_NOTIFY_INFO \
198 union acpi_operand_object *system_notify; /* Handler for system notifies */\
199 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
200 union acpi_operand_object *handler; /* Handler for Address space */
201
202struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
203ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
204
205struct acpi_object_device {
206 ACPI_OBJECT_COMMON_HEADER
207 ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block;
208};
209
210struct acpi_object_power_resource {
211 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level;
212 u32 resource_order;
213};
214
215struct acpi_object_processor {
216 ACPI_OBJECT_COMMON_HEADER
217 /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
218 u8 proc_id;
219 u8 length;
220 ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
221};
222
223struct acpi_object_thermal_zone {
224ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
225
226/******************************************************************************
227 *
228 * Fields. All share a common header/info field.
229 *
230 *****************************************************************************/
231
232/*
233 * Common bitfield for the field objects
234 * "Field Datum" -- a datum from the actual field object
235 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
236 */
237#define ACPI_COMMON_FIELD_INFO \
238 u8 field_flags; /* Access, update, and lock bits */\
239 u8 attribute; /* From access_as keyword */\
240 u8 access_byte_width; /* Read/Write size in bytes */\
241 struct acpi_namespace_node *node; /* Link back to parent node */\
242 u32 bit_length; /* Length of field in bits */\
243 u32 base_byte_offset; /* Byte offset within containing object */\
244 u32 value; /* Value to store into the Bank or Index register */\
245 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
246 u8 access_bit_width; /* Read/Write size in bits (8-64) */
247
248struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
249 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
250};
251
252struct acpi_object_region_field {
253 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
254};
255
256struct acpi_object_bank_field {
257 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
258 union acpi_operand_object *bank_obj; /* bank_select Register object */
259};
260
261struct acpi_object_index_field {
262 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
263 /*
264 * No "RegionObj" pointer needed since the Index and Data registers
265 * are each field definitions unto themselves.
266 */
267 union acpi_operand_object *index_obj; /* Index register */
268 union acpi_operand_object *data_obj; /* Data register */
269};
270
271/* The buffer_field is different in that it is part of a Buffer, not an op_region */
272
273struct acpi_object_buffer_field {
274 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */
275};
276
277/******************************************************************************
278 *
279 * Objects for handlers
280 *
281 *****************************************************************************/
282
283struct acpi_object_notify_handler {
284 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */
285 acpi_notify_handler handler;
286 void *context;
287};
288
289struct acpi_object_addr_handler {
290 ACPI_OBJECT_COMMON_HEADER u8 space_id;
291 u8 handler_flags;
292 acpi_adr_space_handler handler;
293 struct acpi_namespace_node *node; /* Parent device */
294 void *context;
295 acpi_adr_space_setup setup;
296 union acpi_operand_object *region_list; /* regions using this handler */
297 union acpi_operand_object *next;
298};
299
300/* Flags for address handler (handler_flags) */
301
302#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
303
304/******************************************************************************
305 *
306 * Special internal objects
307 *
308 *****************************************************************************/
309
310/*
311 * The Reference object is used for these opcodes:
312 * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
313 * The Reference.Class differentiates these types.
314 */
315struct acpi_object_reference {
316 ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */
317 u8 target_type; /* Used for Index Op */
318 u8 reserved;
319 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
320 struct acpi_namespace_node *node; /* ref_of or Namepath */
321 union acpi_operand_object **where; /* Target of Index */
322 u32 value; /* Used for Local/Arg/Index/ddb_handle */
323};
324
325/* Values for Reference.Class above */
326
327typedef enum {
328 ACPI_REFCLASS_LOCAL = 0, /* Method local */
329 ACPI_REFCLASS_ARG = 1, /* Method argument */
330 ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
331 ACPI_REFCLASS_INDEX = 3, /* Result of Index() */
332 ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */
333 ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
334 ACPI_REFCLASS_DEBUG = 6, /* Debug object */
335
336 ACPI_REFCLASS_MAX = 6
337} ACPI_REFERENCE_CLASSES;
338
339/*
340 * Extra object is used as additional storage for types that
341 * have AML code in their declarations (term_args) that must be
342 * evaluated at run time.
343 *
344 * Currently: Region and field_unit types
345 */
346struct acpi_object_extra {
347 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
348 void *region_context; /* Region-specific data */
349 u8 *aml_start;
350 u32 aml_length;
351};
352
353/* Additional data that can be attached to namespace nodes */
354
355struct acpi_object_data {
356 ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler;
357 void *pointer;
358};
359
360/* Structure used when objects are cached for reuse */
361
362struct acpi_object_cache_list {
363 ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */
364};
365
366/******************************************************************************
367 *
368 * union acpi_operand_object Descriptor - a giant union of all of the above
369 *
370 *****************************************************************************/
371
372union acpi_operand_object {
373 struct acpi_object_common common;
374 struct acpi_object_integer integer;
375 struct acpi_object_string string;
376 struct acpi_object_buffer buffer;
377 struct acpi_object_package package;
378 struct acpi_object_event event;
379 struct acpi_object_method method;
380 struct acpi_object_mutex mutex;
381 struct acpi_object_region region;
382 struct acpi_object_notify_common common_notify;
383 struct acpi_object_device device;
384 struct acpi_object_power_resource power_resource;
385 struct acpi_object_processor processor;
386 struct acpi_object_thermal_zone thermal_zone;
387 struct acpi_object_field_common common_field;
388 struct acpi_object_region_field field;
389 struct acpi_object_buffer_field buffer_field;
390 struct acpi_object_bank_field bank_field;
391 struct acpi_object_index_field index_field;
392 struct acpi_object_notify_handler notify;
393 struct acpi_object_addr_handler address_space;
394 struct acpi_object_reference reference;
395 struct acpi_object_extra extra;
396 struct acpi_object_data data;
397 struct acpi_object_cache_list cache;
398
399 /*
400 * Add namespace node to union in order to simplify code that accepts both
401 * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
402 * a common descriptor_type field in order to differentiate them.
403 */
404 struct acpi_namespace_node node;
405};
406
407/******************************************************************************
408 *
409 * union acpi_descriptor - objects that share a common descriptor identifier
410 *
411 *****************************************************************************/
412
413/* Object descriptor types */
414
415#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
416#define ACPI_DESC_TYPE_STATE 0x02
417#define ACPI_DESC_TYPE_STATE_UPDATE 0x03
418#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04
419#define ACPI_DESC_TYPE_STATE_CONTROL 0x05
420#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06
421#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07
422#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08
423#define ACPI_DESC_TYPE_STATE_RESULT 0x09
424#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A
425#define ACPI_DESC_TYPE_STATE_THREAD 0x0B
426#define ACPI_DESC_TYPE_WALK 0x0C
427#define ACPI_DESC_TYPE_PARSER 0x0D
428#define ACPI_DESC_TYPE_OPERAND 0x0E
429#define ACPI_DESC_TYPE_NAMED 0x0F
430#define ACPI_DESC_TYPE_MAX 0x0F
431
432struct acpi_common_descriptor {
433 void *common_pointer;
434 u8 descriptor_type; /* To differentiate various internal objs */
435};
436
437union acpi_descriptor {
438 struct acpi_common_descriptor common;
439 union acpi_operand_object object;
440 struct acpi_namespace_node node;
441 union acpi_parse_object op;
442};
443
444#pragma pack()
445
446#endif /* _ACOBJECT_H */
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
deleted file mode 100644
index dfdf63327885..000000000000
--- a/include/acpi/acopcode.h
+++ /dev/null
@@ -1,323 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acopcode.h - AML opcode information for the AML parser and interpreter
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACOPCODE_H__
45#define __ACOPCODE_H__
46
47#define MAX_EXTENDED_OPCODE 0x88
48#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
49#define MAX_INTERNAL_OPCODE
50#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
51
52/* Used for non-assigned opcodes */
53
54#define _UNK 0x6B
55
56/*
57 * Reserved ASCII characters. Do not use any of these for
58 * internal opcodes, since they are used to differentiate
59 * name strings from AML opcodes
60 */
61#define _ASC 0x6C
62#define _NAM 0x6C
63#define _PFX 0x6D
64
65/*
66 * All AML opcodes and the parse-time arguments for each. Used by the AML
67 * parser Each list is compressed into a 32-bit number and stored in the
68 * master opcode table (in psopcode.c).
69 */
70#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
71#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
72#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
73#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
74#define ARGP_ARG0 ARG_NONE
75#define ARGP_ARG1 ARG_NONE
76#define ARGP_ARG2 ARG_NONE
77#define ARGP_ARG3 ARG_NONE
78#define ARGP_ARG4 ARG_NONE
79#define ARGP_ARG5 ARG_NONE
80#define ARGP_ARG6 ARG_NONE
81#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
82#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
83#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
84#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
85#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
86#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
87#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
88#define ARGP_BREAK_OP ARG_NONE
89#define ARGP_BREAK_POINT_OP ARG_NONE
90#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
91#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
92#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
93#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
94#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
96#define ARGP_CONTINUE_OP ARG_NONE
97#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
98#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
99#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
100#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
101#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
102#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
103#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
104#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
105#define ARGP_DEBUG_OP ARG_NONE
106#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
107#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
108#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
109#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
110#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
111#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
112#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
113#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
114#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
115#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
116#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
117#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
118#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
119#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
120#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
121#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
122#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
123#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
124#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
125#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
126#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
127#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
128#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
129#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
130#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
131#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
132#define ARGP_LOCAL0 ARG_NONE
133#define ARGP_LOCAL1 ARG_NONE
134#define ARGP_LOCAL2 ARG_NONE
135#define ARGP_LOCAL3 ARG_NONE
136#define ARGP_LOCAL4 ARG_NONE
137#define ARGP_LOCAL5 ARG_NONE
138#define ARGP_LOCAL6 ARG_NONE
139#define ARGP_LOCAL7 ARG_NONE
140#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
141#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
142#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
143#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
144#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
145#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
146#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
147#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
148#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
149#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
150#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
151#define ARGP_NOOP_OP ARG_NONE
152#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
153#define ARGP_ONE_OP ARG_NONE
154#define ARGP_ONES_OP ARG_NONE
155#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
156#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
157#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
158#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
159#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
160#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
161#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
162#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
163#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
164#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
165#define ARGP_REVISION_OP ARG_NONE
166#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
167#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
168#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
169#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
170#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
171#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
172#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
173#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
174#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
175#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
176#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
177#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
178#define ARGP_TIMER_OP ARG_NONE
179#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
180#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
181#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
182#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
183#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
184#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
185#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
186#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
187#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
188#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
189#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
190#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
191#define ARGP_ZERO_OP ARG_NONE
192
193/*
194 * All AML opcodes and the runtime arguments for each. Used by the AML
195 * interpreter Each list is compressed into a 32-bit number and stored
196 * in the master opcode table (in psopcode.c).
197 *
198 * (Used by prep_operands procedure and the ASL Compiler)
199 */
200#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
201#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
202#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
203#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
204#define ARGI_ARG0 ARG_NONE
205#define ARGI_ARG1 ARG_NONE
206#define ARGI_ARG2 ARG_NONE
207#define ARGI_ARG3 ARG_NONE
208#define ARGI_ARG4 ARG_NONE
209#define ARGI_ARG5 ARG_NONE
210#define ARGI_ARG6 ARG_NONE
211#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
212#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
213#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
214#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
215#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
216#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
217#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
218#define ARGI_BREAK_OP ARG_NONE
219#define ARGI_BREAK_POINT_OP ARG_NONE
220#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
221#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
222#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
223#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
224#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
225#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
226#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
227#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
228#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
229#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
230#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
231#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
232#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
233#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
234#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
235#define ARGI_DEBUG_OP ARG_NONE
236#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF)
237#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
238#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
239#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
240#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
241#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
242#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
243#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
244#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
245#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
246#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
247#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
248#define ARGI_IF_OP ARGI_INVALID_OPCODE
249#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF)
250#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
251#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
252#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
253#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
254#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
255#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
256#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
257#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
258#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
259#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
260#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF)
261#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
262#define ARGI_LOCAL0 ARG_NONE
263#define ARGI_LOCAL1 ARG_NONE
264#define ARGI_LOCAL2 ARG_NONE
265#define ARGI_LOCAL3 ARG_NONE
266#define ARGI_LOCAL4 ARG_NONE
267#define ARGI_LOCAL5 ARG_NONE
268#define ARGI_LOCAL6 ARG_NONE
269#define ARGI_LOCAL7 ARG_NONE
270#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
271#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
272#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
273#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
274#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
275#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
276#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
277#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
278#define ARGI_NAME_OP ARGI_INVALID_OPCODE
279#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
280#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
281#define ARGI_NOOP_OP ARG_NONE
282#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
283#define ARGI_ONE_OP ARG_NONE
284#define ARGI_ONES_OP ARG_NONE
285#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
286#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
287#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
288#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
289#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
290#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
291#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
292#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
293#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
294#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
295#define ARGI_REVISION_OP ARG_NONE
296#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
297#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
298#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
299#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
300#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
301#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
302#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
303#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
304#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
305#define ARGI_STRING_OP ARGI_INVALID_OPCODE
306#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
307#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
308#define ARGI_TIMER_OP ARG_NONE
309#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
310#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
311#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
312#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
313#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
314#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
315#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
316#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
317#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
318#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
319#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
320#define ARGI_WORD_OP ARGI_INVALID_OPCODE
321#define ARGI_ZERO_OP ARG_NONE
322
323#endif /* __ACOPCODE_H__ */
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index db8852d8bcf7..5c823d5ab783 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -45,9 +45,9 @@
45#define __ACOUTPUT_H__ 45#define __ACOUTPUT_H__
46 46
47/* 47/*
48 * Debug levels and component IDs. These are used to control the 48 * Debug levels and component IDs. These are used to control the
49 * granularity of the output of the DEBUG_PRINT macro -- on a per- 49 * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
50 * component basis and a per-exception-type basis. 50 * per-component basis and a per-exception-type basis.
51 */ 51 */
52 52
53/* Component IDs are used in the global "DebugLayer" */ 53/* Component IDs are used in the global "DebugLayer" */
@@ -69,8 +69,10 @@
69 69
70#define ACPI_COMPILER 0x00001000 70#define ACPI_COMPILER 0x00001000
71#define ACPI_TOOLS 0x00002000 71#define ACPI_TOOLS 0x00002000
72#define ACPI_EXAMPLE 0x00004000
73#define ACPI_DRIVER 0x00008000
72 74
73#define ACPI_ALL_COMPONENTS 0x00003FFF 75#define ACPI_ALL_COMPONENTS 0x0000FFFF
74#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 76#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
75 77
76/* Component IDs reserved for ACPI drivers */ 78/* Component IDs reserved for ACPI drivers */
@@ -78,7 +80,7 @@
78#define ACPI_ALL_DRIVERS 0xFFFF0000 80#define ACPI_ALL_DRIVERS 0xFFFF0000
79 81
80/* 82/*
81 * Raw debug output levels, do not use these in the DEBUG_PRINT macros 83 * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros
82 */ 84 */
83#define ACPI_LV_INIT 0x00000001 85#define ACPI_LV_INIT 0x00000001
84#define ACPI_LV_DEBUG_OBJECT 0x00000002 86#define ACPI_LV_DEBUG_OBJECT 0x00000002
@@ -176,4 +178,95 @@
176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 178#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 179#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
178 180
181#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
182/*
183 * Module name is included in both debug and non-debug versions primarily for
184 * error messages. The __FILE__ macro is not very useful for this, because it
185 * often includes the entire pathname to the module
186 */
187#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
188#else
189#define ACPI_MODULE_NAME(name)
190#endif
191
192/*
193 * Ascii error messages can be configured out
194 */
195#ifndef ACPI_NO_ERROR_MESSAGES
196#define AE_INFO _acpi_module_name, __LINE__
197
198/*
199 * Error reporting. Callers module and line number are inserted by AE_INFO,
200 * the plist contains a set of parens to allow variable-length lists.
201 * These macros are used for both the debug and non-debug versions of the code.
202 */
203#define ACPI_INFO(plist) acpi_info plist
204#define ACPI_WARNING(plist) acpi_warning plist
205#define ACPI_EXCEPTION(plist) acpi_exception plist
206#define ACPI_ERROR(plist) acpi_error plist
207
208#else
209
210/* No error messages */
211
212#define ACPI_INFO(plist)
213#define ACPI_WARNING(plist)
214#define ACPI_EXCEPTION(plist)
215#define ACPI_ERROR(plist)
216
217#endif /* ACPI_NO_ERROR_MESSAGES */
218
219/*
220 * Debug macros that are conditionally compiled
221 */
222#ifdef ACPI_DEBUG_OUTPUT
223
224/*
225 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
226 * define it now. This is the case where there the compiler does not support
227 * a __FUNCTION__ macro or equivalent.
228 */
229#ifndef ACPI_GET_FUNCTION_NAME
230#define ACPI_GET_FUNCTION_NAME _acpi_function_name
231
232/*
233 * The Name parameter should be the procedure name as a quoted string.
234 * The function name is also used by the function exit macros below.
235 * Note: (const char) is used to be compatible with the debug interfaces
236 * and macros such as __FUNCTION__.
237 */
238#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
239
240#else
241/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
242
243#define ACPI_FUNCTION_NAME(name)
244#endif /* ACPI_GET_FUNCTION_NAME */
245
246/*
247 * Common parameters used for debug output functions:
248 * line number, function name, module(file) name, component ID
249 */
250#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
251
252/*
253 * Master debug print macros
254 * Print message if and only if:
255 * 1) Debug print for the current component is enabled
256 * 2) Debug error level or trace level for the print statement is enabled
257 */
258#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist
259#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist
260
261#else
262/*
263 * This is the non-debug case -- make everything go away,
264 * leaving no executable debug code!
265 */
266#define ACPI_FUNCTION_NAME(a)
267#define ACPI_DEBUG_PRINT(pl)
268#define ACPI_DEBUG_PRINT_RAW(pl)
269
270#endif /* ACPI_DEBUG_OUTPUT */
271
179#endif /* __ACOUTPUT_H__ */ 272#endif /* __ACOUTPUT_H__ */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
deleted file mode 100644
index 23ee0fbf5619..000000000000
--- a/include/acpi/acparser.h
+++ /dev/null
@@ -1,234 +0,0 @@
1/******************************************************************************
2 *
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACPARSER_H__
45#define __ACPARSER_H__
46
47#define OP_HAS_RETURN_VALUE 1
48
49/* Variable number of arguments. This field must be 32 bits */
50
51#define ACPI_VAR_ARGS ACPI_UINT32_MAX
52
53#define ACPI_PARSE_DELETE_TREE 0x0001
54#define ACPI_PARSE_NO_TREE_DELETE 0x0000
55#define ACPI_PARSE_TREE_MASK 0x0001
56
57#define ACPI_PARSE_LOAD_PASS1 0x0010
58#define ACPI_PARSE_LOAD_PASS2 0x0020
59#define ACPI_PARSE_EXECUTE 0x0030
60#define ACPI_PARSE_MODE_MASK 0x0030
61
62#define ACPI_PARSE_DEFERRED_OP 0x0100
63#define ACPI_PARSE_DISASSEMBLE 0x0200
64
65/******************************************************************************
66 *
67 * Parser interfaces
68 *
69 *****************************************************************************/
70
71/*
72 * psxface - Parser external interfaces
73 */
74acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
75
76/*
77 * psargs - Parse AML opcode arguments
78 */
79u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state);
80
81char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state);
82
83void
84acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
85 u32 arg_type, union acpi_parse_object *arg);
86
87acpi_status
88acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
89 struct acpi_parse_state *parser_state,
90 union acpi_parse_object *arg, u8 method_call);
91
92acpi_status
93acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
94 struct acpi_parse_state *parser_state,
95 u32 arg_type, union acpi_parse_object **return_arg);
96
97/*
98 * psfind
99 */
100union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope,
101 u32 name, u32 opcode);
102
103union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op);
104
105/*
106 * psopcode - AML Opcode information
107 */
108const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
109
110char *acpi_ps_get_opcode_name(u16 opcode);
111
112u8 acpi_ps_get_argument_count(u32 op_type);
113
114/*
115 * psparse - top level parsing routines
116 */
117acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state);
118
119u32 acpi_ps_get_opcode_size(u32 opcode);
120
121u16 acpi_ps_peek_opcode(struct acpi_parse_state *state);
122
123acpi_status
124acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
125 union acpi_parse_object *op);
126
127acpi_status
128acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
129 union acpi_parse_object *op,
130 acpi_status callback_status);
131
132/*
133 * psloop - main parse loop
134 */
135acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state);
136
137/*
138 * psscope - Scope stack management routines
139 */
140acpi_status
141acpi_ps_init_scope(struct acpi_parse_state *parser_state,
142 union acpi_parse_object *root);
143
144union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
145 *state);
146
147u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
148
149void
150acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
151 union acpi_parse_object **op,
152 u32 * arg_list, u32 * arg_count);
153
154acpi_status
155acpi_ps_push_scope(struct acpi_parse_state *parser_state,
156 union acpi_parse_object *op,
157 u32 remaining_args, u32 arg_count);
158
159void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
160
161/*
162 * pstree - parse tree manipulation routines
163 */
164void
165acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg);
166
167union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope,
168 char *path, u16 opcode, u32 create);
169
170union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn);
171
172#ifdef ACPI_FUTURE_USAGE
173union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
174 union acpi_parse_object *op);
175#endif /* ACPI_FUTURE_USAGE */
176
177/*
178 * pswalk - parse tree walk routines
179 */
180acpi_status
181acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op,
182 union acpi_parse_object *end_op,
183 union acpi_operand_object *mth_desc,
184 struct acpi_namespace_node *start_node,
185 union acpi_operand_object **params,
186 union acpi_operand_object **caller_return_desc,
187 acpi_owner_id owner_id,
188 acpi_parse_downwards descending_callback,
189 acpi_parse_upwards ascending_callback);
190
191acpi_status
192acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state,
193 union acpi_parse_object *op,
194 acpi_parse_upwards ascending_callback);
195
196acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state);
197
198void acpi_ps_delete_parse_tree(union acpi_parse_object *root);
199
200/*
201 * psutils - parser utilities
202 */
203union acpi_parse_object *acpi_ps_create_scope_op(void);
204
205void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode);
206
207union acpi_parse_object *acpi_ps_alloc_op(u16 opcode);
208
209void acpi_ps_free_op(union acpi_parse_object *op);
210
211u8 acpi_ps_is_leading_char(u32 c);
212
213u8 acpi_ps_is_prefix_char(u32 c);
214
215#ifdef ACPI_FUTURE_USAGE
216u32 acpi_ps_get_name(union acpi_parse_object *op);
217#endif /* ACPI_FUTURE_USAGE */
218
219void acpi_ps_set_name(union acpi_parse_object *op, u32 name);
220
221/*
222 * psdump - display parser tree
223 */
224u32
225acpi_ps_sprint_path(char *buffer_start,
226 u32 buffer_size, union acpi_parse_object *op);
227
228u32
229acpi_ps_sprint_op(char *buffer_start,
230 u32 buffer_size, union acpi_parse_object *op);
231
232void acpi_ps_show(union acpi_parse_object *op);
233
234#endif /* __ACPARSER_H__ */
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index c515ef6cc89e..472b7bf0c5d4 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: acpi.h - Master include file, Publics and external data. 3 * Name: acpi.h - Master public include file used to interface to ACPICA
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -45,25 +45,22 @@
45#define __ACPI_H__ 45#define __ACPI_H__
46 46
47/* 47/*
48 * Common includes for all ACPI driver files 48 * Public include files for use by code that will interface to ACPICA.
49 * We put them here because we don't want to duplicate them 49 *
50 * in the rest of the source code again and again. 50 * Information includes the ACPICA data types, names, exceptions, and
51 * external interface prototypes. Also included are the definitions for
52 * all ACPI tables (FADT, MADT, etc.)
53 *
54 * Note: The order of these include files is important.
51 */ 55 */
52#include "acnames.h" /* Global ACPI names and strings */ 56#include "platform/acenv.h" /* Environment-specific items */
53#include "acconfig.h" /* Configuration constants */ 57#include "acnames.h" /* Common ACPI names and strings */
54#include "platform/acenv.h" /* Target environment specific items */ 58#include "actypes.h" /* ACPICA data types and structures */
55#include "actypes.h" /* Fundamental common data types */ 59#include "acexcep.h" /* ACPICA exceptions */
56#include "acexcep.h" /* ACPI exception codes */
57#include "acmacros.h" /* C macros */
58#include "actbl.h" /* ACPI table definitions */ 60#include "actbl.h" /* ACPI table definitions */
59#include "aclocal.h" /* Internal data types */
60#include "acoutput.h" /* Error output and Debug macros */ 61#include "acoutput.h" /* Error output and Debug macros */
61#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer */ 62#include "acrestyp.h" /* Resource Descriptor structs */
63#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */
62#include "acpixf.h" /* ACPI core subsystem external interfaces */ 64#include "acpixf.h" /* ACPI core subsystem external interfaces */
63#include "acobject.h" /* ACPI internal object */
64#include "acstruct.h" /* Common structures */
65#include "acglobal.h" /* All global variables */
66#include "achware.h" /* Hardware defines and interfaces */
67#include "acutils.h" /* Utility interfaces */
68 65
69#endif /* __ACPI_H__ */ 66#endif /* __ACPI_H__ */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index b91440ac0d16..a62720a7edc0 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -121,8 +121,11 @@ acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
121acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units); 121acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
122 122
123/* 123/*
124 * Mutex primitives 124 * Mutex primitives. May be configured to use semaphores instead via
125 * ACPI_MUTEX_TYPE (see platform/acenv.h)
125 */ 126 */
127#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
128
126acpi_status acpi_os_create_mutex(acpi_mutex * out_handle); 129acpi_status acpi_os_create_mutex(acpi_mutex * out_handle);
127 130
128void acpi_os_delete_mutex(acpi_mutex handle); 131void acpi_os_delete_mutex(acpi_mutex handle);
@@ -130,13 +133,7 @@ void acpi_os_delete_mutex(acpi_mutex handle);
130acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout); 133acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
131 134
132void acpi_os_release_mutex(acpi_mutex handle); 135void acpi_os_release_mutex(acpi_mutex handle);
133 136#endif
134/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
135
136#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle)
137#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle)
138#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time)
139#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1)
140 137
141/* 138/*
142 * Memory allocation and mapping 139 * Memory allocation and mapping
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 33bc0e3b1954..c8e8cf45830f 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -45,9 +45,32 @@
45#ifndef __ACXFACE_H__ 45#ifndef __ACXFACE_H__
46#define __ACXFACE_H__ 46#define __ACXFACE_H__
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */
49
50#define ACPI_CA_VERSION 0x20081204
51
48#include "actypes.h" 52#include "actypes.h"
49#include "actbl.h" 53#include "actbl.h"
50 54
55extern u8 acpi_gbl_permanent_mmap;
56
57/*
58 * Globals that are publically available, allowing for
59 * run time configuration
60 */
61extern u32 acpi_dbg_level;
62extern u32 acpi_dbg_layer;
63extern u8 acpi_gbl_enable_interpreter_slack;
64extern u8 acpi_gbl_all_methods_serialized;
65extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags;
69
70extern u32 acpi_current_gpe_count;
71extern struct acpi_table_fadt acpi_gbl_FADT;
72
73extern u32 acpi_rsdt_forced;
51/* 74/*
52 * Global interfaces 75 * Global interfaces
53 */ 76 */
@@ -79,11 +102,6 @@ const char *acpi_format_exception(acpi_status exception);
79 102
80acpi_status acpi_purge_cached_objects(void); 103acpi_status acpi_purge_cached_objects(void);
81 104
82#ifdef ACPI_FUTURE_USAGE
83acpi_status
84acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
85#endif
86
87/* 105/*
88 * ACPI Memory management 106 * ACPI Memory management
89 */ 107 */
@@ -193,9 +211,12 @@ acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
193acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); 211acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
194 212
195/* 213/*
196 * Event handler interfaces 214 * Handler interfaces
197 */ 215 */
198acpi_status 216acpi_status
217acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
218
219acpi_status
199acpi_install_fixed_event_handler(u32 acpi_event, 220acpi_install_fixed_event_handler(u32 acpi_event,
200 acpi_event_handler handler, void *context); 221 acpi_event_handler handler, void *context);
201 222
@@ -227,6 +248,10 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
227 u32 gpe_number, 248 u32 gpe_number,
228 u32 type, acpi_event_handler address, void *context); 249 u32 type, acpi_event_handler address, void *context);
229 250
251acpi_status
252acpi_remove_gpe_handler(acpi_handle gpe_device,
253 u32 gpe_number, acpi_event_handler address);
254
230#ifdef ACPI_FUTURE_USAGE 255#ifdef ACPI_FUTURE_USAGE
231acpi_status acpi_install_exception_handler(acpi_exception_handler handler); 256acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
232#endif 257#endif
@@ -238,10 +263,6 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
238 263
239acpi_status acpi_release_global_lock(u32 handle); 264acpi_status acpi_release_global_lock(u32 handle);
240 265
241acpi_status
242acpi_remove_gpe_handler(acpi_handle gpe_device,
243 u32 gpe_number, acpi_event_handler address);
244
245acpi_status acpi_enable_event(u32 event, u32 flags); 266acpi_status acpi_enable_event(u32 event, u32 flags);
246 267
247acpi_status acpi_disable_event(u32 event, u32 flags); 268acpi_status acpi_disable_event(u32 event, u32 flags);
@@ -250,6 +271,9 @@ acpi_status acpi_clear_event(u32 event);
250 271
251acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); 272acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
252 273
274/*
275 * GPE Interfaces
276 */
253acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); 277acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type);
254 278
255acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); 279acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
@@ -263,6 +287,12 @@ acpi_get_gpe_status(acpi_handle gpe_device,
263 u32 gpe_number, 287 u32 gpe_number,
264 u32 flags, acpi_event_status * event_status); 288 u32 flags, acpi_event_status * event_status);
265 289
290acpi_status acpi_disable_all_gpes(void);
291
292acpi_status acpi_enable_all_runtime_gpes(void);
293
294acpi_status acpi_get_gpe_device(u32 gpe_index, acpi_handle *gpe_device);
295
266acpi_status 296acpi_status
267acpi_install_gpe_block(acpi_handle gpe_device, 297acpi_install_gpe_block(acpi_handle gpe_device,
268 struct acpi_generic_address *gpe_block_address, 298 struct acpi_generic_address *gpe_block_address,
@@ -313,6 +343,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
313/* 343/*
314 * Hardware (ACPI device) interfaces 344 * Hardware (ACPI device) interfaces
315 */ 345 */
346acpi_status acpi_reset(void);
347
316acpi_status acpi_get_register(u32 register_id, u32 * return_value); 348acpi_status acpi_get_register(u32 register_id, u32 * return_value);
317 349
318acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value); 350acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
@@ -320,12 +352,14 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
320acpi_status acpi_set_register(u32 register_id, u32 value); 352acpi_status acpi_set_register(u32 register_id, u32 value);
321 353
322acpi_status 354acpi_status
323acpi_set_firmware_waking_vector(acpi_physical_address physical_address); 355acpi_set_firmware_waking_vector(u32 physical_address);
324 356
325#ifdef ACPI_FUTURE_USAGE
326acpi_status 357acpi_status
327acpi_get_firmware_waking_vector(acpi_physical_address * physical_address); 358acpi_set_firmware_waking_vector64(u64 physical_address);
328#endif 359
360acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg);
361
362acpi_status acpi_write(u32 value, struct acpi_generic_address *reg);
329 363
330acpi_status 364acpi_status
331acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); 365acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
@@ -340,4 +374,42 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
340 374
341acpi_status acpi_leave_sleep_state(u8 sleep_state); 375acpi_status acpi_leave_sleep_state(u8 sleep_state);
342 376
377/*
378 * Debug output
379 */
380void ACPI_INTERNAL_VAR_XFACE
381acpi_error(const char *module_name,
382 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
383
384void ACPI_INTERNAL_VAR_XFACE
385acpi_exception(const char *module_name,
386 u32 line_number,
387 acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4);
388
389void ACPI_INTERNAL_VAR_XFACE
390acpi_warning(const char *module_name,
391 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
392
393void ACPI_INTERNAL_VAR_XFACE
394acpi_info(const char *module_name,
395 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
396
397#ifdef ACPI_DEBUG_OUTPUT
398
399void ACPI_INTERNAL_VAR_XFACE
400acpi_debug_print(u32 requested_debug_level,
401 u32 line_number,
402 const char *function_name,
403 const char *module_name,
404 u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6);
405
406void ACPI_INTERNAL_VAR_XFACE
407acpi_debug_print_raw(u32 requested_debug_level,
408 u32 line_number,
409 const char *function_name,
410 const char *module_name,
411 u32 component_id,
412 const char *format, ...) ACPI_PRINTF_LIKE(6);
413#endif
414
343#endif /* __ACXFACE_H__ */ 415#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/acpredef.h b/include/acpi/acpredef.h
deleted file mode 100644
index 16a9ca9a66e4..000000000000
--- a/include/acpi/acpredef.h
+++ /dev/null
@@ -1,371 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acpredef - Information table for ACPI predefined methods and objects
4 * $Revision: 1.1 $
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#ifndef __ACPREDEF_H__
46#define __ACPREDEF_H__
47
48/******************************************************************************
49 *
50 * Return Package types
51 *
52 * 1) PTYPE1 packages do not contain sub-packages.
53 *
54 * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types:
55 * object type
56 * count
57 * object type
58 * count
59 *
60 * ACPI_PTYPE1_VAR: Variable length:
61 * object type (Int/Buf/Ref)
62 *
63 * ACPI_PTYPE1_OPTION: Package has some required and some optional elements:
64 * Used for _PRW
65 *
66 *
67 * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the
68 * different types describe the contents of each of the sub-packages.
69 *
70 * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
71 * object type
72 * count
73 * object type
74 * count
75 *
76 * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element:
77 * object type
78 *
79 * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
80 * object type
81 * count
82 * object type
83 * count
84 *
85 * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length:
86 * Used for _PRT
87 *
88 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
89 * Used for _HPX
90 *
91 *****************************************************************************/
92
93enum acpi_return_package_types {
94 ACPI_PTYPE1_FIXED = 1,
95 ACPI_PTYPE1_VAR = 2,
96 ACPI_PTYPE1_OPTION = 3,
97 ACPI_PTYPE2 = 4,
98 ACPI_PTYPE2_COUNT = 5,
99 ACPI_PTYPE2_PKG_COUNT = 6,
100 ACPI_PTYPE2_FIXED = 7,
101 ACPI_PTYPE2_MIN = 8
102};
103
104/*
105 * Predefined method/object information table.
106 *
107 * These are the names that can actually be evaluated via acpi_evaluate_object.
108 * Not present in this table are the following:
109 *
110 * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object:
111 * _Lxx and _Exx GPE methods
112 * _Qxx EC methods
113 * _T_x compiler temporary variables
114 *
115 * 2) Predefined names that never actually exist within the AML code:
116 * Predefined resource descriptor field names
117 *
118 * 3) Predefined names that are implemented within ACPICA:
119 * _OSI
120 *
121 * 4) Some predefined names that are not documented within the ACPI spec.
122 * _WDG, _WED
123 *
124 * The main entries in the table each contain the following items:
125 *
126 * Name - The ACPI reserved name
127 * param_count - Number of arguments to the method
128 * expected_btypes - Allowed type(s) for the return value.
129 * 0 means that no return value is expected.
130 *
131 * For methods that return packages, the next entry in the table contains
132 * information about the expected structure of the package. This information
133 * is saved here (rather than in a separate table) in order to minimize the
134 * overall size of the stored data.
135 */
136static const union acpi_predefined_info predefined_names[] = {
137 {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}},
138 {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}},
139 {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}},
140 {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}},
141 {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}},
142 {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}},
143 {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}},
144 {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}},
145 {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}},
146 {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}},
147 {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}},
148 {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
149 {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
150 {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
151 {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
152 {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
153 {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
154 {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
155 {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
156 {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
157 {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
158 {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}},
159 {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}},
160 {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}},
161 {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */
162 {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}},
163 {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}},
164 {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
165 {.info = {"_BCM", 1, 0}},
166 {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}},
167 {.info = {"_BFS", 1, 0}},
168 {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER,
169 9,
170 ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}}, /* fixed (9 Int),(4 Str) */
171 {.info = {"_BLT", 3, 0}},
172 {.info = {"_BMC", 1, 0}},
173 {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */
174 {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}},
175 {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
176 {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}},
177 {.info = {"_BTP", 1, 0}},
178 {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */
179 {.info = {"_CID", 0,
180 ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}},
181 {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */
182 {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}},
183 {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}},
184 {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */
185 {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT,
186 ACPI_RTYPE_BUFFER, 1,
187 ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */
188 {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}},
189 {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}},
190 {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
191 {.info = {"_DDN", 0, ACPI_RTYPE_STRING}},
192 {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}},
193 {.info = {"_DIS", 0, 0}},
194 {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}},
195 {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
196 {.info = {"_DOS", 1, 0}},
197 {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */
198 {.info = {"_DSS", 1, 0}},
199 {.info = {"_DSW", 3, 0}},
200 {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}},
201 {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
202 {.info = {"_EJ0", 1, 0}},
203 {.info = {"_EJ1", 1, 0}},
204 {.info = {"_EJ2", 1, 0}},
205 {.info = {"_EJ3", 1, 0}},
206 {.info = {"_EJ4", 1, 0}},
207 {.info = {"_EJD", 0, ACPI_RTYPE_STRING}},
208 {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}},
209 {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */
210 {.info = {"_FDM", 1, 0}},
211 {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
212 {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}},
213 {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}},
214 {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
215 {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}},
216 {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}},
217 {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}},
218 {.info = {"_GTS", 1, 0}},
219 {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
220 {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}},
221 {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
222
223 /*
224 * For _HPX, a single package is returned, containing a variable number of sub-packages.
225 * Each sub-package contains a PCI record setting. There are several different type of
226 * record settings, of different lengths, but all elements of all settings are Integers.
227 */
228 {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */
229 {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */
230 {.info = {"_INI", 0, 0}},
231 {.info = {"_IRC", 0, 0}},
232 {.info = {"_LCK", 1, 0}},
233 {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}},
234 {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}},
235 {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */
236 {.info = {"_MSG", 1, 0}},
237 {.info = {"_OFF", 0, 0}},
238 {.info = {"_ON_", 0, 0}},
239 {.info = {"_OS_", 0, ACPI_RTYPE_STRING}},
240 {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}},
241 {.info = {"_OST", 3, 0}},
242 {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
243 {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */
244 {.info = {"_PDC", 1, 0}},
245 {.info = {"_PIC", 1, 0}},
246 {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */
247 {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}},
248 {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */
249 {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
250 {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
251 {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
252 {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}},
253
254 /*
255 * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there
256 * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow
257 * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE
258 * type to the 2nd element (index 1) in the statement below.
259 */
260 {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4,
261 ACPI_RTYPE_INTEGER,
262 ACPI_RTYPE_INTEGER,
263 ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */
264
265 {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2,
266 ACPI_RTYPE_INTEGER |
267 ACPI_RTYPE_PACKAGE,
268 ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */
269
270 {.info = {"_PS0", 0, 0}},
271 {.info = {"_PS1", 0, 0}},
272 {.info = {"_PS2", 0, 0}},
273 {.info = {"_PS3", 0, 0}},
274 {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}},
275 {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */
276 {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
277 {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}},
278 {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */
279 {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}},
280 {.info = {"_PSW", 1, 0}},
281 {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */
282 {.info = {"_PTS", 1, 0}},
283 {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}},
284 {.info = {"_REG", 2, 0}},
285 {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}},
286 {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}},
287 {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}},
288 {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}},
289
290 /*
291 * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer,
292 * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length",
293 * but all elements must be Integers.
294 */
295 {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
296 {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
297 {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
298 {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
299 {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
300 {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
301
302 {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}},
303 {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}},
304 {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}},
305 {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}},
306 {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}},
307 {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}},
308 {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}},
309 {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}},
310 {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}},
311 {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}},
312 {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
313 /* Note: the 3-arg definition may be removed for ACPI 4.0 */
314 {.info = {"_SDD", 1, 0}},
315 {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}},
316 {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}},
317 {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}},
318 {.info = {"_SRS", 1, 0}},
319 {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */
320 {.info = {"_SST", 1, 0}},
321 {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}},
322 {.info = {"_STM", 3, 0}},
323 {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}},
324 {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}},
325 {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}},
326 {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}},
327 {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}},
328 {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}},
329 {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}},
330 {.info = {"_TPT", 1, 0}},
331 {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2,
332 ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */
333 {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */
334 {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}},
335 {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */
336 {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}},
337 {.info = {"_TTS", 1, 0}},
338 {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
339 {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}},
340 {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}},
341 {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
342 {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
343 {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}},
344 {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}},
345 {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}},
346
347 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
348
349 {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
350 {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */
351 {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */
352};
353
354#if 0
355 /* Not implemented */
356
357{
358"_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */
359
360{
361"_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */
362
363 /* This is an internally implemented control method, no need to check */
364{
365"_OSI", 1, ACPI_RTYPE_INTEGER},
366
367 /* TBD: */
368 _PRT - currently ignore reversed entries.attempt to fix here ?
369 think about code that attempts to fix package elements like _BIF, etc.
370#endif
371#endif
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
deleted file mode 100644
index eef5bd7a59fa..000000000000
--- a/include/acpi/acresrc.h
+++ /dev/null
@@ -1,336 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acresrc.h - Resource Manager function prototypes
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACRESRC_H__
45#define __ACRESRC_H__
46
47/* Need the AML resource descriptor structs */
48
49#include "amlresrc.h"
50
51/*
52 * If possible, pack the following structures to byte alignment, since we
53 * don't care about performance for debug output. Two cases where we cannot
54 * pack the structures:
55 *
56 * 1) Hardware does not support misaligned memory transfers
57 * 2) Compiler does not support pointers within packed structures
58 */
59#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
60#pragma pack(1)
61#endif
62
63/*
64 * Individual entry for the resource conversion tables
65 */
66typedef const struct acpi_rsconvert_info {
67 u8 opcode;
68 u8 resource_offset;
69 u8 aml_offset;
70 u8 value;
71
72} acpi_rsconvert_info;
73
74/* Resource conversion opcodes */
75
76#define ACPI_RSC_INITGET 0
77#define ACPI_RSC_INITSET 1
78#define ACPI_RSC_FLAGINIT 2
79#define ACPI_RSC_1BITFLAG 3
80#define ACPI_RSC_2BITFLAG 4
81#define ACPI_RSC_COUNT 5
82#define ACPI_RSC_COUNT16 6
83#define ACPI_RSC_LENGTH 7
84#define ACPI_RSC_MOVE8 8
85#define ACPI_RSC_MOVE16 9
86#define ACPI_RSC_MOVE32 10
87#define ACPI_RSC_MOVE64 11
88#define ACPI_RSC_SET8 12
89#define ACPI_RSC_DATA8 13
90#define ACPI_RSC_ADDRESS 14
91#define ACPI_RSC_SOURCE 15
92#define ACPI_RSC_SOURCEX 16
93#define ACPI_RSC_BITMASK 17
94#define ACPI_RSC_BITMASK16 18
95#define ACPI_RSC_EXIT_NE 19
96#define ACPI_RSC_EXIT_LE 20
97#define ACPI_RSC_EXIT_EQ 21
98
99/* Resource Conversion sub-opcodes */
100
101#define ACPI_RSC_COMPARE_AML_LENGTH 0
102#define ACPI_RSC_COMPARE_VALUE 1
103
104#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
105
106#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
107#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
108
109typedef const struct acpi_rsdump_info {
110 u8 opcode;
111 u8 offset;
112 char *name;
113 const char **pointer;
114
115} acpi_rsdump_info;
116
117/* Values for the Opcode field above */
118
119#define ACPI_RSD_TITLE 0
120#define ACPI_RSD_LITERAL 1
121#define ACPI_RSD_STRING 2
122#define ACPI_RSD_UINT8 3
123#define ACPI_RSD_UINT16 4
124#define ACPI_RSD_UINT32 5
125#define ACPI_RSD_UINT64 6
126#define ACPI_RSD_1BITFLAG 7
127#define ACPI_RSD_2BITFLAG 8
128#define ACPI_RSD_SHORTLIST 9
129#define ACPI_RSD_LONGLIST 10
130#define ACPI_RSD_DWORDLIST 11
131#define ACPI_RSD_ADDRESS 12
132#define ACPI_RSD_SOURCE 13
133
134/* restore default alignment */
135
136#pragma pack()
137
138/* Resource tables indexed by internal resource type */
139
140extern const u8 acpi_gbl_aml_resource_sizes[];
141extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
142
143/* Resource tables indexed by raw AML resource descriptor type */
144
145extern const u8 acpi_gbl_resource_struct_sizes[];
146extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
147
148struct acpi_vendor_walk_info {
149 struct acpi_vendor_uuid *uuid;
150 struct acpi_buffer *buffer;
151 acpi_status status;
152};
153
154/*
155 * rscreate
156 */
157acpi_status
158acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
159 struct acpi_buffer *output_buffer);
160
161acpi_status
162acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
163 struct acpi_buffer *output_buffer);
164
165acpi_status
166acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
167 struct acpi_buffer *output_buffer);
168
169/*
170 * rsutils
171 */
172
173acpi_status
174acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
175 struct acpi_buffer *ret_buffer);
176
177acpi_status
178acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
179 struct acpi_buffer *ret_buffer);
180
181acpi_status
182acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
183 struct acpi_buffer *ret_buffer);
184
185acpi_status
186acpi_rs_get_method_data(acpi_handle handle,
187 char *path, struct acpi_buffer *ret_buffer);
188
189acpi_status
190acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
191 struct acpi_buffer *ret_buffer);
192
193/*
194 * rscalc
195 */
196acpi_status
197acpi_rs_get_list_length(u8 * aml_buffer,
198 u32 aml_buffer_length, acpi_size * size_needed);
199
200acpi_status
201acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
202 acpi_size * size_needed);
203
204acpi_status
205acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
206 acpi_size * buffer_size_needed);
207
208acpi_status
209acpi_rs_convert_aml_to_resources(u8 * aml,
210 u32 length,
211 u32 offset, u8 resource_index, void **context);
212
213acpi_status
214acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
215 acpi_size aml_size_needed, u8 * output_buffer);
216
217/*
218 * rsaddr
219 */
220void
221acpi_rs_set_address_common(union aml_resource *aml,
222 struct acpi_resource *resource);
223
224u8
225acpi_rs_get_address_common(struct acpi_resource *resource,
226 union aml_resource *aml);
227
228/*
229 * rsmisc
230 */
231acpi_status
232acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
233 union aml_resource *aml,
234 struct acpi_rsconvert_info *info);
235
236acpi_status
237acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
238 union aml_resource *aml,
239 struct acpi_rsconvert_info *info);
240
241/*
242 * rsutils
243 */
244void
245acpi_rs_move_data(void *destination,
246 void *source, u16 item_count, u8 move_type);
247
248u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
249
250u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
251
252acpi_rs_length
253acpi_rs_get_resource_source(acpi_rs_length resource_length,
254 acpi_rs_length minimum_length,
255 struct acpi_resource_source *resource_source,
256 union aml_resource *aml, char *string_ptr);
257
258acpi_rsdesc_size
259acpi_rs_set_resource_source(union aml_resource *aml,
260 acpi_rs_length minimum_length,
261 struct acpi_resource_source *resource_source);
262
263void
264acpi_rs_set_resource_header(u8 descriptor_type,
265 acpi_rsdesc_size total_length,
266 union aml_resource *aml);
267
268void
269acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
270 union aml_resource *aml);
271
272/*
273 * rsdump
274 */
275void acpi_rs_dump_resource_list(struct acpi_resource *resource);
276
277void acpi_rs_dump_irq_list(u8 * route_table);
278
279/*
280 * Resource conversion tables
281 */
282extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
283extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
284extern struct acpi_rsconvert_info acpi_rs_convert_io[];
285extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
286extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
287extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
288extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
289extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
290extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
291extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
292extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
293extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
294extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
295extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
296
297/* These resources require separate get/set tables */
298
299extern struct acpi_rsconvert_info acpi_rs_get_irq[];
300extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
301extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
302extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
303
304extern struct acpi_rsconvert_info acpi_rs_set_irq[];
305extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
306extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
307
308#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
309/*
310 * rsinfo
311 */
312extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
313
314/*
315 * rsdump
316 */
317extern struct acpi_rsdump_info acpi_rs_dump_irq[];
318extern struct acpi_rsdump_info acpi_rs_dump_dma[];
319extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
320extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
321extern struct acpi_rsdump_info acpi_rs_dump_io[];
322extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
323extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
324extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
325extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
326extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
327extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
328extern struct acpi_rsdump_info acpi_rs_dump_address16[];
329extern struct acpi_rsdump_info acpi_rs_dump_address32[];
330extern struct acpi_rsdump_info acpi_rs_dump_address64[];
331extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
332extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
333extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
334#endif
335
336#endif /* __ACRESRC_H__ */
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
new file mode 100644
index 000000000000..9ffe00feada6
--- /dev/null
+++ b/include/acpi/acrestyp.h
@@ -0,0 +1,405 @@
1/******************************************************************************
2 *
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACRESTYP_H__
45#define __ACRESTYP_H__
46
47/*
48 * Definitions for Resource Attributes
49 */
50typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
51typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
52
53/*
54 * Memory Attributes
55 */
56#define ACPI_READ_ONLY_MEMORY (u8) 0x00
57#define ACPI_READ_WRITE_MEMORY (u8) 0x01
58
59#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
60#define ACPI_CACHABLE_MEMORY (u8) 0x01
61#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
62#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
63
64/*
65 * IO Attributes
66 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
67 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
68 */
69#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
70#define ACPI_ISA_ONLY_RANGES (u8) 0x02
71#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
72
73/* Type of translation - 1=Sparse, 0=Dense */
74
75#define ACPI_SPARSE_TRANSLATION (u8) 0x01
76
77/*
78 * IO Port Descriptor Decode
79 */
80#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
81#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
82
83/*
84 * IRQ Attributes
85 */
86#define ACPI_LEVEL_SENSITIVE (u8) 0x00
87#define ACPI_EDGE_SENSITIVE (u8) 0x01
88
89#define ACPI_ACTIVE_HIGH (u8) 0x00
90#define ACPI_ACTIVE_LOW (u8) 0x01
91
92#define ACPI_EXCLUSIVE (u8) 0x00
93#define ACPI_SHARED (u8) 0x01
94
95/*
96 * DMA Attributes
97 */
98#define ACPI_COMPATIBILITY (u8) 0x00
99#define ACPI_TYPE_A (u8) 0x01
100#define ACPI_TYPE_B (u8) 0x02
101#define ACPI_TYPE_F (u8) 0x03
102
103#define ACPI_NOT_BUS_MASTER (u8) 0x00
104#define ACPI_BUS_MASTER (u8) 0x01
105
106#define ACPI_TRANSFER_8 (u8) 0x00
107#define ACPI_TRANSFER_8_16 (u8) 0x01
108#define ACPI_TRANSFER_16 (u8) 0x02
109
110/*
111 * Start Dependent Functions Priority definitions
112 */
113#define ACPI_GOOD_CONFIGURATION (u8) 0x00
114#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
115#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
116
117/*
118 * 16, 32 and 64-bit Address Descriptor resource types
119 */
120#define ACPI_MEMORY_RANGE (u8) 0x00
121#define ACPI_IO_RANGE (u8) 0x01
122#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
123
124#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
125#define ACPI_ADDRESS_FIXED (u8) 0x01
126
127#define ACPI_POS_DECODE (u8) 0x00
128#define ACPI_SUB_DECODE (u8) 0x01
129
130#define ACPI_PRODUCER (u8) 0x00
131#define ACPI_CONSUMER (u8) 0x01
132
133/*
134 * If possible, pack the following structures to byte alignment
135 */
136#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
137#pragma pack(1)
138#endif
139
140/* UUID data structures for use in vendor-defined resource descriptors */
141
142struct acpi_uuid {
143 u8 data[ACPI_UUID_LENGTH];
144};
145
146struct acpi_vendor_uuid {
147 u8 subtype;
148 u8 data[ACPI_UUID_LENGTH];
149};
150
151/*
152 * Structures used to describe device resources
153 */
154struct acpi_resource_irq {
155 u8 descriptor_length;
156 u8 triggering;
157 u8 polarity;
158 u8 sharable;
159 u8 interrupt_count;
160 u8 interrupts[1];
161};
162
163struct acpi_resource_dma {
164 u8 type;
165 u8 bus_master;
166 u8 transfer;
167 u8 channel_count;
168 u8 channels[1];
169};
170
171struct acpi_resource_start_dependent {
172 u8 descriptor_length;
173 u8 compatibility_priority;
174 u8 performance_robustness;
175};
176
177/*
178 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
179 * needed because it has no fields
180 */
181
182struct acpi_resource_io {
183 u8 io_decode;
184 u8 alignment;
185 u8 address_length;
186 u16 minimum;
187 u16 maximum;
188};
189
190struct acpi_resource_fixed_io {
191 u16 address;
192 u8 address_length;
193};
194
195struct acpi_resource_vendor {
196 u16 byte_length;
197 u8 byte_data[1];
198};
199
200/* Vendor resource with UUID info (introduced in ACPI 3.0) */
201
202struct acpi_resource_vendor_typed {
203 u16 byte_length;
204 u8 uuid_subtype;
205 u8 uuid[ACPI_UUID_LENGTH];
206 u8 byte_data[1];
207};
208
209struct acpi_resource_end_tag {
210 u8 checksum;
211};
212
213struct acpi_resource_memory24 {
214 u8 write_protect;
215 u16 minimum;
216 u16 maximum;
217 u16 alignment;
218 u16 address_length;
219};
220
221struct acpi_resource_memory32 {
222 u8 write_protect;
223 u32 minimum;
224 u32 maximum;
225 u32 alignment;
226 u32 address_length;
227};
228
229struct acpi_resource_fixed_memory32 {
230 u8 write_protect;
231 u32 address;
232 u32 address_length;
233};
234
235struct acpi_memory_attribute {
236 u8 write_protect;
237 u8 caching;
238 u8 range_type;
239 u8 translation;
240};
241
242struct acpi_io_attribute {
243 u8 range_type;
244 u8 translation;
245 u8 translation_type;
246 u8 reserved1;
247};
248
249union acpi_resource_attribute {
250 struct acpi_memory_attribute mem;
251 struct acpi_io_attribute io;
252
253 /* Used for the *word_space macros */
254
255 u8 type_specific;
256};
257
258struct acpi_resource_source {
259 u8 index;
260 u16 string_length;
261 char *string_ptr;
262};
263
264/* Fields common to all address descriptors, 16/32/64 bit */
265
266#define ACPI_RESOURCE_ADDRESS_COMMON \
267 u8 resource_type; \
268 u8 producer_consumer; \
269 u8 decode; \
270 u8 min_address_fixed; \
271 u8 max_address_fixed; \
272 union acpi_resource_attribute info;
273
274struct acpi_resource_address {
275ACPI_RESOURCE_ADDRESS_COMMON};
276
277struct acpi_resource_address16 {
278 ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
279 u16 minimum;
280 u16 maximum;
281 u16 translation_offset;
282 u16 address_length;
283 struct acpi_resource_source resource_source;
284};
285
286struct acpi_resource_address32 {
287 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
288 u32 minimum;
289 u32 maximum;
290 u32 translation_offset;
291 u32 address_length;
292 struct acpi_resource_source resource_source;
293};
294
295struct acpi_resource_address64 {
296 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
297 u64 minimum;
298 u64 maximum;
299 u64 translation_offset;
300 u64 address_length;
301 struct acpi_resource_source resource_source;
302};
303
304struct acpi_resource_extended_address64 {
305 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
306 u64 granularity;
307 u64 minimum;
308 u64 maximum;
309 u64 translation_offset;
310 u64 address_length;
311 u64 type_specific;
312};
313
314struct acpi_resource_extended_irq {
315 u8 producer_consumer;
316 u8 triggering;
317 u8 polarity;
318 u8 sharable;
319 u8 interrupt_count;
320 struct acpi_resource_source resource_source;
321 u32 interrupts[1];
322};
323
324struct acpi_resource_generic_register {
325 u8 space_id;
326 u8 bit_width;
327 u8 bit_offset;
328 u8 access_size;
329 u64 address;
330};
331
332/* ACPI_RESOURCE_TYPEs */
333
334#define ACPI_RESOURCE_TYPE_IRQ 0
335#define ACPI_RESOURCE_TYPE_DMA 1
336#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
337#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
338#define ACPI_RESOURCE_TYPE_IO 4
339#define ACPI_RESOURCE_TYPE_FIXED_IO 5
340#define ACPI_RESOURCE_TYPE_VENDOR 6
341#define ACPI_RESOURCE_TYPE_END_TAG 7
342#define ACPI_RESOURCE_TYPE_MEMORY24 8
343#define ACPI_RESOURCE_TYPE_MEMORY32 9
344#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
345#define ACPI_RESOURCE_TYPE_ADDRESS16 11
346#define ACPI_RESOURCE_TYPE_ADDRESS32 12
347#define ACPI_RESOURCE_TYPE_ADDRESS64 13
348#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
349#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
350#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
351#define ACPI_RESOURCE_TYPE_MAX 16
352
353/* Master union for resource descriptors */
354
355union acpi_resource_data {
356 struct acpi_resource_irq irq;
357 struct acpi_resource_dma dma;
358 struct acpi_resource_start_dependent start_dpf;
359 struct acpi_resource_io io;
360 struct acpi_resource_fixed_io fixed_io;
361 struct acpi_resource_vendor vendor;
362 struct acpi_resource_vendor_typed vendor_typed;
363 struct acpi_resource_end_tag end_tag;
364 struct acpi_resource_memory24 memory24;
365 struct acpi_resource_memory32 memory32;
366 struct acpi_resource_fixed_memory32 fixed_memory32;
367 struct acpi_resource_address16 address16;
368 struct acpi_resource_address32 address32;
369 struct acpi_resource_address64 address64;
370 struct acpi_resource_extended_address64 ext_address64;
371 struct acpi_resource_extended_irq extended_irq;
372 struct acpi_resource_generic_register generic_reg;
373
374 /* Common fields */
375
376 struct acpi_resource_address address; /* Common 16/32/64 address fields */
377};
378
379/* Common resource header */
380
381struct acpi_resource {
382 u32 type;
383 u32 length;
384 union acpi_resource_data data;
385};
386
387/* restore default alignment */
388
389#pragma pack()
390
391#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
392#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
393#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
394
395#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
396
397struct acpi_pci_routing_table {
398 u32 length;
399 u32 pin;
400 acpi_integer address; /* here for 64-bit alignment */
401 u32 source_index;
402 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
403};
404
405#endif /* __ACRESTYP_H__ */
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
deleted file mode 100644
index 7980a26bad35..000000000000
--- a/include/acpi/acstruct.h
+++ /dev/null
@@ -1,228 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acstruct.h - Internal structs
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACSTRUCT_H__
45#define __ACSTRUCT_H__
46
47/* acpisrc:struct_defs -- for acpisrc conversion */
48
49/*****************************************************************************
50 *
51 * Tree walking typedefs and structs
52 *
53 ****************************************************************************/
54
55/*
56 * Walk state - current state of a parse tree walk. Used for both a leisurely
57 * stroll through the tree (for whatever reason), and for control method
58 * execution.
59 */
60#define ACPI_NEXT_OP_DOWNWARD 1
61#define ACPI_NEXT_OP_UPWARD 2
62
63/*
64 * Groups of definitions for walk_type used for different implementations of
65 * walkers (never simultaneously) - flags for interpreter:
66 */
67#define ACPI_WALK_NON_METHOD 0
68#define ACPI_WALK_METHOD 0x01
69#define ACPI_WALK_METHOD_RESTART 0x02
70
71/* Flags for i_aSL compiler only */
72
73#define ACPI_WALK_CONST_REQUIRED 0x10
74#define ACPI_WALK_CONST_OPTIONAL 0x20
75
76struct acpi_walk_state {
77 struct acpi_walk_state *next; /* Next walk_state in list */
78 u8 descriptor_type; /* To differentiate various internal objs */
79 u8 walk_type;
80 u16 opcode; /* Current AML opcode */
81 u8 next_op_info; /* Info about next_op */
82 u8 num_operands; /* Stack pointer for Operands[] array */
83 u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */
84 acpi_owner_id owner_id; /* Owner of objects created during the walk */
85 u8 last_predicate; /* Result of last predicate */
86 u8 current_result;
87 u8 return_used;
88 u8 scope_depth;
89 u8 pass_number; /* Parse pass during table load */
90 u8 result_size; /* Total elements for the result stack */
91 u8 result_count; /* Current number of occupied elements of result stack */
92 u32 aml_offset;
93 u32 arg_types;
94 u32 method_breakpoint; /* For single stepping */
95 u32 user_breakpoint; /* User AML breakpoint */
96 u32 parse_flags;
97
98 struct acpi_parse_state parser_state; /* Current state of parser */
99 u32 prev_arg_types;
100 u32 arg_count; /* push for fixed or var args */
101
102 struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
103 struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
104 union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
105 union acpi_operand_object **params;
106
107 u8 *aml_last_while;
108 union acpi_operand_object **caller_return_desc;
109 union acpi_generic_state *control_state; /* List of control states (nested IFs) */
110 struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
111 union acpi_operand_object *implicit_return_obj;
112 struct acpi_namespace_node *method_call_node; /* Called method Node */
113 union acpi_parse_object *method_call_op; /* method_call Op if running a method */
114 union acpi_operand_object *method_desc; /* Method descriptor if running a method */
115 struct acpi_namespace_node *method_node; /* Method node if running a method. */
116 union acpi_parse_object *op; /* Current parser op */
117 const struct acpi_opcode_info *op_info; /* Info on current opcode */
118 union acpi_parse_object *origin; /* Start of walk [Obsolete] */
119 union acpi_operand_object *result_obj;
120 union acpi_generic_state *results; /* Stack of accumulated results */
121 union acpi_operand_object *return_desc; /* Return object, if any */
122 union acpi_generic_state *scope_info; /* Stack of nested scopes */
123 union acpi_parse_object *prev_op; /* Last op that was processed */
124 union acpi_parse_object *next_op; /* next op to be processed */
125 struct acpi_thread_state *thread;
126 acpi_parse_downwards descending_callback;
127 acpi_parse_upwards ascending_callback;
128};
129
130/* Info used by acpi_ps_init_objects */
131
132struct acpi_init_walk_info {
133 u16 method_count;
134 u16 device_count;
135 u16 op_region_count;
136 u16 field_count;
137 u16 buffer_count;
138 u16 package_count;
139 u16 op_region_init;
140 u16 field_init;
141 u16 buffer_init;
142 u16 package_init;
143 u16 object_count;
144 acpi_owner_id owner_id;
145 u32 table_index;
146};
147
148struct acpi_get_devices_info {
149 acpi_walk_callback user_function;
150 void *context;
151 const char *hid;
152};
153
154union acpi_aml_operands {
155 union acpi_operand_object *operands[7];
156
157 struct {
158 struct acpi_object_integer *type;
159 struct acpi_object_integer *code;
160 struct acpi_object_integer *argument;
161
162 } fatal;
163
164 struct {
165 union acpi_operand_object *source;
166 struct acpi_object_integer *index;
167 union acpi_operand_object *target;
168
169 } index;
170
171 struct {
172 union acpi_operand_object *source;
173 struct acpi_object_integer *index;
174 struct acpi_object_integer *length;
175 union acpi_operand_object *target;
176
177 } mid;
178};
179
180/*
181 * Structure used to pass object evaluation parameters.
182 * Purpose is to reduce CPU stack use.
183 */
184struct acpi_evaluate_info {
185 struct acpi_namespace_node *prefix_node;
186 char *pathname;
187 union acpi_operand_object *obj_desc;
188 union acpi_operand_object **parameters;
189 struct acpi_namespace_node *resolved_node;
190 union acpi_operand_object *return_object;
191 u8 param_count;
192 u8 pass_number;
193 u8 return_object_type;
194 u8 flags;
195};
196
197/* Values for Flags above */
198
199#define ACPI_IGNORE_RETURN_VALUE 1
200
201/* Info used by acpi_ns_initialize_devices */
202
203struct acpi_device_walk_info {
204 u16 device_count;
205 u16 num_STA;
206 u16 num_INI;
207 struct acpi_table_desc *table_desc;
208 struct acpi_evaluate_info *evaluate_info;
209};
210
211/* TBD: [Restructure] Merge with struct above */
212
213struct acpi_walk_info {
214 u32 debug_level;
215 u32 count;
216 acpi_owner_id owner_id;
217 u8 display_type;
218};
219
220/* Display Types */
221
222#define ACPI_DISPLAY_SUMMARY (u8) 0
223#define ACPI_DISPLAY_OBJECTS (u8) 1
224#define ACPI_DISPLAY_MASK (u8) 1
225
226#define ACPI_DISPLAY_SHORT (u8) 2
227
228#endif
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
deleted file mode 100644
index 0cbe1b9ab522..000000000000
--- a/include/acpi/actables.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/******************************************************************************
2 *
3 * Name: actables.h - ACPI table management
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACTABLES_H__
45#define __ACTABLES_H__
46
47acpi_status acpi_allocate_root_table(u32 initial_table_count);
48
49/*
50 * tbfadt - FADT parse/convert/validate
51 */
52void acpi_tb_parse_fadt(u32 table_index, u8 flags);
53
54void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
55
56/*
57 * tbfind - find ACPI table
58 */
59acpi_status
60acpi_tb_find_table(char *signature,
61 char *oem_id, char *oem_table_id, u32 *table_index);
62
63/*
64 * tbinstal - Table removal and deletion
65 */
66acpi_status acpi_tb_resize_root_table_list(void);
67
68acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc);
69
70acpi_status
71acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index);
72
73acpi_status
74acpi_tb_store_table(acpi_physical_address address,
75 struct acpi_table_header *table,
76 u32 length, u8 flags, u32 *table_index);
77
78void acpi_tb_delete_table(struct acpi_table_desc *table_desc);
79
80void acpi_tb_terminate(void);
81
82void acpi_tb_delete_namespace_by_owner(u32 table_index);
83
84acpi_status acpi_tb_allocate_owner_id(u32 table_index);
85
86acpi_status acpi_tb_release_owner_id(u32 table_index);
87
88acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id);
89
90u8 acpi_tb_is_table_loaded(u32 table_index);
91
92void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
93
94/*
95 * tbutils - table manager utilities
96 */
97u8 acpi_tb_tables_loaded(void);
98
99void
100acpi_tb_print_table_header(acpi_physical_address address,
101 struct acpi_table_header *header);
102
103u8 acpi_tb_checksum(u8 *buffer, u32 length);
104
105acpi_status
106acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);
107
108void
109acpi_tb_install_table(acpi_physical_address address,
110 u8 flags, char *signature, u32 table_index);
111
112acpi_status
113acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags);
114
115#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 13a3d9ad92db..813e4b6c2c0d 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -288,6 +288,31 @@ enum acpi_prefered_pm_profiles {
288 288
289#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 289#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f)
290 290
291union acpi_name_union {
292 u32 integer;
293 char ascii[4];
294};
295
296/*
297 * Internal ACPI Table Descriptor. One per ACPI table
298 */
299struct acpi_table_desc {
300 acpi_physical_address address;
301 struct acpi_table_header *pointer;
302 u32 length; /* Length fixed at 32 bits */
303 union acpi_name_union signature;
304 acpi_owner_id owner_id;
305 u8 flags;
306};
307
308/* Flags for above */
309
310#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
311#define ACPI_TABLE_ORIGIN_MAPPED (1)
312#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
313#define ACPI_TABLE_ORIGIN_MASK (3)
314#define ACPI_TABLE_IS_LOADED (4)
315
291/* 316/*
292 * Get the remaining ACPI tables 317 * Get the remaining ACPI tables
293 */ 318 */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 63f5b4cf4de1..18963b968114 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -627,7 +627,7 @@ struct acpi_hest_aer_common {
627 u32 uncorrectable_error_mask; 627 u32 uncorrectable_error_mask;
628 u32 uncorrectable_error_severity; 628 u32 uncorrectable_error_severity;
629 u32 correctable_error_mask; 629 u32 correctable_error_mask;
630 u32 advanced_error_cababilities; 630 u32 advanced_error_capabilities;
631}; 631};
632 632
633/* Hardware Error Notification */ 633/* Hardware Error Notification */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 8222e8de0d1c..a20aab510173 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -204,11 +204,10 @@ typedef u32 acpi_physical_address;
204 204
205/******************************************************************************* 205/*******************************************************************************
206 * 206 *
207 * OS-dependent and compiler-dependent types 207 * OS-dependent types
208 * 208 *
209 * If the defaults below are not appropriate for the host system, they can 209 * If the defaults below are not appropriate for the host system, they can
210 * be defined in the compiler-specific or OS-specific header, and this will 210 * be defined in the OS-specific header, and this will take precedence.
211 * take precedence.
212 * 211 *
213 ******************************************************************************/ 212 ******************************************************************************/
214 213
@@ -218,12 +217,6 @@ typedef u32 acpi_physical_address;
218#define acpi_thread_id acpi_size 217#define acpi_thread_id acpi_size
219#endif 218#endif
220 219
221/* Object returned from acpi_os_create_lock */
222
223#ifndef acpi_spinlock
224#define acpi_spinlock void *
225#endif
226
227/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ 220/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */
228 221
229#ifndef acpi_cpu_flags 222#ifndef acpi_cpu_flags
@@ -233,9 +226,51 @@ typedef u32 acpi_physical_address;
233/* Object returned from acpi_os_create_cache */ 226/* Object returned from acpi_os_create_cache */
234 227
235#ifndef acpi_cache_t 228#ifndef acpi_cache_t
229#ifdef ACPI_USE_LOCAL_CACHE
236#define acpi_cache_t struct acpi_memory_list 230#define acpi_cache_t struct acpi_memory_list
231#else
232#define acpi_cache_t void *
233#endif
234#endif
235
236/*
237 * Synchronization objects - Mutexes, Semaphores, and spin_locks
238 */
239#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
240/*
241 * These macros are used if the host OS does not support a mutex object.
242 * Map the OSL Mutex interfaces to binary semaphores.
243 */
244#define acpi_mutex acpi_semaphore
245#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle)
246#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle)
247#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time)
248#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1)
249#endif
250
251/* Configurable types for synchronization objects */
252
253#ifndef acpi_spinlock
254#define acpi_spinlock void *
255#endif
256
257#ifndef acpi_semaphore
258#define acpi_semaphore void *
259#endif
260
261#ifndef acpi_mutex
262#define acpi_mutex void *
237#endif 263#endif
238 264
265/*******************************************************************************
266 *
267 * Compiler-dependent types
268 *
269 * If the defaults below are not appropriate for the host compiler, they can
270 * be defined in the compiler-specific header, and this will take precedence.
271 *
272 ******************************************************************************/
273
239/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ 274/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
240 275
241#ifndef acpi_uintptr_t 276#ifndef acpi_uintptr_t
@@ -268,6 +303,43 @@ typedef u32 acpi_physical_address;
268#define ACPI_EXPORT_SYMBOL(symbol) 303#define ACPI_EXPORT_SYMBOL(symbol)
269#endif 304#endif
270 305
306/******************************************************************************
307 *
308 * ACPI Specification constants (Do not change unless the specification changes)
309 *
310 *****************************************************************************/
311
312/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
313
314#define ACPI_MAX_GPE_BLOCKS 2
315
316/* Default ACPI register widths */
317
318#define ACPI_GPE_REGISTER_WIDTH 8
319#define ACPI_PM1_REGISTER_WIDTH 16
320#define ACPI_PM2_REGISTER_WIDTH 8
321#define ACPI_PM_TIMER_WIDTH 32
322
323/* Names within the namespace are 4 bytes long */
324
325#define ACPI_NAME_SIZE 4
326#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
327#define ACPI_PATH_SEPARATOR '.'
328
329/* Sizes for ACPI table headers */
330
331#define ACPI_OEM_ID_SIZE 6
332#define ACPI_OEM_TABLE_ID_SIZE 8
333
334/* ACPI/PNP hardware IDs */
335
336#define PCI_ROOT_HID_STRING "PNP0A03"
337#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
338
339/* PM Timer ticks per second (HZ) */
340
341#define PM_TIMER_FREQUENCY 3579545
342
271/******************************************************************************* 343/*******************************************************************************
272 * 344 *
273 * Independent types 345 * Independent types
@@ -291,13 +363,18 @@ typedef u32 acpi_physical_address;
291#endif 363#endif
292 364
293/* 365/*
294 * Mescellaneous types 366 * Miscellaneous types
295 */ 367 */
296typedef u32 acpi_status; /* All ACPI Exceptions */ 368typedef u32 acpi_status; /* All ACPI Exceptions */
297typedef u32 acpi_name; /* 4-byte ACPI name */ 369typedef u32 acpi_name; /* 4-byte ACPI name */
298typedef char *acpi_string; /* Null terminated ASCII string */ 370typedef char *acpi_string; /* Null terminated ASCII string */
299typedef void *acpi_handle; /* Actually a ptr to a NS Node */ 371typedef void *acpi_handle; /* Actually a ptr to a NS Node */
300 372
373/* Owner IDs are used to track namespace nodes for selective deletion */
374
375typedef u8 acpi_owner_id;
376#define ACPI_OWNER_ID_MAX 0xFF
377
301struct uint64_struct { 378struct uint64_struct {
302 u32 lo; 379 u32 lo;
303 u32 hi; 380 u32 hi;
@@ -313,13 +390,8 @@ struct uint32_struct {
313 u32 hi; 390 u32 hi;
314}; 391};
315 392
316/* Synchronization objects */
317
318#define acpi_mutex void *
319#define acpi_semaphore void *
320
321/* 393/*
322 * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI 394 * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
323 * version 2, integers are 64 bits. Note that this pertains to the ACPI integer 395 * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
324 * type only, not other integers used in the implementation of the ACPI CA 396 * type only, not other integers used in the implementation of the ACPI CA
325 * subsystem. 397 * subsystem.
@@ -338,10 +410,75 @@ typedef unsigned long long acpi_integer;
338#define ACPI_MAX16_DECIMAL_DIGITS 5 410#define ACPI_MAX16_DECIMAL_DIGITS 5
339#define ACPI_MAX8_DECIMAL_DIGITS 3 411#define ACPI_MAX8_DECIMAL_DIGITS 3
340 412
413/* PM Timer ticks per second (HZ) */
414
415#define PM_TIMER_FREQUENCY 3579545
416
341/* 417/*
342 * Constants with special meanings 418 * Constants with special meanings
343 */ 419 */
344#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) 420#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR)
421#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
422#define ACPI_DO_NOT_WAIT 0
423
424/*******************************************************************************
425 *
426 * Commonly used macros
427 *
428 ******************************************************************************/
429
430/* Data manipulation */
431
432#define ACPI_LOWORD(l) ((u16)(u32)(l))
433#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF))
434#define ACPI_LOBYTE(l) ((u8)(u16)(l))
435#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF))
436
437/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */
438
439struct acpi_integer_overlay {
440 u32 lo_dword;
441 u32 hi_dword;
442};
443
444#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
445#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
446
447#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
448#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
449#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
450#define ACPI_MAX(a,b) (((a)>(b))?(a):(b))
451
452/* Size calculation */
453
454#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
455
456/* Pointer manipulation */
457
458#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p))
459#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p))
460#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
461#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
462
463/* Pointer/Integer type conversions */
464
465#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i)
466#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
467#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
468#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
469#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
470
471#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
472#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
473#else
474#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
475#endif
476
477/*******************************************************************************
478 *
479 * Miscellaneous constants
480 *
481 ******************************************************************************/
345 482
346/* 483/*
347 * Initialization sequence 484 * Initialization sequence
@@ -414,7 +551,7 @@ typedef unsigned long long acpi_integer;
414#define ACPI_NOTIFY_MAX 0x0B 551#define ACPI_NOTIFY_MAX 0x0B
415 552
416/* 553/*
417 * Types associated with ACPI names and objects. The first group of 554 * Types associated with ACPI names and objects. The first group of
418 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 555 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
419 * of the ACPI object_type() operator (See the ACPI Spec). Therefore, 556 * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
420 * only add to the first group if the spec changes. 557 * only add to the first group if the spec changes.
@@ -732,6 +869,15 @@ struct acpi_buffer {
732#define ACPI_NAME_TYPE_MAX 1 869#define ACPI_NAME_TYPE_MAX 1
733 870
734/* 871/*
872 * Predefined Namespace items
873 */
874struct acpi_predefined_names {
875 char *name;
876 u8 type;
877 char *val;
878};
879
880/*
735 * Structure and flags for acpi_get_system_info 881 * Structure and flags for acpi_get_system_info
736 */ 882 */
737#define ACPI_SYS_MODE_UNKNOWN 0x0000 883#define ACPI_SYS_MODE_UNKNOWN 0x0000
@@ -787,7 +933,7 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status,
787 u16 opcode, 933 u16 opcode,
788 u32 aml_offset, void *context); 934 u32 aml_offset, void *context);
789 935
790/* Table Event handler (Load, load_table etc) and types */ 936/* Table Event handler (Load, load_table, etc.) and types */
791 937
792typedef 938typedef
793acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context); 939acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context);
@@ -823,6 +969,12 @@ acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
823#define ACPI_INTERRUPT_NOT_HANDLED 0x00 969#define ACPI_INTERRUPT_NOT_HANDLED 0x00
824#define ACPI_INTERRUPT_HANDLED 0x01 970#define ACPI_INTERRUPT_HANDLED 0x01
825 971
972/* Length of _HID, _UID, _CID, and UUID values */
973
974#define ACPI_DEVICE_ID_LENGTH 0x09
975#define ACPI_MAX_CID_LENGTH 48
976#define ACPI_UUID_LENGTH 16
977
826/* Common string version of device HIDs and UIDs */ 978/* Common string version of device HIDs and UIDs */
827 979
828struct acpica_device_id { 980struct acpica_device_id {
@@ -900,357 +1052,28 @@ struct acpi_mem_space_context {
900}; 1052};
901 1053
902/* 1054/*
903 * Definitions for Resource Attributes 1055 * struct acpi_memory_list is used only if the ACPICA local cache is enabled
904 */
905typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
906typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
907
908/*
909 * Memory Attributes
910 */
911#define ACPI_READ_ONLY_MEMORY (u8) 0x00
912#define ACPI_READ_WRITE_MEMORY (u8) 0x01
913
914#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
915#define ACPI_CACHABLE_MEMORY (u8) 0x01
916#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
917#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
918
919/*
920 * IO Attributes
921 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
922 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
923 */ 1056 */
924#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 1057struct acpi_memory_list {
925#define ACPI_ISA_ONLY_RANGES (u8) 0x02 1058 char *list_name;
926#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 1059 void *list_head;
927 1060 u16 object_size;
928/* Type of translation - 1=Sparse, 0=Dense */ 1061 u16 max_depth;
929 1062 u16 current_depth;
930#define ACPI_SPARSE_TRANSLATION (u8) 0x01 1063 u16 link_offset;
931 1064
932/* 1065#ifdef ACPI_DBG_TRACK_ALLOCATIONS
933 * IO Port Descriptor Decode 1066
934 */ 1067 /* Statistics for debug memory tracking only */
935#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ 1068
936#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 1069 u32 total_allocated;
937 1070 u32 total_freed;
938/* 1071 u32 max_occupied;
939 * IRQ Attributes 1072 u32 total_size;
940 */ 1073 u32 current_total_size;
941#define ACPI_LEVEL_SENSITIVE (u8) 0x00 1074 u32 requests;
942#define ACPI_EDGE_SENSITIVE (u8) 0x01 1075 u32 hits;
943
944#define ACPI_ACTIVE_HIGH (u8) 0x00
945#define ACPI_ACTIVE_LOW (u8) 0x01
946
947#define ACPI_EXCLUSIVE (u8) 0x00
948#define ACPI_SHARED (u8) 0x01
949
950/*
951 * DMA Attributes
952 */
953#define ACPI_COMPATIBILITY (u8) 0x00
954#define ACPI_TYPE_A (u8) 0x01
955#define ACPI_TYPE_B (u8) 0x02
956#define ACPI_TYPE_F (u8) 0x03
957
958#define ACPI_NOT_BUS_MASTER (u8) 0x00
959#define ACPI_BUS_MASTER (u8) 0x01
960
961#define ACPI_TRANSFER_8 (u8) 0x00
962#define ACPI_TRANSFER_8_16 (u8) 0x01
963#define ACPI_TRANSFER_16 (u8) 0x02
964
965/*
966 * Start Dependent Functions Priority definitions
967 */
968#define ACPI_GOOD_CONFIGURATION (u8) 0x00
969#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
970#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
971
972/*
973 * 16, 32 and 64-bit Address Descriptor resource types
974 */
975#define ACPI_MEMORY_RANGE (u8) 0x00
976#define ACPI_IO_RANGE (u8) 0x01
977#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
978
979#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
980#define ACPI_ADDRESS_FIXED (u8) 0x01
981
982#define ACPI_POS_DECODE (u8) 0x00
983#define ACPI_SUB_DECODE (u8) 0x01
984
985#define ACPI_PRODUCER (u8) 0x00
986#define ACPI_CONSUMER (u8) 0x01
987
988/*
989 * If possible, pack the following structures to byte alignment
990 */
991#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
992#pragma pack(1)
993#endif 1076#endif
994
995/* UUID data structures for use in vendor-defined resource descriptors */
996
997struct acpi_uuid {
998 u8 data[ACPI_UUID_LENGTH];
999};
1000
1001struct acpi_vendor_uuid {
1002 u8 subtype;
1003 u8 data[ACPI_UUID_LENGTH];
1004};
1005
1006/*
1007 * Structures used to describe device resources
1008 */
1009struct acpi_resource_irq {
1010 u8 descriptor_length;
1011 u8 triggering;
1012 u8 polarity;
1013 u8 sharable;
1014 u8 interrupt_count;
1015 u8 interrupts[1];
1016};
1017
1018struct acpi_resource_dma {
1019 u8 type;
1020 u8 bus_master;
1021 u8 transfer;
1022 u8 channel_count;
1023 u8 channels[1];
1024};
1025
1026struct acpi_resource_start_dependent {
1027 u8 descriptor_length;
1028 u8 compatibility_priority;
1029 u8 performance_robustness;
1030};
1031
1032/*
1033 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
1034 * needed because it has no fields
1035 */
1036
1037struct acpi_resource_io {
1038 u8 io_decode;
1039 u8 alignment;
1040 u8 address_length;
1041 u16 minimum;
1042 u16 maximum;
1043};
1044
1045struct acpi_resource_fixed_io {
1046 u16 address;
1047 u8 address_length;
1048};
1049
1050struct acpi_resource_vendor {
1051 u16 byte_length;
1052 u8 byte_data[1];
1053};
1054
1055/* Vendor resource with UUID info (introduced in ACPI 3.0) */
1056
1057struct acpi_resource_vendor_typed {
1058 u16 byte_length;
1059 u8 uuid_subtype;
1060 u8 uuid[ACPI_UUID_LENGTH];
1061 u8 byte_data[1];
1062};
1063
1064struct acpi_resource_end_tag {
1065 u8 checksum;
1066};
1067
1068struct acpi_resource_memory24 {
1069 u8 write_protect;
1070 u16 minimum;
1071 u16 maximum;
1072 u16 alignment;
1073 u16 address_length;
1074};
1075
1076struct acpi_resource_memory32 {
1077 u8 write_protect;
1078 u32 minimum;
1079 u32 maximum;
1080 u32 alignment;
1081 u32 address_length;
1082};
1083
1084struct acpi_resource_fixed_memory32 {
1085 u8 write_protect;
1086 u32 address;
1087 u32 address_length;
1088};
1089
1090struct acpi_memory_attribute {
1091 u8 write_protect;
1092 u8 caching;
1093 u8 range_type;
1094 u8 translation;
1095};
1096
1097struct acpi_io_attribute {
1098 u8 range_type;
1099 u8 translation;
1100 u8 translation_type;
1101 u8 reserved1;
1102};
1103
1104union acpi_resource_attribute {
1105 struct acpi_memory_attribute mem;
1106 struct acpi_io_attribute io;
1107
1108 /* Used for the *word_space macros */
1109
1110 u8 type_specific;
1111};
1112
1113struct acpi_resource_source {
1114 u8 index;
1115 u16 string_length;
1116 char *string_ptr;
1117};
1118
1119/* Fields common to all address descriptors, 16/32/64 bit */
1120
1121#define ACPI_RESOURCE_ADDRESS_COMMON \
1122 u8 resource_type; \
1123 u8 producer_consumer; \
1124 u8 decode; \
1125 u8 min_address_fixed; \
1126 u8 max_address_fixed; \
1127 union acpi_resource_attribute info;
1128
1129struct acpi_resource_address {
1130ACPI_RESOURCE_ADDRESS_COMMON};
1131
1132struct acpi_resource_address16 {
1133 ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
1134 u16 minimum;
1135 u16 maximum;
1136 u16 translation_offset;
1137 u16 address_length;
1138 struct acpi_resource_source resource_source;
1139};
1140
1141struct acpi_resource_address32 {
1142 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
1143 u32 minimum;
1144 u32 maximum;
1145 u32 translation_offset;
1146 u32 address_length;
1147 struct acpi_resource_source resource_source;
1148};
1149
1150struct acpi_resource_address64 {
1151 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
1152 u64 minimum;
1153 u64 maximum;
1154 u64 translation_offset;
1155 u64 address_length;
1156 struct acpi_resource_source resource_source;
1157};
1158
1159struct acpi_resource_extended_address64 {
1160 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
1161 u64 granularity;
1162 u64 minimum;
1163 u64 maximum;
1164 u64 translation_offset;
1165 u64 address_length;
1166 u64 type_specific;
1167};
1168
1169struct acpi_resource_extended_irq {
1170 u8 producer_consumer;
1171 u8 triggering;
1172 u8 polarity;
1173 u8 sharable;
1174 u8 interrupt_count;
1175 struct acpi_resource_source resource_source;
1176 u32 interrupts[1];
1177};
1178
1179struct acpi_resource_generic_register {
1180 u8 space_id;
1181 u8 bit_width;
1182 u8 bit_offset;
1183 u8 access_size;
1184 u64 address;
1185};
1186
1187/* ACPI_RESOURCE_TYPEs */
1188
1189#define ACPI_RESOURCE_TYPE_IRQ 0
1190#define ACPI_RESOURCE_TYPE_DMA 1
1191#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
1192#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
1193#define ACPI_RESOURCE_TYPE_IO 4
1194#define ACPI_RESOURCE_TYPE_FIXED_IO 5
1195#define ACPI_RESOURCE_TYPE_VENDOR 6
1196#define ACPI_RESOURCE_TYPE_END_TAG 7
1197#define ACPI_RESOURCE_TYPE_MEMORY24 8
1198#define ACPI_RESOURCE_TYPE_MEMORY32 9
1199#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
1200#define ACPI_RESOURCE_TYPE_ADDRESS16 11
1201#define ACPI_RESOURCE_TYPE_ADDRESS32 12
1202#define ACPI_RESOURCE_TYPE_ADDRESS64 13
1203#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
1204#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
1205#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
1206#define ACPI_RESOURCE_TYPE_MAX 16
1207
1208union acpi_resource_data {
1209 struct acpi_resource_irq irq;
1210 struct acpi_resource_dma dma;
1211 struct acpi_resource_start_dependent start_dpf;
1212 struct acpi_resource_io io;
1213 struct acpi_resource_fixed_io fixed_io;
1214 struct acpi_resource_vendor vendor;
1215 struct acpi_resource_vendor_typed vendor_typed;
1216 struct acpi_resource_end_tag end_tag;
1217 struct acpi_resource_memory24 memory24;
1218 struct acpi_resource_memory32 memory32;
1219 struct acpi_resource_fixed_memory32 fixed_memory32;
1220 struct acpi_resource_address16 address16;
1221 struct acpi_resource_address32 address32;
1222 struct acpi_resource_address64 address64;
1223 struct acpi_resource_extended_address64 ext_address64;
1224 struct acpi_resource_extended_irq extended_irq;
1225 struct acpi_resource_generic_register generic_reg;
1226
1227 /* Common fields */
1228
1229 struct acpi_resource_address address; /* Common 16/32/64 address fields */
1230};
1231
1232struct acpi_resource {
1233 u32 type;
1234 u32 length;
1235 union acpi_resource_data data;
1236};
1237
1238/* restore default alignment */
1239
1240#pragma pack()
1241
1242#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
1243#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
1244#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
1245
1246#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
1247
1248struct acpi_pci_routing_table {
1249 u32 length;
1250 u32 pin;
1251 acpi_integer address; /* here for 64-bit alignment */
1252 u32 source_index;
1253 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1254}; 1077};
1255 1078
1256#endif /* __ACTYPES_H__ */ 1079#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
deleted file mode 100644
index d8307b2987e3..000000000000
--- a/include/acpi/acutils.h
+++ /dev/null
@@ -1,585 +0,0 @@
1/******************************************************************************
2 *
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACUTILS_H
45#define _ACUTILS_H
46
47extern const u8 acpi_gbl_resource_aml_sizes[];
48
49/* Strings used by the disassembler and debugger resource dump routines */
50
51#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
52
53extern const char *acpi_gbl_bm_decode[];
54extern const char *acpi_gbl_config_decode[];
55extern const char *acpi_gbl_consume_decode[];
56extern const char *acpi_gbl_dec_decode[];
57extern const char *acpi_gbl_he_decode[];
58extern const char *acpi_gbl_io_decode[];
59extern const char *acpi_gbl_ll_decode[];
60extern const char *acpi_gbl_max_decode[];
61extern const char *acpi_gbl_mem_decode[];
62extern const char *acpi_gbl_min_decode[];
63extern const char *acpi_gbl_mtp_decode[];
64extern const char *acpi_gbl_rng_decode[];
65extern const char *acpi_gbl_rw_decode[];
66extern const char *acpi_gbl_shr_decode[];
67extern const char *acpi_gbl_siz_decode[];
68extern const char *acpi_gbl_trs_decode[];
69extern const char *acpi_gbl_ttp_decode[];
70extern const char *acpi_gbl_typ_decode[];
71#endif
72
73/* Types for Resource descriptor entries */
74
75#define ACPI_INVALID_RESOURCE 0
76#define ACPI_FIXED_LENGTH 1
77#define ACPI_VARIABLE_LENGTH 2
78#define ACPI_SMALL_VARIABLE_LENGTH 3
79
80typedef
81acpi_status(*acpi_walk_aml_callback) (u8 * aml,
82 u32 length,
83 u32 offset,
84 u8 resource_index, void **context);
85
86typedef
87acpi_status(*acpi_pkg_callback) (u8 object_type,
88 union acpi_operand_object * source_object,
89 union acpi_generic_state * state,
90 void *context);
91
92struct acpi_pkg_info {
93 u8 *free_space;
94 acpi_size length;
95 u32 object_space;
96 u32 num_packages;
97};
98
99#define REF_INCREMENT (u16) 0
100#define REF_DECREMENT (u16) 1
101#define REF_FORCE_DELETE (u16) 2
102
103/* acpi_ut_dump_buffer */
104
105#define DB_BYTE_DISPLAY 1
106#define DB_WORD_DISPLAY 2
107#define DB_DWORD_DISPLAY 4
108#define DB_QWORD_DISPLAY 8
109
110/*
111 * utglobal - Global data structures and procedures
112 */
113acpi_status acpi_ut_init_globals(void);
114
115#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
116
117char *acpi_ut_get_mutex_name(u32 mutex_id);
118
119const char *acpi_ut_get_notify_name(u32 notify_value);
120
121#endif
122
123char *acpi_ut_get_type_name(acpi_object_type type);
124
125char *acpi_ut_get_node_name(void *object);
126
127char *acpi_ut_get_descriptor_name(void *object);
128
129const char *acpi_ut_get_reference_name(union acpi_operand_object *object);
130
131char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
132
133char *acpi_ut_get_region_name(u8 space_id);
134
135char *acpi_ut_get_event_name(u32 event_id);
136
137char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position);
138
139u8 acpi_ut_valid_object_type(acpi_object_type type);
140
141/*
142 * utinit - miscellaneous initialization and shutdown
143 */
144acpi_status acpi_ut_hardware_initialize(void);
145
146void acpi_ut_subsystem_shutdown(void);
147
148/*
149 * utclib - Local implementations of C library functions
150 */
151#ifndef ACPI_USE_SYSTEM_CLIBRARY
152
153acpi_size acpi_ut_strlen(const char *string);
154
155char *acpi_ut_strcpy(char *dst_string, const char *src_string);
156
157char *acpi_ut_strncpy(char *dst_string,
158 const char *src_string, acpi_size count);
159
160int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
161
162int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
163
164int acpi_ut_strcmp(const char *string1, const char *string2);
165
166char *acpi_ut_strcat(char *dst_string, const char *src_string);
167
168char *acpi_ut_strncat(char *dst_string,
169 const char *src_string, acpi_size count);
170
171u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
172
173char *acpi_ut_strstr(char *string1, char *string2);
174
175void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
176
177void *acpi_ut_memset(void *dest, u8 value, acpi_size count);
178
179int acpi_ut_to_upper(int c);
180
181int acpi_ut_to_lower(int c);
182
183extern const u8 _acpi_ctype[];
184
185#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
186#define _ACPI_XS 0x40 /* extra space */
187#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
188#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
189#define _ACPI_DI 0x04 /* '0'-'9' */
190#define _ACPI_LO 0x02 /* 'a'-'z' */
191#define _ACPI_PU 0x10 /* punctuation */
192#define _ACPI_SP 0x08 /* space */
193#define _ACPI_UP 0x01 /* 'A'-'Z' */
194#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
195
196#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
197#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
198#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
199#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
200#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
201#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
202#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
203
204#endif /* ACPI_USE_SYSTEM_CLIBRARY */
205
206/*
207 * utcopy - Object construction and conversion interfaces
208 */
209acpi_status
210acpi_ut_build_simple_object(union acpi_operand_object *obj,
211 union acpi_object *user_obj,
212 u8 * data_space, u32 * buffer_space_used);
213
214acpi_status
215acpi_ut_build_package_object(union acpi_operand_object *obj,
216 u8 * buffer, u32 * space_used);
217
218acpi_status
219acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
220 struct acpi_buffer *ret_buffer);
221
222acpi_status
223acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
224 union acpi_operand_object **internal_obj);
225
226acpi_status
227acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
228 union acpi_operand_object *dest_obj);
229
230acpi_status
231acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
232 union acpi_operand_object **dest_desc,
233 struct acpi_walk_state *walk_state);
234
235/*
236 * utcreate - Object creation
237 */
238acpi_status
239acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
240
241/*
242 * utdebug - Debug interfaces
243 */
244void acpi_ut_init_stack_ptr_trace(void);
245
246void acpi_ut_track_stack_ptr(void);
247
248void
249acpi_ut_trace(u32 line_number,
250 const char *function_name,
251 const char *module_name, u32 component_id);
252
253void
254acpi_ut_trace_ptr(u32 line_number,
255 const char *function_name,
256 const char *module_name, u32 component_id, void *pointer);
257
258void
259acpi_ut_trace_u32(u32 line_number,
260 const char *function_name,
261 const char *module_name, u32 component_id, u32 integer);
262
263void
264acpi_ut_trace_str(u32 line_number,
265 const char *function_name,
266 const char *module_name, u32 component_id, char *string);
267
268void
269acpi_ut_exit(u32 line_number,
270 const char *function_name,
271 const char *module_name, u32 component_id);
272
273void
274acpi_ut_status_exit(u32 line_number,
275 const char *function_name,
276 const char *module_name,
277 u32 component_id, acpi_status status);
278
279void
280acpi_ut_value_exit(u32 line_number,
281 const char *function_name,
282 const char *module_name,
283 u32 component_id, acpi_integer value);
284
285void
286acpi_ut_ptr_exit(u32 line_number,
287 const char *function_name,
288 const char *module_name, u32 component_id, u8 *ptr);
289
290void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
291
292void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
293
294void acpi_ut_report_error(char *module_name, u32 line_number);
295
296void acpi_ut_report_info(char *module_name, u32 line_number);
297
298void acpi_ut_report_warning(char *module_name, u32 line_number);
299
300/* Error and message reporting interfaces */
301
302void ACPI_INTERNAL_VAR_XFACE
303acpi_ut_debug_print(u32 requested_debug_level,
304 u32 line_number,
305 const char *function_name,
306 const char *module_name,
307 u32 component_id,
308 const char *format, ...) ACPI_PRINTF_LIKE(6);
309
310void ACPI_INTERNAL_VAR_XFACE
311acpi_ut_debug_print_raw(u32 requested_debug_level,
312 u32 line_number,
313 const char *function_name,
314 const char *module_name,
315 u32 component_id,
316 const char *format, ...) ACPI_PRINTF_LIKE(6);
317
318void ACPI_INTERNAL_VAR_XFACE
319acpi_ut_error(const char *module_name,
320 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
321
322void ACPI_INTERNAL_VAR_XFACE
323acpi_ut_exception(const char *module_name,
324 u32 line_number,
325 acpi_status status,
326 const char *format, ...) ACPI_PRINTF_LIKE(4);
327
328void ACPI_INTERNAL_VAR_XFACE
329acpi_ut_warning(const char *module_name,
330 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
331
332void ACPI_INTERNAL_VAR_XFACE
333acpi_ut_info(const char *module_name,
334 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
335
336/*
337 * utdelete - Object deletion and reference counts
338 */
339void acpi_ut_add_reference(union acpi_operand_object *object);
340
341void acpi_ut_remove_reference(union acpi_operand_object *object);
342
343void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
344
345void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
346
347void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
348
349/*
350 * uteval - object evaluation
351 */
352acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
353
354acpi_status
355acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
356 char *path,
357 u32 expected_return_btypes,
358 union acpi_operand_object **return_desc);
359
360acpi_status
361acpi_ut_evaluate_numeric_object(char *object_name,
362 struct acpi_namespace_node *device_node,
363 acpi_integer * address);
364
365acpi_status
366acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
367 struct acpica_device_id *hid);
368
369acpi_status
370acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
371 struct acpi_compatible_id_list **return_cid_list);
372
373acpi_status
374acpi_ut_execute_STA(struct acpi_namespace_node *device_node,
375 u32 * status_flags);
376
377acpi_status
378acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
379 struct acpica_device_id *uid);
380
381acpi_status
382acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);
383
384/*
385 * utobject - internal object create/delete/cache routines
386 */
387union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
388 *module_name,
389 u32 line_number,
390 u32 component_id,
391 acpi_object_type
392 type);
393
394void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
395 u32 line_number, u32 component_id);
396
397#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
398#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
399
400void acpi_ut_delete_object_desc(union acpi_operand_object *object);
401
402u8 acpi_ut_valid_internal_object(void *object);
403
404union acpi_operand_object *acpi_ut_create_package_object(u32 count);
405
406union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
407
408union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
409
410acpi_status
411acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
412
413/*
414 * utstate - Generic state creation/cache routines
415 */
416void
417acpi_ut_push_generic_state(union acpi_generic_state **list_head,
418 union acpi_generic_state *state);
419
420union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
421 **list_head);
422
423union acpi_generic_state *acpi_ut_create_generic_state(void);
424
425struct acpi_thread_state *acpi_ut_create_thread_state(void);
426
427union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
428 *object, u16 action);
429
430union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
431 void *external_object,
432 u16 index);
433
434acpi_status
435acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
436 u16 action,
437 union acpi_generic_state **state_list);
438
439#ifdef ACPI_FUTURE_USAGE
440acpi_status
441acpi_ut_create_pkg_state_and_push(void *internal_object,
442 void *external_object,
443 u16 index,
444 union acpi_generic_state **state_list);
445#endif /* ACPI_FUTURE_USAGE */
446
447union acpi_generic_state *acpi_ut_create_control_state(void);
448
449void acpi_ut_delete_generic_state(union acpi_generic_state *state);
450
451/*
452 * utmath
453 */
454acpi_status
455acpi_ut_divide(acpi_integer in_dividend,
456 acpi_integer in_divisor,
457 acpi_integer * out_quotient, acpi_integer * out_remainder);
458
459acpi_status
460acpi_ut_short_divide(acpi_integer in_dividend,
461 u32 divisor,
462 acpi_integer * out_quotient, u32 * out_remainder);
463
464/*
465 * utmisc
466 */
467const char *acpi_ut_validate_exception(acpi_status status);
468
469u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
470
471acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
472
473void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
474
475acpi_status
476acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
477 void *target_object,
478 acpi_pkg_callback walk_callback, void *context);
479
480void acpi_ut_strupr(char *src_string);
481
482void acpi_ut_print_string(char *string, u8 max_length);
483
484u8 acpi_ut_valid_acpi_name(u32 name);
485
486acpi_name acpi_ut_repair_name(char *name);
487
488u8 acpi_ut_valid_acpi_char(char character, u32 position);
489
490acpi_status
491acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
492
493/* Values for Base above (16=Hex, 10=Decimal) */
494
495#define ACPI_ANY_BASE 0
496
497u32 acpi_ut_dword_byte_swap(u32 value);
498
499void acpi_ut_set_integer_width(u8 revision);
500
501#ifdef ACPI_DEBUG_OUTPUT
502void
503acpi_ut_display_init_pathname(u8 type,
504 struct acpi_namespace_node *obj_handle,
505 char *path);
506#endif
507
508/*
509 * utresrc
510 */
511acpi_status
512acpi_ut_walk_aml_resources(u8 * aml,
513 acpi_size aml_length,
514 acpi_walk_aml_callback user_function,
515 void **context);
516
517acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
518
519u32 acpi_ut_get_descriptor_length(void *aml);
520
521u16 acpi_ut_get_resource_length(void *aml);
522
523u8 acpi_ut_get_resource_header_length(void *aml);
524
525u8 acpi_ut_get_resource_type(void *aml);
526
527acpi_status
528acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
529 u8 ** end_tag);
530
531/*
532 * utmutex - mutex support
533 */
534acpi_status acpi_ut_mutex_initialize(void);
535
536void acpi_ut_mutex_terminate(void);
537
538acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
539
540acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
541
542/*
543 * utalloc - memory allocation and object caching
544 */
545acpi_status acpi_ut_create_caches(void);
546
547acpi_status acpi_ut_delete_caches(void);
548
549acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
550
551acpi_status
552acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
553 acpi_size required_length);
554
555void *acpi_ut_allocate(acpi_size size,
556 u32 component, const char *module, u32 line);
557
558void *acpi_ut_allocate_zeroed(acpi_size size,
559 u32 component, const char *module, u32 line);
560
561#ifdef ACPI_DBG_TRACK_ALLOCATIONS
562void *acpi_ut_allocate_and_track(acpi_size size,
563 u32 component, const char *module, u32 line);
564
565void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
566 u32 component,
567 const char *module, u32 line);
568
569void
570acpi_ut_free_and_track(void *address,
571 u32 component, const char *module, u32 line);
572
573#ifdef ACPI_FUTURE_USAGE
574void acpi_ut_dump_allocation_info(void);
575#endif /* ACPI_FUTURE_USAGE */
576
577void acpi_ut_dump_allocations(u32 component, const char *module);
578
579acpi_status
580acpi_ut_create_list(char *list_name,
581 u16 object_size, struct acpi_memory_list **return_cache);
582
583#endif
584
585#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
deleted file mode 100644
index ff851c5df698..000000000000
--- a/include/acpi/amlcode.h
+++ /dev/null
@@ -1,494 +0,0 @@
1/******************************************************************************
2 *
3 * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
4 * Declarations and definitions contained herein are derived
5 * directly from the ACPI specification.
6 *
7 *****************************************************************************/
8
9/*
10 * Copyright (C) 2000 - 2008, Intel Corp.
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions, and the following disclaimer,
18 * without modification.
19 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
20 * substantially similar to the "NO WARRANTY" disclaimer below
21 * ("Disclaimer") and any redistribution must be conditioned upon
22 * including a substantially similar Disclaimer requirement for further
23 * binary redistribution.
24 * 3. Neither the names of the above-listed copyright holders nor the names
25 * of any contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * Alternatively, this software may be distributed under the terms of the
29 * GNU General Public License ("GPL") version 2 as published by the Free
30 * Software Foundation.
31 *
32 * NO WARRANTY
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
36 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGES.
44 */
45
46#ifndef __AMLCODE_H__
47#define __AMLCODE_H__
48
49/* primary opcodes */
50
51#define AML_NULL_CHAR (u16) 0x00
52
53#define AML_ZERO_OP (u16) 0x00
54#define AML_ONE_OP (u16) 0x01
55#define AML_UNASSIGNED (u16) 0x02
56#define AML_ALIAS_OP (u16) 0x06
57#define AML_NAME_OP (u16) 0x08
58#define AML_BYTE_OP (u16) 0x0a
59#define AML_WORD_OP (u16) 0x0b
60#define AML_DWORD_OP (u16) 0x0c
61#define AML_STRING_OP (u16) 0x0d
62#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */
63#define AML_SCOPE_OP (u16) 0x10
64#define AML_BUFFER_OP (u16) 0x11
65#define AML_PACKAGE_OP (u16) 0x12
66#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */
67#define AML_METHOD_OP (u16) 0x14
68#define AML_DUAL_NAME_PREFIX (u16) 0x2e
69#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f
70#define AML_NAME_CHAR_SUBSEQ (u16) 0x30
71#define AML_NAME_CHAR_FIRST (u16) 0x41
72#define AML_EXTENDED_OP_PREFIX (u16) 0x5b
73#define AML_ROOT_PREFIX (u16) 0x5c
74#define AML_PARENT_PREFIX (u16) 0x5e
75#define AML_LOCAL_OP (u16) 0x60
76#define AML_LOCAL0 (u16) 0x60
77#define AML_LOCAL1 (u16) 0x61
78#define AML_LOCAL2 (u16) 0x62
79#define AML_LOCAL3 (u16) 0x63
80#define AML_LOCAL4 (u16) 0x64
81#define AML_LOCAL5 (u16) 0x65
82#define AML_LOCAL6 (u16) 0x66
83#define AML_LOCAL7 (u16) 0x67
84#define AML_ARG_OP (u16) 0x68
85#define AML_ARG0 (u16) 0x68
86#define AML_ARG1 (u16) 0x69
87#define AML_ARG2 (u16) 0x6a
88#define AML_ARG3 (u16) 0x6b
89#define AML_ARG4 (u16) 0x6c
90#define AML_ARG5 (u16) 0x6d
91#define AML_ARG6 (u16) 0x6e
92#define AML_STORE_OP (u16) 0x70
93#define AML_REF_OF_OP (u16) 0x71
94#define AML_ADD_OP (u16) 0x72
95#define AML_CONCAT_OP (u16) 0x73
96#define AML_SUBTRACT_OP (u16) 0x74
97#define AML_INCREMENT_OP (u16) 0x75
98#define AML_DECREMENT_OP (u16) 0x76
99#define AML_MULTIPLY_OP (u16) 0x77
100#define AML_DIVIDE_OP (u16) 0x78
101#define AML_SHIFT_LEFT_OP (u16) 0x79
102#define AML_SHIFT_RIGHT_OP (u16) 0x7a
103#define AML_BIT_AND_OP (u16) 0x7b
104#define AML_BIT_NAND_OP (u16) 0x7c
105#define AML_BIT_OR_OP (u16) 0x7d
106#define AML_BIT_NOR_OP (u16) 0x7e
107#define AML_BIT_XOR_OP (u16) 0x7f
108#define AML_BIT_NOT_OP (u16) 0x80
109#define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81
110#define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82
111#define AML_DEREF_OF_OP (u16) 0x83
112#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */
113#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */
114#define AML_NOTIFY_OP (u16) 0x86
115#define AML_SIZE_OF_OP (u16) 0x87
116#define AML_INDEX_OP (u16) 0x88
117#define AML_MATCH_OP (u16) 0x89
118#define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a
119#define AML_CREATE_WORD_FIELD_OP (u16) 0x8b
120#define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c
121#define AML_CREATE_BIT_FIELD_OP (u16) 0x8d
122#define AML_TYPE_OP (u16) 0x8e
123#define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */
124#define AML_LAND_OP (u16) 0x90
125#define AML_LOR_OP (u16) 0x91
126#define AML_LNOT_OP (u16) 0x92
127#define AML_LEQUAL_OP (u16) 0x93
128#define AML_LGREATER_OP (u16) 0x94
129#define AML_LLESS_OP (u16) 0x95
130#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */
131#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */
132#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */
133#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */
134#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */
135#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */
136#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */
137#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */
138#define AML_IF_OP (u16) 0xa0
139#define AML_ELSE_OP (u16) 0xa1
140#define AML_WHILE_OP (u16) 0xa2
141#define AML_NOOP_OP (u16) 0xa3
142#define AML_RETURN_OP (u16) 0xa4
143#define AML_BREAK_OP (u16) 0xa5
144#define AML_BREAK_POINT_OP (u16) 0xcc
145#define AML_ONES_OP (u16) 0xff
146
147/* prefixed opcodes */
148
149#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */
150
151#define AML_MUTEX_OP (u16) 0x5b01
152#define AML_EVENT_OP (u16) 0x5b02
153#define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10
154#define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11
155#define AML_COND_REF_OF_OP (u16) 0x5b12
156#define AML_CREATE_FIELD_OP (u16) 0x5b13
157#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */
158#define AML_LOAD_OP (u16) 0x5b20
159#define AML_STALL_OP (u16) 0x5b21
160#define AML_SLEEP_OP (u16) 0x5b22
161#define AML_ACQUIRE_OP (u16) 0x5b23
162#define AML_SIGNAL_OP (u16) 0x5b24
163#define AML_WAIT_OP (u16) 0x5b25
164#define AML_RESET_OP (u16) 0x5b26
165#define AML_RELEASE_OP (u16) 0x5b27
166#define AML_FROM_BCD_OP (u16) 0x5b28
167#define AML_TO_BCD_OP (u16) 0x5b29
168#define AML_UNLOAD_OP (u16) 0x5b2a
169#define AML_REVISION_OP (u16) 0x5b30
170#define AML_DEBUG_OP (u16) 0x5b31
171#define AML_FATAL_OP (u16) 0x5b32
172#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */
173#define AML_REGION_OP (u16) 0x5b80
174#define AML_FIELD_OP (u16) 0x5b81
175#define AML_DEVICE_OP (u16) 0x5b82
176#define AML_PROCESSOR_OP (u16) 0x5b83
177#define AML_POWER_RES_OP (u16) 0x5b84
178#define AML_THERMAL_ZONE_OP (u16) 0x5b85
179#define AML_INDEX_FIELD_OP (u16) 0x5b86
180#define AML_BANK_FIELD_OP (u16) 0x5b87
181#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */
182
183/*
184 * Combination opcodes (actually two one-byte opcodes)
185 * Used by the disassembler and i_aSL compiler
186 */
187#define AML_LGREATEREQUAL_OP (u16) 0x9295
188#define AML_LLESSEQUAL_OP (u16) 0x9294
189#define AML_LNOTEQUAL_OP (u16) 0x9293
190
191/*
192 * Internal opcodes
193 * Use only "Unknown" AML opcodes, don't attempt to use
194 * any valid ACPI ASCII values (A-Z, 0-9, '-')
195 */
196#define AML_INT_NAMEPATH_OP (u16) 0x002d
197#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
198#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
199#define AML_INT_ACCESSFIELD_OP (u16) 0x0032
200#define AML_INT_BYTELIST_OP (u16) 0x0033
201#define AML_INT_STATICSTRING_OP (u16) 0x0034
202#define AML_INT_METHODCALL_OP (u16) 0x0035
203#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
204#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
205
206#define ARG_NONE 0x0
207
208/*
209 * Argument types for the AML Parser
210 * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
211 * There can be up to 31 unique argument types
212 * Zero is reserved as end-of-list indicator
213 */
214#define ARGP_BYTEDATA 0x01
215#define ARGP_BYTELIST 0x02
216#define ARGP_CHARLIST 0x03
217#define ARGP_DATAOBJ 0x04
218#define ARGP_DATAOBJLIST 0x05
219#define ARGP_DWORDDATA 0x06
220#define ARGP_FIELDLIST 0x07
221#define ARGP_NAME 0x08
222#define ARGP_NAMESTRING 0x09
223#define ARGP_OBJLIST 0x0A
224#define ARGP_PKGLENGTH 0x0B
225#define ARGP_SUPERNAME 0x0C
226#define ARGP_TARGET 0x0D
227#define ARGP_TERMARG 0x0E
228#define ARGP_TERMLIST 0x0F
229#define ARGP_WORDDATA 0x10
230#define ARGP_QWORDDATA 0x11
231#define ARGP_SIMPLENAME 0x12
232
233/*
234 * Resolved argument types for the AML Interpreter
235 * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
236 * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
237 *
238 * Note1: These values are completely independent from the ACPI_TYPEs
239 * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
240 *
241 * Note2: If and when 5 bits becomes insufficient, it would probably be best
242 * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
243 */
244
245/* Single, simple types */
246
247#define ARGI_ANYTYPE 0x01 /* Don't care */
248#define ARGI_PACKAGE 0x02
249#define ARGI_EVENT 0x03
250#define ARGI_MUTEX 0x04
251#define ARGI_DDBHANDLE 0x05
252
253/* Interchangeable types (via implicit conversion) */
254
255#define ARGI_INTEGER 0x06
256#define ARGI_STRING 0x07
257#define ARGI_BUFFER 0x08
258#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */
259#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */
260
261/* Reference objects */
262
263#define ARGI_INTEGER_REF 0x0B
264#define ARGI_OBJECT_REF 0x0C
265#define ARGI_DEVICE_REF 0x0D
266#define ARGI_REFERENCE 0x0E
267#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */
268#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */
269#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */
270
271/* Multiple/complex types */
272
273#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */
274#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
275#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
276#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */
277#define ARGI_DATAREFOBJ 0x16
278
279/* Note: types above can expand to 0x1F maximum */
280
281#define ARGI_INVALID_OPCODE 0xFFFFFFFF
282
283/*
284 * hash offsets
285 */
286#define AML_EXTOP_HASH_OFFSET 22
287#define AML_LNOT_HASH_OFFSET 19
288
289/*
290 * opcode groups and types
291 */
292#define OPGRP_NAMED 0x01
293#define OPGRP_FIELD 0x02
294#define OPGRP_BYTELIST 0x04
295
296/*
297 * Opcode information
298 */
299
300/* Opcode flags */
301
302#define AML_LOGICAL 0x0001
303#define AML_LOGICAL_NUMERIC 0x0002
304#define AML_MATH 0x0004
305#define AML_CREATE 0x0008
306#define AML_FIELD 0x0010
307#define AML_DEFER 0x0020
308#define AML_NAMED 0x0040
309#define AML_NSNODE 0x0080
310#define AML_NSOPCODE 0x0100
311#define AML_NSOBJECT 0x0200
312#define AML_HAS_RETVAL 0x0400
313#define AML_HAS_TARGET 0x0800
314#define AML_HAS_ARGS 0x1000
315#define AML_CONSTANT 0x2000
316#define AML_NO_OPERAND_RESOLVE 0x4000
317
318/* Convenient flag groupings */
319
320#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL
321#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
322#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
323#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
324#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */
325#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */
326#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */
327#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */
328#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
329#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS
330#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
331#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL
332
333/*
334 * The opcode Type is used in a dispatch table, do not change
335 * without updating the table.
336 */
337#define AML_TYPE_EXEC_0A_0T_1R 0x00
338#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */
339#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */
340#define AML_TYPE_EXEC_1A_1T_0R 0x03
341#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */
342#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */
343#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */
344#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */
345#define AML_TYPE_EXEC_2A_2T_1R 0x08
346#define AML_TYPE_EXEC_3A_0T_0R 0x09
347#define AML_TYPE_EXEC_3A_1T_1R 0x0A
348#define AML_TYPE_EXEC_6A_0T_1R 0x0B
349/* End of types used in dispatch table */
350
351#define AML_TYPE_LITERAL 0x0B
352#define AML_TYPE_CONSTANT 0x0C
353#define AML_TYPE_METHOD_ARGUMENT 0x0D
354#define AML_TYPE_LOCAL_VARIABLE 0x0E
355#define AML_TYPE_DATA_TERM 0x0F
356
357/* Generic for an op that returns a value */
358
359#define AML_TYPE_METHOD_CALL 0x10
360
361/* Misc */
362
363#define AML_TYPE_CREATE_FIELD 0x11
364#define AML_TYPE_CREATE_OBJECT 0x12
365#define AML_TYPE_CONTROL 0x13
366#define AML_TYPE_NAMED_NO_OBJ 0x14
367#define AML_TYPE_NAMED_FIELD 0x15
368#define AML_TYPE_NAMED_SIMPLE 0x16
369#define AML_TYPE_NAMED_COMPLEX 0x17
370#define AML_TYPE_RETURN 0x18
371
372#define AML_TYPE_UNDEFINED 0x19
373#define AML_TYPE_BOGUS 0x1A
374
375/* AML Package Length encodings */
376
377#define ACPI_AML_PACKAGE_TYPE1 0x40
378#define ACPI_AML_PACKAGE_TYPE2 0x4000
379#define ACPI_AML_PACKAGE_TYPE3 0x400000
380#define ACPI_AML_PACKAGE_TYPE4 0x40000000
381
382/*
383 * Opcode classes
384 */
385#define AML_CLASS_EXECUTE 0x00
386#define AML_CLASS_CREATE 0x01
387#define AML_CLASS_ARGUMENT 0x02
388#define AML_CLASS_NAMED_OBJECT 0x03
389#define AML_CLASS_CONTROL 0x04
390#define AML_CLASS_ASCII 0x05
391#define AML_CLASS_PREFIX 0x06
392#define AML_CLASS_INTERNAL 0x07
393#define AML_CLASS_RETURN_VALUE 0x08
394#define AML_CLASS_METHOD_CALL 0x09
395#define AML_CLASS_UNKNOWN 0x0A
396
397/* Predefined Operation Region space_iDs */
398
399typedef enum {
400 REGION_MEMORY = 0,
401 REGION_IO,
402 REGION_PCI_CONFIG,
403 REGION_EC,
404 REGION_SMBUS,
405 REGION_CMOS,
406 REGION_PCI_BAR,
407 REGION_DATA_TABLE, /* Internal use only */
408 REGION_FIXED_HW = 0x7F
409} AML_REGION_TYPES;
410
411/* Comparison operation codes for match_op operator */
412
413typedef enum {
414 MATCH_MTR = 0,
415 MATCH_MEQ = 1,
416 MATCH_MLE = 2,
417 MATCH_MLT = 3,
418 MATCH_MGE = 4,
419 MATCH_MGT = 5
420} AML_MATCH_OPERATOR;
421
422#define MAX_MATCH_OPERATOR 5
423
424/*
425 * field_flags
426 *
427 * This byte is extracted from the AML and includes three separate
428 * pieces of information about the field:
429 * 1) The field access type
430 * 2) The field update rule
431 * 3) The lock rule for the field
432 *
433 * Bits 00 - 03 : access_type (any_acc, byte_acc, etc.)
434 * 04 : lock_rule (1 == Lock)
435 * 05 - 06 : update_rule
436 */
437#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
438#define AML_FIELD_LOCK_RULE_MASK 0x10
439#define AML_FIELD_UPDATE_RULE_MASK 0x60
440
441/* 1) Field Access Types */
442
443typedef enum {
444 AML_FIELD_ACCESS_ANY = 0x00,
445 AML_FIELD_ACCESS_BYTE = 0x01,
446 AML_FIELD_ACCESS_WORD = 0x02,
447 AML_FIELD_ACCESS_DWORD = 0x03,
448 AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
449 AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
450} AML_ACCESS_TYPE;
451
452/* 2) Field Lock Rules */
453
454typedef enum {
455 AML_FIELD_LOCK_NEVER = 0x00,
456 AML_FIELD_LOCK_ALWAYS = 0x10
457} AML_LOCK_RULE;
458
459/* 3) Field Update Rules */
460
461typedef enum {
462 AML_FIELD_UPDATE_PRESERVE = 0x00,
463 AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
464 AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
465} AML_UPDATE_RULE;
466
467/*
468 * Field Access Attributes.
469 * This byte is extracted from the AML via the
470 * access_as keyword
471 */
472typedef enum {
473 AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
474 AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
475 AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
476 AML_FIELD_ATTRIB_SMB_WORD = 0x08,
477 AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
478 AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
479 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
480} AML_ACCESS_ATTRIBUTE;
481
482/* Bit fields in method_flags byte */
483
484#define AML_METHOD_ARG_COUNT 0x07
485#define AML_METHOD_SERIALIZED 0x08
486#define AML_METHOD_SYNCH_LEVEL 0xF0
487
488/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
489
490#define AML_METHOD_INTERNAL_ONLY 0x01
491#define AML_METHOD_RESERVED1 0x02
492#define AML_METHOD_RESERVED2 0x04
493
494#endif /* __AMLCODE_H__ */
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
deleted file mode 100644
index 7b070e42b7c5..000000000000
--- a/include/acpi/amlresrc.h
+++ /dev/null
@@ -1,311 +0,0 @@
1
2/******************************************************************************
3 *
4 * Module Name: amlresrc.h - AML resource descriptors
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45/* acpisrc:struct_defs -- for acpisrc conversion */
46
47#ifndef __AMLRESRC_H
48#define __AMLRESRC_H
49
50/*
51 * Resource descriptor tags, as defined in the ACPI specification.
52 * Used to symbolically reference fields within a descriptor.
53 */
54#define ACPI_RESTAG_ADDRESS "_ADR"
55#define ACPI_RESTAG_ALIGNMENT "_ALN"
56#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
57#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
58#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
59#define ACPI_RESTAG_BASEADDRESS "_BAS"
60#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
61#define ACPI_RESTAG_DECODE "_DEC"
62#define ACPI_RESTAG_DMA "_DMA"
63#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
64#define ACPI_RESTAG_GRANULARITY "_GRA"
65#define ACPI_RESTAG_INTERRUPT "_INT"
66#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
67#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
68#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
69#define ACPI_RESTAG_LENGTH "_LEN"
70#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
71#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
72#define ACPI_RESTAG_MAXADDR "_MAX"
73#define ACPI_RESTAG_MINADDR "_MIN"
74#define ACPI_RESTAG_MAXTYPE "_MAF"
75#define ACPI_RESTAG_MINTYPE "_MIF"
76#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
77#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
78#define ACPI_RESTAG_RANGETYPE "_RNG"
79#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
80#define ACPI_RESTAG_TRANSLATION "_TRA"
81#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
82#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
83#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */
84
85/* Default sizes for "small" resource descriptors */
86
87#define ASL_RDESC_IRQ_SIZE 0x02
88#define ASL_RDESC_DMA_SIZE 0x02
89#define ASL_RDESC_ST_DEPEND_SIZE 0x00
90#define ASL_RDESC_END_DEPEND_SIZE 0x00
91#define ASL_RDESC_IO_SIZE 0x07
92#define ASL_RDESC_FIXED_IO_SIZE 0x03
93#define ASL_RDESC_END_TAG_SIZE 0x01
94
95struct asl_resource_node {
96 u32 buffer_length;
97 void *buffer;
98 struct asl_resource_node *next;
99};
100
101/* Macros used to generate AML resource length fields */
102
103#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
104#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
105
106/*
107 * Resource descriptors defined in the ACPI specification.
108 *
109 * Packing/alignment must be BYTE because these descriptors
110 * are used to overlay the raw AML byte stream.
111 */
112#pragma pack(1)
113
114/*
115 * SMALL descriptors
116 */
117#define AML_RESOURCE_SMALL_HEADER_COMMON \
118 u8 descriptor_type;
119
120struct aml_resource_small_header {
121AML_RESOURCE_SMALL_HEADER_COMMON};
122
123struct aml_resource_irq {
124 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
125 u8 flags;
126};
127
128struct aml_resource_irq_noflags {
129 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
130};
131
132struct aml_resource_dma {
133 AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
134 u8 flags;
135};
136
137struct aml_resource_start_dependent {
138 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
139};
140
141struct aml_resource_start_dependent_noprio {
142AML_RESOURCE_SMALL_HEADER_COMMON};
143
144struct aml_resource_end_dependent {
145AML_RESOURCE_SMALL_HEADER_COMMON};
146
147struct aml_resource_io {
148 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
149 u16 minimum;
150 u16 maximum;
151 u8 alignment;
152 u8 address_length;
153};
154
155struct aml_resource_fixed_io {
156 AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
157 u8 address_length;
158};
159
160struct aml_resource_vendor_small {
161AML_RESOURCE_SMALL_HEADER_COMMON};
162
163struct aml_resource_end_tag {
164 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
165};
166
167/*
168 * LARGE descriptors
169 */
170#define AML_RESOURCE_LARGE_HEADER_COMMON \
171 u8 descriptor_type;\
172 u16 resource_length;
173
174struct aml_resource_large_header {
175AML_RESOURCE_LARGE_HEADER_COMMON};
176
177struct aml_resource_memory24 {
178 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
179 u16 minimum;
180 u16 maximum;
181 u16 alignment;
182 u16 address_length;
183};
184
185struct aml_resource_vendor_large {
186AML_RESOURCE_LARGE_HEADER_COMMON};
187
188struct aml_resource_memory32 {
189 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
190 u32 minimum;
191 u32 maximum;
192 u32 alignment;
193 u32 address_length;
194};
195
196struct aml_resource_fixed_memory32 {
197 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
198 u32 address;
199 u32 address_length;
200};
201
202#define AML_RESOURCE_ADDRESS_COMMON \
203 u8 resource_type; \
204 u8 flags; \
205 u8 specific_flags;
206
207struct aml_resource_address {
208AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
209
210struct aml_resource_extended_address64 {
211 AML_RESOURCE_LARGE_HEADER_COMMON
212 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD;
213 u8 reserved;
214 u64 granularity;
215 u64 minimum;
216 u64 maximum;
217 u64 translation_offset;
218 u64 address_length;
219 u64 type_specific;
220};
221
222#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
223
224struct aml_resource_address64 {
225 AML_RESOURCE_LARGE_HEADER_COMMON
226 AML_RESOURCE_ADDRESS_COMMON u64 granularity;
227 u64 minimum;
228 u64 maximum;
229 u64 translation_offset;
230 u64 address_length;
231};
232
233struct aml_resource_address32 {
234 AML_RESOURCE_LARGE_HEADER_COMMON
235 AML_RESOURCE_ADDRESS_COMMON u32 granularity;
236 u32 minimum;
237 u32 maximum;
238 u32 translation_offset;
239 u32 address_length;
240};
241
242struct aml_resource_address16 {
243 AML_RESOURCE_LARGE_HEADER_COMMON
244 AML_RESOURCE_ADDRESS_COMMON u16 granularity;
245 u16 minimum;
246 u16 maximum;
247 u16 translation_offset;
248 u16 address_length;
249};
250
251struct aml_resource_extended_irq {
252 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
253 u8 interrupt_count;
254 u32 interrupts[1];
255 /* res_source_index, res_source optional fields follow */
256};
257
258struct aml_resource_generic_register {
259 AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
260 u8 bit_width;
261 u8 bit_offset;
262 u8 access_size; /* ACPI 3.0, was previously Reserved */
263 u64 address;
264};
265
266/* restore default alignment */
267
268#pragma pack()
269
270/* Union of all resource descriptors, so we can allocate the worst case */
271
272union aml_resource {
273 /* Descriptor headers */
274
275 u8 descriptor_type;
276 struct aml_resource_small_header small_header;
277 struct aml_resource_large_header large_header;
278
279 /* Small resource descriptors */
280
281 struct aml_resource_irq irq;
282 struct aml_resource_dma dma;
283 struct aml_resource_start_dependent start_dpf;
284 struct aml_resource_end_dependent end_dpf;
285 struct aml_resource_io io;
286 struct aml_resource_fixed_io fixed_io;
287 struct aml_resource_vendor_small vendor_small;
288 struct aml_resource_end_tag end_tag;
289
290 /* Large resource descriptors */
291
292 struct aml_resource_memory24 memory24;
293 struct aml_resource_generic_register generic_reg;
294 struct aml_resource_vendor_large vendor_large;
295 struct aml_resource_memory32 memory32;
296 struct aml_resource_fixed_memory32 fixed_memory32;
297 struct aml_resource_address16 address16;
298 struct aml_resource_address32 address32;
299 struct aml_resource_address64 address64;
300 struct aml_resource_extended_address64 ext_address64;
301 struct aml_resource_extended_irq extended_irq;
302
303 /* Utility overlays */
304
305 struct aml_resource_address address;
306 u32 dword_item;
307 u16 word_item;
308 u8 byte_item;
309};
310
311#endif
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index fcd2572e428c..e62f10d9a7d8 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -44,14 +44,26 @@
44#ifndef __ACENV_H__ 44#ifndef __ACENV_H__
45#define __ACENV_H__ 45#define __ACENV_H__
46 46
47/* 47/* Types for ACPI_MUTEX_TYPE */
48
49#define ACPI_BINARY_SEMAPHORE 0
50#define ACPI_OSL_MUTEX 1
51
52/* Types for DEBUGGER_THREADING */
53
54#define DEBUGGER_SINGLE_THREADED 0
55#define DEBUGGER_MULTI_THREADED 1
56
57/******************************************************************************
58 *
48 * Configuration for ACPI tools and utilities 59 * Configuration for ACPI tools and utilities
49 */ 60 *
61 *****************************************************************************/
50 62
51#ifdef ACPI_LIBRARY 63#ifdef ACPI_LIBRARY
52/* 64/*
53 * Note: The non-debug version of the acpi_library does not contain any 65 * Note: The non-debug version of the acpi_library does not contain any
54 * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG 66 * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG
55 */ 67 */
56#define ACPI_USE_LOCAL_CACHE 68#define ACPI_USE_LOCAL_CACHE
57#endif 69#endif
@@ -75,17 +87,6 @@
75#define ACPI_DBG_TRACK_ALLOCATIONS 87#define ACPI_DBG_TRACK_ALLOCATIONS
76#endif 88#endif
77 89
78#ifdef ACPI_DASM_APP
79#ifndef MSDOS
80#define ACPI_DEBUG_OUTPUT
81#endif
82#define ACPI_APPLICATION
83#define ACPI_DISASSEMBLER
84#define ACPI_NO_METHOD_EXECUTION
85#define ACPI_LARGE_NAMESPACE_NODE
86#define ACPI_DATA_TABLE_DISASSEMBLY
87#endif
88
89#ifdef ACPI_APPLICATION 90#ifdef ACPI_APPLICATION
90#define ACPI_USE_SYSTEM_CLIBRARY 91#define ACPI_USE_SYSTEM_CLIBRARY
91#define ACPI_USE_LOCAL_CACHE 92#define ACPI_USE_LOCAL_CACHE
@@ -179,6 +180,19 @@
179 180
180/*! [End] no source code translation !*/ 181/*! [End] no source code translation !*/
181 182
183/******************************************************************************
184 *
185 * Miscellaneous configuration
186 *
187 *****************************************************************************/
188
189/*
190 * Are mutexes supported by the host? default is no, use binary semaphores.
191 */
192#ifndef ACPI_MUTEX_TYPE
193#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
194#endif
195
182/* 196/*
183 * Debugger threading model 197 * Debugger threading model
184 * Use single threaded if the entire subsystem is contained in an application 198 * Use single threaded if the entire subsystem is contained in an application
@@ -187,9 +201,6 @@
187 * By default the model is single threaded if ACPI_APPLICATION is set, 201 * By default the model is single threaded if ACPI_APPLICATION is set,
188 * multi-threaded if ACPI_APPLICATION is not set. 202 * multi-threaded if ACPI_APPLICATION is not set.
189 */ 203 */
190#define DEBUGGER_SINGLE_THREADED 0
191#define DEBUGGER_MULTI_THREADED 1
192
193#ifndef DEBUGGER_THREADING 204#ifndef DEBUGGER_THREADING
194#ifdef ACPI_APPLICATION 205#ifdef ACPI_APPLICATION
195#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 206#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0515e754449d..6d49b2a498c4 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -46,6 +46,7 @@
46 46
47#define ACPI_USE_SYSTEM_CLIBRARY 47#define ACPI_USE_SYSTEM_CLIBRARY
48#define ACPI_USE_DO_WHILE_0 48#define ACPI_USE_DO_WHILE_0
49#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
49 50
50#ifdef __KERNEL__ 51#ifdef __KERNEL__
51 52
@@ -70,9 +71,6 @@
70#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 71#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
71#define strtoul simple_strtoul 72#define strtoul simple_strtoul
72 73
73/* Full namespace pathname length limit - arbitrary */
74#define ACPI_PATHNAME_MAX 256
75
76#else /* !__KERNEL__ */ 74#else /* !__KERNEL__ */
77 75
78#include <stdarg.h> 76#include <stdarg.h>
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index fba8051fb297..6fce2fc2d124 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -131,22 +131,6 @@ extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
131 */ 131 */
132void acpi_unregister_gsi (u32 gsi); 132void acpi_unregister_gsi (u32 gsi);
133 133
134struct acpi_prt_entry {
135 struct list_head node;
136 struct acpi_pci_id id;
137 u8 pin;
138 struct {
139 acpi_handle handle;
140 u32 index;
141 } link;
142 u32 irq;
143};
144
145struct acpi_prt_list {
146 int count;
147 struct list_head entries;
148};
149
150struct pci_dev; 134struct pci_dev;
151 135
152int acpi_pci_irq_enable (struct pci_dev *dev); 136int acpi_pci_irq_enable (struct pci_dev *dev);
@@ -270,6 +254,7 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
270#ifdef CONFIG_PM_SLEEP 254#ifdef CONFIG_PM_SLEEP
271void __init acpi_no_s4_hw_signature(void); 255void __init acpi_no_s4_hw_signature(void);
272void __init acpi_old_suspend_ordering(void); 256void __init acpi_old_suspend_ordering(void);
257void __init acpi_s4_no_nvs(void);
273#endif /* CONFIG_PM_SLEEP */ 258#endif /* CONFIG_PM_SLEEP */
274#else /* CONFIG_ACPI */ 259#else /* CONFIG_ACPI */
275 260
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 0f50d4cc4360..45f6297821bd 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -59,9 +59,7 @@ enum async_tx_flags {
59}; 59};
60 60
61#ifdef CONFIG_DMA_ENGINE 61#ifdef CONFIG_DMA_ENGINE
62void async_tx_issue_pending_all(void); 62#define async_tx_issue_pending_all dma_issue_pending_all
63enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
64void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx);
65#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 63#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
66#include <asm/async_tx.h> 64#include <asm/async_tx.h>
67#else 65#else
@@ -77,19 +75,6 @@ static inline void async_tx_issue_pending_all(void)
77 do { } while (0); 75 do { } while (0);
78} 76}
79 77
80static inline enum dma_status
81dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
82{
83 return DMA_SUCCESS;
84}
85
86static inline void
87async_tx_run_dependencies(struct dma_async_tx_descriptor *tx,
88 struct dma_chan *host_chan)
89{
90 do { } while (0);
91}
92
93static inline struct dma_chan * 78static inline struct dma_chan *
94async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 79async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
95 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 80 enum dma_transaction_type tx_type, struct page **dst, int dst_count,
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 2a2213eefd85..2f1f95737acb 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -3,7 +3,7 @@
3 3
4#define ATMEL_MCI_MAX_NR_SLOTS 2 4#define ATMEL_MCI_MAX_NR_SLOTS 2
5 5
6struct dma_slave; 6#include <linux/dw_dmac.h>
7 7
8/** 8/**
9 * struct mci_slot_pdata - board-specific per-slot configuration 9 * struct mci_slot_pdata - board-specific per-slot configuration
@@ -28,11 +28,11 @@ struct mci_slot_pdata {
28 28
29/** 29/**
30 * struct mci_platform_data - board-specific MMC/SDcard configuration 30 * struct mci_platform_data - board-specific MMC/SDcard configuration
31 * @dma_slave: DMA slave interface to use in data transfers, or NULL. 31 * @dma_slave: DMA slave interface to use in data transfers.
32 * @slot: Per-slot configuration data. 32 * @slot: Per-slot configuration data.
33 */ 33 */
34struct mci_platform_data { 34struct mci_platform_data {
35 struct dma_slave *dma_slave; 35 struct dw_dma_slave dma_slave;
36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; 36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS];
37}; 37};
38 38
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index d7afa9dd6635..f3b5d4e3a2ac 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -23,16 +23,16 @@
23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ 23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ 24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
25#define AT_CLKTCK 17 /* frequency at which times() increments */ 25#define AT_CLKTCK 17 /* frequency at which times() increments */
26 26/* AT_* values 18 through 22 are reserved */
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28
29#define AT_BASE_PLATFORM 24 /* string identifying real platform, may 28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
30 * differ from AT_PLATFORM. */ 29 * differ from AT_PLATFORM. */
30#define AT_RANDOM 25 /* address of 16 random bytes */
31 31
32#define AT_EXECFN 31 /* filename of program */ 32#define AT_EXECFN 31 /* filename of program */
33 33
34#ifdef __KERNEL__ 34#ifdef __KERNEL__
35#define AT_VECTOR_SIZE_BASE 18 /* NEW_AUX_ENT entries in auxiliary table */ 35#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */
36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */ 36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
37#endif 37#endif
38 38
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 1ee9488ca2e4..79ca2da81c87 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -31,6 +31,10 @@ struct backlight_device;
31struct fb_info; 31struct fb_info;
32 32
33struct backlight_ops { 33struct backlight_ops {
34 unsigned int options;
35
36#define BL_CORE_SUSPENDRESUME (1 << 0)
37
34 /* Notify the backlight driver some property has changed */ 38 /* Notify the backlight driver some property has changed */
35 int (*update_status)(struct backlight_device *); 39 int (*update_status)(struct backlight_device *);
36 /* Return the current backlight brightness (accounting for power, 40 /* Return the current backlight brightness (accounting for power,
@@ -51,7 +55,19 @@ struct backlight_properties {
51 modes; 4: full off), see FB_BLANK_XXX */ 55 modes; 4: full off), see FB_BLANK_XXX */
52 int power; 56 int power;
53 /* FB Blanking active? (values as for power) */ 57 /* FB Blanking active? (values as for power) */
58 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
54 int fb_blank; 59 int fb_blank;
60 /* Flags used to signal drivers of state changes */
61 /* Upper 4 bits are reserved for driver internal use */
62 unsigned int state;
63
64#define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */
65#define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */
66#define BL_CORE_DRIVER4 (1 << 28) /* reserved for driver specific use */
67#define BL_CORE_DRIVER3 (1 << 29) /* reserved for driver specific use */
68#define BL_CORE_DRIVER2 (1 << 30) /* reserved for driver specific use */
69#define BL_CORE_DRIVER1 (1 << 31) /* reserved for driver specific use */
70
55}; 71};
56 72
57struct backlight_device { 73struct backlight_device {
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7035cec583b6..044467ef7b11 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -690,6 +690,8 @@ struct rq_map_data {
690 struct page **pages; 690 struct page **pages;
691 int page_order; 691 int page_order;
692 int nr_entries; 692 int nr_entries;
693 unsigned long offset;
694 int null_mapped;
693}; 695};
694 696
695struct req_iterator { 697struct req_iterator {
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index f50785ad4781..25085cbadcfc 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -19,7 +19,7 @@
19#include <linux/skbuff.h> 19#include <linux/skbuff.h>
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21 21
22#define CAN_VERSION "20081130" 22#define CAN_VERSION "20090105"
23 23
24/* increment this number each time you change some user-space interface */ 24/* increment this number each time you change some user-space interface */
25#define CAN_ABI_VERSION "8" 25#define CAN_ABI_VERSION "8"
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 08b78c09b09a..e267e62827bb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -52,9 +52,9 @@ struct cgroup_subsys_state {
52 * hierarchy structure */ 52 * hierarchy structure */
53 struct cgroup *cgroup; 53 struct cgroup *cgroup;
54 54
55 /* State maintained by the cgroup system to allow 55 /* State maintained by the cgroup system to allow subsystems
56 * subsystems to be "busy". Should be accessed via css_get() 56 * to be "busy". Should be accessed via css_get(),
57 * and css_put() */ 57 * css_tryget() and and css_put(). */
58 58
59 atomic_t refcnt; 59 atomic_t refcnt;
60 60
@@ -64,11 +64,14 @@ struct cgroup_subsys_state {
64/* bits in struct cgroup_subsys_state flags field */ 64/* bits in struct cgroup_subsys_state flags field */
65enum { 65enum {
66 CSS_ROOT, /* This CSS is the root of the subsystem */ 66 CSS_ROOT, /* This CSS is the root of the subsystem */
67 CSS_REMOVED, /* This CSS is dead */
67}; 68};
68 69
69/* 70/*
70 * Call css_get() to hold a reference on the cgroup; 71 * Call css_get() to hold a reference on the css; it can be used
71 * 72 * for a reference obtained via:
73 * - an existing ref-counted reference to the css
74 * - task->cgroups for a locked task
72 */ 75 */
73 76
74static inline void css_get(struct cgroup_subsys_state *css) 77static inline void css_get(struct cgroup_subsys_state *css)
@@ -77,9 +80,32 @@ static inline void css_get(struct cgroup_subsys_state *css)
77 if (!test_bit(CSS_ROOT, &css->flags)) 80 if (!test_bit(CSS_ROOT, &css->flags))
78 atomic_inc(&css->refcnt); 81 atomic_inc(&css->refcnt);
79} 82}
83
84static inline bool css_is_removed(struct cgroup_subsys_state *css)
85{
86 return test_bit(CSS_REMOVED, &css->flags);
87}
88
89/*
90 * Call css_tryget() to take a reference on a css if your existing
91 * (known-valid) reference isn't already ref-counted. Returns false if
92 * the css has been destroyed.
93 */
94
95static inline bool css_tryget(struct cgroup_subsys_state *css)
96{
97 if (test_bit(CSS_ROOT, &css->flags))
98 return true;
99 while (!atomic_inc_not_zero(&css->refcnt)) {
100 if (test_bit(CSS_REMOVED, &css->flags))
101 return false;
102 }
103 return true;
104}
105
80/* 106/*
81 * css_put() should be called to release a reference taken by 107 * css_put() should be called to release a reference taken by
82 * css_get() 108 * css_get() or css_tryget()
83 */ 109 */
84 110
85extern void __css_put(struct cgroup_subsys_state *css); 111extern void __css_put(struct cgroup_subsys_state *css);
@@ -116,7 +142,7 @@ struct cgroup {
116 struct list_head children; /* my children */ 142 struct list_head children; /* my children */
117 143
118 struct cgroup *parent; /* my parent */ 144 struct cgroup *parent; /* my parent */
119 struct dentry *dentry; /* cgroup fs entry */ 145 struct dentry *dentry; /* cgroup fs entry, RCU protected */
120 146
121 /* Private pointers for each registered subsystem */ 147 /* Private pointers for each registered subsystem */
122 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 148 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
@@ -145,6 +171,9 @@ struct cgroup {
145 int pids_use_count; 171 int pids_use_count;
146 /* Length of the current tasks_pids array */ 172 /* Length of the current tasks_pids array */
147 int pids_length; 173 int pids_length;
174
175 /* For RCU-protected deletion */
176 struct rcu_head rcu_head;
148}; 177};
149 178
150/* A css_set is a structure holding pointers to a set of 179/* A css_set is a structure holding pointers to a set of
@@ -337,9 +366,23 @@ struct cgroup_subsys {
337#define MAX_CGROUP_TYPE_NAMELEN 32 366#define MAX_CGROUP_TYPE_NAMELEN 32
338 const char *name; 367 const char *name;
339 368
340 /* Protected by RCU */ 369 /*
341 struct cgroupfs_root *root; 370 * Protects sibling/children links of cgroups in this
371 * hierarchy, plus protects which hierarchy (or none) the
372 * subsystem is a part of (i.e. root/sibling). To avoid
373 * potential deadlocks, the following operations should not be
374 * undertaken while holding any hierarchy_mutex:
375 *
376 * - allocating memory
377 * - initiating hotplug events
378 */
379 struct mutex hierarchy_mutex;
342 380
381 /*
382 * Link to parent, and list entry in parent's children.
383 * Protected by this->hierarchy_mutex and cgroup_lock()
384 */
385 struct cgroupfs_root *root;
343 struct list_head sibling; 386 struct list_head sibling;
344}; 387};
345 388
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 51ea2bdea0f9..90c6074a36ca 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,8 +20,9 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
20extern int cpuset_init_early(void); 20extern int cpuset_init_early(void);
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern void cpuset_cpus_allowed_locked(struct task_struct *p, cpumask_t *mask); 24extern void cpuset_cpus_allowed_locked(struct task_struct *p,
25 struct cpumask *mask);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
@@ -86,12 +87,13 @@ static inline int cpuset_init_early(void) { return 0; }
86static inline int cpuset_init(void) { return 0; } 87static inline int cpuset_init(void) { return 0; }
87static inline void cpuset_init_smp(void) {} 88static inline void cpuset_init_smp(void) {}
88 89
89static inline void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask) 90static inline void cpuset_cpus_allowed(struct task_struct *p,
91 struct cpumask *mask)
90{ 92{
91 *mask = cpu_possible_map; 93 *mask = cpu_possible_map;
92} 94}
93static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 95static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
94 cpumask_t *mask) 96 struct cpumask *mask)
95{ 97{
96 *mask = cpu_possible_map; 98 *mask = cpu_possible_map;
97} 99}
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index adb0b084eb5a..64dea2ab326c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -29,32 +29,6 @@
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30 30
31/** 31/**
32 * enum dma_state - resource PNP/power management state
33 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state
34 * @DMA_RESOURCE_RESUME: DMA device returning to full power
35 * @DMA_RESOURCE_AVAILABLE: DMA device available to the system
36 * @DMA_RESOURCE_REMOVED: DMA device removed from the system
37 */
38enum dma_state {
39 DMA_RESOURCE_SUSPEND,
40 DMA_RESOURCE_RESUME,
41 DMA_RESOURCE_AVAILABLE,
42 DMA_RESOURCE_REMOVED,
43};
44
45/**
46 * enum dma_state_client - state of the channel in the client
47 * @DMA_ACK: client would like to use, or was using this channel
48 * @DMA_DUP: client has already seen this channel, or is not using this channel
49 * @DMA_NAK: client does not want to see any more channels
50 */
51enum dma_state_client {
52 DMA_ACK,
53 DMA_DUP,
54 DMA_NAK,
55};
56
57/**
58 * typedef dma_cookie_t - an opaque DMA cookie 32 * typedef dma_cookie_t - an opaque DMA cookie
59 * 33 *
60 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 34 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
@@ -89,23 +63,13 @@ enum dma_transaction_type {
89 DMA_MEMSET, 63 DMA_MEMSET,
90 DMA_MEMCPY_CRC32C, 64 DMA_MEMCPY_CRC32C,
91 DMA_INTERRUPT, 65 DMA_INTERRUPT,
66 DMA_PRIVATE,
92 DMA_SLAVE, 67 DMA_SLAVE,
93}; 68};
94 69
95/* last transaction type for creation of the capabilities mask */ 70/* last transaction type for creation of the capabilities mask */
96#define DMA_TX_TYPE_END (DMA_SLAVE + 1) 71#define DMA_TX_TYPE_END (DMA_SLAVE + 1)
97 72
98/**
99 * enum dma_slave_width - DMA slave register access width.
100 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
101 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
102 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
103 */
104enum dma_slave_width {
105 DMA_SLAVE_WIDTH_8BIT,
106 DMA_SLAVE_WIDTH_16BIT,
107 DMA_SLAVE_WIDTH_32BIT,
108};
109 73
110/** 74/**
111 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 75 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -132,32 +96,6 @@ enum dma_ctrl_flags {
132typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t; 96typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t;
133 97
134/** 98/**
135 * struct dma_slave - Information about a DMA slave
136 * @dev: device acting as DMA slave
137 * @dma_dev: required DMA master device. If non-NULL, the client can not be
138 * bound to other masters than this.
139 * @tx_reg: physical address of data register used for
140 * memory-to-peripheral transfers
141 * @rx_reg: physical address of data register used for
142 * peripheral-to-memory transfers
143 * @reg_width: peripheral register width
144 *
145 * If dma_dev is non-NULL, the client can not be bound to other DMA
146 * masters than the one corresponding to this device. The DMA master
147 * driver may use this to determine if there is controller-specific
148 * data wrapped around this struct. Drivers of platform code that sets
149 * the dma_dev field must therefore make sure to use an appropriate
150 * controller-specific dma slave structure wrapping this struct.
151 */
152struct dma_slave {
153 struct device *dev;
154 struct device *dma_dev;
155 dma_addr_t tx_reg;
156 dma_addr_t rx_reg;
157 enum dma_slave_width reg_width;
158};
159
160/**
161 * struct dma_chan_percpu - the per-CPU part of struct dma_chan 99 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
162 * @refcount: local_t used for open-coded "bigref" counting 100 * @refcount: local_t used for open-coded "bigref" counting
163 * @memcpy_count: transaction counter 101 * @memcpy_count: transaction counter
@@ -165,7 +103,6 @@ struct dma_slave {
165 */ 103 */
166 104
167struct dma_chan_percpu { 105struct dma_chan_percpu {
168 local_t refcount;
169 /* stats */ 106 /* stats */
170 unsigned long memcpy_count; 107 unsigned long memcpy_count;
171 unsigned long bytes_transferred; 108 unsigned long bytes_transferred;
@@ -176,13 +113,14 @@ struct dma_chan_percpu {
176 * @device: ptr to the dma device who supplies this channel, always !%NULL 113 * @device: ptr to the dma device who supplies this channel, always !%NULL
177 * @cookie: last cookie value returned to client 114 * @cookie: last cookie value returned to client
178 * @chan_id: channel ID for sysfs 115 * @chan_id: channel ID for sysfs
179 * @class_dev: class device for sysfs 116 * @dev: class device for sysfs
180 * @refcount: kref, used in "bigref" slow-mode 117 * @refcount: kref, used in "bigref" slow-mode
181 * @slow_ref: indicates that the DMA channel is free 118 * @slow_ref: indicates that the DMA channel is free
182 * @rcu: the DMA channel's RCU head 119 * @rcu: the DMA channel's RCU head
183 * @device_node: used to add this to the device chan list 120 * @device_node: used to add this to the device chan list
184 * @local: per-cpu pointer to a struct dma_chan_percpu 121 * @local: per-cpu pointer to a struct dma_chan_percpu
185 * @client-count: how many clients are using this channel 122 * @client-count: how many clients are using this channel
123 * @table_count: number of appearances in the mem-to-mem allocation table
186 */ 124 */
187struct dma_chan { 125struct dma_chan {
188 struct dma_device *device; 126 struct dma_device *device;
@@ -190,73 +128,47 @@ struct dma_chan {
190 128
191 /* sysfs */ 129 /* sysfs */
192 int chan_id; 130 int chan_id;
193 struct device dev; 131 struct dma_chan_dev *dev;
194
195 struct kref refcount;
196 int slow_ref;
197 struct rcu_head rcu;
198 132
199 struct list_head device_node; 133 struct list_head device_node;
200 struct dma_chan_percpu *local; 134 struct dma_chan_percpu *local;
201 int client_count; 135 int client_count;
136 int table_count;
202}; 137};
203 138
204#define to_dma_chan(p) container_of(p, struct dma_chan, dev) 139/**
205 140 * struct dma_chan_dev - relate sysfs device node to backing channel device
206void dma_chan_cleanup(struct kref *kref); 141 * @chan - driver channel device
207 142 * @device - sysfs device
208static inline void dma_chan_get(struct dma_chan *chan) 143 * @dev_id - parent dma_device dev_id
209{ 144 * @idr_ref - reference count to gate release of dma_device dev_id
210 if (unlikely(chan->slow_ref)) 145 */
211 kref_get(&chan->refcount); 146struct dma_chan_dev {
212 else { 147 struct dma_chan *chan;
213 local_inc(&(per_cpu_ptr(chan->local, get_cpu())->refcount)); 148 struct device device;
214 put_cpu(); 149 int dev_id;
215 } 150 atomic_t *idr_ref;
216} 151};
217 152
218static inline void dma_chan_put(struct dma_chan *chan) 153static inline const char *dma_chan_name(struct dma_chan *chan)
219{ 154{
220 if (unlikely(chan->slow_ref)) 155 return dev_name(&chan->dev->device);
221 kref_put(&chan->refcount, dma_chan_cleanup);
222 else {
223 local_dec(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
224 put_cpu();
225 }
226} 156}
227 157
228/* 158void dma_chan_cleanup(struct kref *kref);
229 * typedef dma_event_callback - function pointer to a DMA event callback
230 * For each channel added to the system this routine is called for each client.
231 * If the client would like to use the channel it returns '1' to signal (ack)
232 * the dmaengine core to take out a reference on the channel and its
233 * corresponding device. A client must not 'ack' an available channel more
234 * than once. When a channel is removed all clients are notified. If a client
235 * is using the channel it must 'ack' the removal. A client must not 'ack' a
236 * removed channel more than once.
237 * @client - 'this' pointer for the client context
238 * @chan - channel to be acted upon
239 * @state - available or removed
240 */
241struct dma_client;
242typedef enum dma_state_client (*dma_event_callback) (struct dma_client *client,
243 struct dma_chan *chan, enum dma_state state);
244 159
245/** 160/**
246 * struct dma_client - info on the entity making use of DMA services 161 * typedef dma_filter_fn - callback filter for dma_request_channel
247 * @event_callback: func ptr to call when something happens 162 * @chan: channel to be reviewed
248 * @cap_mask: only return channels that satisfy the requested capabilities 163 * @filter_param: opaque parameter passed through dma_request_channel
249 * a value of zero corresponds to any capability 164 *
250 * @slave: data for preparing slave transfer. Must be non-NULL iff the 165 * When this optional parameter is specified in a call to dma_request_channel a
251 * DMA_SLAVE capability is requested. 166 * suitable channel is passed to this routine for further dispositioning before
252 * @global_node: list_head for global dma_client_list 167 * being returned. Where 'suitable' indicates a non-busy channel that
168 * satisfies the given capability mask. It returns 'true' to indicate that the
169 * channel is suitable.
253 */ 170 */
254struct dma_client { 171typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
255 dma_event_callback event_callback;
256 dma_cap_mask_t cap_mask;
257 struct dma_slave *slave;
258 struct list_head global_node;
259};
260 172
261typedef void (*dma_async_tx_callback)(void *dma_async_param); 173typedef void (*dma_async_tx_callback)(void *dma_async_param);
262/** 174/**
@@ -323,14 +235,10 @@ struct dma_device {
323 dma_cap_mask_t cap_mask; 235 dma_cap_mask_t cap_mask;
324 int max_xor; 236 int max_xor;
325 237
326 struct kref refcount;
327 struct completion done;
328
329 int dev_id; 238 int dev_id;
330 struct device *dev; 239 struct device *dev;
331 240
332 int (*device_alloc_chan_resources)(struct dma_chan *chan, 241 int (*device_alloc_chan_resources)(struct dma_chan *chan);
333 struct dma_client *client);
334 void (*device_free_chan_resources)(struct dma_chan *chan); 242 void (*device_free_chan_resources)(struct dma_chan *chan);
335 243
336 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( 244 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
@@ -362,9 +270,8 @@ struct dma_device {
362 270
363/* --- public DMA engine API --- */ 271/* --- public DMA engine API --- */
364 272
365void dma_async_client_register(struct dma_client *client); 273void dmaengine_get(void);
366void dma_async_client_unregister(struct dma_client *client); 274void dmaengine_put(void);
367void dma_async_client_chan_request(struct dma_client *client);
368dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 275dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
369 void *dest, void *src, size_t len); 276 void *dest, void *src, size_t len);
370dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, 277dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
@@ -406,6 +313,12 @@ __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
406 set_bit(tx_type, dstp->bits); 313 set_bit(tx_type, dstp->bits);
407} 314}
408 315
316#define dma_cap_zero(mask) __dma_cap_zero(&(mask))
317static inline void __dma_cap_zero(dma_cap_mask_t *dstp)
318{
319 bitmap_zero(dstp->bits, DMA_TX_TYPE_END);
320}
321
409#define dma_has_cap(tx, mask) __dma_has_cap((tx), &(mask)) 322#define dma_has_cap(tx, mask) __dma_has_cap((tx), &(mask))
410static inline int 323static inline int
411__dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp) 324__dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp)
@@ -475,11 +388,25 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
475} 388}
476 389
477enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); 390enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
391#ifdef CONFIG_DMA_ENGINE
392enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
393#else
394static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
395{
396 return DMA_SUCCESS;
397}
398#endif
478 399
479/* --- DMA device --- */ 400/* --- DMA device --- */
480 401
481int dma_async_device_register(struct dma_device *device); 402int dma_async_device_register(struct dma_device *device);
482void dma_async_device_unregister(struct dma_device *device); 403void dma_async_device_unregister(struct dma_device *device);
404void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
405struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
406void dma_issue_pending_all(void);
407#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
408struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
409void dma_release_channel(struct dma_chan *chan);
483 410
484/* --- Helper iov-locking functions --- */ 411/* --- Helper iov-locking functions --- */
485 412
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 04d217b442bf..d797dde247f7 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -22,14 +22,34 @@ struct dw_dma_platform_data {
22}; 22};
23 23
24/** 24/**
25 * enum dw_dma_slave_width - DMA slave register access width.
26 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
27 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
28 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
29 */
30enum dw_dma_slave_width {
31 DW_DMA_SLAVE_WIDTH_8BIT,
32 DW_DMA_SLAVE_WIDTH_16BIT,
33 DW_DMA_SLAVE_WIDTH_32BIT,
34};
35
36/**
25 * struct dw_dma_slave - Controller-specific information about a slave 37 * struct dw_dma_slave - Controller-specific information about a slave
26 * @slave: Generic information about the slave 38 *
27 * @ctl_lo: Platform-specific initializer for the CTL_LO register 39 * @dma_dev: required DMA master device
40 * @tx_reg: physical address of data register used for
41 * memory-to-peripheral transfers
42 * @rx_reg: physical address of data register used for
43 * peripheral-to-memory transfers
44 * @reg_width: peripheral register width
28 * @cfg_hi: Platform-specific initializer for the CFG_HI register 45 * @cfg_hi: Platform-specific initializer for the CFG_HI register
29 * @cfg_lo: Platform-specific initializer for the CFG_LO register 46 * @cfg_lo: Platform-specific initializer for the CFG_LO register
30 */ 47 */
31struct dw_dma_slave { 48struct dw_dma_slave {
32 struct dma_slave slave; 49 struct device *dma_dev;
50 dma_addr_t tx_reg;
51 dma_addr_t rx_reg;
52 enum dw_dma_slave_width reg_width;
33 u32 cfg_hi; 53 u32 cfg_hi;
34 u32 cfg_lo; 54 u32 cfg_lo;
35}; 55};
@@ -54,9 +74,4 @@ struct dw_dma_slave {
54#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ 74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
55#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ 75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
56 76
57static inline struct dw_dma_slave *to_dw_dma_slave(struct dma_slave *slave)
58{
59 return container_of(slave, struct dw_dma_slave, slave);
60}
61
62#endif /* DW_DMAC_H */ 77#endif /* DW_DMAC_H */
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 78c775a83f7c..121720d74e15 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -194,6 +194,30 @@ struct ext2_group_desc
194#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ 194#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
195#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ 195#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
196 196
197/* Flags that should be inherited by new inodes from their parent. */
198#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
199 EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\
200 EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\
201 EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
202 EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
203
204/* Flags that are appropriate for regular files (all but dir-specific ones). */
205#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL))
206
207/* Flags that are appropriate for non-directories/regular files. */
208#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
209
210/* Mask out flags that are inappropriate for the given type of inode. */
211static inline __u32 ext2_mask_flags(umode_t mode, __u32 flags)
212{
213 if (S_ISDIR(mode))
214 return flags;
215 else if (S_ISREG(mode))
216 return flags & EXT2_REG_FLMASK;
217 else
218 return flags & EXT2_OTHER_FLMASK;
219}
220
197/* 221/*
198 * ioctl commands 222 * ioctl commands
199 */ 223 */
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index dc541f3653d1..1cdb66367c98 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -101,7 +101,7 @@ struct ext2_sb_info {
101 struct percpu_counter s_freeblocks_counter; 101 struct percpu_counter s_freeblocks_counter;
102 struct percpu_counter s_freeinodes_counter; 102 struct percpu_counter s_freeinodes_counter;
103 struct percpu_counter s_dirs_counter; 103 struct percpu_counter s_dirs_counter;
104 struct blockgroup_lock s_blockgroup_lock; 104 struct blockgroup_lock *s_blockgroup_lock;
105 /* root of the per fs reservation window tree */ 105 /* root of the per fs reservation window tree */
106 spinlock_t s_rsv_window_lock; 106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root; 107 struct rb_root s_rsv_window_root;
@@ -111,7 +111,7 @@ struct ext2_sb_info {
111static inline spinlock_t * 111static inline spinlock_t *
112sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group) 112sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group)
113{ 113{
114 return bgl_lock_ptr(&sbi->s_blockgroup_lock, block_group); 114 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
115} 115}
116 116
117#endif /* _LINUX_EXT2_FS_SB */ 117#endif /* _LINUX_EXT2_FS_SB */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index d14f02918483..dd495b8c3091 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -178,6 +178,30 @@ struct ext3_group_desc
178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
180 180
181/* Flags that should be inherited by new inodes from their parent. */
182#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
183 EXT3_SYNC_FL | EXT3_IMMUTABLE_FL | EXT3_APPEND_FL |\
184 EXT3_NODUMP_FL | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL|\
185 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
186 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
187
188/* Flags that are appropriate for regular files (all but dir-specific ones). */
189#define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL))
190
191/* Flags that are appropriate for non-directories/regular files. */
192#define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL)
193
194/* Mask out flags that are inappropriate for the given type of inode. */
195static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
196{
197 if (S_ISDIR(mode))
198 return flags;
199 else if (S_ISREG(mode))
200 return flags & EXT3_REG_FLMASK;
201 else
202 return flags & EXT3_OTHER_FLMASK;
203}
204
181/* 205/*
182 * Inode dynamic state flags 206 * Inode dynamic state flags
183 */ 207 */
@@ -354,6 +378,13 @@ struct ext3_inode {
354#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ 378#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
355 379
356/* 380/*
381 * Misc. filesystem flags
382 */
383#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
384#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
385#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
386
387/*
357 * Mount flags 388 * Mount flags
358 */ 389 */
359#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */ 390#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
@@ -489,7 +520,23 @@ struct ext3_super_block {
489 __u16 s_reserved_word_pad; 520 __u16 s_reserved_word_pad;
490 __le32 s_default_mount_opts; 521 __le32 s_default_mount_opts;
491 __le32 s_first_meta_bg; /* First metablock block group */ 522 __le32 s_first_meta_bg; /* First metablock block group */
492 __u32 s_reserved[190]; /* Padding to the end of the block */ 523 __le32 s_mkfs_time; /* When the filesystem was created */
524 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
525 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
526/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
527 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
528 __le32 s_free_blocks_count_hi; /* Free blocks count */
529 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
530 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
531 __le32 s_flags; /* Miscellaneous flags */
532 __le16 s_raid_stride; /* RAID stride */
533 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
534 __le64 s_mmp_block; /* Block for multi-mount protection */
535 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
536 __u8 s_log_groups_per_flex; /* FLEX_BG group size */
537 __u8 s_reserved_char_pad2;
538 __le16 s_reserved_pad;
539 __u32 s_reserved[162]; /* Padding to the end of the block */
493}; 540};
494 541
495#ifdef __KERNEL__ 542#ifdef __KERNEL__
@@ -694,6 +741,9 @@ static inline __le16 ext3_rec_len_to_disk(unsigned len)
694#define DX_HASH_LEGACY 0 741#define DX_HASH_LEGACY 0
695#define DX_HASH_HALF_MD4 1 742#define DX_HASH_HALF_MD4 1
696#define DX_HASH_TEA 2 743#define DX_HASH_TEA 2
744#define DX_HASH_LEGACY_UNSIGNED 3
745#define DX_HASH_HALF_MD4_UNSIGNED 4
746#define DX_HASH_TEA_UNSIGNED 5
697 747
698#ifdef __KERNEL__ 748#ifdef __KERNEL__
699 749
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index e024e38248ff..f07f34de2f0e 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -57,10 +57,11 @@ struct ext3_sb_info {
57 u32 s_next_generation; 57 u32 s_next_generation;
58 u32 s_hash_seed[4]; 58 u32 s_hash_seed[4];
59 int s_def_hash_version; 59 int s_def_hash_version;
60 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
60 struct percpu_counter s_freeblocks_counter; 61 struct percpu_counter s_freeblocks_counter;
61 struct percpu_counter s_freeinodes_counter; 62 struct percpu_counter s_freeinodes_counter;
62 struct percpu_counter s_dirs_counter; 63 struct percpu_counter s_dirs_counter;
63 struct blockgroup_lock s_blockgroup_lock; 64 struct blockgroup_lock *s_blockgroup_lock;
64 65
65 /* root of the per fs reservation window tree */ 66 /* root of the per fs reservation window tree */
66 spinlock_t s_rsv_window_lock; 67 spinlock_t s_rsv_window_lock;
@@ -86,7 +87,7 @@ struct ext3_sb_info {
86static inline spinlock_t * 87static inline spinlock_t *
87sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group) 88sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group)
88{ 89{
89 return bgl_lock_ptr(&sbi->s_blockgroup_lock, block_group); 90 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
90} 91}
91 92
92#endif /* _LINUX_EXT3_FS_SB */ 93#endif /* _LINUX_EXT3_FS_SB */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e38a64d71eff..0b87b29f4797 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -565,6 +565,7 @@ struct address_space {
565struct block_device { 565struct block_device {
566 dev_t bd_dev; /* not a kdev_t - it's a search key */ 566 dev_t bd_dev; /* not a kdev_t - it's a search key */
567 struct inode * bd_inode; /* will die */ 567 struct inode * bd_inode; /* will die */
568 struct super_block * bd_super;
568 int bd_openers; 569 int bd_openers;
569 struct mutex bd_mutex; /* open/close mutex */ 570 struct mutex bd_mutex; /* open/close mutex */
570 struct semaphore bd_mount_sem; 571 struct semaphore bd_mount_sem;
@@ -1389,6 +1390,7 @@ struct super_operations {
1389 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1390 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1390 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1391 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1391#endif 1392#endif
1393 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1392}; 1394};
1393 1395
1394/* 1396/*
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a5cb0c3f6dcf..f8ff918c208f 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -115,6 +115,11 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, 115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
116 u16 vlan_tci, int polling); 116 u16 vlan_tci, int polling);
117extern int vlan_hwaccel_do_receive(struct sk_buff *skb); 117extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
119 unsigned int vlan_tci, struct sk_buff *skb);
120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci,
122 struct napi_gro_fraginfo *info);
118 123
119#else 124#else
120static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 125static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@@ -140,6 +145,20 @@ static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
140{ 145{
141 return 0; 146 return 0;
142} 147}
148
149static inline int vlan_gro_receive(struct napi_struct *napi,
150 struct vlan_group *grp,
151 unsigned int vlan_tci, struct sk_buff *skb)
152{
153 return NET_RX_DROP;
154}
155
156static inline int vlan_gro_frags(struct napi_struct *napi,
157 struct vlan_group *grp, unsigned int vlan_tci,
158 struct napi_gro_fraginfo *info)
159{
160 return NET_RX_DROP;
161}
143#endif 162#endif
144 163
145/** 164/**
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index f98a656b17e5..76dad4808847 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -86,4 +86,6 @@ static inline int task_nice_ioclass(struct task_struct *task)
86 */ 86 */
87extern int ioprio_best(unsigned short aprio, unsigned short bprio); 87extern int ioprio_best(unsigned short aprio, unsigned short bprio);
88 88
89extern int set_task_ioprio(struct task_struct *task, int ioprio);
90
89#endif 91#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 346e2b80be7d..6384b19efe64 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -543,6 +543,11 @@ struct transaction_s
543 unsigned long t_expires; 543 unsigned long t_expires;
544 544
545 /* 545 /*
546 * When this transaction started, in nanoseconds [no locking]
547 */
548 ktime_t t_start_time;
549
550 /*
546 * How many handles used this transaction? [t_handle_lock] 551 * How many handles used this transaction? [t_handle_lock]
547 */ 552 */
548 int t_handle_count; 553 int t_handle_count;
@@ -798,9 +803,19 @@ struct journal_s
798 struct buffer_head **j_wbuf; 803 struct buffer_head **j_wbuf;
799 int j_wbufsize; 804 int j_wbufsize;
800 805
806 /*
807 * this is the pid of the last person to run a synchronous operation
808 * through the journal.
809 */
801 pid_t j_last_sync_writer; 810 pid_t j_last_sync_writer;
802 811
803 /* 812 /*
813 * the average amount of time in nanoseconds it takes to commit a
814 * transaction to the disk. [j_state_lock]
815 */
816 u64 j_average_commit_time;
817
818 /*
804 * An opaque pointer to fs-private information. ext3 puts its 819 * An opaque pointer to fs-private information. ext3 puts its
805 * superblock pointer here 820 * superblock pointer here
806 */ 821 */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 34456476e761..b45109c61fba 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -638,6 +638,11 @@ struct transaction_s
638 unsigned long t_expires; 638 unsigned long t_expires;
639 639
640 /* 640 /*
641 * When this transaction started, in nanoseconds [no locking]
642 */
643 ktime_t t_start_time;
644
645 /*
641 * How many handles used this transaction? [t_handle_lock] 646 * How many handles used this transaction? [t_handle_lock]
642 */ 647 */
643 int t_handle_count; 648 int t_handle_count;
@@ -682,6 +687,8 @@ jbd2_time_diff(unsigned long start, unsigned long end)
682 return end + (MAX_JIFFY_OFFSET - start); 687 return end + (MAX_JIFFY_OFFSET - start);
683} 688}
684 689
690#define JBD2_NR_BATCH 64
691
685/** 692/**
686 * struct journal_s - The journal_s type is the concrete type associated with 693 * struct journal_s - The journal_s type is the concrete type associated with
687 * journal_t. 694 * journal_t.
@@ -826,6 +833,14 @@ struct journal_s
826 struct mutex j_checkpoint_mutex; 833 struct mutex j_checkpoint_mutex;
827 834
828 /* 835 /*
836 * List of buffer heads used by the checkpoint routine. This
837 * was moved from jbd2_log_do_checkpoint() to reduce stack
838 * usage. Access to this array is controlled by the
839 * j_checkpoint_mutex. [j_checkpoint_mutex]
840 */
841 struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
842
843 /*
829 * Journal head: identifies the first unused block in the journal. 844 * Journal head: identifies the first unused block in the journal.
830 * [j_state_lock] 845 * [j_state_lock]
831 */ 846 */
@@ -939,8 +954,26 @@ struct journal_s
939 struct buffer_head **j_wbuf; 954 struct buffer_head **j_wbuf;
940 int j_wbufsize; 955 int j_wbufsize;
941 956
957 /*
958 * this is the pid of hte last person to run a synchronous operation
959 * through the journal
960 */
942 pid_t j_last_sync_writer; 961 pid_t j_last_sync_writer;
943 962
963 /*
964 * the average amount of time in nanoseconds it takes to commit a
965 * transaction to disk. [j_state_lock]
966 */
967 u64 j_average_commit_time;
968
969 /*
970 * minimum and maximum times that we should wait for
971 * additional filesystem operations to get batched into a
972 * synchronous handle in microseconds
973 */
974 u32 j_min_batch_time;
975 u32 j_max_batch_time;
976
944 /* This function is called when a transaction is closed */ 977 /* This function is called when a transaction is closed */
945 void (*j_commit_callback)(journal_t *, 978 void (*j_commit_callback)(journal_t *,
946 transaction_t *); 979 transaction_t *);
@@ -1102,7 +1135,6 @@ extern int jbd2_journal_set_features
1102 (journal_t *, unsigned long, unsigned long, unsigned long); 1135 (journal_t *, unsigned long, unsigned long, unsigned long);
1103extern void jbd2_journal_clear_features 1136extern void jbd2_journal_clear_features
1104 (journal_t *, unsigned long, unsigned long, unsigned long); 1137 (journal_t *, unsigned long, unsigned long, unsigned long);
1105extern int jbd2_journal_create (journal_t *);
1106extern int jbd2_journal_load (journal_t *journal); 1138extern int jbd2_journal_load (journal_t *journal);
1107extern int jbd2_journal_destroy (journal_t *); 1139extern int jbd2_journal_destroy (journal_t *);
1108extern int jbd2_journal_recover (journal_t *journal); 1140extern int jbd2_journal_recover (journal_t *journal);
@@ -1177,8 +1209,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1177int jbd2_log_do_checkpoint(journal_t *journal); 1209int jbd2_log_do_checkpoint(journal_t *journal);
1178 1210
1179void __jbd2_log_wait_for_space(journal_t *journal); 1211void __jbd2_log_wait_for_space(journal_t *journal);
1180extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *); 1212extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
1181extern int jbd2_cleanup_journal_tail(journal_t *); 1213extern int jbd2_cleanup_journal_tail(journal_t *);
1182 1214
1183/* Debugging code only: */ 1215/* Debugging code only: */
1184 1216
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 6b8e2027165e..343df9ef2412 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -476,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
476 __val = __val < __min ? __min: __val; \ 476 __val = __val < __min ? __min: __val; \
477 __val > __max ? __max: __val; }) 477 __val > __max ? __max: __val; })
478 478
479
480/*
481 * swap - swap value of @a and @b
482 */
483#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
484
479/** 485/**
480 * container_of - cast a member of a structure out to the containing structure 486 * container_of - cast a member of a structure out to the containing structure
481 * @ptr: the pointer to the member. 487 * @ptr: the pointer to the member.
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3449de597eff..4f7c8fb4d3fe 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1518,6 +1518,7 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
1518 1518
1519extern const struct ata_port_operations ata_sff_port_ops; 1519extern const struct ata_port_operations ata_sff_port_ops;
1520extern const struct ata_port_operations ata_bmdma_port_ops; 1520extern const struct ata_port_operations ata_bmdma_port_ops;
1521extern const struct ata_port_operations ata_bmdma32_port_ops;
1521 1522
1522/* PIO only, sg_tablesize and dma_boundary limits can be removed */ 1523/* PIO only, sg_tablesize and dma_boundary limits can be removed */
1523#define ATA_PIO_SHT(drv_name) \ 1524#define ATA_PIO_SHT(drv_name) \
@@ -1545,6 +1546,8 @@ extern void ata_sff_exec_command(struct ata_port *ap,
1545 const struct ata_taskfile *tf); 1546 const struct ata_taskfile *tf);
1546extern unsigned int ata_sff_data_xfer(struct ata_device *dev, 1547extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
1547 unsigned char *buf, unsigned int buflen, int rw); 1548 unsigned char *buf, unsigned int buflen, int rw);
1549extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1550 unsigned char *buf, unsigned int buflen, int rw);
1548extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1551extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1549 unsigned char *buf, unsigned int buflen, int rw); 1552 unsigned char *buf, unsigned int buflen, int rw);
1550extern u8 ata_sff_irq_on(struct ata_port *ap); 1553extern u8 ata_sff_irq_on(struct ata_port *ap);
diff --git a/include/linux/magic.h b/include/linux/magic.h
index f7f3fdddbef0..439f6f3cb0c4 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -13,6 +13,7 @@
13#define EFS_SUPER_MAGIC 0x414A53 13#define EFS_SUPER_MAGIC 0x414A53
14#define EXT2_SUPER_MAGIC 0xEF53 14#define EXT2_SUPER_MAGIC 0xEF53
15#define EXT3_SUPER_MAGIC 0xEF53 15#define EXT3_SUPER_MAGIC 0xEF53
16#define XENFS_SUPER_MAGIC 0xabba1974
16#define EXT4_SUPER_MAGIC 0xEF53 17#define EXT4_SUPER_MAGIC 0xEF53
17#define HPFS_SUPER_MAGIC 0xf995e849 18#define HPFS_SUPER_MAGIC 0xf995e849
18#define ISOFS_SUPER_MAGIC 0x9660 19#define ISOFS_SUPER_MAGIC 0x9660
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 1fbe14d39521..326f45c86530 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -19,22 +19,45 @@
19 19
20#ifndef _LINUX_MEMCONTROL_H 20#ifndef _LINUX_MEMCONTROL_H
21#define _LINUX_MEMCONTROL_H 21#define _LINUX_MEMCONTROL_H
22 22#include <linux/cgroup.h>
23struct mem_cgroup; 23struct mem_cgroup;
24struct page_cgroup; 24struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29/*
30 * All "charge" functions with gfp_mask should use GFP_KERNEL or
31 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't
32 * alloc memory but reclaims memory from all available zones. So, "where I want
33 * memory from" bits of gfp_mask has no meaning. So any bits of that field is
34 * available but adding a rule is better. charge functions' gfp_mask should
35 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous
36 * codes.
37 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
38 */
29 39
30extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, 40extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm,
31 gfp_t gfp_mask); 41 gfp_t gfp_mask);
42/* for swap handling */
43extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
44 struct page *page, gfp_t mask, struct mem_cgroup **ptr);
45extern void mem_cgroup_commit_charge_swapin(struct page *page,
46 struct mem_cgroup *ptr);
47extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr);
48
32extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 49extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
33 gfp_t gfp_mask); 50 gfp_t gfp_mask);
34extern void mem_cgroup_move_lists(struct page *page, enum lru_list lru); 51extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru);
52extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru);
53extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
54extern void mem_cgroup_del_lru(struct page *page);
55extern void mem_cgroup_move_lists(struct page *page,
56 enum lru_list from, enum lru_list to);
35extern void mem_cgroup_uncharge_page(struct page *page); 57extern void mem_cgroup_uncharge_page(struct page *page);
36extern void mem_cgroup_uncharge_cache_page(struct page *page); 58extern void mem_cgroup_uncharge_cache_page(struct page *page);
37extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); 59extern int mem_cgroup_shrink_usage(struct page *page,
60 struct mm_struct *mm, gfp_t gfp_mask);
38 61
39extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
40 struct list_head *dst, 63 struct list_head *dst,
@@ -47,12 +70,20 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
47 70
48extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 71extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
49 72
50#define mm_match_cgroup(mm, cgroup) \ 73static inline
51 ((cgroup) == mem_cgroup_from_task((mm)->owner)) 74int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
75{
76 struct mem_cgroup *mem;
77 rcu_read_lock();
78 mem = mem_cgroup_from_task((mm)->owner);
79 rcu_read_unlock();
80 return cgroup == mem;
81}
52 82
53extern int 83extern int
54mem_cgroup_prepare_migration(struct page *page, struct page *newpage); 84mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
55extern void mem_cgroup_end_migration(struct page *page); 85extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
86 struct page *oldpage, struct page *newpage);
56 87
57/* 88/*
58 * For memory reclaim. 89 * For memory reclaim.
@@ -65,13 +96,32 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
65 int priority); 96 int priority);
66extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 97extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
67 int priority); 98 int priority);
99int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
100unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
101 struct zone *zone,
102 enum lru_list lru);
103struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
104 struct zone *zone);
105struct zone_reclaim_stat*
106mem_cgroup_get_reclaim_stat_from_page(struct page *page);
68 107
69extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone, 108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
70 int priority, enum lru_list lru); 109extern int do_swap_account;
110#endif
71 111
112static inline bool mem_cgroup_disabled(void)
113{
114 if (mem_cgroup_subsys.disabled)
115 return true;
116 return false;
117}
118
119extern bool mem_cgroup_oom_called(struct task_struct *task);
72 120
73#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 121#else /* CONFIG_CGROUP_MEM_RES_CTLR */
74static inline int mem_cgroup_charge(struct page *page, 122struct mem_cgroup;
123
124static inline int mem_cgroup_newpage_charge(struct page *page,
75 struct mm_struct *mm, gfp_t gfp_mask) 125 struct mm_struct *mm, gfp_t gfp_mask)
76{ 126{
77 return 0; 127 return 0;
@@ -83,6 +133,21 @@ static inline int mem_cgroup_cache_charge(struct page *page,
83 return 0; 133 return 0;
84} 134}
85 135
136static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
137 struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr)
138{
139 return 0;
140}
141
142static inline void mem_cgroup_commit_charge_swapin(struct page *page,
143 struct mem_cgroup *ptr)
144{
145}
146
147static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr)
148{
149}
150
86static inline void mem_cgroup_uncharge_page(struct page *page) 151static inline void mem_cgroup_uncharge_page(struct page *page)
87{ 152{
88} 153}
@@ -91,12 +156,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
91{ 156{
92} 157}
93 158
94static inline int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask) 159static inline int mem_cgroup_shrink_usage(struct page *page,
160 struct mm_struct *mm, gfp_t gfp_mask)
95{ 161{
96 return 0; 162 return 0;
97} 163}
98 164
99static inline void mem_cgroup_move_lists(struct page *page, bool active) 165static inline void mem_cgroup_add_lru_list(struct page *page, int lru)
166{
167}
168
169static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
170{
171 return ;
172}
173
174static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru)
175{
176 return ;
177}
178
179static inline void mem_cgroup_del_lru(struct page *page)
180{
181 return ;
182}
183
184static inline void
185mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to)
100{ 186{
101} 187}
102 188
@@ -112,12 +198,14 @@ static inline int task_in_mem_cgroup(struct task_struct *task,
112} 198}
113 199
114static inline int 200static inline int
115mem_cgroup_prepare_migration(struct page *page, struct page *newpage) 201mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
116{ 202{
117 return 0; 203 return 0;
118} 204}
119 205
120static inline void mem_cgroup_end_migration(struct page *page) 206static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
207 struct page *oldpage,
208 struct page *newpage)
121{ 209{
122} 210}
123 211
@@ -146,12 +234,42 @@ static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
146{ 234{
147} 235}
148 236
149static inline long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, 237static inline bool mem_cgroup_disabled(void)
150 struct zone *zone, int priority, 238{
151 enum lru_list lru) 239 return true;
240}
241
242static inline bool mem_cgroup_oom_called(struct task_struct *task)
243{
244 return false;
245}
246
247static inline int
248mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
249{
250 return 1;
251}
252
253static inline unsigned long
254mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
255 enum lru_list lru)
152{ 256{
153 return 0; 257 return 0;
154} 258}
259
260
261static inline struct zone_reclaim_stat*
262mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, struct zone *zone)
263{
264 return NULL;
265}
266
267static inline struct zone_reclaim_stat*
268mem_cgroup_get_reclaim_stat_from_page(struct page *page)
269{
270 return NULL;
271}
272
155#endif /* CONFIG_CGROUP_MEM_CONT */ 273#endif /* CONFIG_CGROUP_MEM_CONT */
156 274
157#endif /* _LINUX_MEMCONTROL_H */ 275#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index c948350c378e..7fbb97267556 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -28,6 +28,7 @@ add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
28{ 28{
29 list_add(&page->lru, &zone->lru[l].list); 29 list_add(&page->lru, &zone->lru[l].list);
30 __inc_zone_state(zone, NR_LRU_BASE + l); 30 __inc_zone_state(zone, NR_LRU_BASE + l);
31 mem_cgroup_add_lru_list(page, l);
31} 32}
32 33
33static inline void 34static inline void
@@ -35,6 +36,7 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
35{ 36{
36 list_del(&page->lru); 37 list_del(&page->lru);
37 __dec_zone_state(zone, NR_LRU_BASE + l); 38 __dec_zone_state(zone, NR_LRU_BASE + l);
39 mem_cgroup_del_lru_list(page, l);
38} 40}
39 41
40static inline void 42static inline void
@@ -54,6 +56,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
54 l += page_is_file_cache(page); 56 l += page_is_file_cache(page);
55 } 57 }
56 __dec_zone_state(zone, NR_LRU_BASE + l); 58 __dec_zone_state(zone, NR_LRU_BASE + l);
59 mem_cgroup_del_lru_list(page, l);
57} 60}
58 61
59/** 62/**
@@ -78,23 +81,4 @@ static inline enum lru_list page_lru(struct page *page)
78 return lru; 81 return lru;
79} 82}
80 83
81/**
82 * inactive_anon_is_low - check if anonymous pages need to be deactivated
83 * @zone: zone to check
84 *
85 * Returns true if the zone does not have enough inactive anon pages,
86 * meaning some active anon pages need to be deactivated.
87 */
88static inline int inactive_anon_is_low(struct zone *zone)
89{
90 unsigned long active, inactive;
91
92 active = zone_page_state(zone, NR_ACTIVE_ANON);
93 inactive = zone_page_state(zone, NR_INACTIVE_ANON);
94
95 if (inactive * zone->inactive_ratio < active)
96 return 1;
97
98 return 0;
99}
100#endif 84#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 35a7b5e19465..09c14e213b63 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -263,6 +263,19 @@ enum zone_type {
263#error ZONES_SHIFT -- too many zones configured adjust calculation 263#error ZONES_SHIFT -- too many zones configured adjust calculation
264#endif 264#endif
265 265
266struct zone_reclaim_stat {
267 /*
268 * The pageout code in vmscan.c keeps track of how many of the
269 * mem/swap backed and file backed pages are refeferenced.
270 * The higher the rotated/scanned ratio, the more valuable
271 * that cache is.
272 *
273 * The anon LRU stats live in [0], file LRU stats in [1]
274 */
275 unsigned long recent_rotated[2];
276 unsigned long recent_scanned[2];
277};
278
266struct zone { 279struct zone {
267 /* Fields commonly accessed by the page allocator */ 280 /* Fields commonly accessed by the page allocator */
268 unsigned long pages_min, pages_low, pages_high; 281 unsigned long pages_min, pages_low, pages_high;
@@ -315,16 +328,7 @@ struct zone {
315 unsigned long nr_scan; 328 unsigned long nr_scan;
316 } lru[NR_LRU_LISTS]; 329 } lru[NR_LRU_LISTS];
317 330
318 /* 331 struct zone_reclaim_stat reclaim_stat;
319 * The pageout code in vmscan.c keeps track of how many of the
320 * mem/swap backed and file backed pages are refeferenced.
321 * The higher the rotated/scanned ratio, the more valuable
322 * that cache is.
323 *
324 * The anon LRU stats live in [0], file LRU stats in [1]
325 */
326 unsigned long recent_rotated[2];
327 unsigned long recent_scanned[2];
328 332
329 unsigned long pages_scanned; /* since last reclaim */ 333 unsigned long pages_scanned; /* since last reclaim */
330 unsigned long flags; /* zone flags, see below */ 334 unsigned long flags; /* zone flags, see below */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 00e2b575021f..88d3d8fbf9f2 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -520,6 +520,7 @@ struct cfi_fixup {
520 520
521#define CFI_MFR_AMD 0x0001 521#define CFI_MFR_AMD 0x0001
522#define CFI_MFR_ATMEL 0x001F 522#define CFI_MFR_ATMEL 0x001F
523#define CFI_MFR_SAMSUNG 0x00EC
523#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 524#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
524 525
525void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 526void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h
index 0be442f881dd..0555f7a0b9ed 100644
--- a/include/linux/mtd/ftl.h
+++ b/include/linux/mtd/ftl.h
@@ -32,25 +32,25 @@
32#define _LINUX_FTL_H 32#define _LINUX_FTL_H
33 33
34typedef struct erase_unit_header_t { 34typedef struct erase_unit_header_t {
35 u_int8_t LinkTargetTuple[5]; 35 uint8_t LinkTargetTuple[5];
36 u_int8_t DataOrgTuple[10]; 36 uint8_t DataOrgTuple[10];
37 u_int8_t NumTransferUnits; 37 uint8_t NumTransferUnits;
38 u_int32_t EraseCount; 38 uint32_t EraseCount;
39 u_int16_t LogicalEUN; 39 uint16_t LogicalEUN;
40 u_int8_t BlockSize; 40 uint8_t BlockSize;
41 u_int8_t EraseUnitSize; 41 uint8_t EraseUnitSize;
42 u_int16_t FirstPhysicalEUN; 42 uint16_t FirstPhysicalEUN;
43 u_int16_t NumEraseUnits; 43 uint16_t NumEraseUnits;
44 u_int32_t FormattedSize; 44 uint32_t FormattedSize;
45 u_int32_t FirstVMAddress; 45 uint32_t FirstVMAddress;
46 u_int16_t NumVMPages; 46 uint16_t NumVMPages;
47 u_int8_t Flags; 47 uint8_t Flags;
48 u_int8_t Code; 48 uint8_t Code;
49 u_int32_t SerialNumber; 49 uint32_t SerialNumber;
50 u_int32_t AltEUHOffset; 50 uint32_t AltEUHOffset;
51 u_int32_t BAMOffset; 51 uint32_t BAMOffset;
52 u_int8_t Reserved[12]; 52 uint8_t Reserved[12];
53 u_int8_t EndTuple[2]; 53 uint8_t EndTuple[2];
54} erase_unit_header_t; 54} erase_unit_header_t;
55 55
56/* Flags in erase_unit_header_t */ 56/* Flags in erase_unit_header_t */
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index aa30244492c6..b981b8772217 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -223,6 +223,7 @@ struct map_info {
223 must leave it enabled. */ 223 must leave it enabled. */
224 void (*set_vpp)(struct map_info *, int); 224 void (*set_vpp)(struct map_info *, int);
225 225
226 unsigned long pfow_base;
226 unsigned long map_priv_1; 227 unsigned long map_priv_1;
227 unsigned long map_priv_2; 228 unsigned long map_priv_2;
228 void *fldrv_priv; 229 void *fldrv_priv;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 64433eb411d7..3aa5d77c2cdb 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -15,6 +15,8 @@
15#include <linux/mtd/compatmac.h> 15#include <linux/mtd/compatmac.h>
16#include <mtd/mtd-abi.h> 16#include <mtd/mtd-abi.h>
17 17
18#include <asm/div64.h>
19
18#define MTD_CHAR_MAJOR 90 20#define MTD_CHAR_MAJOR 90
19#define MTD_BLOCK_MAJOR 31 21#define MTD_BLOCK_MAJOR 31
20#define MAX_MTD_DEVICES 32 22#define MAX_MTD_DEVICES 32
@@ -25,20 +27,20 @@
25#define MTD_ERASE_DONE 0x08 27#define MTD_ERASE_DONE 0x08
26#define MTD_ERASE_FAILED 0x10 28#define MTD_ERASE_FAILED 0x10
27 29
28#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff 30#define MTD_FAIL_ADDR_UNKNOWN -1LL
29 31
30/* If the erase fails, fail_addr might indicate exactly which block failed. If 32/* If the erase fails, fail_addr might indicate exactly which block failed. If
31 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not 33 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not
32 specific to any particular block. */ 34 specific to any particular block. */
33struct erase_info { 35struct erase_info {
34 struct mtd_info *mtd; 36 struct mtd_info *mtd;
35 u_int32_t addr; 37 uint64_t addr;
36 u_int32_t len; 38 uint64_t len;
37 u_int32_t fail_addr; 39 uint64_t fail_addr;
38 u_long time; 40 u_long time;
39 u_long retries; 41 u_long retries;
40 u_int dev; 42 unsigned dev;
41 u_int cell; 43 unsigned cell;
42 void (*callback) (struct erase_info *self); 44 void (*callback) (struct erase_info *self);
43 u_long priv; 45 u_long priv;
44 u_char state; 46 u_char state;
@@ -46,9 +48,9 @@ struct erase_info {
46}; 48};
47 49
48struct mtd_erase_region_info { 50struct mtd_erase_region_info {
49 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ 51 uint64_t offset; /* At which this region starts, from the beginning of the MTD */
50 u_int32_t erasesize; /* For this region */ 52 uint32_t erasesize; /* For this region */
51 u_int32_t numblocks; /* Number of blocks of erasesize in this region */ 53 uint32_t numblocks; /* Number of blocks of erasesize in this region */
52 unsigned long *lockmap; /* If keeping bitmap of locks */ 54 unsigned long *lockmap; /* If keeping bitmap of locks */
53}; 55};
54 56
@@ -100,14 +102,14 @@ struct mtd_oob_ops {
100 102
101struct mtd_info { 103struct mtd_info {
102 u_char type; 104 u_char type;
103 u_int32_t flags; 105 uint32_t flags;
104 u_int32_t size; // Total size of the MTD 106 uint64_t size; // Total size of the MTD
105 107
106 /* "Major" erase size for the device. Naïve users may take this 108 /* "Major" erase size for the device. Naïve users may take this
107 * to be the only erase size available, or may use the more detailed 109 * to be the only erase size available, or may use the more detailed
108 * information below if they desire 110 * information below if they desire
109 */ 111 */
110 u_int32_t erasesize; 112 uint32_t erasesize;
111 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even 113 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
112 * though individual bits can be cleared), in case of NAND flash it is 114 * though individual bits can be cleared), in case of NAND flash it is
113 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR 115 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
@@ -115,10 +117,20 @@ struct mtd_info {
115 * Any driver registering a struct mtd_info must ensure a writesize of 117 * Any driver registering a struct mtd_info must ensure a writesize of
116 * 1 or larger. 118 * 1 or larger.
117 */ 119 */
118 u_int32_t writesize; 120 uint32_t writesize;
121
122 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
123 uint32_t oobavail; // Available OOB bytes per block
119 124
120 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 125 /*
121 u_int32_t oobavail; // Available OOB bytes per block 126 * If erasesize is a power of 2 then the shift is stored in
127 * erasesize_shift otherwise erasesize_shift is zero. Ditto writesize.
128 */
129 unsigned int erasesize_shift;
130 unsigned int writesize_shift;
131 /* Masks based on erasesize_shift and writesize_shift */
132 unsigned int erasesize_mask;
133 unsigned int writesize_mask;
122 134
123 // Kernel-only stuff starts here. 135 // Kernel-only stuff starts here.
124 const char *name; 136 const char *name;
@@ -190,8 +202,8 @@ struct mtd_info {
190 void (*sync) (struct mtd_info *mtd); 202 void (*sync) (struct mtd_info *mtd);
191 203
192 /* Chip-supported device locking */ 204 /* Chip-supported device locking */
193 int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); 205 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
194 int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); 206 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
195 207
196 /* Power Management functions */ 208 /* Power Management functions */
197 int (*suspend) (struct mtd_info *mtd); 209 int (*suspend) (struct mtd_info *mtd);
@@ -221,6 +233,35 @@ struct mtd_info {
221 void (*put_device) (struct mtd_info *mtd); 233 void (*put_device) (struct mtd_info *mtd);
222}; 234};
223 235
236static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
237{
238 if (mtd->erasesize_shift)
239 return sz >> mtd->erasesize_shift;
240 do_div(sz, mtd->erasesize);
241 return sz;
242}
243
244static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd)
245{
246 if (mtd->erasesize_shift)
247 return sz & mtd->erasesize_mask;
248 return do_div(sz, mtd->erasesize);
249}
250
251static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd)
252{
253 if (mtd->writesize_shift)
254 return sz >> mtd->writesize_shift;
255 do_div(sz, mtd->writesize);
256 return sz;
257}
258
259static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
260{
261 if (mtd->writesize_shift)
262 return sz & mtd->writesize_mask;
263 return do_div(sz, mtd->writesize);
264}
224 265
225 /* Kernel-side ioctl definitions */ 266 /* Kernel-side ioctl definitions */
226 267
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 733d3f3b4eb8..db5b63da2a7e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -335,17 +335,12 @@ struct nand_buffers {
335 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 335 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support
336 * @scan_bbt: [REPLACEABLE] function to scan bad block table 336 * @scan_bbt: [REPLACEABLE] function to scan bad block table
337 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 337 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
338 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress
339 * @state: [INTERN] the current state of the NAND device 338 * @state: [INTERN] the current state of the NAND device
340 * @oob_poi: poison value buffer 339 * @oob_poi: poison value buffer
341 * @page_shift: [INTERN] number of address bits in a page (column address bits) 340 * @page_shift: [INTERN] number of address bits in a page (column address bits)
342 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 341 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
343 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 342 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
344 * @chip_shift: [INTERN] number of address bits in one chip 343 * @chip_shift: [INTERN] number of address bits in one chip
345 * @datbuf: [INTERN] internal buffer for one page + oob
346 * @oobbuf: [INTERN] oob buffer for one eraseblock
347 * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized
348 * @data_poi: [INTERN] pointer to a data buffer
349 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about 344 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
350 * special functionality. See the defines for further explanation 345 * special functionality. See the defines for further explanation
351 * @badblockpos: [INTERN] position of the bad block marker in the oob area 346 * @badblockpos: [INTERN] position of the bad block marker in the oob area
@@ -399,7 +394,7 @@ struct nand_chip {
399 int bbt_erase_shift; 394 int bbt_erase_shift;
400 int chip_shift; 395 int chip_shift;
401 int numchips; 396 int numchips;
402 unsigned long chipsize; 397 uint64_t chipsize;
403 int pagemask; 398 int pagemask;
404 int pagebuf; 399 int pagebuf;
405 int subpagesize; 400 int subpagesize;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index c92b4d439609..a45dd831b3f8 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -36,9 +36,9 @@
36 36
37struct mtd_partition { 37struct mtd_partition {
38 char *name; /* identifier string */ 38 char *name; /* identifier string */
39 u_int32_t size; /* partition size */ 39 uint64_t size; /* partition size */
40 u_int32_t offset; /* offset within the master MTD space */ 40 uint64_t offset; /* offset within the master MTD space */
41 u_int32_t mask_flags; /* master MTD flags to mask out for this partition */ 41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ 42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
43 struct mtd_info **mtdp; /* pointer to store the MTD object */ 43 struct mtd_info **mtdp; /* pointer to store the MTD object */
44}; 44};
diff --git a/include/linux/mtd/pfow.h b/include/linux/mtd/pfow.h
new file mode 100644
index 000000000000..b730d4f84655
--- /dev/null
+++ b/include/linux/mtd/pfow.h
@@ -0,0 +1,159 @@
1/* Primary function overlay window definitions
2 * and service functions used by LPDDR chips
3 */
4#ifndef __LINUX_MTD_PFOW_H
5#define __LINUX_MTD_PFOW_H
6
7#include <linux/mtd/qinfo.h>
8
9/* PFOW registers addressing */
10/* Address of symbol "P" */
11#define PFOW_QUERY_STRING_P 0x0000
12/* Address of symbol "F" */
13#define PFOW_QUERY_STRING_F 0x0002
14/* Address of symbol "O" */
15#define PFOW_QUERY_STRING_O 0x0004
16/* Address of symbol "W" */
17#define PFOW_QUERY_STRING_W 0x0006
18/* Identification info for LPDDR chip */
19#define PFOW_MANUFACTURER_ID 0x0020
20#define PFOW_DEVICE_ID 0x0022
21/* Address in PFOW where prog buffer can can be found */
22#define PFOW_PROGRAM_BUFFER_OFFSET 0x0040
23/* Size of program buffer in words */
24#define PFOW_PROGRAM_BUFFER_SIZE 0x0042
25/* Address command code register */
26#define PFOW_COMMAND_CODE 0x0080
27/* command data register */
28#define PFOW_COMMAND_DATA 0x0084
29/* command address register lower address bits */
30#define PFOW_COMMAND_ADDRESS_L 0x0088
31/* command address register upper address bits */
32#define PFOW_COMMAND_ADDRESS_H 0x008a
33/* number of bytes to be proggrammed lower address bits */
34#define PFOW_DATA_COUNT_L 0x0090
35/* number of bytes to be proggrammed higher address bits */
36#define PFOW_DATA_COUNT_H 0x0092
37/* command execution register, the only possible value is 0x01 */
38#define PFOW_COMMAND_EXECUTE 0x00c0
39/* 0x01 should be written at this address to clear buffer */
40#define PFOW_CLEAR_PROGRAM_BUFFER 0x00c4
41/* device program/erase suspend register */
42#define PFOW_PROGRAM_ERASE_SUSPEND 0x00c8
43/* device status register */
44#define PFOW_DSR 0x00cc
45
46/* LPDDR memory device command codes */
47/* They are possible values of PFOW command code register */
48#define LPDDR_WORD_PROGRAM 0x0041
49#define LPDDR_BUFF_PROGRAM 0x00E9
50#define LPDDR_BLOCK_ERASE 0x0020
51#define LPDDR_LOCK_BLOCK 0x0061
52#define LPDDR_UNLOCK_BLOCK 0x0062
53#define LPDDR_READ_BLOCK_LOCK_STATUS 0x0065
54#define LPDDR_INFO_QUERY 0x0098
55#define LPDDR_READ_OTP 0x0097
56#define LPDDR_PROG_OTP 0x00C0
57#define LPDDR_RESUME 0x00D0
58
59/* Defines possible value of PFOW command execution register */
60#define LPDDR_START_EXECUTION 0x0001
61
62/* Defines possible value of PFOW program/erase suspend register */
63#define LPDDR_SUSPEND 0x0001
64
65/* Possible values of PFOW device status register */
66/* access R - read; RC read & clearable */
67#define DSR_DPS (1<<1) /* RC; device protect status
68 * 0 - not protected 1 - locked */
69#define DSR_PSS (1<<2) /* R; program suspend status;
70 * 0-prog in progress/completed,
71 * 1- prog suspended */
72#define DSR_VPPS (1<<3) /* RC; 0-Vpp OK, * 1-Vpp low */
73#define DSR_PROGRAM_STATUS (1<<4) /* RC; 0-successful, 1-error */
74#define DSR_ERASE_STATUS (1<<5) /* RC; erase or blank check status;
75 * 0-success erase/blank check,
76 * 1 blank check error */
77#define DSR_ESS (1<<6) /* R; erase suspend status;
78 * 0-erase in progress/complete,
79 * 1 erase suspended */
80#define DSR_READY_STATUS (1<<7) /* R; Device status
81 * 0-busy,
82 * 1-ready */
83#define DSR_RPS (0x3<<8) /* RC; region program status
84 * 00 - Success,
85 * 01-re-program attempt in region with
86 * object mode data,
87 * 10-object mode program w attempt in
88 * region with control mode data
89 * 11-attempt to program invalid half
90 * with 0x41 command */
91#define DSR_AOS (1<<12) /* RC; 1- AO related failure */
92#define DSR_AVAILABLE (1<<15) /* R; Device availbility
93 * 1 - Device available
94 * 0 - not available */
95
96/* The superset of all possible error bits in DSR */
97#define DSR_ERR 0x133A
98
99static inline void send_pfow_command(struct map_info *map,
100 unsigned long cmd_code, unsigned long adr,
101 unsigned long len, map_word *datum)
102{
103 int bits_per_chip = map_bankwidth(map) * 8;
104 int chipnum;
105 struct lpddr_private *lpddr = map->fldrv_priv;
106 chipnum = adr >> lpddr->chipshift;
107
108 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE);
109 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)),
110 map->pfow_base + PFOW_COMMAND_ADDRESS_L);
111 map_write(map, CMD(adr>>bits_per_chip),
112 map->pfow_base + PFOW_COMMAND_ADDRESS_H);
113 if (len) {
114 map_write(map, CMD(len & ((1<<bits_per_chip) - 1)),
115 map->pfow_base + PFOW_DATA_COUNT_L);
116 map_write(map, CMD(len>>bits_per_chip),
117 map->pfow_base + PFOW_DATA_COUNT_H);
118 }
119 if (datum)
120 map_write(map, *datum, map->pfow_base + PFOW_COMMAND_DATA);
121
122 /* Command execution start */
123 map_write(map, CMD(LPDDR_START_EXECUTION),
124 map->pfow_base + PFOW_COMMAND_EXECUTE);
125}
126
127static inline void print_drs_error(unsigned dsr)
128{
129 int prog_status = (dsr & DSR_RPS) >> 8;
130
131 if (!(dsr & DSR_AVAILABLE))
132 printk(KERN_NOTICE"DSR.15: (0) Device not Available\n");
133 if (prog_status & 0x03)
134 printk(KERN_NOTICE"DSR.9,8: (11) Attempt to program invalid "
135 "half with 41h command\n");
136 else if (prog_status & 0x02)
137 printk(KERN_NOTICE"DSR.9,8: (10) Object Mode Program attempt "
138 "in region with Control Mode data\n");
139 else if (prog_status & 0x01)
140 printk(KERN_NOTICE"DSR.9,8: (01) Program attempt in region "
141 "with Object Mode data\n");
142 if (!(dsr & DSR_READY_STATUS))
143 printk(KERN_NOTICE"DSR.7: (0) Device is Busy\n");
144 if (dsr & DSR_ESS)
145 printk(KERN_NOTICE"DSR.6: (1) Erase Suspended\n");
146 if (dsr & DSR_ERASE_STATUS)
147 printk(KERN_NOTICE"DSR.5: (1) Erase/Blank check error\n");
148 if (dsr & DSR_PROGRAM_STATUS)
149 printk(KERN_NOTICE"DSR.4: (1) Program Error\n");
150 if (dsr & DSR_VPPS)
151 printk(KERN_NOTICE"DSR.3: (1) Vpp low detect, operation "
152 "aborted\n");
153 if (dsr & DSR_PSS)
154 printk(KERN_NOTICE"DSR.2: (1) Program suspended\n");
155 if (dsr & DSR_DPS)
156 printk(KERN_NOTICE"DSR.1: (1) Aborted Erase/Program attempt "
157 "on locked block\n");
158}
159#endif /* __LINUX_MTD_PFOW_H */
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index c8e63a5ee72e..76f7cabf07d3 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -24,6 +24,7 @@ struct physmap_flash_data {
24 unsigned int width; 24 unsigned int width;
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base;
27 struct mtd_partition *parts; 28 struct mtd_partition *parts;
28}; 29};
29 30
diff --git a/include/linux/mtd/qinfo.h b/include/linux/mtd/qinfo.h
new file mode 100644
index 000000000000..7b3d487d8b3f
--- /dev/null
+++ b/include/linux/mtd/qinfo.h
@@ -0,0 +1,91 @@
1#ifndef __LINUX_MTD_QINFO_H
2#define __LINUX_MTD_QINFO_H
3
4#include <linux/mtd/map.h>
5#include <linux/wait.h>
6#include <linux/spinlock.h>
7#include <linux/delay.h>
8#include <linux/mtd/mtd.h>
9#include <linux/mtd/flashchip.h>
10#include <linux/mtd/partitions.h>
11
12/* lpddr_private describes lpddr flash chip in memory map
13 * @ManufactId - Chip Manufacture ID
14 * @DevId - Chip Device ID
15 * @qinfo - pointer to qinfo records describing the chip
16 * @numchips - number of chips including virual RWW partitions
17 * @chipshift - Chip/partiton size 2^chipshift
18 * @chips - per-chip data structure
19 */
20struct lpddr_private {
21 uint16_t ManufactId;
22 uint16_t DevId;
23 struct qinfo_chip *qinfo;
24 int numchips;
25 unsigned long chipshift;
26 struct flchip chips[0];
27};
28
29/* qinfo_query_info structure contains request information for
30 * each qinfo record
31 * @major - major number of qinfo record
32 * @major - minor number of qinfo record
33 * @id_str - descriptive string to access the record
34 * @desc - detailed description for the qinfo record
35 */
36struct qinfo_query_info {
37 uint8_t major;
38 uint8_t minor;
39 char *id_str;
40 char *desc;
41};
42
43/*
44 * qinfo_chip structure contains necessary qinfo records data
45 * @DevSizeShift - Device size 2^n bytes
46 * @BufSizeShift - Program buffer size 2^n bytes
47 * @TotalBlocksNum - Total number of blocks
48 * @UniformBlockSizeShift - Uniform block size 2^UniformBlockSizeShift bytes
49 * @HWPartsNum - Number of hardware partitions
50 * @SuspEraseSupp - Suspend erase supported
51 * @SingleWordProgTime - Single word program 2^SingleWordProgTime u-sec
52 * @ProgBufferTime - Program buffer write 2^ProgBufferTime u-sec
53 * @BlockEraseTime - Block erase 2^BlockEraseTime m-sec
54 */
55struct qinfo_chip {
56 /* General device info */
57 uint16_t DevSizeShift;
58 uint16_t BufSizeShift;
59 /* Erase block information */
60 uint16_t TotalBlocksNum;
61 uint16_t UniformBlockSizeShift;
62 /* Partition information */
63 uint16_t HWPartsNum;
64 /* Optional features */
65 uint16_t SuspEraseSupp;
66 /* Operation typical time */
67 uint16_t SingleWordProgTime;
68 uint16_t ProgBufferTime;
69 uint16_t BlockEraseTime;
70};
71
72/* defines for fixup usage */
73#define LPDDR_MFR_ANY 0xffff
74#define LPDDR_ID_ANY 0xffff
75#define NUMONYX_MFGR_ID 0x0089
76#define R18_DEVICE_ID_1G 0x893c
77
78static inline map_word lpddr_build_cmd(u_long cmd, struct map_info *map)
79{
80 map_word val = { {0} };
81 val.x[0] = cmd;
82 return val;
83}
84
85#define CMD(x) lpddr_build_cmd(x, map)
86#define CMDVAL(cmd) cmd.x[0]
87
88struct mtd_info *lpddr_cmdset(struct map_info *);
89
90#endif
91
diff --git a/include/linux/mtd/sharpsl.h b/include/linux/mtd/sharpsl.h
new file mode 100644
index 000000000000..25f4d2a845c1
--- /dev/null
+++ b/include/linux/mtd/sharpsl.h
@@ -0,0 +1,20 @@
1/*
2 * SharpSL NAND support
3 *
4 * Copyright (C) 2008 Dmitry Baryshkov
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/mtd/nand.h>
12#include <linux/mtd/nand_ecc.h>
13#include <linux/mtd/partitions.h>
14
15struct sharpsl_nand_platform_data {
16 struct nand_bbt_descr *badblock_pattern;
17 struct nand_ecclayout *ecc_layout;
18 struct mtd_partition *partitions;
19 unsigned int nr_partitions;
20};
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c28bbba3c23d..f24556813375 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1125,9 +1125,6 @@ struct softnet_data
1125 struct sk_buff *completion_queue; 1125 struct sk_buff *completion_queue;
1126 1126
1127 struct napi_struct backlog; 1127 struct napi_struct backlog;
1128#ifdef CONFIG_NET_DMA
1129 struct dma_chan *net_dma;
1130#endif
1131}; 1128};
1132 1129
1133DECLARE_PER_CPU(struct softnet_data,softnet_data); 1130DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -1373,8 +1370,14 @@ extern int netif_rx_ni(struct sk_buff *skb);
1373#define HAVE_NETIF_RECEIVE_SKB 1 1370#define HAVE_NETIF_RECEIVE_SKB 1
1374extern int netif_receive_skb(struct sk_buff *skb); 1371extern int netif_receive_skb(struct sk_buff *skb);
1375extern void napi_gro_flush(struct napi_struct *napi); 1372extern void napi_gro_flush(struct napi_struct *napi);
1373extern int dev_gro_receive(struct napi_struct *napi,
1374 struct sk_buff *skb);
1376extern int napi_gro_receive(struct napi_struct *napi, 1375extern int napi_gro_receive(struct napi_struct *napi,
1377 struct sk_buff *skb); 1376 struct sk_buff *skb);
1377extern void napi_reuse_skb(struct napi_struct *napi,
1378 struct sk_buff *skb);
1379extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1380 struct napi_gro_fraginfo *info);
1378extern int napi_gro_frags(struct napi_struct *napi, 1381extern int napi_gro_frags(struct napi_struct *napi,
1379 struct napi_gro_fraginfo *info); 1382 struct napi_gro_fraginfo *info);
1380extern void netif_nit_deliver(struct sk_buff *skb); 1383extern void netif_nit_deliver(struct sk_buff *skb);
diff --git a/include/linux/nwpserial.h b/include/linux/nwpserial.h
new file mode 100644
index 000000000000..9acb21572eaf
--- /dev/null
+++ b/include/linux/nwpserial.h
@@ -0,0 +1,18 @@
1/*
2 * Serial Port driver for a NWP uart device
3 *
4 * Copyright (C) 2008 IBM Corp., Benjamin Krill <ben@codiert.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12#ifndef _NWPSERIAL_H
13#define _NWPSERIAL_H
14
15int nwpserial_register_port(struct uart_port *port);
16void nwpserial_unregister_port(int line);
17
18#endif /* _NWPSERIAL_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 1ce9fe572e51..1d9518bc4c58 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -164,4 +164,22 @@ void oprofile_put_buff(unsigned long *buf, unsigned int start,
164unsigned long oprofile_get_cpu_buffer_size(void); 164unsigned long oprofile_get_cpu_buffer_size(void);
165void oprofile_cpu_buffer_inc_smpl_lost(void); 165void oprofile_cpu_buffer_inc_smpl_lost(void);
166 166
167/* cpu buffer functions */
168
169struct op_sample;
170
171struct op_entry {
172 struct ring_buffer_event *event;
173 struct op_sample *sample;
174 unsigned long irq_flags;
175 unsigned long size;
176 unsigned long *data;
177};
178
179void oprofile_write_reserve(struct op_entry *entry,
180 struct pt_regs * const regs,
181 unsigned long pc, int code, int size);
182int oprofile_add_data(struct op_entry *entry, unsigned long val);
183int oprofile_write_commit(struct op_entry *entry);
184
167#endif /* OPROFILE_H */ 185#endif /* OPROFILE_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 1e6d34bfa094..602cc1fdee90 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -26,10 +26,6 @@ enum {
26 PCG_LOCK, /* page cgroup is locked */ 26 PCG_LOCK, /* page cgroup is locked */
27 PCG_CACHE, /* charged as cache */ 27 PCG_CACHE, /* charged as cache */
28 PCG_USED, /* this object is in use. */ 28 PCG_USED, /* this object is in use. */
29 /* flags for LRU placement */
30 PCG_ACTIVE, /* page is active in this cgroup */
31 PCG_FILE, /* page is file system backed */
32 PCG_UNEVICTABLE, /* page is unevictableable */
33}; 29};
34 30
35#define TESTPCGFLAG(uname, lname) \ 31#define TESTPCGFLAG(uname, lname) \
@@ -50,19 +46,6 @@ TESTPCGFLAG(Cache, CACHE)
50TESTPCGFLAG(Used, USED) 46TESTPCGFLAG(Used, USED)
51CLEARPCGFLAG(Used, USED) 47CLEARPCGFLAG(Used, USED)
52 48
53/* LRU management flags (from global-lru definition) */
54TESTPCGFLAG(File, FILE)
55SETPCGFLAG(File, FILE)
56CLEARPCGFLAG(File, FILE)
57
58TESTPCGFLAG(Active, ACTIVE)
59SETPCGFLAG(Active, ACTIVE)
60CLEARPCGFLAG(Active, ACTIVE)
61
62TESTPCGFLAG(Unevictable, UNEVICTABLE)
63SETPCGFLAG(Unevictable, UNEVICTABLE)
64CLEARPCGFLAG(Unevictable, UNEVICTABLE)
65
66static inline int page_cgroup_nid(struct page_cgroup *pc) 49static inline int page_cgroup_nid(struct page_cgroup *pc)
67{ 50{
68 return page_to_nid(pc->page); 51 return page_to_nid(pc->page);
@@ -105,4 +88,39 @@ static inline void page_cgroup_init(void)
105} 88}
106 89
107#endif 90#endif
91
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
93#include <linux/swap.h>
94extern struct mem_cgroup *
95swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem);
96extern struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent);
97extern int swap_cgroup_swapon(int type, unsigned long max_pages);
98extern void swap_cgroup_swapoff(int type);
99#else
100#include <linux/swap.h>
101
102static inline
103struct mem_cgroup *swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem)
104{
105 return NULL;
106}
107
108static inline
109struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent)
110{
111 return NULL;
112}
113
114static inline int
115swap_cgroup_swapon(int type, unsigned long max_pages)
116{
117 return 0;
118}
119
120static inline void swap_cgroup_swapoff(int type)
121{
122 return;
123}
124
125#endif
108#endif 126#endif
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index f7cc204fab07..20998746518e 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -223,7 +223,6 @@ struct hotplug_params {
223#ifdef CONFIG_ACPI 223#ifdef CONFIG_ACPI
224#include <acpi/acpi.h> 224#include <acpi/acpi.h>
225#include <acpi/acpi_bus.h> 225#include <acpi/acpi_bus.h>
226#include <acpi/actypes.h>
227extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 226extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
228 struct hotplug_params *hpp); 227 struct hotplug_params *hpp);
229int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 228int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
diff --git a/include/linux/pid.h b/include/linux/pid.h
index bb206c56d1f0..49f1c2f66e95 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -123,6 +123,24 @@ extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
124 124
125/* 125/*
126 * ns_of_pid() returns the pid namespace in which the specified pid was
127 * allocated.
128 *
129 * NOTE:
130 * ns_of_pid() is expected to be called for a process (task) that has
131 * an attached 'struct pid' (see attach_pid(), detach_pid()) i.e @pid
132 * is expected to be non-NULL. If @pid is NULL, caller should handle
133 * the resulting NULL pid-ns.
134 */
135static inline struct pid_namespace *ns_of_pid(struct pid *pid)
136{
137 struct pid_namespace *ns = NULL;
138 if (pid)
139 ns = pid->numbers[pid->level].ns;
140 return ns;
141}
142
143/*
126 * the helpers to get the pid's id seen from different namespaces 144 * the helpers to get the pid's id seen from different namespaces
127 * 145 *
128 * pid_nr() : global id, i.e. the id seen from the init namespace; 146 * pid_nr() : global id, i.e. the id seen from the init namespace;
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index d82fe825d62f..38d10326246a 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -79,11 +79,7 @@ static inline void zap_pid_ns_processes(struct pid_namespace *ns)
79} 79}
80#endif /* CONFIG_PID_NS */ 80#endif /* CONFIG_PID_NS */
81 81
82static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) 82extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
83{
84 return tsk->nsproxy->pid_ns;
85}
86
87void pidhash_init(void); 83void pidhash_init(void);
88void pidmap_init(void); 84void pidmap_init(void);
89 85
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8fc909ef6787..9743e4dbc918 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -137,6 +137,9 @@ struct mddev_s
137 struct gendisk *gendisk; 137 struct gendisk *gendisk;
138 138
139 struct kobject kobj; 139 struct kobject kobj;
140 int hold_active;
141#define UNTIL_IOCTL 1
142#define UNTIL_STOP 2
140 143
141 /* Superblock information */ 144 /* Superblock information */
142 int major_version, 145 int major_version,
@@ -215,6 +218,9 @@ struct mddev_s
215#define MD_RECOVERY_FROZEN 9 218#define MD_RECOVERY_FROZEN 9
216 219
217 unsigned long recovery; 220 unsigned long recovery;
221 int recovery_disabled; /* if we detect that recovery
222 * will always fail, set this
223 * so we don't loop trying */
218 224
219 int in_sync; /* know to not need resync */ 225 int in_sync; /* know to not need resync */
220 struct mutex reconfig_mutex; 226 struct mutex reconfig_mutex;
@@ -244,6 +250,9 @@ struct mddev_s
244 struct sysfs_dirent *sysfs_state; /* handle for 'array_state' 250 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
245 * file in sysfs. 251 * file in sysfs.
246 */ 252 */
253 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
254
255 struct work_struct del_work; /* used for delayed sysfs removal */
247 256
248 spinlock_t write_lock; 257 spinlock_t write_lock;
249 wait_queue_head_t sb_wait; /* for waiting on superblock updates */ 258 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
@@ -334,17 +343,14 @@ static inline char * mdname (mddev_t * mddev)
334 * iterates through some rdev ringlist. It's safe to remove the 343 * iterates through some rdev ringlist. It's safe to remove the
335 * current 'rdev'. Dont touch 'tmp' though. 344 * current 'rdev'. Dont touch 'tmp' though.
336 */ 345 */
337#define rdev_for_each_list(rdev, tmp, list) \ 346#define rdev_for_each_list(rdev, tmp, head) \
338 \ 347 list_for_each_entry_safe(rdev, tmp, head, same_set)
339 for ((tmp) = (list).next; \ 348
340 (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), \
341 (tmp) = (tmp)->next, (tmp)->prev != &(list) \
342 ; )
343/* 349/*
344 * iterates through the 'same array disks' ringlist 350 * iterates through the 'same array disks' ringlist
345 */ 351 */
346#define rdev_for_each(rdev, tmp, mddev) \ 352#define rdev_for_each(rdev, tmp, mddev) \
347 rdev_for_each_list(rdev, tmp, (mddev)->disks) 353 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
348 354
349#define rdev_for_each_rcu(rdev, mddev) \ 355#define rdev_for_each_rcu(rdev, mddev) \
350 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) 356 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8b4de4a41ff1..9491026afe66 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -194,6 +194,8 @@ static inline __u64 md_event(mdp_super_t *sb) {
194 return (ev<<32)| sb->events_lo; 194 return (ev<<32)| sb->events_lo;
195} 195}
196 196
197#define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1)
198
197/* 199/*
198 * The version-1 superblock : 200 * The version-1 superblock :
199 * All numeric fields are little-endian. 201 * All numeric fields are little-endian.
diff --git a/include/linux/raid/raid0.h b/include/linux/raid/raid0.h
index 1b2dda035f8e..fd42aa87c391 100644
--- a/include/linux/raid/raid0.h
+++ b/include/linux/raid/raid0.h
@@ -5,9 +5,9 @@
5 5
6struct strip_zone 6struct strip_zone
7{ 7{
8 sector_t zone_offset; /* Zone offset in md_dev */ 8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */
9 sector_t dev_offset; /* Zone offset in real dev */ 9 sector_t dev_start; /* Zone offset in real dev (in sectors) */
10 sector_t size; /* Zone size */ 10 sector_t sectors; /* Zone size in sectors */
11 int nb_dev; /* # of devices attached to the zone */ 11 int nb_dev; /* # of devices attached to the zone */
12 mdk_rdev_t **dev; /* Devices attached to the zone */ 12 mdk_rdev_t **dev; /* Devices attached to the zone */
13}; 13};
@@ -19,8 +19,8 @@ struct raid0_private_data
19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ 19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
20 int nr_strip_zones; 20 int nr_strip_zones;
21 21
22 sector_t hash_spacing; 22 sector_t spacing;
23 int preshift; /* shift this before divide by hash_spacing */ 23 int sector_shift; /* shift this before divide by spacing */
24}; 24};
25 25
26typedef struct raid0_private_data raid0_conf_t; 26typedef struct raid0_private_data raid0_conf_t;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index afdc4558bb94..801bf77ff4e2 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -104,10 +104,10 @@ struct regulator;
104/** 104/**
105 * struct regulator_bulk_data - Data used for bulk regulator operations. 105 * struct regulator_bulk_data - Data used for bulk regulator operations.
106 * 106 *
107 * @supply The name of the supply. Initialised by the user before 107 * @supply: The name of the supply. Initialised by the user before
108 * using the bulk regulator APIs. 108 * using the bulk regulator APIs.
109 * @consumer The regulator consumer for the supply. This will be managed 109 * @consumer: The regulator consumer for the supply. This will be managed
110 * by the bulk API. 110 * by the bulk API.
111 * 111 *
112 * The regulator APIs provide a series of regulator_bulk_() API calls as 112 * The regulator APIs provide a series of regulator_bulk_() API calls as
113 * a convenience to consumers which require multiple supplies. This 113 * a convenience to consumers which require multiple supplies. This
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index e37d80561985..2dae05705f13 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -24,7 +24,33 @@ struct regulator_init_data;
24/** 24/**
25 * struct regulator_ops - regulator operations. 25 * struct regulator_ops - regulator operations.
26 * 26 *
27 * This struct describes regulator operations. 27 * This struct describes regulator operations which can be implemented by
28 * regulator chip drivers.
29 *
30 * @enable: Enable the regulator.
31 * @disable: Disable the regulator.
32 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise.
33 *
34 * @set_voltage: Set the voltage for the regulator within the range specified.
35 * The driver should select the voltage closest to min_uV.
36 * @get_voltage: Return the currently configured voltage for the regulator.
37 *
38 * @set_current_limit: Configure a limit for a current-limited regulator.
39 * @get_current_limit: Get the limit for a current-limited regulator.
40 *
41 * @set_mode: Set the operating mode for the regulator.
42 * @get_mode: Get the current operating mode for the regulator.
43 * @get_optimum_mode: Get the most efficient operating mode for the regulator
44 * when running with the specified parameters.
45 *
46 * @set_suspend_voltage: Set the voltage for the regulator when the system
47 * is suspended.
48 * @set_suspend_enable: Mark the regulator as enabled when the system is
49 * suspended.
50 * @set_suspend_disable: Mark the regulator as disabled when the system is
51 * suspended.
52 * @set_suspend_mode: Set the operating mode for the regulator when the
53 * system is suspended.
28 */ 54 */
29struct regulator_ops { 55struct regulator_ops {
30 56
@@ -75,6 +101,15 @@ enum regulator_type {
75/** 101/**
76 * struct regulator_desc - Regulator descriptor 102 * struct regulator_desc - Regulator descriptor
77 * 103 *
104 * Each regulator registered with the core is described with a structure of
105 * this type.
106 *
107 * @name: Identifying name for the regulator.
108 * @id: Numerical identifier for the regulator.
109 * @ops: Regulator operations table.
110 * @irq: Interrupt number for the regulator.
111 * @type: Indicates if the regulator is a voltage or current regulator.
112 * @owner: Module providing the regulator, used for refcounting.
78 */ 113 */
79struct regulator_desc { 114struct regulator_desc {
80 const char *name; 115 const char *name;
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index c6d69331a81e..3794773b23d2 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -44,6 +44,10 @@ struct regulator;
44 * struct regulator_state - regulator state during low power syatem states 44 * struct regulator_state - regulator state during low power syatem states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power state.
47 *
48 * @uV: Operating voltage during suspend.
49 * @mode: Operating mode during suspend.
50 * @enabled: Enabled during suspend.
47 */ 51 */
48struct regulator_state { 52struct regulator_state {
49 int uV; /* suspend voltage */ 53 int uV; /* suspend voltage */
@@ -55,6 +59,30 @@ struct regulator_state {
55 * struct regulation_constraints - regulator operating constraints. 59 * struct regulation_constraints - regulator operating constraints.
56 * 60 *
57 * This struct describes regulator and board/machine specific constraints. 61 * This struct describes regulator and board/machine specific constraints.
62 *
63 * @name: Descriptive name for the constraints, used for display purposes.
64 *
65 * @min_uV: Smallest voltage consumers may set.
66 * @max_uV: Largest voltage consumers may set.
67 *
68 * @min_uA: Smallest consumers consumers may set.
69 * @max_uA: Largest current consumers may set.
70 *
71 * @valid_modes_mask: Mask of modes which may be configured by consumers.
72 * @valid_ops_mask: Operations which may be performed by consumers.
73 *
74 * @always_on: Set if the regulator should never be disabled.
75 * @boot_on: Set if the regulator is enabled when the system is initially
76 * started.
77 * @apply_uV: Apply the voltage constraint when initialising.
78 *
79 * @input_uV: Input voltage for regulator when supplied by another regulator.
80 *
81 * @state_disk: State for regulator when system is suspended in disk mode.
82 * @state_mem: State for regulator when system is suspended in mem mode.
83 * @state_standby: State for regulator when system is suspended in standby
84 * mode.
85 * @initial_state: Suspend state to set by default.
58 */ 86 */
59struct regulation_constraints { 87struct regulation_constraints {
60 88
@@ -93,6 +121,9 @@ struct regulation_constraints {
93 * struct regulator_consumer_supply - supply -> device mapping 121 * struct regulator_consumer_supply - supply -> device mapping
94 * 122 *
95 * This maps a supply name to a device. 123 * This maps a supply name to a device.
124 *
125 * @dev: Device structure for the consumer.
126 * @supply: Name for the supply.
96 */ 127 */
97struct regulator_consumer_supply { 128struct regulator_consumer_supply {
98 struct device *dev; /* consumer */ 129 struct device *dev; /* consumer */
@@ -103,6 +134,16 @@ struct regulator_consumer_supply {
103 * struct regulator_init_data - regulator platform initialisation data. 134 * struct regulator_init_data - regulator platform initialisation data.
104 * 135 *
105 * Initialisation constraints, our supply and consumers supplies. 136 * Initialisation constraints, our supply and consumers supplies.
137 *
138 * @supply_regulator_dev: Parent regulator (if any).
139 *
140 * @constraints: Constraints. These must be specified for the regulator to
141 * be usable.
142 * @num_consumer_supplies: Number of consumer device supplies.
143 * @consumer_supplies: Consumer device supply configuration.
144 *
145 * @regulator_init: Callback invoked when the regulator has been registered.
146 * @driver_data: Data passed to regulator_init.
106 */ 147 */
107struct regulator_init_data { 148struct regulator_init_data {
108 struct device *supply_regulator_dev; /* or NULL for LINE */ 149 struct device *supply_regulator_dev; /* or NULL for LINE */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 271c1c2c9f6f..dede0a2cfc45 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -43,6 +43,10 @@ struct res_counter {
43 * the routines below consider this to be IRQ-safe 43 * the routines below consider this to be IRQ-safe
44 */ 44 */
45 spinlock_t lock; 45 spinlock_t lock;
46 /*
47 * Parent counter, used for hierarchial resource accounting
48 */
49 struct res_counter *parent;
46}; 50};
47 51
48/** 52/**
@@ -87,7 +91,7 @@ enum {
87 * helpers for accounting 91 * helpers for accounting
88 */ 92 */
89 93
90void res_counter_init(struct res_counter *counter); 94void res_counter_init(struct res_counter *counter, struct res_counter *parent);
91 95
92/* 96/*
93 * charge - try to consume more resource. 97 * charge - try to consume more resource.
@@ -103,7 +107,7 @@ void res_counter_init(struct res_counter *counter);
103int __must_check res_counter_charge_locked(struct res_counter *counter, 107int __must_check res_counter_charge_locked(struct res_counter *counter,
104 unsigned long val); 108 unsigned long val);
105int __must_check res_counter_charge(struct res_counter *counter, 109int __must_check res_counter_charge(struct res_counter *counter,
106 unsigned long val); 110 unsigned long val, struct res_counter **limit_fail_at);
107 111
108/* 112/*
109 * uncharge - tell that some portion of the resource is released 113 * uncharge - tell that some portion of the resource is released
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b4199841f1fc..90bbbf0b1161 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -161,6 +161,9 @@
161 161
162#define PORT_S3C6400 84 162#define PORT_S3C6400 84
163 163
164/* NWPSERIAL */
165#define PORT_NWPSERIAL 85
166
164#ifdef __KERNEL__ 167#ifdef __KERNEL__
165 168
166#include <linux/compiler.h> 169#include <linux/compiler.h>
diff --git a/include/linux/spi/tdo24m.h b/include/linux/spi/tdo24m.h
new file mode 100644
index 000000000000..7572d4e1fe76
--- /dev/null
+++ b/include/linux/spi/tdo24m.h
@@ -0,0 +1,13 @@
1#ifndef __TDO24M_H__
2#define __TDO24M_H__
3
4enum tdo24m_model {
5 TDO24M,
6 TDO35S,
7};
8
9struct tdo24m_platform_data {
10 enum tdo24m_model model;
11};
12
13#endif /* __TDO24M_H__ */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 2ce8207686e2..2b409c44db83 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -232,6 +232,11 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
232 232
233extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 233extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
234extern int hibernate(void); 234extern int hibernate(void);
235extern int hibernate_nvs_register(unsigned long start, unsigned long size);
236extern int hibernate_nvs_alloc(void);
237extern void hibernate_nvs_free(void);
238extern void hibernate_nvs_save(void);
239extern void hibernate_nvs_restore(void);
235#else /* CONFIG_HIBERNATION */ 240#else /* CONFIG_HIBERNATION */
236static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 241static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
237static inline void swsusp_set_page_free(struct page *p) {} 242static inline void swsusp_set_page_free(struct page *p) {}
@@ -239,6 +244,14 @@ static inline void swsusp_unset_page_free(struct page *p) {}
239 244
240static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 245static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
241static inline int hibernate(void) { return -ENOSYS; } 246static inline int hibernate(void) { return -ENOSYS; }
247static inline int hibernate_nvs_register(unsigned long a, unsigned long b)
248{
249 return 0;
250}
251static inline int hibernate_nvs_alloc(void) { return 0; }
252static inline void hibernate_nvs_free(void) {}
253static inline void hibernate_nvs_save(void) {}
254static inline void hibernate_nvs_restore(void) {}
242#endif /* CONFIG_HIBERNATION */ 255#endif /* CONFIG_HIBERNATION */
243 256
244#ifdef CONFIG_PM_SLEEP 257#ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 91dee50fe260..d30215578877 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -214,7 +214,8 @@ static inline void lru_cache_add_active_file(struct page *page)
214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
215 gfp_t gfp_mask); 215 gfp_t gfp_mask);
216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
217 gfp_t gfp_mask); 217 gfp_t gfp_mask, bool noswap,
218 unsigned int swappiness);
218extern int __isolate_lru_page(struct page *page, int mode, int file); 219extern int __isolate_lru_page(struct page *page, int mode, int file);
219extern unsigned long shrink_all_memory(unsigned long nr_pages); 220extern unsigned long shrink_all_memory(unsigned long nr_pages);
220extern int vm_swappiness; 221extern int vm_swappiness;
@@ -333,6 +334,22 @@ static inline void disable_swap_token(void)
333 put_swap_token(swap_token_mm); 334 put_swap_token(swap_token_mm);
334} 335}
335 336
337#ifdef CONFIG_CGROUP_MEM_RES_CTLR
338extern void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent);
339#else
340static inline void
341mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
342{
343}
344#endif
345#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
346extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
347#else
348static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
349{
350}
351#endif
352
336#else /* CONFIG_SWAP */ 353#else /* CONFIG_SWAP */
337 354
338#define nr_swap_pages 0L 355#define nr_swap_pages 0L
@@ -409,6 +426,12 @@ static inline swp_entry_t get_swap_page(void)
409#define has_swap_token(x) 0 426#define has_swap_token(x) 0
410#define disable_swap_token() do { } while(0) 427#define disable_swap_token() do { } while(0)
411 428
429static inline int mem_cgroup_cache_charge_swapin(struct page *page,
430 struct mm_struct *mm, gfp_t mask, bool locked)
431{
432 return 0;
433}
434
412#endif /* CONFIG_SWAP */ 435#endif /* CONFIG_SWAP */
413#endif /* __KERNEL__*/ 436#endif /* __KERNEL__*/
414#endif /* _LINUX_SWAP_H */ 437#endif /* _LINUX_SWAP_H */
diff --git a/include/net/netdma.h b/include/net/netdma.h
index f28c6e064e8f..8ba8ce284eeb 100644
--- a/include/net/netdma.h
+++ b/include/net/netdma.h
@@ -24,17 +24,6 @@
24#include <linux/dmaengine.h> 24#include <linux/dmaengine.h>
25#include <linux/skbuff.h> 25#include <linux/skbuff.h>
26 26
27static inline struct dma_chan *get_softnet_dma(void)
28{
29 struct dma_chan *chan;
30 rcu_read_lock();
31 chan = rcu_dereference(__get_cpu_var(softnet_data).net_dma);
32 if (chan)
33 dma_chan_get(chan);
34 rcu_read_unlock();
35 return chan;
36}
37
38int dma_skb_copy_datagram_iovec(struct dma_chan* chan, 27int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
39 struct sk_buff *skb, int offset, struct iovec *to, 28 struct sk_buff *skb, int offset, struct iovec *to,
40 size_t len, struct dma_pinned_list *pinned_list); 29 size_t len, struct dma_pinned_list *pinned_list);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index cb2965aa1b62..ffa5b8b1f1df 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -59,6 +59,9 @@ struct inet6_protocol
59 int (*gso_send_check)(struct sk_buff *skb); 59 int (*gso_send_check)(struct sk_buff *skb);
60 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 60 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
61 int features); 61 int features);
62 struct sk_buff **(*gro_receive)(struct sk_buff **head,
63 struct sk_buff *skb);
64 int (*gro_complete)(struct sk_buff *skb);
62 65
63 unsigned int flags; /* INET6_PROTO_xxx */ 66 unsigned int flags; /* INET6_PROTO_xxx */
64}; 67};
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 1602614fdaf9..073809ce94f8 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -323,6 +323,9 @@ struct input_dev;
323 * 323 *
324 * @rf_hw: [private] State of the hardware radio switch (OFF/ON) 324 * @rf_hw: [private] State of the hardware radio switch (OFF/ON)
325 * 325 *
326 * @debufs_dentry: [private] Used to hook up a debugfs entry. This
327 * shows up in the debugfs root as wimax:DEVICENAME.
328 *
326 * Description: 329 * Description:
327 * This structure defines a common interface to access all WiMAX 330 * This structure defines a common interface to access all WiMAX
328 * devices from different vendors and provides a common API as well as 331 * devices from different vendors and provides a common API as well as
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 6e04e6fe79c7..c9184f756cad 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -358,6 +358,7 @@ struct fc_rport { /* aka fc_starget_attrs */
358#define FC_RPORT_DEVLOSS_PENDING 0x01 358#define FC_RPORT_DEVLOSS_PENDING 0x01
359#define FC_RPORT_SCAN_PENDING 0x02 359#define FC_RPORT_SCAN_PENDING 0x02
360#define FC_RPORT_FAST_FAIL_TIMEDOUT 0x04 360#define FC_RPORT_FAST_FAIL_TIMEDOUT 0x04
361#define FC_RPORT_DEVLOSS_CALLBK_DONE 0x08
361 362
362#define dev_to_rport(d) \ 363#define dev_to_rport(d) \
363 container_of(d, struct fc_rport, dev) 364 container_of(d, struct fc_rport, dev)
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 6369d89c25d5..f87f9614844d 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -136,8 +136,6 @@ struct xenbus_transaction
136/* Nil transaction ID. */ 136/* Nil transaction ID. */
137#define XBT_NIL ((struct xenbus_transaction) { 0 }) 137#define XBT_NIL ((struct xenbus_transaction) { 0 })
138 138
139int __init xenbus_dev_init(void);
140
141char **xenbus_directory(struct xenbus_transaction t, 139char **xenbus_directory(struct xenbus_transaction t,
142 const char *dir, const char *node, unsigned int *num); 140 const char *dir, const char *node, unsigned int *num);
143void *xenbus_read(struct xenbus_transaction t, 141void *xenbus_read(struct xenbus_transaction t,