blob: a72685c1e819660768933e84abe9d1076c953bff [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Module Name: utglobal - Global variables for the ACPI subsystem
4 *
5 *****************************************************************************/
6
7/*
David E. Box82a80942015-02-05 15:20:45 +08008 * Copyright (C) 2000 - 2015, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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
Lv Zheng839e9282013-10-29 09:29:51 +080044#define EXPORT_ACPI_INTERFACES
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#define DEFINE_ACPI_GLOBALS
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#include <acpi/acpi.h>
Len Browne2f7a772009-01-09 00:30:03 -050048#include "accommon.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50#define _COMPONENT ACPI_UTILITIES
Bob Mooree97d6bf2008-12-30 09:45:17 +080051ACPI_MODULE_NAME("utglobal")
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Robert Moore44f6c012005-04-18 22:49:35 -040053/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 * Static global variable initialization.
56 *
57 ******************************************************************************/
Lv Zheng3aa0b082014-02-26 10:32:38 +080058/* Various state name strings */
Len Brown4be44fc2005-08-05 00:44:28 -040059const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 "\\_S0_",
61 "\\_S1_",
62 "\\_S2_",
63 "\\_S3_",
64 "\\_S4_",
65 "\\_S5_"
66};
67
Bob Moore15b8dd52009-06-29 13:39:29 +080068const 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] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 "_S1D",
78 "_S2D",
79 "_S3D",
80 "_S4D"
81};
82
Robert Moore44f6c012005-04-18 22:49:35 -040083/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 *
Bob Moore84fb2c92007-02-02 19:48:19 +030085 * Namespace globals
86 *
87 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070088/*
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
Bob Moore81256662010-10-18 08:44:34 +080095 * 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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 */
Bob Moore08978312005-10-21 00:00:00 -040099const 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},
Bob Moore81256662010-10-18 08:44:34 +0800104 {"_TZ_", ACPI_TYPE_DEVICE, NULL},
Rafael J. Wysockiea7d5212015-07-01 23:24:05 +0200105 /*
106 * March, 2015:
107 * The _REV object is in the process of being deprecated, because
108 * other ACPI implementations permanently return 2. Thus, it
109 * has little or no value. Return 2 for compatibility with
110 * other ACPI implementations.
111 */
112 {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)},
Bob Moore08978312005-10-21 00:00:00 -0400113 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
Rafael J. Wysockiea7d5212015-07-01 23:24:05 +0200114 {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
116#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
Rafael J. Wysockiea7d5212015-07-01 23:24:05 +0200117 {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
Robert Moore44f6c012005-04-18 22:49:35 -0400120 /* Table terminator */
121
Bob Moore08978312005-10-21 00:00:00 -0400122 {NULL, ACPI_TYPE_ANY, NULL}
Robert Moore44f6c012005-04-18 22:49:35 -0400123};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
Bob Moore33620c52012-02-14 18:14:27 +0800125#if (!ACPI_REDUCED_HARDWARE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126/******************************************************************************
127 *
128 * Event and Hardware globals
129 *
130 ******************************************************************************/
131
Len Brown4be44fc2005-08-05 00:44:28 -0400132struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 /* Name Parent Register Register Bit Position Register Bit Mask */
134
Len Brown4be44fc2005-08-05 00:44:28 -0400135 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
136 ACPI_BITPOSITION_TIMER_STATUS,
137 ACPI_BITMASK_TIMER_STATUS},
138 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
139 ACPI_BITPOSITION_BUS_MASTER_STATUS,
140 ACPI_BITMASK_BUS_MASTER_STATUS},
141 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
142 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
143 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
144 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
145 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
146 ACPI_BITMASK_POWER_BUTTON_STATUS},
147 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
148 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
149 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
150 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
151 ACPI_BITPOSITION_RT_CLOCK_STATUS,
152 ACPI_BITMASK_RT_CLOCK_STATUS},
153 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
154 ACPI_BITPOSITION_WAKE_STATUS,
155 ACPI_BITMASK_WAKE_STATUS},
156 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
157 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
158 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
Len Brown4be44fc2005-08-05 00:44:28 -0400160 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
161 ACPI_BITPOSITION_TIMER_ENABLE,
162 ACPI_BITMASK_TIMER_ENABLE},
163 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
164 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
165 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
166 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
167 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
168 ACPI_BITMASK_POWER_BUTTON_ENABLE},
169 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
170 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
171 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
172 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
173 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
174 ACPI_BITMASK_RT_CLOCK_ENABLE},
Len Brown4be44fc2005-08-05 00:44:28 -0400175 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
176 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
177 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
Len Brown4be44fc2005-08-05 00:44:28 -0400179 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
180 ACPI_BITPOSITION_SCI_ENABLE,
181 ACPI_BITMASK_SCI_ENABLE},
182 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
183 ACPI_BITPOSITION_BUS_MASTER_RLD,
184 ACPI_BITMASK_BUS_MASTER_RLD},
185 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
186 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
187 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
Bob Moore82d79b82009-02-18 14:31:05 +0800188 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL,
189 ACPI_BITPOSITION_SLEEP_TYPE,
190 ACPI_BITMASK_SLEEP_TYPE},
Len Brown4be44fc2005-08-05 00:44:28 -0400191 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
192 ACPI_BITPOSITION_SLEEP_ENABLE,
193 ACPI_BITMASK_SLEEP_ENABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
Len Brown4be44fc2005-08-05 00:44:28 -0400195 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
196 ACPI_BITPOSITION_ARB_DISABLE,
197 ACPI_BITMASK_ARB_DISABLE}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198};
199
Len Brown4be44fc2005-08-05 00:44:28 -0400200struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
201 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
202 ACPI_BITREG_TIMER_ENABLE,
203 ACPI_BITMASK_TIMER_STATUS,
204 ACPI_BITMASK_TIMER_ENABLE},
205 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
206 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
207 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
208 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
209 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
210 ACPI_BITREG_POWER_BUTTON_ENABLE,
211 ACPI_BITMASK_POWER_BUTTON_STATUS,
212 ACPI_BITMASK_POWER_BUTTON_ENABLE},
213 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
214 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
215 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
216 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
217 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
218 ACPI_BITREG_RT_CLOCK_ENABLE,
219 ACPI_BITMASK_RT_CLOCK_STATUS,
220 ACPI_BITMASK_RT_CLOCK_ENABLE},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221};
Bob Moore33620c52012-02-14 18:14:27 +0800222#endif /* !ACPI_REDUCED_HARDWARE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223
Lv Zheng75c80442012-12-19 05:36:49 +0000224/* Public globals */
Lv Zheng3e8214e2012-12-19 05:37:15 +0000225
Bob Mooree97d6bf2008-12-30 09:45:17 +0800226ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
Bob Moore83135242006-10-03 00:00:00 -0400227ACPI_EXPORT_SYMBOL(acpi_dbg_level)
Bob Moore1044f1f2008-09-27 11:08:41 +0800228ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
Lv Zheng9187a412013-10-31 09:30:28 +0800229ACPI_EXPORT_SYMBOL(acpi_gpe_count)
Bob Mooree97d6bf2008-12-30 09:45:17 +0800230ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)