]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/acpi/actypes.h
[ACPI] acpi_register_gsi() fix needed for ACPICA 20051021
[mirror_ubuntu-zesty-kernel.git] / include / acpi / actypes.h
CommitLineData
1da177e4
LT
1/******************************************************************************
2 *
3 * Name: actypes.h - Common data types for the entire ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
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 __ACTYPES_H__
45#define __ACTYPES_H__
46
47/*! [Begin] no source code translation (keep the typedefs) */
48
1da177e4
LT
49/*
50 * Data type ranges
51 * Note: These macros are designed to be compiler independent as well as
52 * working around problems that some 32-bit compilers have with 64-bit
53 * constants.
54 */
4be44fcd
LB
55#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
56#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
57#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
58#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
1da177e4
LT
59#define ACPI_ASCII_MAX 0x7F
60
1da177e4
LT
61#ifdef DEFINE_ALTERNATE_TYPES
62/*
63 * Types used only in translated source, defined here to enable
64 * cross-platform compilation only.
65 */
4be44fcd
LB
66typedef int s32;
67typedef unsigned char u8;
68typedef unsigned short u16;
69typedef unsigned int u32;
70typedef COMPILER_DEPENDENT_UINT64 u64;
1da177e4
LT
71
72#endif
73
1da177e4
LT
74/*
75 * Data types - Fixed across all compilation models (16/32/64)
76 *
77 * BOOLEAN Logical Boolean.
78 * INT8 8-bit (1 byte) signed value
79 * UINT8 8-bit (1 byte) unsigned value
80 * INT16 16-bit (2 byte) signed value
81 * UINT16 16-bit (2 byte) unsigned value
82 * INT32 32-bit (4 byte) signed value
83 * UINT32 32-bit (4 byte) unsigned value
84 * INT64 64-bit (8 byte) signed value
85 * UINT64 64-bit (8 byte) unsigned value
0897831b 86 * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value
1da177e4
LT
87 */
88
0897831b
BM
89typedef unsigned long acpi_native_uint;
90
1da177e4
LT
91#ifndef ACPI_MACHINE_WIDTH
92#error ACPI_MACHINE_WIDTH not defined
93#endif
94
95#if ACPI_MACHINE_WIDTH == 64
96
97/*! [Begin] no source code translation (keep the typedefs) */
98
99/*
100 * 64-bit type definitions
101 */
4be44fcd
LB
102typedef unsigned char UINT8;
103typedef unsigned char BOOLEAN;
104typedef unsigned short UINT16;
105typedef int INT32;
106typedef unsigned int UINT32;
107typedef COMPILER_DEPENDENT_INT64 INT64;
108typedef COMPILER_DEPENDENT_UINT64 UINT64;
1da177e4
LT
109
110/*! [End] no source code translation !*/
111
4be44fcd
LB
112typedef u64 acpi_table_ptr;
113typedef u64 acpi_io_address;
114typedef u64 acpi_physical_address;
115typedef u64 acpi_size;
1da177e4 116
4be44fcd
LB
117#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
118#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
1da177e4
LT
119#define ACPI_MAX_PTR ACPI_UINT64_MAX
120#define ACPI_SIZE_MAX ACPI_UINT64_MAX
121
0897831b
BM
122/*
123 * In the case of the Itanium Processor Family (IPF), the hardware does not
124 * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
125 * to indicate that special precautions must be taken to avoid alignment faults.
126 * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
127 *
128 * Note: Em64_t and other X86-64 processors do support misaligned transfers,
129 * so there is no need to define this flag.
130 */
131#if defined (__IA64__) || defined (__ia64__)
132#define ACPI_MISALIGNMENT_NOT_SUPPORTED
133#endif
134
1da177e4
LT
135#elif ACPI_MACHINE_WIDTH == 16
136
0897831b 137/*! [Begin] no source code translation (keep the typedefs as-is) */
1da177e4
LT
138
139/*
140 * 16-bit type definitions
141 */
4be44fcd
LB
142typedef unsigned char UINT8;
143typedef unsigned char BOOLEAN;
144typedef unsigned int UINT16;
145typedef long INT32;
146typedef int INT16;
147typedef unsigned long UINT32;
148
149struct {
150 UINT32 Lo;
151 UINT32 Hi;
1da177e4
LT
152};
153
154/*! [End] no source code translation !*/
155
4be44fcd
LB
156typedef u32 acpi_table_ptr;
157typedef u32 acpi_io_address;
158typedef char *acpi_physical_address;
159typedef u16 acpi_size;
1da177e4
LT
160
161#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
4be44fcd 162#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
1da177e4
LT
163#define ACPI_MAX_PTR ACPI_UINT16_MAX
164#define ACPI_SIZE_MAX ACPI_UINT16_MAX
165
166/*
167 * (16-bit only) internal integers must be 32-bits, so
168 * 64-bit integers cannot be supported
169 */
170#define ACPI_NO_INTEGER64_SUPPORT
171
1da177e4
LT
172#elif ACPI_MACHINE_WIDTH == 32
173
174/*! [Begin] no source code translation (keep the typedefs) */
175
176/*
177 * 32-bit type definitions (default)
178 */
4be44fcd
LB
179typedef unsigned char UINT8;
180typedef unsigned char BOOLEAN;
181typedef unsigned short UINT16;
182typedef int INT32;
183typedef unsigned int UINT32;
184typedef COMPILER_DEPENDENT_INT64 INT64;
185typedef COMPILER_DEPENDENT_UINT64 UINT64;
1da177e4
LT
186
187/*! [End] no source code translation !*/
188
4be44fcd
LB
189typedef u64 acpi_table_ptr;
190typedef u32 acpi_io_address;
191typedef u64 acpi_physical_address;
192typedef u32 acpi_size;
1da177e4
LT
193
194#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
1da177e4
LT
195#define ACPI_MAX_PTR ACPI_UINT32_MAX
196#define ACPI_SIZE_MAX ACPI_UINT32_MAX
197
198#else
199#error unknown ACPI_MACHINE_WIDTH
200#endif
201
1da177e4 202/*
f9f4601f
RM
203 * This type is used for bitfields in ACPI tables. The only type that is
204 * even remotely portable is u8. Anything else is not portable, so
205 * do not add any more bitfield types.
1da177e4 206 */
4be44fcd
LB
207typedef u8 UINT8_BIT;
208typedef acpi_native_uint ACPI_PTRDIFF;
1da177e4
LT
209
210/*
211 * Pointer overlays to avoid lots of typecasting for
212 * code that accepts both physical and logical pointers.
213 */
4be44fcd
LB
214union acpi_pointers {
215 acpi_physical_address physical;
216 void *logical;
217 acpi_table_ptr value;
1da177e4
LT
218};
219
4be44fcd
LB
220struct acpi_pointer {
221 u32 pointer_type;
222 union acpi_pointers pointer;
1da177e4
LT
223};
224
225/* pointer_types for above */
226
227#define ACPI_PHYSICAL_POINTER 0x01
228#define ACPI_LOGICAL_POINTER 0x02
229
230/* Processor mode */
231
232#define ACPI_PHYSICAL_ADDRESSING 0x04
233#define ACPI_LOGICAL_ADDRESSING 0x08
234#define ACPI_MEMORY_MODE 0x0C
235
236#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
237#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
238#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
239
f9f4601f
RM
240/*
241 * If acpi_cache_t was not defined in the OS-dependent header,
242 * define it now. This is typically the case where the local cache
243 * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
244 */
245#ifndef acpi_cache_t
246#define acpi_cache_t struct acpi_memory_list
73459f73 247#endif
1da177e4
LT
248
249/*
250 * Useful defines
251 */
252#ifdef FALSE
253#undef FALSE
254#endif
255#define FALSE (1 == 0)
256
257#ifdef TRUE
258#undef TRUE
259#endif
260#define TRUE (1 == 1)
261
262#ifndef NULL
263#define NULL (void *) 0
264#endif
265
1da177e4
LT
266/*
267 * Local datatypes
268 */
4be44fcd
LB
269typedef u32 acpi_status; /* All ACPI Exceptions */
270typedef u32 acpi_name; /* 4-byte ACPI name */
271typedef char *acpi_string; /* Null terminated ASCII string */
272typedef void *acpi_handle; /* Actually a ptr to an Node */
273
274struct uint64_struct {
275 u32 lo;
276 u32 hi;
1da177e4
LT
277};
278
4be44fcd
LB
279union uint64_overlay {
280 u64 full;
281 struct uint64_struct part;
1da177e4
LT
282};
283
4be44fcd
LB
284struct uint32_struct {
285 u32 lo;
286 u32 hi;
1da177e4
LT
287};
288
1da177e4
LT
289/*
290 * Acpi integer width. In ACPI version 1, integers are
291 * 32 bits. In ACPI version 2, integers are 64 bits.
292 * Note that this pertains to the ACPI integer type only, not
293 * other integers used in the implementation of the ACPI CA
294 * subsystem.
295 */
296#ifdef ACPI_NO_INTEGER64_SUPPORT
297
298/* 32-bit integers only, no 64-bit support */
299
4be44fcd 300typedef u32 acpi_integer;
1da177e4
LT
301#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
302#define ACPI_INTEGER_BIT_SIZE 32
4be44fcd 303#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */
1da177e4 304
4be44fcd 305#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
1da177e4
LT
306
307#else
308
309/* 64-bit integers */
310
4be44fcd 311typedef u64 acpi_integer;
1da177e4
LT
312#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
313#define ACPI_INTEGER_BIT_SIZE 64
4be44fcd 314#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
1da177e4
LT
315
316#if ACPI_MACHINE_WIDTH == 64
4be44fcd 317#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
1da177e4
LT
318#endif
319#endif
320
321#define ACPI_MAX64_DECIMAL_DIGITS 20
322#define ACPI_MAX32_DECIMAL_DIGITS 10
323#define ACPI_MAX16_DECIMAL_DIGITS 5
324#define ACPI_MAX8_DECIMAL_DIGITS 3
325
326/*
327 * Constants with special meanings
328 */
c51a4de8 329#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR)
1da177e4 330
1da177e4
LT
331/*
332 * Initialization sequence
333 */
334#define ACPI_FULL_INITIALIZATION 0x00
335#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
336#define ACPI_NO_HARDWARE_INIT 0x02
337#define ACPI_NO_EVENT_INIT 0x04
338#define ACPI_NO_HANDLER_INIT 0x08
339#define ACPI_NO_ACPI_ENABLE 0x10
340#define ACPI_NO_DEVICE_INIT 0x20
341#define ACPI_NO_OBJECT_INIT 0x40
342
343/*
344 * Initialization state
345 */
346#define ACPI_INITIALIZED_OK 0x01
347
348/*
349 * Power state values
350 */
351#define ACPI_STATE_UNKNOWN (u8) 0xFF
352
353#define ACPI_STATE_S0 (u8) 0
354#define ACPI_STATE_S1 (u8) 1
355#define ACPI_STATE_S2 (u8) 2
356#define ACPI_STATE_S3 (u8) 3
357#define ACPI_STATE_S4 (u8) 4
358#define ACPI_STATE_S5 (u8) 5
359#define ACPI_S_STATES_MAX ACPI_STATE_S5
360#define ACPI_S_STATE_COUNT 6
361
362#define ACPI_STATE_D0 (u8) 0
363#define ACPI_STATE_D1 (u8) 1
364#define ACPI_STATE_D2 (u8) 2
365#define ACPI_STATE_D3 (u8) 3
366#define ACPI_D_STATES_MAX ACPI_STATE_D3
367#define ACPI_D_STATE_COUNT 4
368
369#define ACPI_STATE_C0 (u8) 0
370#define ACPI_STATE_C1 (u8) 1
371#define ACPI_STATE_C2 (u8) 2
372#define ACPI_STATE_C3 (u8) 3
373#define ACPI_C_STATES_MAX ACPI_STATE_C3
374#define ACPI_C_STATE_COUNT 4
375
376/*
377 * Sleep type invalid value
378 */
379#define ACPI_SLEEP_TYPE_MAX 0x7
380#define ACPI_SLEEP_TYPE_INVALID 0xFF
381
382/*
383 * Standard notify values
384 */
385#define ACPI_NOTIFY_BUS_CHECK (u8) 0
386#define ACPI_NOTIFY_DEVICE_CHECK (u8) 1
387#define ACPI_NOTIFY_DEVICE_WAKE (u8) 2
388#define ACPI_NOTIFY_EJECT_REQUEST (u8) 3
389#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4
390#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5
391#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6
392#define ACPI_NOTIFY_POWER_FAULT (u8) 7
393
394/*
395 * Table types. These values are passed to the table related APIs
396 */
4be44fcd 397typedef u32 acpi_table_type;
1da177e4
LT
398
399#define ACPI_TABLE_RSDP (acpi_table_type) 0
400#define ACPI_TABLE_DSDT (acpi_table_type) 1
401#define ACPI_TABLE_FADT (acpi_table_type) 2
402#define ACPI_TABLE_FACS (acpi_table_type) 3
403#define ACPI_TABLE_PSDT (acpi_table_type) 4
404#define ACPI_TABLE_SSDT (acpi_table_type) 5
405#define ACPI_TABLE_XSDT (acpi_table_type) 6
406#define ACPI_TABLE_MAX 6
407#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
408
409/*
410 * Types associated with ACPI names and objects. The first group of
411 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
412 * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
413 * only add to the first group if the spec changes.
414 *
415 * NOTE: Types must be kept in sync with the global acpi_ns_properties
416 * and acpi_ns_type_names arrays.
417 */
4be44fcd 418typedef u32 acpi_object_type;
1da177e4
LT
419
420#define ACPI_TYPE_ANY 0x00
4be44fcd 421#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
1da177e4
LT
422#define ACPI_TYPE_STRING 0x02
423#define ACPI_TYPE_BUFFER 0x03
4be44fcd 424#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */
1da177e4 425#define ACPI_TYPE_FIELD_UNIT 0x05
4be44fcd 426#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */
1da177e4 427#define ACPI_TYPE_EVENT 0x07
4be44fcd 428#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */
1da177e4
LT
429#define ACPI_TYPE_MUTEX 0x09
430#define ACPI_TYPE_REGION 0x0A
4be44fcd
LB
431#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */
432#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */
433#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */
1da177e4
LT
434#define ACPI_TYPE_BUFFER_FIELD 0x0E
435#define ACPI_TYPE_DDB_HANDLE 0x0F
436#define ACPI_TYPE_DEBUG_OBJECT 0x10
437
438#define ACPI_TYPE_EXTERNAL_MAX 0x10
439
440/*
441 * These are object types that do not map directly to the ACPI
442 * object_type() operator. They are used for various internal purposes only.
443 * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
444 * internal types must move upwards. (There is code that depends on these
445 * values being contiguous with the external types above.)
446 */
447#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11
448#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12
449#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13
4be44fcd 450#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */
1da177e4
LT
451#define ACPI_TYPE_LOCAL_ALIAS 0x15
452#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16
453#define ACPI_TYPE_LOCAL_NOTIFY 0x17
454#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
455#define ACPI_TYPE_LOCAL_RESOURCE 0x19
456#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A
4be44fcd 457#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */
1da177e4 458
4be44fcd 459#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */
1da177e4
LT
460
461/*
462 * These are special object types that never appear in
463 * a Namespace node, only in an union acpi_operand_object
464 */
465#define ACPI_TYPE_LOCAL_EXTRA 0x1C
466#define ACPI_TYPE_LOCAL_DATA 0x1D
467
468#define ACPI_TYPE_LOCAL_MAX 0x1D
469
470/* All types above here are invalid */
471
472#define ACPI_TYPE_INVALID 0x1E
473#define ACPI_TYPE_NOT_FOUND 0xFF
474
1da177e4
LT
475/*
476 * Bitmapped ACPI types. Used internally only
477 */
478#define ACPI_BTYPE_ANY 0x00000000
479#define ACPI_BTYPE_INTEGER 0x00000001
480#define ACPI_BTYPE_STRING 0x00000002
481#define ACPI_BTYPE_BUFFER 0x00000004
482#define ACPI_BTYPE_PACKAGE 0x00000008
483#define ACPI_BTYPE_FIELD_UNIT 0x00000010
484#define ACPI_BTYPE_DEVICE 0x00000020
485#define ACPI_BTYPE_EVENT 0x00000040
486#define ACPI_BTYPE_METHOD 0x00000080
487#define ACPI_BTYPE_MUTEX 0x00000100
488#define ACPI_BTYPE_REGION 0x00000200
489#define ACPI_BTYPE_POWER 0x00000400
490#define ACPI_BTYPE_PROCESSOR 0x00000800
491#define ACPI_BTYPE_THERMAL 0x00001000
492#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
493#define ACPI_BTYPE_DDB_HANDLE 0x00004000
494#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
495#define ACPI_BTYPE_REFERENCE 0x00010000
496#define ACPI_BTYPE_RESOURCE 0x00020000
497
498#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
499
500#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
501#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
502#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
4be44fcd 503#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
1da177e4
LT
504#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
505
506/*
507 * All I/O
508 */
509#define ACPI_READ 0
510#define ACPI_WRITE 1
511#define ACPI_IO_MASK 1
512
513/*
514 * Event Types: Fixed & General Purpose
515 */
4be44fcd 516typedef u32 acpi_event_type;
1da177e4
LT
517
518/*
519 * Fixed events
520 */
521#define ACPI_EVENT_PMTIMER 0
522#define ACPI_EVENT_GLOBAL 1
523#define ACPI_EVENT_POWER_BUTTON 2
524#define ACPI_EVENT_SLEEP_BUTTON 3
525#define ACPI_EVENT_RTC 4
526#define ACPI_EVENT_MAX 4
527#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
528
529/*
530 * Event Status - Per event
531 * -------------
532 * The encoding of acpi_event_status is illustrated below.
533 * Note that a set bit (1) indicates the property is TRUE
534 * (e.g. if bit 0 is set then the event is enabled).
535 * +-------------+-+-+-+
536 * | Bits 31:3 |2|1|0|
537 * +-------------+-+-+-+
538 * | | | |
539 * | | | +- Enabled?
540 * | | +--- Enabled for wake?
541 * | +----- Set?
542 * +----------- <Reserved>
543 */
4be44fcd 544typedef u32 acpi_event_status;
1da177e4
LT
545
546#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00
547#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
548#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
549#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04
550
551/*
552 * General Purpose Events (GPE)
553 */
554#define ACPI_GPE_INVALID 0xFF
555#define ACPI_GPE_MAX 0xFF
556#define ACPI_NUM_GPE 256
557
558#define ACPI_GPE_ENABLE 0
559#define ACPI_GPE_DISABLE 1
560
1da177e4
LT
561/*
562 * GPE info flags - Per GPE
563 * +-+-+-+---+---+-+
564 * |7|6|5|4:3|2:1|0|
565 * +-+-+-+---+---+-+
566 * | | | | | |
567 * | | | | | +--- Interrupt type: Edge or Level Triggered
568 * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
569 * | | | +--- Type of dispatch -- to method, handler, or none
570 * | | +--- Enabled for runtime?
571 * | +--- Enabled for wake?
572 * +--- System state when GPE ocurred (running/waking)
573 */
574#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01
575#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
576#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00
577
578#define ACPI_GPE_TYPE_MASK (u8) 0x06
579#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06
580#define ACPI_GPE_TYPE_WAKE (u8) 0x02
4be44fcd 581#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */
1da177e4
LT
582
583#define ACPI_GPE_DISPATCH_MASK (u8) 0x18
584#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08
585#define ACPI_GPE_DISPATCH_METHOD (u8) 0x10
4be44fcd 586#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */
1da177e4
LT
587
588#define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20
589#define ACPI_GPE_RUN_ENABLED (u8) 0x20
4be44fcd 590#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */
1da177e4
LT
591
592#define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40
593#define ACPI_GPE_WAKE_ENABLED (u8) 0x40
4be44fcd 594#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */
1da177e4 595
4be44fcd 596#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */
1da177e4
LT
597
598#define ACPI_GPE_SYSTEM_MASK (u8) 0x80
599#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80
600#define ACPI_GPE_SYSTEM_WAKING (u8) 0x00
601
602/*
603 * Flags for GPE and Lock interfaces
604 */
4be44fcd
LB
605#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */
606#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */
1da177e4
LT
607
608#define ACPI_NOT_ISR 0x1
609#define ACPI_ISR 0x0
610
1da177e4
LT
611/* Notify types */
612
613#define ACPI_SYSTEM_NOTIFY 0x1
614#define ACPI_DEVICE_NOTIFY 0x2
615#define ACPI_ALL_NOTIFY 0x3
616#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
617
618#define ACPI_MAX_SYS_NOTIFY 0x7f
619
1da177e4
LT
620/* Address Space (Operation Region) Types */
621
4be44fcd 622typedef u8 acpi_adr_space_type;
1da177e4
LT
623
624#define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0
625#define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1
626#define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2
627#define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3
628#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4
629#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
630#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
631#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7
632#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127
633
1da177e4
LT
634/*
635 * bit_register IDs
636 * These are bitfields defined within the full ACPI registers
637 */
638#define ACPI_BITREG_TIMER_STATUS 0x00
639#define ACPI_BITREG_BUS_MASTER_STATUS 0x01
640#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
641#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
642#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
643#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
644#define ACPI_BITREG_WAKE_STATUS 0x06
645#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07
646
647#define ACPI_BITREG_TIMER_ENABLE 0x08
648#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
649#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
650#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
651#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
652#define ACPI_BITREG_WAKE_ENABLE 0x0D
653#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E
654
655#define ACPI_BITREG_SCI_ENABLE 0x0F
656#define ACPI_BITREG_BUS_MASTER_RLD 0x10
657#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11
658#define ACPI_BITREG_SLEEP_TYPE_A 0x12
659#define ACPI_BITREG_SLEEP_TYPE_B 0x13
660#define ACPI_BITREG_SLEEP_ENABLE 0x14
661
662#define ACPI_BITREG_ARB_DISABLE 0x15
663
664#define ACPI_BITREG_MAX 0x15
665#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
666
1da177e4
LT
667/*
668 * External ACPI object definition
669 */
4be44fcd
LB
670union acpi_object {
671 acpi_object_type type; /* See definition of acpi_ns_type for values */
672 struct {
673 acpi_object_type type;
674 acpi_integer value; /* The actual number */
1da177e4
LT
675 } integer;
676
4be44fcd
LB
677 struct {
678 acpi_object_type type;
679 u32 length; /* # of bytes in string, excluding trailing null */
680 char *pointer; /* points to the string value */
1da177e4
LT
681 } string;
682
4be44fcd
LB
683 struct {
684 acpi_object_type type;
685 u32 length; /* # of bytes in buffer */
686 u8 *pointer; /* points to the buffer */
1da177e4
LT
687 } buffer;
688
4be44fcd
LB
689 struct {
690 acpi_object_type type;
691 u32 fill1;
692 acpi_handle handle; /* object reference */
1da177e4
LT
693 } reference;
694
4be44fcd
LB
695 struct {
696 acpi_object_type type;
697 u32 count; /* # of elements in package */
698 union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */
1da177e4
LT
699 } package;
700
4be44fcd
LB
701 struct {
702 acpi_object_type type;
703 u32 proc_id;
704 acpi_io_address pblk_address;
705 u32 pblk_length;
1da177e4
LT
706 } processor;
707
4be44fcd
LB
708 struct {
709 acpi_object_type type;
710 u32 system_level;
711 u32 resource_order;
1da177e4
LT
712 } power_resource;
713};
714
1da177e4
LT
715/*
716 * List of objects, used as a parameter list for control method evaluation
717 */
4be44fcd
LB
718struct acpi_object_list {
719 u32 count;
720 union acpi_object *pointer;
1da177e4
LT
721};
722
1da177e4
LT
723/*
724 * Miscellaneous common Data Structures used by the interfaces
725 */
726#define ACPI_NO_BUFFER 0
727#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1)
728#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2)
729
4be44fcd
LB
730struct acpi_buffer {
731 acpi_size length; /* Length in bytes of the buffer */
732 void *pointer; /* pointer to buffer */
1da177e4
LT
733};
734
1da177e4
LT
735/*
736 * name_type for acpi_get_name
737 */
738#define ACPI_FULL_PATHNAME 0
739#define ACPI_SINGLE_NAME 1
740#define ACPI_NAME_TYPE_MAX 1
741
1da177e4
LT
742/*
743 * Structure and flags for acpi_get_system_info
744 */
745#define ACPI_SYS_MODE_UNKNOWN 0x0000
746#define ACPI_SYS_MODE_ACPI 0x0001
747#define ACPI_SYS_MODE_LEGACY 0x0002
748#define ACPI_SYS_MODES_MASK 0x0003
749
1da177e4
LT
750/*
751 * ACPI Table Info. One per ACPI table _type_
752 */
4be44fcd
LB
753struct acpi_table_info {
754 u32 count;
1da177e4
LT
755};
756
1da177e4
LT
757/*
758 * System info returned by acpi_get_system_info()
759 */
4be44fcd
LB
760struct acpi_system_info {
761 u32 acpi_ca_version;
762 u32 flags;
763 u32 timer_resolution;
764 u32 reserved1;
765 u32 reserved2;
766 u32 debug_level;
767 u32 debug_layer;
768 u32 num_table_types;
769 struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES];
1da177e4
LT
770};
771
1da177e4
LT
772/*
773 * Types specific to the OS service interfaces
774 */
4be44fcd 775typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context);
1da177e4
LT
776
777typedef void
4be44fcd 778 (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context);
1da177e4
LT
779
780/*
781 * Various handlers and callback procedures
782 */
4be44fcd 783typedef u32(*acpi_event_handler) (void *context);
1da177e4
LT
784
785typedef
4be44fcd 786void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
1da177e4
LT
787
788typedef
4be44fcd 789void (*acpi_object_handler) (acpi_handle object, u32 function, void *data);
1da177e4 790
4be44fcd 791typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
1da177e4
LT
792
793#define ACPI_INIT_DEVICE_INI 1
794
795typedef
4be44fcd
LB
796acpi_status(*acpi_exception_handler) (acpi_status aml_status,
797 acpi_name name,
798 u16 opcode,
799 u32 aml_offset, void *context);
1da177e4
LT
800
801/* Address Spaces (For Operation Regions) */
802
803typedef
4be44fcd
LB
804acpi_status(*acpi_adr_space_handler) (u32 function,
805 acpi_physical_address address,
806 u32 bit_width,
807 acpi_integer * value,
808 void *handler_context,
809 void *region_context);
1da177e4
LT
810
811#define ACPI_DEFAULT_HANDLER NULL
812
1da177e4 813typedef
4be44fcd
LB
814acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
815 u32 function,
816 void *handler_context,
817 void **region_context);
1da177e4
LT
818
819#define ACPI_REGION_ACTIVATE 0
820#define ACPI_REGION_DEACTIVATE 1
821
822typedef
4be44fcd
LB
823acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
824 u32 nesting_level,
825 void *context, void **return_value);
1da177e4
LT
826
827/* Interrupt handler return values */
828
829#define ACPI_INTERRUPT_NOT_HANDLED 0x00
830#define ACPI_INTERRUPT_HANDLED 0x01
831
1da177e4
LT
832/* Common string version of device HIDs and UIDs */
833
4be44fcd
LB
834struct acpi_device_id {
835 char value[ACPI_DEVICE_ID_LENGTH];
1da177e4
LT
836};
837
838/* Common string version of device CIDs */
839
4be44fcd
LB
840struct acpi_compatible_id {
841 char value[ACPI_MAX_CID_LENGTH];
1da177e4
LT
842};
843
4be44fcd
LB
844struct acpi_compatible_id_list {
845 u32 count;
846 u32 size;
847 struct acpi_compatible_id id[1];
1da177e4
LT
848};
849
1da177e4
LT
850/* Structure and flags for acpi_get_object_info */
851
852#define ACPI_VALID_STA 0x0001
853#define ACPI_VALID_ADR 0x0002
854#define ACPI_VALID_HID 0x0004
855#define ACPI_VALID_UID 0x0008
856#define ACPI_VALID_CID 0x0010
857#define ACPI_VALID_SXDS 0x0020
858
1da177e4
LT
859#define ACPI_COMMON_OBJ_INFO \
860 acpi_object_type type; /* ACPI object type */ \
4be44fcd 861 acpi_name name /* ACPI object Name */
1da177e4 862
4be44fcd 863struct acpi_obj_info_header {
1da177e4
LT
864 ACPI_COMMON_OBJ_INFO;
865};
866
1da177e4
LT
867/* Structure returned from Get Object Info */
868
4be44fcd 869struct acpi_device_info {
1da177e4
LT
870 ACPI_COMMON_OBJ_INFO;
871
4be44fcd
LB
872 u32 valid; /* Indicates which fields below are valid */
873 u32 current_status; /* _STA value */
874 acpi_integer address; /* _ADR value if any */
875 struct acpi_device_id hardware_id; /* _HID value if any */
876 struct acpi_device_id unique_id; /* _UID value if any */
877 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
878 struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */
1da177e4
LT
879};
880
1da177e4
LT
881/* Context structs for address space handlers */
882
4be44fcd
LB
883struct acpi_pci_id {
884 u16 segment;
885 u16 bus;
886 u16 device;
887 u16 function;
1da177e4
LT
888};
889
4be44fcd
LB
890struct acpi_mem_space_context {
891 u32 length;
892 acpi_physical_address address;
893 acpi_physical_address mapped_physical_address;
894 u8 *mapped_logical_address;
895 acpi_size mapped_length;
1da177e4
LT
896};
897
1da177e4
LT
898/*
899 * Definitions for Resource Attributes
900 */
0897831b
BM
901typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
902typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */
1da177e4
LT
903
904/*
905 * Memory Attributes
906 */
907#define ACPI_READ_ONLY_MEMORY (u8) 0x00
908#define ACPI_READ_WRITE_MEMORY (u8) 0x01
909
910#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
911#define ACPI_CACHABLE_MEMORY (u8) 0x01
912#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
913#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
914
915/*
916 * IO Attributes
917 * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh.
918 * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh.
919 */
920#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
921#define ACPI_ISA_ONLY_RANGES (u8) 0x02
922#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
923
924#define ACPI_SPARSE_TRANSLATION (u8) 0x03
925
926/*
927 * IO Port Descriptor Decode
928 */
4be44fcd
LB
929#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
930#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
1da177e4
LT
931
932/*
933 * IRQ Attributes
934 */
0897831b
BM
935#define ACPI_LEVEL_SENSITIVE (u8) 0x00
936#define ACPI_EDGE_SENSITIVE (u8) 0x01
1da177e4
LT
937
938#define ACPI_ACTIVE_HIGH (u8) 0x00
939#define ACPI_ACTIVE_LOW (u8) 0x01
940
941#define ACPI_EXCLUSIVE (u8) 0x00
942#define ACPI_SHARED (u8) 0x01
943
944/*
945 * DMA Attributes
946 */
947#define ACPI_COMPATIBILITY (u8) 0x00
948#define ACPI_TYPE_A (u8) 0x01
949#define ACPI_TYPE_B (u8) 0x02
950#define ACPI_TYPE_F (u8) 0x03
951
952#define ACPI_NOT_BUS_MASTER (u8) 0x00
953#define ACPI_BUS_MASTER (u8) 0x01
954
955#define ACPI_TRANSFER_8 (u8) 0x00
956#define ACPI_TRANSFER_8_16 (u8) 0x01
957#define ACPI_TRANSFER_16 (u8) 0x02
958
959/*
960 * Start Dependent Functions Priority definitions
961 */
962#define ACPI_GOOD_CONFIGURATION (u8) 0x00
963#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
964#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
965
966/*
967 * 16, 32 and 64-bit Address Descriptor resource types
968 */
969#define ACPI_MEMORY_RANGE (u8) 0x00
970#define ACPI_IO_RANGE (u8) 0x01
971#define ACPI_BUS_NUMBER_RANGE (u8) 0x02
972
973#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
974#define ACPI_ADDRESS_FIXED (u8) 0x01
975
976#define ACPI_POS_DECODE (u8) 0x00
977#define ACPI_SUB_DECODE (u8) 0x01
978
979#define ACPI_PRODUCER (u8) 0x00
980#define ACPI_CONSUMER (u8) 0x01
981
0897831b
BM
982/*
983 * If possible, pack the following structures to byte alignment
984 */
985#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
986#pragma pack(1)
987#endif
988
c51a4de8
BM
989/* UUID data structures for use in vendor-defined resource descriptors */
990
991struct acpi_uuid {
992 u8 data[ACPI_UUID_LENGTH];
993};
994
995struct acpi_vendor_uuid {
996 u8 subtype;
997 u8 data[ACPI_UUID_LENGTH];
998};
999
1da177e4
LT
1000/*
1001 * Structures used to describe device resources
1002 */
4be44fcd 1003struct acpi_resource_irq {
0897831b
BM
1004 u8 triggering;
1005 u8 polarity;
1006 u8 sharable;
1007 u8 interrupt_count;
1008 u8 interrupts[1];
1da177e4
LT
1009};
1010
4be44fcd 1011struct acpi_resource_dma {
0897831b
BM
1012 u8 type;
1013 u8 bus_master;
1014 u8 transfer;
1015 u8 channel_count;
1016 u8 channels[1];
1da177e4
LT
1017};
1018
50eca3eb 1019struct acpi_resource_start_dependent {
0897831b
BM
1020 u8 compatibility_priority;
1021 u8 performance_robustness;
1da177e4
LT
1022};
1023
1024/*
1025 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
1026 * needed because it has no fields
1027 */
1028
4be44fcd 1029struct acpi_resource_io {
0897831b
BM
1030 u8 io_decode;
1031 u8 alignment;
1032 u8 address_length;
1033 u16 minimum;
1034 u16 maximum;
1da177e4
LT
1035};
1036
4be44fcd 1037struct acpi_resource_fixed_io {
0897831b
BM
1038 u16 address;
1039 u8 address_length;
1da177e4
LT
1040};
1041
4be44fcd 1042struct acpi_resource_vendor {
0897831b 1043 u16 byte_length;
50eca3eb 1044 u8 byte_data[1];
1da177e4
LT
1045};
1046
c51a4de8
BM
1047/* Vendor resource with UUID info (introduced in ACPI 3.0) */
1048
1049struct acpi_resource_vendor_typed {
1050 u16 byte_length;
1051 u8 uuid_subtype;
1052 u8 uuid[ACPI_UUID_LENGTH];
1053 u8 byte_data[1];
1054};
1055
4be44fcd
LB
1056struct acpi_resource_end_tag {
1057 u8 checksum;
1da177e4
LT
1058};
1059
50eca3eb 1060struct acpi_resource_memory24 {
0897831b
BM
1061 u8 write_protect;
1062 u16 minimum;
1063 u16 maximum;
1064 u16 alignment;
1065 u16 address_length;
1da177e4
LT
1066};
1067
50eca3eb 1068struct acpi_resource_memory32 {
0897831b 1069 u8 write_protect;
50eca3eb
BM
1070 u32 minimum;
1071 u32 maximum;
4be44fcd 1072 u32 alignment;
50eca3eb 1073 u32 address_length;
1da177e4
LT
1074};
1075
50eca3eb 1076struct acpi_resource_fixed_memory32 {
0897831b 1077 u8 write_protect;
50eca3eb
BM
1078 u32 address;
1079 u32 address_length;
1da177e4
LT
1080};
1081
4be44fcd 1082struct acpi_memory_attribute {
0897831b
BM
1083 u8 write_protect;
1084 u8 caching;
1085 u8 range_type;
1086 u8 translation;
1da177e4
LT
1087};
1088
4be44fcd 1089struct acpi_io_attribute {
0897831b
BM
1090 u8 range_type;
1091 u8 translation;
1092 u8 translation_type;
1093 u8 reserved1;
1da177e4
LT
1094};
1095
4be44fcd 1096union acpi_resource_attribute {
0897831b 1097 struct acpi_memory_attribute mem;
4be44fcd 1098 struct acpi_io_attribute io;
0897831b
BM
1099
1100 /* Used for the *word_space macros */
1101
1102 u8 type_specific;
1da177e4
LT
1103};
1104
4be44fcd 1105struct acpi_resource_source {
0897831b
BM
1106 u8 index;
1107 u16 string_length;
4be44fcd 1108 char *string_ptr;
1da177e4
LT
1109};
1110
aff8c277
RM
1111/* Fields common to all address descriptors, 16/32/64 bit */
1112
1113#define ACPI_RESOURCE_ADDRESS_COMMON \
0897831b
BM
1114 u8 resource_type; \
1115 u8 producer_consumer; \
1116 u8 decode; \
1117 u8 min_address_fixed; \
1118 u8 max_address_fixed; \
1119 union acpi_resource_attribute info;
aff8c277
RM
1120
1121struct acpi_resource_address {
1122ACPI_RESOURCE_ADDRESS_COMMON};
1123
4be44fcd 1124struct acpi_resource_address16 {
0897831b
BM
1125 ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
1126 u16 minimum;
1127 u16 maximum;
1128 u16 translation_offset;
1129 u16 address_length;
4be44fcd 1130 struct acpi_resource_source resource_source;
1da177e4
LT
1131};
1132
4be44fcd 1133struct acpi_resource_address32 {
aff8c277 1134 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
50eca3eb
BM
1135 u32 minimum;
1136 u32 maximum;
1137 u32 translation_offset;
4be44fcd
LB
1138 u32 address_length;
1139 struct acpi_resource_source resource_source;
1da177e4
LT
1140};
1141
4be44fcd 1142struct acpi_resource_address64 {
aff8c277 1143 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
50eca3eb
BM
1144 u64 minimum;
1145 u64 maximum;
1146 u64 translation_offset;
4be44fcd 1147 u64 address_length;
4be44fcd 1148 struct acpi_resource_source resource_source;
1da177e4
LT
1149};
1150
50eca3eb 1151struct acpi_resource_extended_address64 {
0897831b
BM
1152 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
1153 u64 granularity;
50eca3eb
BM
1154 u64 minimum;
1155 u64 maximum;
1156 u64 translation_offset;
1157 u64 address_length;
0897831b 1158 u64 type_specific;
50eca3eb
BM
1159};
1160
1161struct acpi_resource_extended_irq {
0897831b
BM
1162 u8 producer_consumer;
1163 u8 triggering;
1164 u8 polarity;
1165 u8 sharable;
1166 u8 interrupt_count;
4be44fcd
LB
1167 struct acpi_resource_source resource_source;
1168 u32 interrupts[1];
1da177e4
LT
1169};
1170
50eca3eb 1171struct acpi_resource_generic_register {
0897831b
BM
1172 u8 space_id;
1173 u8 bit_width;
1174 u8 bit_offset;
1175 u8 access_size;
bda663d3
RM
1176 u64 address;
1177};
1178
1da177e4
LT
1179/* ACPI_RESOURCE_TYPEs */
1180
50eca3eb
BM
1181#define ACPI_RESOURCE_TYPE_IRQ 0
1182#define ACPI_RESOURCE_TYPE_DMA 1
1183#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
1184#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
1185#define ACPI_RESOURCE_TYPE_IO 4
1186#define ACPI_RESOURCE_TYPE_FIXED_IO 5
1187#define ACPI_RESOURCE_TYPE_VENDOR 6
1188#define ACPI_RESOURCE_TYPE_END_TAG 7
1189#define ACPI_RESOURCE_TYPE_MEMORY24 8
1190#define ACPI_RESOURCE_TYPE_MEMORY32 9
1191#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
1192#define ACPI_RESOURCE_TYPE_ADDRESS16 11
1193#define ACPI_RESOURCE_TYPE_ADDRESS32 12
1194#define ACPI_RESOURCE_TYPE_ADDRESS64 13
1195#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
1196#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
1197#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
1198#define ACPI_RESOURCE_TYPE_MAX 16
4be44fcd
LB
1199
1200union acpi_resource_data {
1201 struct acpi_resource_irq irq;
1202 struct acpi_resource_dma dma;
50eca3eb 1203 struct acpi_resource_start_dependent start_dpf;
4be44fcd
LB
1204 struct acpi_resource_io io;
1205 struct acpi_resource_fixed_io fixed_io;
50eca3eb 1206 struct acpi_resource_vendor vendor;
c51a4de8 1207 struct acpi_resource_vendor_typed vendor_typed;
4be44fcd 1208 struct acpi_resource_end_tag end_tag;
50eca3eb
BM
1209 struct acpi_resource_memory24 memory24;
1210 struct acpi_resource_memory32 memory32;
1211 struct acpi_resource_fixed_memory32 fixed_memory32;
4be44fcd
LB
1212 struct acpi_resource_address16 address16;
1213 struct acpi_resource_address32 address32;
1214 struct acpi_resource_address64 address64;
50eca3eb
BM
1215 struct acpi_resource_extended_address64 ext_address64;
1216 struct acpi_resource_extended_irq extended_irq;
1217 struct acpi_resource_generic_register generic_reg;
1218
1219 /* Common fields */
1220
1221 struct acpi_resource_address address; /* Common 16/32/64 address fields */
1da177e4
LT
1222};
1223
4be44fcd 1224struct acpi_resource {
50eca3eb 1225 u32 type;
4be44fcd
LB
1226 u32 length;
1227 union acpi_resource_data data;
1da177e4
LT
1228};
1229
0897831b
BM
1230/* restore default alignment */
1231
1232#pragma pack()
1da177e4 1233
0897831b
BM
1234#define ACPI_RS_SIZE_MIN 12
1235#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
1236#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
1da177e4
LT
1237
1238#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
1239
0897831b 1240#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
1da177e4
LT
1241#define ACPI_ALIGN_RESOURCE_SIZE(length) (length)
1242#else
1243#define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
1244#endif
1245
1246/*
1247 * END: of definitions for Resource Attributes
1248 */
1249
4be44fcd
LB
1250struct acpi_pci_routing_table {
1251 u32 length;
1252 u32 pin;
1253 acpi_integer address; /* here for 64-bit alignment */
1254 u32 source_index;
1255 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
1da177e4
LT
1256};
1257
1258/*
1259 * END: of definitions for PCI Routing tables
1260 */
1261
4be44fcd 1262#endif /* __ACTYPES_H__ */