1 /******************************************************************************
2  *
3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2007, 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 __ACLOCAL_H__
45 #define __ACLOCAL_H__
46 
47 /* acpisrc:struct_defs -- for acpisrc conversion */
48 
49 /*****************************************************************************
50  *
51  * Namespace typedefs and structs
52  *
53  ****************************************************************************/
54 
55 union acpi_name_union {
56 	u32 integer;
57 	char ascii[4];
58 };
59 
60 /*
61  * ACPI Table Descriptor.  One per ACPI table
62  */
63 struct acpi_table_desc {
64 	acpi_physical_address address;
65 	struct acpi_table_header *pointer;
66 	u32 length;		/* Length fixed at 32 bits */
67 	union acpi_name_union signature;
68 	u8 flags;
69 };
70 
71 /* Flags for above */
72 
73 #define ACPI_TABLE_ORIGIN_UNKNOWN       (0)
74 #define ACPI_TABLE_ORIGIN_MAPPED        (1)
75 #define ACPI_TABLE_ORIGIN_ALLOCATED     (2)
76 #define ACPI_TABLE_ORIGIN_MASK          (3)
77 #define ACPI_TABLE_IS_LOADED            (4)
78 
79 /* One internal RSDT for table management */
80 
81 struct acpi_internal_rsdt {
82 	struct acpi_table_desc *tables;
83 	u32 count;
84 	u32 size;
85 	u8 flags;
86 };
87 
88 /* Flags for above */
89 
90 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)	/* ~ORIGIN_ALLOCATED */
91 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
92 #define ACPI_ROOT_ALLOW_RESIZE          (2)
93 
94 /* Predefined (fixed) table indexes */
95 
96 #define ACPI_TABLE_INDEX_DSDT           (0)
97 #define ACPI_TABLE_INDEX_FACS           (1)
98 
99 /*****************************************************************************
100  *
101  * Hardware (ACPI registers) and PNP
102  *
103  ****************************************************************************/
104 
105 struct acpi_bit_register_info {
106 	u8 parent_register;
107 	u8 bit_position;
108 	u16 access_bit_mask;
109 };
110 
111 /*
112  * Some ACPI registers have bits that must be ignored -- meaning that they
113  * must be preserved.
114  */
115 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800	/* Bit 11 */
116 #define ACPI_PM1_CONTROL_PRESERVED_BITS         0x0200	/* Bit 9 (whatever) */
117 
118 /*
119  * Register IDs
120  * These are the full ACPI registers
121  */
122 #define ACPI_REGISTER_PM1_STATUS                0x01
123 #define ACPI_REGISTER_PM1_ENABLE                0x02
124 #define ACPI_REGISTER_PM1_CONTROL               0x03
125 #define ACPI_REGISTER_PM1A_CONTROL              0x04
126 #define ACPI_REGISTER_PM1B_CONTROL              0x05
127 #define ACPI_REGISTER_PM2_CONTROL               0x06
128 #define ACPI_REGISTER_PM_TIMER                  0x07
129 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
130 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
131 #define ACPI_REGISTER_SLEEP_CONTROL             0x0a
132 #define ACPI_REGISTER_SLEEP_STATUS              0x0b
133 
134 /* Masks used to access the bit_registers */
135 
136 #define ACPI_BITMASK_TIMER_STATUS               0x0001
137 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
138 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
139 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
140 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
141 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
142 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000	/* ACPI 3.0 */
143 #define ACPI_BITMASK_WAKE_STATUS                0x8000
144 
145 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
146 	ACPI_BITMASK_TIMER_STATUS          | \
147 	ACPI_BITMASK_BUS_MASTER_STATUS     | \
148 	ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
149 	ACPI_BITMASK_POWER_BUTTON_STATUS   | \
150 	ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
151 	ACPI_BITMASK_RT_CLOCK_STATUS       | \
152 	ACPI_BITMASK_WAKE_STATUS)
153 
154 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
155 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
156 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
157 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
158 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
159 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000	/* ACPI 3.0 */
160 
161 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
162 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
163 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
164 #define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
165 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
166 
167 #define ACPI_BITMASK_ARB_DISABLE                0x0001
168 
169 /* Raw bit position of each bit_register */
170 
171 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
172 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
173 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
174 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
175 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
176 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
177 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E	/* ACPI 3.0 */
178 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
179 
180 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
181 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
182 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
183 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
184 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
185 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E	/* ACPI 3.0 */
186 
187 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
188 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
189 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
190 #define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
191 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
192 
193 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
194 
195 /*****************************************************************************
196  *
197  * Resource descriptors
198  *
199  ****************************************************************************/
200 
201 /* resource_type values */
202 
203 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
204 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
205 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
206 
207 #endif				/* __ACLOCAL_H__ */
208