Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
utglobal.c
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Module Name: utglobal - Global variables for the ACPI subsystem
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2012, 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 DEFINE_ACPI_GLOBALS
45 
46 #include <linux/export.h>
47 #include <acpi/acpi.h>
48 #include "accommon.h"
49 
50 #define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME("utglobal")
52 
53 /*******************************************************************************
54  *
55  * Static global variable initialization.
56  *
57  ******************************************************************************/
58 /*
59  * We want the debug switches statically initialized so they
60  * are already set when the debugger is entered.
61  */
62 /* Debug switch - level and trace mask */
64 
65 /* Debug switch - layer (component) mask */
66 
69 
70 /* Debugger globals */
71 
75 
76 /* System flags */
77 
79 
80 /* System starts uninitialized */
81 
83 
85  "\\_S0_",
86  "\\_S1_",
87  "\\_S2_",
88  "\\_S3_",
89  "\\_S4_",
90  "\\_S5_"
91 };
92 
94  "_S0W",
95  "_S1W",
96  "_S2W",
97  "_S3W",
98  "_S4W"
99 };
100 
102  "_S1D",
103  "_S2D",
104  "_S3D",
105  "_S4D"
106 };
107 
108 /*******************************************************************************
109  *
110  * Namespace globals
111  *
112  ******************************************************************************/
113 /*
114  * Predefined ACPI Names (Built-in to the Interpreter)
115  *
116  * NOTES:
117  * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
118  * during the initialization sequence.
119  * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
120  * perform a Notify() operation on it. 09/2010: Changed to type Device.
121  * This still allows notifies, but does not confuse host code that
122  * searches for valid thermal_zone objects.
123  */
125  {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
126  {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
127  {"_SB_", ACPI_TYPE_DEVICE, NULL},
128  {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
129  {"_TZ_", ACPI_TYPE_DEVICE, NULL},
130  {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
131  {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
132  {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
133 
134 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
135  {"_OSI", ACPI_TYPE_METHOD, (char *)1},
136 #endif
137 
138  /* Table terminator */
139 
141 };
142 
143 #if (!ACPI_REDUCED_HARDWARE)
144 /******************************************************************************
145  *
146  * Event and Hardware globals
147  *
148  ******************************************************************************/
149 
151  /* Name Parent Register Register Bit Position Register Bit Mask */
152 
153  /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
156  /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
159  /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
162  /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
165  /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
168  /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
171  /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
174  /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
177 
178  /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
181  /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
184  /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
187  /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
190  /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
193  /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
196 
197  /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
200  /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
203  /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
206  /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL,
209  /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
212 
213  /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
216 };
217 
219  /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
223  /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
227  /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
231  /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
235  /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
239 };
240 #endif /* !ACPI_REDUCED_HARDWARE */
241 
242 /*******************************************************************************
243  *
244  * FUNCTION: acpi_ut_init_globals
245  *
246  * PARAMETERS: None
247  *
248  * RETURN: Status
249  *
250  * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
251  * initialization should be initialized here. This allows for
252  * a warm restart.
253  *
254  ******************************************************************************/
255 
257 {
259  u32 i;
260 
261  ACPI_FUNCTION_TRACE(ut_init_globals);
262 
263  /* Create all memory caches */
264 
265  status = acpi_ut_create_caches();
266  if (ACPI_FAILURE(status)) {
267  return_ACPI_STATUS(status);
268  }
269 
270  /* Address Range lists */
271 
272  for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
274  }
275 
276  /* Mutex locked flags */
277 
278  for (i = 0; i < ACPI_NUM_MUTEX; i++) {
279  acpi_gbl_mutex_info[i].mutex = NULL;
281  acpi_gbl_mutex_info[i].use_count = 0;
282  }
283 
284  for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
286  }
287 
288  /* Last owner_ID is never valid */
289 
290  acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
291 
292 #if (!ACPI_REDUCED_HARDWARE)
293 
294  /* GPE support */
295 
301 
303 
304 #endif /* !ACPI_REDUCED_HARDWARE */
305 
306  /* Global handlers */
307 
308  acpi_gbl_global_notify[0].handler = NULL;
309  acpi_gbl_global_notify[1].handler = NULL;
314 
315  /* Global Lock support */
316 
322 
323  /* Miscellaneous variables */
324 
339  acpi_gbl_osi_data = 0;
342 
343  /* Hardware oriented */
344 
347 
348  /* Namespace */
349 
359 
360 #ifdef ACPI_DEBUG_OUTPUT
361  acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
362 #endif
363 
364 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
365  acpi_gbl_display_final_mem_stats = FALSE;
366 #endif
367 
369 }
370 
371 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
374 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)