aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utinit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/acpi/utilities/utinit.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/acpi/utilities/utinit.c')
-rw-r--r--drivers/acpi/utilities/utinit.c266
1 files changed, 266 insertions, 0 deletions
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
new file mode 100644
index 000000000000..bdbadaf48d29
--- /dev/null
+++ b/drivers/acpi/utilities/utinit.c
@@ -0,0 +1,266 @@
1/******************************************************************************
2 *
3 * Module Name: utinit - Common ACPI subsystem initialization
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
45#include <acpi/acpi.h>
46#include <acpi/acnamesp.h>
47#include <acpi/acevents.h>
48
49#define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("utinit")
51
52
53/*******************************************************************************
54 *
55 * FUNCTION: acpi_ut_fadt_register_error
56 *
57 * PARAMETERS: *register_name - Pointer to string identifying register
58 * Value - Actual register contents value
59 * acpi_test_spec_section - TDS section containing assertion
60 * acpi_assertion - Assertion number being tested
61 *
62 * RETURN: AE_BAD_VALUE
63 *
64 * DESCRIPTION: Display failure message and link failure to TDS assertion
65 *
66 ******************************************************************************/
67
68static void
69acpi_ut_fadt_register_error (
70 char *register_name,
71 u32 value,
72 acpi_size offset)
73{
74
75 ACPI_REPORT_WARNING (
76 ("Invalid FADT value %s=%X at offset %X FADT=%p\n",
77 register_name, value, (u32) offset, acpi_gbl_FADT));
78}
79
80
81/******************************************************************************
82 *
83 * FUNCTION: acpi_ut_validate_fadt
84 *
85 * PARAMETERS: None
86 *
87 * RETURN: Status
88 *
89 * DESCRIPTION: Validate various ACPI registers in the FADT
90 *
91 ******************************************************************************/
92
93acpi_status
94acpi_ut_validate_fadt (
95 void)
96{
97
98 /*
99 * Verify Fixed ACPI Description Table fields,
100 * but don't abort on any problems, just display error
101 */
102 if (acpi_gbl_FADT->pm1_evt_len < 4) {
103 acpi_ut_fadt_register_error ("PM1_EVT_LEN",
104 (u32) acpi_gbl_FADT->pm1_evt_len,
105 ACPI_FADT_OFFSET (pm1_evt_len));
106 }
107
108 if (!acpi_gbl_FADT->pm1_cnt_len) {
109 acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0,
110 ACPI_FADT_OFFSET (pm1_cnt_len));
111 }
112
113 if (!acpi_gbl_FADT->xpm1a_evt_blk.address) {
114 acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0,
115 ACPI_FADT_OFFSET (xpm1a_evt_blk.address));
116 }
117
118 if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) {
119 acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0,
120 ACPI_FADT_OFFSET (xpm1a_cnt_blk.address));
121 }
122
123 if (!acpi_gbl_FADT->xpm_tmr_blk.address) {
124 acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0,
125 ACPI_FADT_OFFSET (xpm_tmr_blk.address));
126 }
127
128 if ((acpi_gbl_FADT->xpm2_cnt_blk.address &&
129 !acpi_gbl_FADT->pm2_cnt_len)) {
130 acpi_ut_fadt_register_error ("PM2_CNT_LEN",
131 (u32) acpi_gbl_FADT->pm2_cnt_len,
132 ACPI_FADT_OFFSET (pm2_cnt_len));
133 }
134
135 if (acpi_gbl_FADT->pm_tm_len < 4) {
136 acpi_ut_fadt_register_error ("PM_TM_LEN",
137 (u32) acpi_gbl_FADT->pm_tm_len,
138 ACPI_FADT_OFFSET (pm_tm_len));
139 }
140
141 /* Length of GPE blocks must be a multiple of 2 */
142
143 if (acpi_gbl_FADT->xgpe0_blk.address &&
144 (acpi_gbl_FADT->gpe0_blk_len & 1)) {
145 acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN",
146 (u32) acpi_gbl_FADT->gpe0_blk_len,
147 ACPI_FADT_OFFSET (gpe0_blk_len));
148 }
149
150 if (acpi_gbl_FADT->xgpe1_blk.address &&
151 (acpi_gbl_FADT->gpe1_blk_len & 1)) {
152 acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN",
153 (u32) acpi_gbl_FADT->gpe1_blk_len,
154 ACPI_FADT_OFFSET (gpe1_blk_len));
155 }
156
157 return (AE_OK);
158}
159
160
161/******************************************************************************
162 *
163 * FUNCTION: acpi_ut_terminate
164 *
165 * PARAMETERS: none
166 *
167 * RETURN: none
168 *
169 * DESCRIPTION: free global memory
170 *
171 ******************************************************************************/
172
173void
174acpi_ut_terminate (void)
175{
176 struct acpi_gpe_block_info *gpe_block;
177 struct acpi_gpe_block_info *next_gpe_block;
178 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
179 struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
180
181
182 ACPI_FUNCTION_TRACE ("ut_terminate");
183
184
185 /* Free global tables, etc. */
186
187
188 /* Free global GPE blocks and related info structures */
189
190 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
191 while (gpe_xrupt_info) {
192 gpe_block = gpe_xrupt_info->gpe_block_list_head;
193 while (gpe_block) {
194 next_gpe_block = gpe_block->next;
195 ACPI_MEM_FREE (gpe_block->event_info);
196 ACPI_MEM_FREE (gpe_block->register_info);
197 ACPI_MEM_FREE (gpe_block);
198
199 gpe_block = next_gpe_block;
200 }
201 next_gpe_xrupt_info = gpe_xrupt_info->next;
202 ACPI_MEM_FREE (gpe_xrupt_info);
203 gpe_xrupt_info = next_gpe_xrupt_info;
204 }
205
206 return_VOID;
207}
208
209
210/*******************************************************************************
211 *
212 * FUNCTION: acpi_ut_subsystem_shutdown
213 *
214 * PARAMETERS: none
215 *
216 * RETURN: none
217 *
218 * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex
219 * objects here -- because the AML debugger may be still running.
220 *
221 ******************************************************************************/
222
223void
224acpi_ut_subsystem_shutdown (void)
225{
226
227 ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown");
228
229 /* Just exit if subsystem is already shutdown */
230
231 if (acpi_gbl_shutdown) {
232 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n"));
233 return_VOID;
234 }
235
236 /* Subsystem appears active, go ahead and shut it down */
237
238 acpi_gbl_shutdown = TRUE;
239 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n"));
240
241 /* Close the acpi_event Handling */
242
243 acpi_ev_terminate ();
244
245 /* Close the Namespace */
246
247 acpi_ns_terminate ();
248
249 /* Close the globals */
250
251 acpi_ut_terminate ();
252
253 /* Purge the local caches */
254
255 (void) acpi_purge_cached_objects ();
256
257 /* Debug only - display leftover memory allocation, if any */
258
259#ifdef ACPI_DBG_TRACK_ALLOCATIONS
260 acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL);
261#endif
262
263 return_VOID;
264}
265
266