1/******************************************************************************
2 *
3 * Module Name: utglobal - Global variables for the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2015, 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#define EXPORT_ACPI_INTERFACES
45#define DEFINE_ACPI_GLOBALS
46
47#include <acpi/acpi.h>
48#include "accommon.h"
49
50#define _COMPONENT          ACPI_UTILITIES
51ACPI_MODULE_NAME("utglobal")
52
53/*******************************************************************************
54 *
55 * Static global variable initialization.
56 *
57 ******************************************************************************/
58/* Various state name strings */
59const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
60	"\\_S0_",
61	"\\_S1_",
62	"\\_S2_",
63	"\\_S3_",
64	"\\_S4_",
65	"\\_S5_"
66};
67
68const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
69	"_S0W",
70	"_S1W",
71	"_S2W",
72	"_S3W",
73	"_S4W"
74};
75
76const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
77	"_S1D",
78	"_S2D",
79	"_S3D",
80	"_S4D"
81};
82
83/*******************************************************************************
84 *
85 * Namespace globals
86 *
87 ******************************************************************************/
88/*
89 * Predefined ACPI Names (Built-in to the Interpreter)
90 *
91 * NOTES:
92 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
93 *    during the initialization sequence.
94 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
95 *    perform a Notify() operation on it. 09/2010: Changed to type Device.
96 *    This still allows notifies, but does not confuse host code that
97 *    searches for valid thermal_zone objects.
98 */
99const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
100	{"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
101	{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
102	{"_SB_", ACPI_TYPE_DEVICE, NULL},
103	{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
104	{"_TZ_", ACPI_TYPE_DEVICE, NULL},
105	{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
106	{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
107	{"_GL_", ACPI_TYPE_MUTEX, (char *)1},
108
109#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
110	{"_OSI", ACPI_TYPE_METHOD, (char *)1},
111#endif
112
113	/* Table terminator */
114
115	{NULL, ACPI_TYPE_ANY, NULL}
116};
117
118#if (!ACPI_REDUCED_HARDWARE)
119/******************************************************************************
120 *
121 * Event and Hardware globals
122 *
123 ******************************************************************************/
124
125struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
126	/* Name                                     Parent Register             Register Bit Position                   Register Bit Mask       */
127
128	/* ACPI_BITREG_TIMER_STATUS         */ {ACPI_REGISTER_PM1_STATUS,
129						ACPI_BITPOSITION_TIMER_STATUS,
130						ACPI_BITMASK_TIMER_STATUS},
131	/* ACPI_BITREG_BUS_MASTER_STATUS    */ {ACPI_REGISTER_PM1_STATUS,
132						ACPI_BITPOSITION_BUS_MASTER_STATUS,
133						ACPI_BITMASK_BUS_MASTER_STATUS},
134	/* ACPI_BITREG_GLOBAL_LOCK_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
135						ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
136						ACPI_BITMASK_GLOBAL_LOCK_STATUS},
137	/* ACPI_BITREG_POWER_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
138						ACPI_BITPOSITION_POWER_BUTTON_STATUS,
139						ACPI_BITMASK_POWER_BUTTON_STATUS},
140	/* ACPI_BITREG_SLEEP_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
141						ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
142						ACPI_BITMASK_SLEEP_BUTTON_STATUS},
143	/* ACPI_BITREG_RT_CLOCK_STATUS      */ {ACPI_REGISTER_PM1_STATUS,
144						ACPI_BITPOSITION_RT_CLOCK_STATUS,
145						ACPI_BITMASK_RT_CLOCK_STATUS},
146	/* ACPI_BITREG_WAKE_STATUS          */ {ACPI_REGISTER_PM1_STATUS,
147						ACPI_BITPOSITION_WAKE_STATUS,
148						ACPI_BITMASK_WAKE_STATUS},
149	/* ACPI_BITREG_PCIEXP_WAKE_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
150						ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
151						ACPI_BITMASK_PCIEXP_WAKE_STATUS},
152
153	/* ACPI_BITREG_TIMER_ENABLE         */ {ACPI_REGISTER_PM1_ENABLE,
154						ACPI_BITPOSITION_TIMER_ENABLE,
155						ACPI_BITMASK_TIMER_ENABLE},
156	/* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */ {ACPI_REGISTER_PM1_ENABLE,
157						ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
158						ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
159	/* ACPI_BITREG_POWER_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
160						ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
161						ACPI_BITMASK_POWER_BUTTON_ENABLE},
162	/* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
163						ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
164						ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
165	/* ACPI_BITREG_RT_CLOCK_ENABLE      */ {ACPI_REGISTER_PM1_ENABLE,
166						ACPI_BITPOSITION_RT_CLOCK_ENABLE,
167						ACPI_BITMASK_RT_CLOCK_ENABLE},
168	/* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */ {ACPI_REGISTER_PM1_ENABLE,
169						ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
170						ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
171
172	/* ACPI_BITREG_SCI_ENABLE           */ {ACPI_REGISTER_PM1_CONTROL,
173						ACPI_BITPOSITION_SCI_ENABLE,
174						ACPI_BITMASK_SCI_ENABLE},
175	/* ACPI_BITREG_BUS_MASTER_RLD       */ {ACPI_REGISTER_PM1_CONTROL,
176						ACPI_BITPOSITION_BUS_MASTER_RLD,
177						ACPI_BITMASK_BUS_MASTER_RLD},
178	/* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */ {ACPI_REGISTER_PM1_CONTROL,
179						ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
180						ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
181	/* ACPI_BITREG_SLEEP_TYPE           */ {ACPI_REGISTER_PM1_CONTROL,
182						ACPI_BITPOSITION_SLEEP_TYPE,
183						ACPI_BITMASK_SLEEP_TYPE},
184	/* ACPI_BITREG_SLEEP_ENABLE         */ {ACPI_REGISTER_PM1_CONTROL,
185						ACPI_BITPOSITION_SLEEP_ENABLE,
186						ACPI_BITMASK_SLEEP_ENABLE},
187
188	/* ACPI_BITREG_ARB_DIS              */ {ACPI_REGISTER_PM2_CONTROL,
189						ACPI_BITPOSITION_ARB_DISABLE,
190						ACPI_BITMASK_ARB_DISABLE}
191};
192
193struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
194	/* ACPI_EVENT_PMTIMER       */ {ACPI_BITREG_TIMER_STATUS,
195					ACPI_BITREG_TIMER_ENABLE,
196					ACPI_BITMASK_TIMER_STATUS,
197					ACPI_BITMASK_TIMER_ENABLE},
198	/* ACPI_EVENT_GLOBAL        */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
199					ACPI_BITREG_GLOBAL_LOCK_ENABLE,
200					ACPI_BITMASK_GLOBAL_LOCK_STATUS,
201					ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
202	/* ACPI_EVENT_POWER_BUTTON  */ {ACPI_BITREG_POWER_BUTTON_STATUS,
203					ACPI_BITREG_POWER_BUTTON_ENABLE,
204					ACPI_BITMASK_POWER_BUTTON_STATUS,
205					ACPI_BITMASK_POWER_BUTTON_ENABLE},
206	/* ACPI_EVENT_SLEEP_BUTTON  */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
207					ACPI_BITREG_SLEEP_BUTTON_ENABLE,
208					ACPI_BITMASK_SLEEP_BUTTON_STATUS,
209					ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
210	/* ACPI_EVENT_RTC           */ {ACPI_BITREG_RT_CLOCK_STATUS,
211					ACPI_BITREG_RT_CLOCK_ENABLE,
212					ACPI_BITMASK_RT_CLOCK_STATUS,
213					ACPI_BITMASK_RT_CLOCK_ENABLE},
214};
215#endif				/* !ACPI_REDUCED_HARDWARE */
216
217/* Public globals */
218
219ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
220ACPI_EXPORT_SYMBOL(acpi_dbg_level)
221ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
222ACPI_EXPORT_SYMBOL(acpi_gpe_count)
223ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)
224