Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: tbinstal - ACPI table installation and removal | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
c8100dc4 | 8 | * Copyright (C) 2000 - 2016, Intel Corp. |
1da177e4 LT |
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 | ||
1da177e4 | 44 | #include <acpi/acpi.h> |
e2f7a777 | 45 | #include "accommon.h" |
e2f7a777 | 46 | #include "actables.h" |
1da177e4 | 47 | |
1da177e4 | 48 | #define _COMPONENT ACPI_TABLES |
4be44fcd | 49 | ACPI_MODULE_NAME("tbinstal") |
1da177e4 | 50 | |
86dfc6f3 | 51 | /* Local prototypes */ |
86dfc6f3 | 52 | static u8 |
c418ce19 | 53 | acpi_tb_compare_tables(struct acpi_table_desc *table_desc, u32 table_index); |
1da177e4 | 54 | |
7f9fc99c LZ |
55 | /******************************************************************************* |
56 | * | |
c418ce19 | 57 | * FUNCTION: acpi_tb_compare_tables |
7f9fc99c | 58 | * |
c418ce19 BM |
59 | * PARAMETERS: table_desc - Table 1 descriptor to be compared |
60 | * table_index - Index of table 2 to be compared | |
7f9fc99c | 61 | * |
c418ce19 | 62 | * RETURN: TRUE if both tables are identical. |
7f9fc99c | 63 | * |
c418ce19 BM |
64 | * DESCRIPTION: This function compares a table with another table that has |
65 | * already been installed in the root table list. | |
7f9fc99c LZ |
66 | * |
67 | ******************************************************************************/ | |
68 | ||
c418ce19 BM |
69 | static u8 |
70 | acpi_tb_compare_tables(struct acpi_table_desc *table_desc, u32 table_index) | |
1da177e4 | 71 | { |
f3d2e786 | 72 | acpi_status status = AE_OK; |
c418ce19 BM |
73 | u8 is_identical; |
74 | struct acpi_table_header *table; | |
75 | u32 table_length; | |
76 | u8 table_flags; | |
1da177e4 | 77 | |
86dfc6f3 | 78 | status = |
c418ce19 BM |
79 | acpi_tb_acquire_table(&acpi_gbl_root_table_list.tables[table_index], |
80 | &table, &table_length, &table_flags); | |
86dfc6f3 | 81 | if (ACPI_FAILURE(status)) { |
c418ce19 | 82 | return (FALSE); |
86dfc6f3 | 83 | } |
f3d2e786 | 84 | |
86dfc6f3 | 85 | /* |
c418ce19 BM |
86 | * Check for a table match on the entire table length, |
87 | * not just the header. | |
86dfc6f3 | 88 | */ |
c418ce19 | 89 | is_identical = (u8)((table_desc->length != table_length || |
4fa4616e BM |
90 | memcmp(table_desc->pointer, table, table_length)) ? |
91 | FALSE : TRUE); | |
e56f5617 | 92 | |
c418ce19 | 93 | /* Release the acquired table */ |
ed6f1d44 | 94 | |
c418ce19 BM |
95 | acpi_tb_release_table(table, table_length, table_flags); |
96 | return (is_identical); | |
86dfc6f3 | 97 | } |
e56f5617 | 98 | |
86dfc6f3 LZ |
99 | /******************************************************************************* |
100 | * | |
ed6f1d44 | 101 | * FUNCTION: acpi_tb_install_table_with_override |
86dfc6f3 | 102 | * |
8ec3f459 | 103 | * PARAMETERS: new_table_desc - New table descriptor to install |
caf4a15c | 104 | * override - Whether override should be performed |
8ec3f459 | 105 | * table_index - Where the table index is returned |
86dfc6f3 LZ |
106 | * |
107 | * RETURN: None | |
108 | * | |
109 | * DESCRIPTION: Install an ACPI table into the global data structure. The | |
110 | * table override mechanism is called to allow the host | |
111 | * OS to replace any table before it is installed in the root | |
112 | * table array. | |
113 | * | |
114 | ******************************************************************************/ | |
115 | ||
116 | void | |
8ec3f459 LZ |
117 | acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc, |
118 | u8 override, u32 *table_index) | |
86dfc6f3 | 119 | { |
8ec3f459 LZ |
120 | u32 i; |
121 | acpi_status status; | |
ed6f1d44 | 122 | |
8ec3f459 LZ |
123 | status = acpi_tb_get_next_table_descriptor(&i, NULL); |
124 | if (ACPI_FAILURE(status)) { | |
86dfc6f3 | 125 | return; |
1da177e4 LT |
126 | } |
127 | ||
d3ccaff8 BM |
128 | /* |
129 | * ACPI Table Override: | |
86dfc6f3 LZ |
130 | * |
131 | * Before we install the table, let the host OS override it with a new | |
132 | * one if desired. Any table within the RSDT/XSDT can be replaced, | |
133 | * including the DSDT which is pointed to by the FADT. | |
d3ccaff8 | 134 | */ |
caf4a15c LZ |
135 | if (override) { |
136 | acpi_tb_override_table(new_table_desc); | |
137 | } | |
7f9fc99c | 138 | |
8ec3f459 | 139 | acpi_tb_init_table_descriptor(&acpi_gbl_root_table_list.tables[i], |
ed6f1d44 BM |
140 | new_table_desc->address, |
141 | new_table_desc->flags, | |
142 | new_table_desc->pointer); | |
7f9fc99c | 143 | |
86dfc6f3 LZ |
144 | acpi_tb_print_table_header(new_table_desc->address, |
145 | new_table_desc->pointer); | |
146 | ||
8ec3f459 LZ |
147 | /* This synchronizes acpi_gbl_dsdt_index */ |
148 | ||
149 | *table_index = i; | |
150 | ||
86dfc6f3 LZ |
151 | /* Set the global integer width (based upon revision of the DSDT) */ |
152 | ||
8ec3f459 | 153 | if (i == acpi_gbl_dsdt_index) { |
86dfc6f3 LZ |
154 | acpi_ut_set_integer_width(new_table_desc->pointer->revision); |
155 | } | |
156 | } | |
157 | ||
158 | /******************************************************************************* | |
159 | * | |
160 | * FUNCTION: acpi_tb_install_fixed_table | |
161 | * | |
162 | * PARAMETERS: address - Physical address of DSDT or FACS | |
163 | * signature - Table signature, NULL if no need to | |
164 | * match | |
8ec3f459 | 165 | * table_index - Where the table index is returned |
86dfc6f3 LZ |
166 | * |
167 | * RETURN: Status | |
168 | * | |
169 | * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data | |
170 | * structure. | |
171 | * | |
172 | ******************************************************************************/ | |
173 | ||
174 | acpi_status | |
175 | acpi_tb_install_fixed_table(acpi_physical_address address, | |
8ec3f459 | 176 | char *signature, u32 *table_index) |
86dfc6f3 LZ |
177 | { |
178 | struct acpi_table_desc new_table_desc; | |
179 | acpi_status status; | |
180 | ||
181 | ACPI_FUNCTION_TRACE(tb_install_fixed_table); | |
182 | ||
183 | if (!address) { | |
184 | ACPI_ERROR((AE_INFO, | |
185 | "Null physical address for ACPI table [%s]", | |
186 | signature)); | |
187 | return (AE_NO_MEMORY); | |
188 | } | |
189 | ||
190 | /* Fill a table descriptor for validation */ | |
191 | ||
ed6f1d44 BM |
192 | status = acpi_tb_acquire_temp_table(&new_table_desc, address, |
193 | ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); | |
86dfc6f3 | 194 | if (ACPI_FAILURE(status)) { |
cc2080b0 LZ |
195 | ACPI_ERROR((AE_INFO, |
196 | "Could not acquire table length at %8.8X%8.8X", | |
197 | ACPI_FORMAT_UINT64(address))); | |
86dfc6f3 LZ |
198 | return_ACPI_STATUS(status); |
199 | } | |
200 | ||
201 | /* Validate and verify a table before installation */ | |
202 | ||
47d68c7f | 203 | status = acpi_tb_verify_temp_table(&new_table_desc, signature); |
86dfc6f3 LZ |
204 | if (ACPI_FAILURE(status)) { |
205 | goto release_and_exit; | |
206 | } | |
207 | ||
8ec3f459 LZ |
208 | /* Add the table to the global root table list */ |
209 | ||
210 | acpi_tb_install_table_with_override(&new_table_desc, TRUE, table_index); | |
86dfc6f3 LZ |
211 | |
212 | release_and_exit: | |
213 | ||
ed6f1d44 | 214 | /* Release the temporary table descriptor */ |
86dfc6f3 | 215 | |
ed6f1d44 | 216 | acpi_tb_release_temp_table(&new_table_desc); |
86dfc6f3 LZ |
217 | return_ACPI_STATUS(status); |
218 | } | |
219 | ||
86dfc6f3 LZ |
220 | /******************************************************************************* |
221 | * | |
ed6f1d44 | 222 | * FUNCTION: acpi_tb_install_standard_table |
86dfc6f3 | 223 | * |
8a216d7f | 224 | * PARAMETERS: address - Address of the table (might be a virtual |
86dfc6f3 LZ |
225 | * address depending on the table_flags) |
226 | * flags - Flags for the table | |
227 | * reload - Whether reload should be performed | |
caf4a15c | 228 | * override - Whether override should be performed |
86dfc6f3 LZ |
229 | * table_index - Where the table index is returned |
230 | * | |
231 | * RETURN: Status | |
232 | * | |
233 | * DESCRIPTION: This function is called to install an ACPI table that is | |
ed6f1d44 | 234 | * neither DSDT nor FACS (a "standard" table.) |
86dfc6f3 LZ |
235 | * When this function is called by "Load" or "LoadTable" opcodes, |
236 | * or by acpi_load_table() API, the "Reload" parameter is set. | |
237 | * After sucessfully returning from this function, table is | |
238 | * "INSTALLED" but not "VALIDATED". | |
239 | * | |
240 | ******************************************************************************/ | |
241 | ||
242 | acpi_status | |
ed6f1d44 BM |
243 | acpi_tb_install_standard_table(acpi_physical_address address, |
244 | u8 flags, | |
245 | u8 reload, u8 override, u32 *table_index) | |
86dfc6f3 LZ |
246 | { |
247 | u32 i; | |
248 | acpi_status status = AE_OK; | |
249 | struct acpi_table_desc new_table_desc; | |
250 | ||
ed6f1d44 | 251 | ACPI_FUNCTION_TRACE(tb_install_standard_table); |
86dfc6f3 | 252 | |
ed6f1d44 | 253 | /* Acquire a temporary table descriptor for validation */ |
86dfc6f3 | 254 | |
ed6f1d44 | 255 | status = acpi_tb_acquire_temp_table(&new_table_desc, address, flags); |
86dfc6f3 | 256 | if (ACPI_FAILURE(status)) { |
cc2080b0 LZ |
257 | ACPI_ERROR((AE_INFO, |
258 | "Could not acquire table length at %8.8X%8.8X", | |
259 | ACPI_FORMAT_UINT64(address))); | |
86dfc6f3 LZ |
260 | return_ACPI_STATUS(status); |
261 | } | |
262 | ||
a94e88cd LZ |
263 | /* |
264 | * Optionally do not load any SSDTs from the RSDT/XSDT. This can | |
265 | * be useful for debugging ACPI problems on some machines. | |
266 | */ | |
ed6f1d44 BM |
267 | if (!reload && |
268 | acpi_gbl_disable_ssdt_table_install && | |
a94e88cd | 269 | ACPI_COMPARE_NAME(&new_table_desc.signature, ACPI_SIG_SSDT)) { |
cc2080b0 LZ |
270 | ACPI_INFO((AE_INFO, |
271 | "Ignoring installation of %4.4s at %8.8X%8.8X", | |
6d3fd3cc | 272 | new_table_desc.signature.ascii, |
cc2080b0 | 273 | ACPI_FORMAT_UINT64(address))); |
a94e88cd LZ |
274 | goto release_and_exit; |
275 | } | |
276 | ||
86dfc6f3 LZ |
277 | /* Validate and verify a table before installation */ |
278 | ||
47d68c7f | 279 | status = acpi_tb_verify_temp_table(&new_table_desc, NULL); |
86dfc6f3 LZ |
280 | if (ACPI_FAILURE(status)) { |
281 | goto release_and_exit; | |
282 | } | |
283 | ||
284 | if (reload) { | |
285 | /* | |
286 | * Validate the incoming table signature. | |
287 | * | |
288 | * 1) Originally, we checked the table signature for "SSDT" or "PSDT". | |
289 | * 2) We added support for OEMx tables, signature "OEM". | |
290 | * 3) Valid tables were encountered with a null signature, so we just | |
291 | * gave up on validating the signature, (05/2008). | |
292 | * 4) We encountered non-AML tables such as the MADT, which caused | |
293 | * interpreter errors and kernel faults. So now, we once again allow | |
294 | * only "SSDT", "OEMx", and now, also a null signature. (05/2011). | |
295 | */ | |
296 | if ((new_table_desc.signature.ascii[0] != 0x00) && | |
297 | (!ACPI_COMPARE_NAME | |
298 | (&new_table_desc.signature, ACPI_SIG_SSDT)) | |
4fa4616e | 299 | && (strncmp(new_table_desc.signature.ascii, "OEM", 3))) { |
86dfc6f3 LZ |
300 | ACPI_BIOS_ERROR((AE_INFO, |
301 | "Table has invalid signature [%4.4s] (0x%8.8X), " | |
302 | "must be SSDT or OEMx", | |
303 | acpi_ut_valid_acpi_name(new_table_desc. | |
304 | signature. | |
305 | ascii) ? | |
306 | new_table_desc.signature. | |
307 | ascii : "????", | |
308 | new_table_desc.signature.integer)); | |
309 | ||
310 | status = AE_BAD_SIGNATURE; | |
311 | goto release_and_exit; | |
312 | } | |
313 | ||
314 | /* Check if table is already registered */ | |
315 | ||
316 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; | |
317 | ++i) { | |
318 | /* | |
319 | * Check for a table match on the entire table length, | |
320 | * not just the header. | |
321 | */ | |
c418ce19 | 322 | if (!acpi_tb_compare_tables(&new_table_desc, i)) { |
86dfc6f3 LZ |
323 | continue; |
324 | } | |
325 | ||
326 | /* | |
327 | * Note: the current mechanism does not unregister a table if it is | |
328 | * dynamically unloaded. The related namespace entries are deleted, | |
329 | * but the table remains in the root table list. | |
330 | * | |
331 | * The assumption here is that the number of different tables that | |
332 | * will be loaded is actually small, and there is minimal overhead | |
333 | * in just keeping the table in case it is needed again. | |
334 | * | |
335 | * If this assumption changes in the future (perhaps on large | |
336 | * machines with many table load/unload operations), tables will | |
337 | * need to be unregistered when they are unloaded, and slots in the | |
338 | * root table list should be reused when empty. | |
339 | */ | |
1fad8738 BM |
340 | if (acpi_gbl_root_table_list.tables[i].flags & |
341 | ACPI_TABLE_IS_LOADED) { | |
86dfc6f3 LZ |
342 | |
343 | /* Table is still loaded, this is an error */ | |
344 | ||
345 | status = AE_ALREADY_EXISTS; | |
346 | goto release_and_exit; | |
347 | } else { | |
348 | /* | |
349 | * Table was unloaded, allow it to be reloaded. | |
350 | * As we are going to return AE_OK to the caller, we should | |
351 | * take the responsibility of freeing the input descriptor. | |
352 | * Refill the input descriptor to ensure | |
ed6f1d44 | 353 | * acpi_tb_install_table_with_override() can be called again to |
86dfc6f3 LZ |
354 | * indicate the re-installation. |
355 | */ | |
356 | acpi_tb_uninstall_table(&new_table_desc); | |
357 | *table_index = i; | |
86dfc6f3 LZ |
358 | return_ACPI_STATUS(AE_OK); |
359 | } | |
360 | } | |
7f9fc99c | 361 | } |
d3ccaff8 | 362 | |
e56f5617 BM |
363 | /* Add the table to the global root table list */ |
364 | ||
8ec3f459 LZ |
365 | acpi_tb_install_table_with_override(&new_table_desc, override, |
366 | table_index); | |
86dfc6f3 LZ |
367 | |
368 | release_and_exit: | |
0c9938cc | 369 | |
ed6f1d44 | 370 | /* Release the temporary table descriptor */ |
1da177e4 | 371 | |
ed6f1d44 | 372 | acpi_tb_release_temp_table(&new_table_desc); |
4be44fcd | 373 | return_ACPI_STATUS(status); |
1da177e4 LT |
374 | } |
375 | ||
f7b004a1 BM |
376 | /******************************************************************************* |
377 | * | |
7f9fc99c | 378 | * FUNCTION: acpi_tb_override_table |
f7b004a1 | 379 | * |
86dfc6f3 LZ |
380 | * PARAMETERS: old_table_desc - Validated table descriptor to be |
381 | * overridden | |
f7b004a1 | 382 | * |
86dfc6f3 | 383 | * RETURN: None |
f7b004a1 BM |
384 | * |
385 | * DESCRIPTION: Attempt table override by calling the OSL override functions. | |
386 | * Note: If the table is overridden, then the entire new table | |
7f9fc99c | 387 | * is acquired and returned by this function. |
86dfc6f3 LZ |
388 | * Before/after invocation, the table descriptor is in a state |
389 | * that is "VALIDATED". | |
f7b004a1 BM |
390 | * |
391 | ******************************************************************************/ | |
392 | ||
86dfc6f3 | 393 | void acpi_tb_override_table(struct acpi_table_desc *old_table_desc) |
f7b004a1 BM |
394 | { |
395 | acpi_status status; | |
f7b004a1 | 396 | char *override_type; |
7f9fc99c | 397 | struct acpi_table_desc new_table_desc; |
86dfc6f3 LZ |
398 | struct acpi_table_header *table; |
399 | acpi_physical_address address; | |
400 | u32 length; | |
f7b004a1 BM |
401 | |
402 | /* (1) Attempt logical override (returns a logical address) */ | |
403 | ||
86dfc6f3 LZ |
404 | status = acpi_os_table_override(old_table_desc->pointer, &table); |
405 | if (ACPI_SUCCESS(status) && table) { | |
ed6f1d44 BM |
406 | acpi_tb_acquire_temp_table(&new_table_desc, |
407 | ACPI_PTR_TO_PHYSADDR(table), | |
408 | ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL); | |
f7b004a1 BM |
409 | override_type = "Logical"; |
410 | goto finish_override; | |
411 | } | |
412 | ||
413 | /* (2) Attempt physical override (returns a physical address) */ | |
414 | ||
86dfc6f3 LZ |
415 | status = acpi_os_physical_table_override(old_table_desc->pointer, |
416 | &address, &length); | |
417 | if (ACPI_SUCCESS(status) && address && length) { | |
ed6f1d44 BM |
418 | acpi_tb_acquire_temp_table(&new_table_desc, address, |
419 | ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); | |
f7b004a1 | 420 | override_type = "Physical"; |
f7b004a1 BM |
421 | goto finish_override; |
422 | } | |
423 | ||
86dfc6f3 | 424 | return; /* There was no override */ |
f7b004a1 | 425 | |
10622bf8 | 426 | finish_override: |
f7b004a1 | 427 | |
86dfc6f3 LZ |
428 | /* Validate and verify a table before overriding */ |
429 | ||
47d68c7f | 430 | status = acpi_tb_verify_temp_table(&new_table_desc, NULL); |
7f9fc99c | 431 | if (ACPI_FAILURE(status)) { |
86dfc6f3 | 432 | return; |
7f9fc99c LZ |
433 | } |
434 | ||
1d0a0b2f LZ |
435 | ACPI_INFO((AE_INFO, "%4.4s 0x%8.8X%8.8X" |
436 | " %s table override, new table: 0x%8.8X%8.8X", | |
86dfc6f3 | 437 | old_table_desc->signature.ascii, |
1d0a0b2f LZ |
438 | ACPI_FORMAT_UINT64(old_table_desc->address), |
439 | override_type, ACPI_FORMAT_UINT64(new_table_desc.address))); | |
f7b004a1 | 440 | |
86dfc6f3 | 441 | /* We can now uninstall the original table */ |
f7b004a1 | 442 | |
86dfc6f3 | 443 | acpi_tb_uninstall_table(old_table_desc); |
f7b004a1 | 444 | |
86dfc6f3 LZ |
445 | /* |
446 | * Replace the original table descriptor and keep its state as | |
447 | * "VALIDATED". | |
448 | */ | |
ed6f1d44 BM |
449 | acpi_tb_init_table_descriptor(old_table_desc, new_table_desc.address, |
450 | new_table_desc.flags, | |
451 | new_table_desc.pointer); | |
47d68c7f | 452 | acpi_tb_validate_temp_table(old_table_desc); |
f7b004a1 | 453 | |
ed6f1d44 | 454 | /* Release the temporary table descriptor */ |
f7b004a1 | 455 | |
ed6f1d44 | 456 | acpi_tb_release_temp_table(&new_table_desc); |
f7b004a1 BM |
457 | } |
458 | ||
f3d2e786 BM |
459 | /******************************************************************************* |
460 | * | |
7f9fc99c | 461 | * FUNCTION: acpi_tb_uninstall_table |
f3d2e786 | 462 | * |
7f9fc99c | 463 | * PARAMETERS: table_desc - Table descriptor |
f3d2e786 BM |
464 | * |
465 | * RETURN: None | |
466 | * | |
467 | * DESCRIPTION: Delete one internal ACPI table | |
468 | * | |
469 | ******************************************************************************/ | |
1da177e4 | 470 | |
7f9fc99c | 471 | void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc) |
f3d2e786 | 472 | { |
5582982d | 473 | |
7f9fc99c | 474 | ACPI_FUNCTION_TRACE(tb_uninstall_table); |
5582982d | 475 | |
7f9fc99c | 476 | /* Table must be installed */ |
5582982d | 477 | |
7f9fc99c LZ |
478 | if (!table_desc->address) { |
479 | return_VOID; | |
480 | } | |
f7b004a1 | 481 | |
7f9fc99c | 482 | acpi_tb_invalidate_table(table_desc); |
1d1ea1b7 | 483 | |
7f9fc99c | 484 | if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == |
ed6f1d44 | 485 | ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) { |
6d3fd3cc | 486 | ACPI_FREE(ACPI_PHYSADDR_TO_PTR(table_desc->address)); |
1da177e4 LT |
487 | } |
488 | ||
7f9fc99c | 489 | table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL); |
7f9fc99c | 490 | return_VOID; |
1da177e4 | 491 | } |