blob: 5e8d50a4b6a9a1f4d1ae020039338547c7a5654b [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/******************************************************************************
3 *
Bob Moore42f47862013-06-08 00:59:02 +00004 * Module Name: tbutils - ACPI Table utilities
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Bob Moore4441e552021-01-15 10:48:25 -08006 * Copyright (C) 2000 - 2021, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
Erik Schmauss95857632018-03-14 16:13:07 -07008 *****************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <acpi/acpi.h>
Len Browne2f7a772009-01-09 00:30:03 -050011#include "accommon.h"
12#include "actables.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#define _COMPONENT ACPI_TABLES
Len Brown4be44fc2005-08-05 00:44:28 -040015ACPI_MODULE_NAME("tbutils")
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Robert Moore44f6c012005-04-18 22:49:35 -040017/* Local prototypes */
Bob Moorea4bbb812007-02-02 19:48:19 +030018static acpi_physical_address
Bob Moore67a119f2008-06-10 13:42:13 +080019acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
20
Bob Moore33620c52012-02-14 18:14:27 +080021#if (!ACPI_REDUCED_HARDWARE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/*******************************************************************************
23 *
Bob Moore009c4cbe2008-11-12 15:34:52 +080024 * FUNCTION: acpi_tb_initialize_facs
25 *
26 * PARAMETERS: None
27 *
28 * RETURN: Status
29 *
30 * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global
31 * for accessing the Global Lock and Firmware Waking Vector
32 *
33 ******************************************************************************/
34
35acpi_status acpi_tb_initialize_facs(void)
36{
Lv Zheng74846192015-08-25 10:29:08 +080037 struct acpi_table_facs *facs;
Bob Moore009c4cbe2008-11-12 15:34:52 +080038
Bob Moore22e5b402011-11-16 10:57:28 +080039 /* If Hardware Reduced flag is set, there is no FACS */
40
41 if (acpi_gbl_reduced_hardware) {
42 acpi_gbl_FACS = NULL;
43 return (AE_OK);
Lv Zheng8ec3f452015-08-25 10:29:01 +080044 } else if (acpi_gbl_FADT.Xfacs &&
45 (!acpi_gbl_FADT.facs
46 || !acpi_gbl_use32_bit_facs_addresses)) {
47 (void)acpi_get_table_by_index(acpi_gbl_xfacs_index,
48 ACPI_CAST_INDIRECT_PTR(struct
49 acpi_table_header,
Lv Zheng74846192015-08-25 10:29:08 +080050 &facs));
51 acpi_gbl_FACS = facs;
Lv Zheng8ec3f452015-08-25 10:29:01 +080052 } else if (acpi_gbl_FADT.facs) {
53 (void)acpi_get_table_by_index(acpi_gbl_facs_index,
54 ACPI_CAST_INDIRECT_PTR(struct
55 acpi_table_header,
Lv Zheng74846192015-08-25 10:29:08 +080056 &facs));
57 acpi_gbl_FACS = facs;
Lv Zhengc04e1fb2015-07-01 14:43:11 +080058 }
59
Lv Zhengf06147f2015-07-01 14:43:18 +080060 /* If there is no FACS, just continue. There was already an error msg */
61
Lv Zhengc04e1fb2015-07-01 14:43:11 +080062 return (AE_OK);
Bob Moore009c4cbe2008-11-12 15:34:52 +080063}
Bob Moore33620c52012-02-14 18:14:27 +080064#endif /* !ACPI_REDUCED_HARDWARE */
Bob Moore009c4cbe2008-11-12 15:34:52 +080065
66/*******************************************************************************
67 *
Lin Ming729df0f2010-04-01 10:47:56 +080068 * FUNCTION: acpi_tb_check_dsdt_header
69 *
70 * PARAMETERS: None
71 *
72 * RETURN: None
73 *
74 * DESCRIPTION: Quick compare to check validity of the DSDT. This will detect
75 * if the DSDT has been replaced from outside the OS and/or if
76 * the DSDT header has been corrupted.
77 *
78 ******************************************************************************/
79
80void acpi_tb_check_dsdt_header(void)
81{
82
83 /* Compare original length and checksum to current values */
84
Bob Moore43323cb2010-04-07 11:05:11 +080085 if (acpi_gbl_original_dsdt_header.length != acpi_gbl_DSDT->length ||
86 acpi_gbl_original_dsdt_header.checksum != acpi_gbl_DSDT->checksum) {
Bob Moore3b3ea772012-07-16 09:39:54 +080087 ACPI_BIOS_ERROR((AE_INFO,
88 "The DSDT has been corrupted or replaced - "
89 "old, new headers below"));
Bob Moore1fad8732015-12-29 13:54:36 +080090
Lin Ming729df0f2010-04-01 10:47:56 +080091 acpi_tb_print_table_header(0, &acpi_gbl_original_dsdt_header);
Bob Moore43323cb2010-04-07 11:05:11 +080092 acpi_tb_print_table_header(0, acpi_gbl_DSDT);
Lin Ming729df0f2010-04-01 10:47:56 +080093
Lin Mingaa2110c2010-04-08 14:34:27 +080094 ACPI_ERROR((AE_INFO,
95 "Please send DMI info to linux-acpi@vger.kernel.org\n"
96 "If system does not work as expected, please boot with acpi=copy_dsdt"));
97
Lin Ming729df0f2010-04-01 10:47:56 +080098 /* Disable further error messages */
99
Bob Moore43323cb2010-04-07 11:05:11 +0800100 acpi_gbl_original_dsdt_header.length = acpi_gbl_DSDT->length;
Lin Ming729df0f2010-04-01 10:47:56 +0800101 acpi_gbl_original_dsdt_header.checksum =
Bob Moore43323cb2010-04-07 11:05:11 +0800102 acpi_gbl_DSDT->checksum;
Lin Ming729df0f2010-04-01 10:47:56 +0800103 }
104}
105
106/*******************************************************************************
107 *
Lin Ming69ec87e2010-04-01 11:14:12 +0800108 * FUNCTION: acpi_tb_copy_dsdt
109 *
Cao Jin32d80042017-06-05 16:41:04 +0800110 * PARAMETERS: table_index - Index of installed table to copy
Lin Ming69ec87e2010-04-01 11:14:12 +0800111 *
Cao Jin32d80042017-06-05 16:41:04 +0800112 * RETURN: The copied DSDT
Lin Ming69ec87e2010-04-01 11:14:12 +0800113 *
114 * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory.
115 * Some very bad BIOSs are known to either corrupt the DSDT or
116 * install a new, bad DSDT. This copy works around the problem.
117 *
118 ******************************************************************************/
119
Bob Moore43323cb2010-04-07 11:05:11 +0800120struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index)
Lin Ming69ec87e2010-04-01 11:14:12 +0800121{
122 struct acpi_table_header *new_table;
Bob Moore43323cb2010-04-07 11:05:11 +0800123 struct acpi_table_desc *table_desc;
124
125 table_desc = &acpi_gbl_root_table_list.tables[table_index];
Lin Ming69ec87e2010-04-01 11:14:12 +0800126
127 new_table = ACPI_ALLOCATE(table_desc->length);
128 if (!new_table) {
129 ACPI_ERROR((AE_INFO, "Could not copy DSDT of length 0x%X",
130 table_desc->length));
Bob Moore43323cb2010-04-07 11:05:11 +0800131 return (NULL);
Lin Ming69ec87e2010-04-01 11:14:12 +0800132 }
133
Bob Moore4fa46162015-07-01 14:45:11 +0800134 memcpy(new_table, table_desc->pointer, table_desc->length);
Lv Zheng7f9fc992014-04-04 12:38:42 +0800135 acpi_tb_uninstall_table(table_desc);
Bob Mooreed6f1d42014-04-04 12:39:26 +0800136
137 acpi_tb_init_table_descriptor(&acpi_gbl_root_table_list.
Lv Zheng8ec3f452015-08-25 10:29:01 +0800138 tables[acpi_gbl_dsdt_index],
Bob Mooreed6f1d42014-04-04 12:39:26 +0800139 ACPI_PTR_TO_PHYSADDR(new_table),
140 ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
141 new_table);
Lin Ming69ec87e2010-04-01 11:14:12 +0800142
Bob Moore05fb04b2016-02-19 14:16:42 +0800143 ACPI_INFO(("Forced DSDT copy: length 0x%05X copied locally, original unmapped", new_table->length));
Bob Moore43323cb2010-04-07 11:05:11 +0800144
145 return (new_table);
Lin Ming69ec87e2010-04-01 11:14:12 +0800146}
147
148/*******************************************************************************
149 *
Bob Moorea4bbb812007-02-02 19:48:19 +0300150 * FUNCTION: acpi_tb_get_root_table_entry
151 *
152 * PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry
153 * table_entry_size - sizeof 32 or 64 (RSDT or XSDT)
154 *
155 * RETURN: Physical address extracted from the root table
156 *
157 * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
158 * both 32-bit and 64-bit platforms
159 *
160 * NOTE: acpi_physical_address is 32-bit on 32-bit platforms, 64-bit on
161 * 64-bit platforms.
162 *
163 ******************************************************************************/
164
165static acpi_physical_address
Bob Moore67a119f2008-06-10 13:42:13 +0800166acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)
Bob Moorea4bbb812007-02-02 19:48:19 +0300167{
168 u64 address64;
169
170 /*
171 * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
172 * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
173 */
Lv Zheng671cc682014-01-08 13:43:34 +0800174 if (table_entry_size == ACPI_RSDT_ENTRY_SIZE) {
Bob Moorea4bbb812007-02-02 19:48:19 +0300175 /*
176 * 32-bit platform, RSDT: Return 32-bit table entry
177 * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
178 */
179 return ((acpi_physical_address)
180 (*ACPI_CAST_PTR(u32, table_entry)));
181 } else {
182 /*
183 * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
Bob Mooreec41f192009-02-18 15:03:30 +0800184 * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
185 * return 64-bit
Bob Moorea4bbb812007-02-02 19:48:19 +0300186 */
187 ACPI_MOVE_64_TO_64(&address64, table_entry);
188
189#if ACPI_MACHINE_WIDTH == 32
190 if (address64 > ACPI_UINT32_MAX) {
191
Bob Mooreea5d8eb2007-02-02 19:48:20 +0300192 /* Will truncate 64-bit address to 32 bits, issue warning */
Bob Moorea4bbb812007-02-02 19:48:19 +0300193
Bob Moore3b3ea772012-07-16 09:39:54 +0800194 ACPI_BIOS_WARNING((AE_INFO,
195 "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
196 " truncating",
197 ACPI_FORMAT_UINT64(address64)));
Bob Moorea4bbb812007-02-02 19:48:19 +0300198 }
199#endif
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800200 return ((acpi_physical_address)(address64));
Bob Moorea4bbb812007-02-02 19:48:19 +0300201 }
202}
203
204/*******************************************************************************
205 *
Bob Mooref3d2e782007-02-02 19:48:18 +0300206 * FUNCTION: acpi_tb_parse_root_table
207 *
Cao Jin32d80042017-06-05 16:41:04 +0800208 * PARAMETERS: rsdp_address - Pointer to the RSDP
Bob Mooref3d2e782007-02-02 19:48:18 +0300209 *
210 * RETURN: Status
211 *
212 * DESCRIPTION: This function is called to parse the Root System Description
213 * Table (RSDT or XSDT)
214 *
215 * NOTE: Tables are mapped (not copied) for efficiency. The FACS must
216 * be mapped and cannot be copied because it contains the actual
217 * memory location of the ACPI Global Lock.
218 *
219 ******************************************************************************/
220
Lv Zheng2368b1a2016-08-04 16:43:19 +0800221acpi_status ACPI_INIT_FUNCTION
222acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
Bob Mooref3d2e782007-02-02 19:48:18 +0300223{
Bob Moorec5fc42a2007-02-02 19:48:19 +0300224 struct acpi_table_rsdp *rsdp;
Bob Moore67a119f2008-06-10 13:42:13 +0800225 u32 table_entry_size;
226 u32 i;
Bob Moorec5fc42a2007-02-02 19:48:19 +0300227 u32 table_count;
Bob Mooref3d2e782007-02-02 19:48:18 +0300228 struct acpi_table_header *table;
229 acpi_physical_address address;
230 u32 length;
231 u8 *table_entry;
Bob Mooref3d2e782007-02-02 19:48:18 +0300232 acpi_status status;
Lv Zheng86dfc6f32014-04-04 12:38:57 +0800233 u32 table_index;
Bob Mooref3d2e782007-02-02 19:48:18 +0300234
235 ACPI_FUNCTION_TRACE(tb_parse_root_table);
236
Lv Zheng671cc682014-01-08 13:43:34 +0800237 /* Map the entire RSDP and extract the address of the RSDT or XSDT */
238
Bob Moorec5fc42a2007-02-02 19:48:19 +0300239 rsdp = acpi_os_map_memory(rsdp_address, sizeof(struct acpi_table_rsdp));
240 if (!rsdp) {
241 return_ACPI_STATUS(AE_NO_MEMORY);
242 }
243
244 acpi_tb_print_table_header(rsdp_address,
245 ACPI_CAST_PTR(struct acpi_table_header,
246 rsdp));
247
Lv Zhengfab46102014-01-08 13:43:40 +0800248 /* Use XSDT if present and not overridden. Otherwise, use RSDT */
Bob Mooref3d2e782007-02-02 19:48:18 +0300249
Lv Zhengfab46102014-01-08 13:43:40 +0800250 if ((rsdp->revision > 1) &&
251 rsdp->xsdt_physical_address && !acpi_gbl_do_not_use_xsdt) {
Bob Moorea18ecf42005-08-15 03:42:00 -0800252 /*
Lv Zheng671cc682014-01-08 13:43:34 +0800253 * RSDP contains an XSDT (64-bit physical addresses). We must use
254 * the XSDT if the revision is > 1 and the XSDT pointer is present,
255 * as per the ACPI specification.
Bob Moorea18ecf42005-08-15 03:42:00 -0800256 */
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800257 address = (acpi_physical_address)rsdp->xsdt_physical_address;
Lv Zheng671cc682014-01-08 13:43:34 +0800258 table_entry_size = ACPI_XSDT_ENTRY_SIZE;
Bob Mooref3d2e782007-02-02 19:48:18 +0300259 } else {
260 /* Root table is an RSDT (32-bit physical addresses) */
Bob Moore52fc0b02006-10-02 00:00:00 -0400261
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800262 address = (acpi_physical_address)rsdp->rsdt_physical_address;
Lv Zheng671cc682014-01-08 13:43:34 +0800263 table_entry_size = ACPI_RSDT_ENTRY_SIZE;
Bob Mooref3d2e782007-02-02 19:48:18 +0300264 }
Robert Moore0c9938c2005-07-29 15:15:00 -0700265
Bob Moorec5fc42a2007-02-02 19:48:19 +0300266 /*
267 * It is not possible to map more than one entry in some environments,
268 * so unmap the RSDP here before mapping other tables
269 */
270 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp));
271
272 /* Map the RSDT/XSDT table header to get the full table length */
Robert Moore0c9938c2005-07-29 15:15:00 -0700273
Bob Mooref3d2e782007-02-02 19:48:18 +0300274 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
275 if (!table) {
Bob Moorec5fc42a2007-02-02 19:48:19 +0300276 return_ACPI_STATUS(AE_NO_MEMORY);
Bob Mooref3d2e782007-02-02 19:48:18 +0300277 }
Robert Moore0c9938c2005-07-29 15:15:00 -0700278
Bob Moorec5fc42a2007-02-02 19:48:19 +0300279 acpi_tb_print_table_header(address, table);
280
Lv Zheng671cc682014-01-08 13:43:34 +0800281 /*
282 * Validate length of the table, and map entire table.
283 * Minimum length table must contain at least one entry.
284 */
Bob Mooref3d2e782007-02-02 19:48:18 +0300285 length = table->length;
286 acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
287
Lv Zheng671cc682014-01-08 13:43:34 +0800288 if (length < (sizeof(struct acpi_table_header) + table_entry_size)) {
Bob Moore3b3ea772012-07-16 09:39:54 +0800289 ACPI_BIOS_ERROR((AE_INFO,
290 "Invalid table length 0x%X in RSDT/XSDT",
291 length));
Bob Moorec5fc42a2007-02-02 19:48:19 +0300292 return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
Bob Mooref3d2e782007-02-02 19:48:18 +0300293 }
294
295 table = acpi_os_map_memory(address, length);
296 if (!table) {
Bob Moorec5fc42a2007-02-02 19:48:19 +0300297 return_ACPI_STATUS(AE_NO_MEMORY);
Bob Mooref3d2e782007-02-02 19:48:18 +0300298 }
299
300 /* Validate the root table checksum */
301
Bob Moorec5fc42a2007-02-02 19:48:19 +0300302 status = acpi_tb_verify_checksum(table, length);
303 if (ACPI_FAILURE(status)) {
Bob Mooref3d2e782007-02-02 19:48:18 +0300304 acpi_os_unmap_memory(table, length);
Bob Moorec5fc42a2007-02-02 19:48:19 +0300305 return_ACPI_STATUS(status);
Bob Mooref3d2e782007-02-02 19:48:18 +0300306 }
Bob Mooref3d2e782007-02-02 19:48:18 +0300307
Lv Zheng671cc682014-01-08 13:43:34 +0800308 /* Get the number of entries and pointer to first entry */
Bob Mooref3d2e782007-02-02 19:48:18 +0300309
Bob Mooreec41f192009-02-18 15:03:30 +0800310 table_count = (u32)((table->length - sizeof(struct acpi_table_header)) /
311 table_entry_size);
Lv Zheng671cc682014-01-08 13:43:34 +0800312 table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header));
313
Lv Zheng671cc682014-01-08 13:43:34 +0800314 /* Initialize the root table array from the RSDT/XSDT */
315
Bob Moorec5fc42a2007-02-02 19:48:19 +0300316 for (i = 0; i < table_count; i++) {
Robert Moore0c9938c2005-07-29 15:15:00 -0700317
Bob Moorea4bbb812007-02-02 19:48:19 +0300318 /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
319
Lv Zheng0f929fbf2014-04-30 10:05:56 +0800320 address =
321 acpi_tb_get_root_table_entry(table_entry, table_entry_size);
322
323 /* Skip NULL entries in RSDT/XSDT */
324
325 if (!address) {
326 goto next_table;
327 }
328
329 status = acpi_tb_install_standard_table(address,
330 ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
Jessica Clarke5d6e5962021-12-22 17:22:28 +0100331 NULL, FALSE, TRUE,
Lv Zheng0f929fbf2014-04-30 10:05:56 +0800332 &table_index);
Lv Zheng86dfc6f32014-04-04 12:38:57 +0800333
334 if (ACPI_SUCCESS(status) &&
Bob Moore5599fb62019-04-08 13:42:24 -0700335 ACPI_COMPARE_NAMESEG(&acpi_gbl_root_table_list.
336 tables[table_index].signature,
337 ACPI_SIG_FADT)) {
Lv Zheng62fcce92015-10-14 13:53:57 +0800338 acpi_gbl_fadt_index = table_index;
339 acpi_tb_parse_fadt();
Lv Zheng86dfc6f32014-04-04 12:38:57 +0800340 }
Bob Mooref3d2e782007-02-02 19:48:18 +0300341
Lv Zheng0f929fbf2014-04-30 10:05:56 +0800342next_table:
343
Bob Moorec5fc42a2007-02-02 19:48:19 +0300344 table_entry += table_entry_size;
Bob Mooref3d2e782007-02-02 19:48:18 +0300345 }
346
Bob Mooref3d2e782007-02-02 19:48:18 +0300347 acpi_os_unmap_memory(table, length);
Len Brown4be44fc2005-08-05 00:44:28 -0400348 return_ACPI_STATUS(AE_OK);
Robert Moore0c9938c2005-07-29 15:15:00 -0700349}
Lv Zheng174cc712016-12-14 15:04:25 +0800350
351/*******************************************************************************
352 *
353 * FUNCTION: acpi_tb_get_table
354 *
355 * PARAMETERS: table_desc - Table descriptor
356 * out_table - Where the pointer to the table is returned
357 *
358 * RETURN: Status and pointer to the requested table
359 *
360 * DESCRIPTION: Increase a reference to a table descriptor and return the
361 * validated table pointer.
362 * If the table descriptor is an entry of the root table list,
363 * this API must be invoked with ACPI_MTX_TABLES acquired.
364 *
365 ******************************************************************************/
366
367acpi_status
368acpi_tb_get_table(struct acpi_table_desc *table_desc,
369 struct acpi_table_header **out_table)
370{
371 acpi_status status;
372
373 ACPI_FUNCTION_TRACE(acpi_tb_get_table);
374
375 if (table_desc->validation_count == 0) {
376
377 /* Table need to be "VALIDATED" */
378
379 status = acpi_tb_validate_table(table_desc);
380 if (ACPI_FAILURE(status)) {
381 return_ACPI_STATUS(status);
382 }
383 }
384
Lv Zheng83848fb2017-06-07 12:54:58 +0800385 if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
386 table_desc->validation_count++;
387
388 /*
389 * Detect validation_count overflows to ensure that the warning
390 * message will only be printed once.
391 */
392 if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
393 ACPI_WARNING((AE_INFO,
394 "Table %p, Validation count overflows\n",
395 table_desc));
396 }
Lv Zheng174cc712016-12-14 15:04:25 +0800397 }
398
399 *out_table = table_desc->pointer;
400 return_ACPI_STATUS(AE_OK);
401}
402
403/*******************************************************************************
404 *
405 * FUNCTION: acpi_tb_put_table
406 *
407 * PARAMETERS: table_desc - Table descriptor
408 *
409 * RETURN: None
410 *
411 * DESCRIPTION: Decrease a reference to a table descriptor and release the
412 * validated table pointer if no references.
413 * If the table descriptor is an entry of the root table list,
414 * this API must be invoked with ACPI_MTX_TABLES acquired.
415 *
416 ******************************************************************************/
417
418void acpi_tb_put_table(struct acpi_table_desc *table_desc)
419{
420
421 ACPI_FUNCTION_TRACE(acpi_tb_put_table);
422
Lv Zheng83848fb2017-06-07 12:54:58 +0800423 if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
424 table_desc->validation_count--;
425
426 /*
427 * Detect validation_count underflows to ensure that the warning
428 * message will only be printed once.
429 */
430 if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
431 ACPI_WARNING((AE_INFO,
432 "Table %p, Validation count underflows\n",
433 table_desc));
434 return_VOID;
435 }
Lv Zheng174cc712016-12-14 15:04:25 +0800436 }
Lv Zheng174cc712016-12-14 15:04:25 +0800437
438 if (table_desc->validation_count == 0) {
439
440 /* Table need to be "INVALIDATED" */
441
442 acpi_tb_invalidate_table(table_desc);
443 }
444
445 return_VOID;
446}