This source file includes following definitions.
- ACPI_MODULE_NAME
- acpi_ns_load_namespace
- acpi_ns_delete_subtree
- acpi_ns_unload_namespace
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acnamesp.h"
13 #include "acdispat.h"
14 #include "actables.h"
15 #include "acinterp.h"
16
17 #define _COMPONENT ACPI_NAMESPACE
18 ACPI_MODULE_NAME("nsload")
19
20
21 #ifdef ACPI_FUTURE_IMPLEMENTATION
22 acpi_status acpi_ns_unload_namespace(acpi_handle handle);
23
24 static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
25 #endif
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 acpi_status
41 acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
42 {
43 acpi_status status;
44
45 ACPI_FUNCTION_TRACE(ns_load_table);
46
47
48
49 if (acpi_tb_is_table_loaded(table_index)) {
50 status = AE_ALREADY_EXISTS;
51 goto unlock;
52 }
53
54 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
55 "**** Loading table into namespace ****\n"));
56
57 status = acpi_tb_allocate_owner_id(table_index);
58 if (ACPI_FAILURE(status)) {
59 goto unlock;
60 }
61
62
63
64
65
66
67
68
69
70
71 status = acpi_ns_parse_table(table_index, node);
72 if (ACPI_SUCCESS(status)) {
73 acpi_tb_set_table_loaded_flag(table_index, TRUE);
74 } else {
75
76
77
78
79
80
81
82
83
84 acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list.
85 tables[table_index].owner_id);
86
87 acpi_tb_release_owner_id(table_index);
88 return_ACPI_STATUS(status);
89 }
90
91 unlock:
92 if (ACPI_FAILURE(status)) {
93 return_ACPI_STATUS(status);
94 }
95
96
97
98
99
100
101
102 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
103 "**** Begin Table Object Initialization\n"));
104
105 acpi_ex_enter_interpreter();
106 status = acpi_ds_initialize_objects(table_index, node);
107 acpi_ex_exit_interpreter();
108
109 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
110 "**** Completed Table Object Initialization\n"));
111
112 return_ACPI_STATUS(status);
113 }
114
115 #ifdef ACPI_OBSOLETE_FUNCTIONS
116
117
118
119
120
121
122
123
124
125
126
127
128
129 acpi_status acpi_ns_load_namespace(void)
130 {
131 acpi_status status;
132
133 ACPI_FUNCTION_TRACE(acpi_load_name_space);
134
135
136
137 if (acpi_gbl_DSDT == NULL) {
138 ACPI_ERROR((AE_INFO, "DSDT is not in memory"));
139 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
140 }
141
142
143
144
145
146 status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT);
147 if (ACPI_FAILURE(status)) {
148 return_ACPI_STATUS(status);
149 }
150
151
152
153 (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT);
154 (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT);
155
156 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
157 "ACPI Namespace successfully loaded at root %p\n",
158 acpi_gbl_root_node));
159
160 return_ACPI_STATUS(status);
161 }
162 #endif
163
164 #ifdef ACPI_FUTURE_IMPLEMENTATION
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181 static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
182 {
183 acpi_status status;
184 acpi_handle child_handle;
185 acpi_handle parent_handle;
186 acpi_handle next_child_handle;
187 acpi_handle dummy;
188 u32 level;
189
190 ACPI_FUNCTION_TRACE(ns_delete_subtree);
191
192 parent_handle = start_handle;
193 child_handle = NULL;
194 level = 1;
195
196
197
198
199
200 while (level > 0) {
201
202
203
204 status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
205 child_handle, &next_child_handle);
206
207 child_handle = next_child_handle;
208
209
210
211 if (ACPI_SUCCESS(status)) {
212
213
214
215 if (ACPI_SUCCESS
216 (acpi_get_next_object
217 (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
218
219
220
221
222 level++;
223 parent_handle = child_handle;
224 child_handle = NULL;
225 }
226 } else {
227
228
229
230
231 level--;
232
233
234
235 acpi_ns_delete_children(child_handle);
236
237 child_handle = parent_handle;
238 status = acpi_get_parent(parent_handle, &parent_handle);
239 if (ACPI_FAILURE(status)) {
240 return_ACPI_STATUS(status);
241 }
242 }
243 }
244
245
246
247 acpi_ns_remove_node(child_handle);
248 return_ACPI_STATUS(AE_OK);
249 }
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265 acpi_status acpi_ns_unload_namespace(acpi_handle handle)
266 {
267 acpi_status status;
268
269 ACPI_FUNCTION_TRACE(ns_unload_name_space);
270
271
272
273 if (!acpi_gbl_root_node) {
274 return_ACPI_STATUS(AE_NO_NAMESPACE);
275 }
276
277 if (!handle) {
278 return_ACPI_STATUS(AE_BAD_PARAMETER);
279 }
280
281
282
283 status = acpi_ns_delete_subtree(handle);
284 return_ACPI_STATUS(status);
285 }
286 #endif