Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/tables/tbinstal.c
+++ new/usr/src/common/acpica/components/tables/tbinstal.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: tbinstal - ACPI table installation and removal
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44
45 45 #define __TBINSTAL_C__
46 46
47 47 #include "acpi.h"
48 48 #include "accommon.h"
49 49 #include "acnamesp.h"
50 50 #include "actables.h"
51 51
52 52
53 53 #define _COMPONENT ACPI_TABLES
54 54 ACPI_MODULE_NAME ("tbinstal")
55 55
56 56
57 57 /******************************************************************************
58 58 *
59 59 * FUNCTION: AcpiTbVerifyTable
60 60 *
61 61 * PARAMETERS: TableDesc - table
62 62 *
63 63 * RETURN: Status
64 64 *
65 65 * DESCRIPTION: this function is called to verify and map table
66 66 *
67 67 *****************************************************************************/
68 68
69 69 ACPI_STATUS
70 70 AcpiTbVerifyTable (
71 71 ACPI_TABLE_DESC *TableDesc)
72 72 {
73 73 ACPI_STATUS Status = AE_OK;
74 74
75 75
76 76 ACPI_FUNCTION_TRACE (TbVerifyTable);
77 77
78 78
79 79 /* Map the table if necessary */
80 80
81 81 if (!TableDesc->Pointer)
82 82 {
83 83 if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
84 84 ACPI_TABLE_ORIGIN_MAPPED)
85 85 {
↓ open down ↓ |
67 lines elided |
↑ open up ↑ |
86 86 TableDesc->Pointer = AcpiOsMapMemory (
87 87 TableDesc->Address, TableDesc->Length);
88 88 }
89 89
90 90 if (!TableDesc->Pointer)
91 91 {
92 92 return_ACPI_STATUS (AE_NO_MEMORY);
93 93 }
94 94 }
95 95
96 - /* FACS is the odd table, has no standard ACPI header and no checksum */
96 + /* Always calculate checksum, ignore bad checksum if requested */
97 97
98 - if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS))
99 - {
100 - /* Always calculate checksum, ignore bad checksum if requested */
98 + Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
101 99
102 - Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
103 - }
104 -
105 100 return_ACPI_STATUS (Status);
106 101 }
107 102
108 103
109 104 /*******************************************************************************
110 105 *
111 106 * FUNCTION: AcpiTbAddTable
112 107 *
113 108 * PARAMETERS: TableDesc - Table descriptor
114 109 * TableIndex - Where the table index is returned
115 110 *
116 111 * RETURN: Status
117 112 *
118 113 * DESCRIPTION: This function is called to add an ACPI table. It is used to
119 114 * dynamically load tables via the Load and LoadTable AML
120 115 * operators.
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
121 116 *
122 117 ******************************************************************************/
123 118
124 119 ACPI_STATUS
125 120 AcpiTbAddTable (
126 121 ACPI_TABLE_DESC *TableDesc,
127 122 UINT32 *TableIndex)
128 123 {
129 124 UINT32 i;
130 125 ACPI_STATUS Status = AE_OK;
131 - ACPI_TABLE_HEADER *OverrideTable = NULL;
132 126
133 127
134 128 ACPI_FUNCTION_TRACE (TbAddTable);
135 129
136 130
137 131 if (!TableDesc->Pointer)
138 132 {
139 133 Status = AcpiTbVerifyTable (TableDesc);
140 134 if (ACPI_FAILURE (Status) || !TableDesc->Pointer)
141 135 {
142 136 return_ACPI_STATUS (Status);
143 137 }
144 138 }
145 139
146 140 /*
147 141 * Validate the incoming table signature.
148 142 *
149 143 * 1) Originally, we checked the table signature for "SSDT" or "PSDT".
150 144 * 2) We added support for OEMx tables, signature "OEM".
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
151 145 * 3) Valid tables were encountered with a null signature, so we just
152 146 * gave up on validating the signature, (05/2008).
153 147 * 4) We encountered non-AML tables such as the MADT, which caused
154 148 * interpreter errors and kernel faults. So now, we once again allow
155 149 * only "SSDT", "OEMx", and now, also a null signature. (05/2011).
156 150 */
157 151 if ((TableDesc->Pointer->Signature[0] != 0x00) &&
158 152 (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) &&
159 153 (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3)))
160 154 {
161 - ACPI_ERROR ((AE_INFO,
162 - "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx",
163 - AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature) ?
155 + ACPI_BIOS_ERROR ((AE_INFO,
156 + "Table has invalid signature [%4.4s] (0x%8.8X), "
157 + "must be SSDT or OEMx",
158 + AcpiUtValidAcpiName (TableDesc->Pointer->Signature) ?
164 159 TableDesc->Pointer->Signature : "????",
165 160 *(UINT32 *) TableDesc->Pointer->Signature));
166 161
167 162 return_ACPI_STATUS (AE_BAD_SIGNATURE);
168 163 }
169 164
170 165 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
171 166
172 167 /* Check if table is already registered */
173 168
174 169 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
175 170 {
176 171 if (!AcpiGbl_RootTableList.Tables[i].Pointer)
177 172 {
178 173 Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
179 174 if (ACPI_FAILURE (Status) ||
180 175 !AcpiGbl_RootTableList.Tables[i].Pointer)
181 176 {
182 177 continue;
183 178 }
184 179 }
185 180
186 181 /*
187 182 * Check for a table match on the entire table length,
188 183 * not just the header.
189 184 */
190 185 if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length)
191 186 {
192 187 continue;
193 188 }
194 189
195 190 if (ACPI_MEMCMP (TableDesc->Pointer,
196 191 AcpiGbl_RootTableList.Tables[i].Pointer,
197 192 AcpiGbl_RootTableList.Tables[i].Length))
198 193 {
199 194 continue;
200 195 }
201 196
202 197 /*
203 198 * Note: the current mechanism does not unregister a table if it is
204 199 * dynamically unloaded. The related namespace entries are deleted,
205 200 * but the table remains in the root table list.
206 201 *
207 202 * The assumption here is that the number of different tables that
208 203 * will be loaded is actually small, and there is minimal overhead
209 204 * in just keeping the table in case it is needed again.
210 205 *
211 206 * If this assumption changes in the future (perhaps on large
212 207 * machines with many table load/unload operations), tables will
213 208 * need to be unregistered when they are unloaded, and slots in the
214 209 * root table list should be reused when empty.
215 210 */
216 211
217 212 /*
218 213 * Table is already registered.
219 214 * We can delete the table that was passed as a parameter.
220 215 */
221 216 AcpiTbDeleteTable (TableDesc);
222 217 *TableIndex = i;
223 218
224 219 if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED)
225 220 {
226 221 /* Table is still loaded, this is an error */
227 222
228 223 Status = AE_ALREADY_EXISTS;
229 224 goto Release;
230 225 }
231 226 else
232 227 {
233 228 /* Table was unloaded, allow it to be reloaded */
234 229
↓ open down ↓ |
61 lines elided |
↑ open up ↑ |
235 230 TableDesc->Pointer = AcpiGbl_RootTableList.Tables[i].Pointer;
236 231 TableDesc->Address = AcpiGbl_RootTableList.Tables[i].Address;
237 232 Status = AE_OK;
238 233 goto PrintHeader;
239 234 }
240 235 }
241 236
242 237 /*
243 238 * ACPI Table Override:
244 239 * Allow the host to override dynamically loaded tables.
240 + * NOTE: the table is fully mapped at this point, and the mapping will
241 + * be deleted by TbTableOverride if the table is actually overridden.
245 242 */
246 - Status = AcpiOsTableOverride (TableDesc->Pointer, &OverrideTable);
247 - if (ACPI_SUCCESS (Status) && OverrideTable)
248 - {
249 - ACPI_INFO ((AE_INFO,
250 - "%4.4s @ 0x%p Table override, replaced with:",
251 - TableDesc->Pointer->Signature,
252 - ACPI_CAST_PTR (void, TableDesc->Address)));
243 + (void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc);
253 244
254 - /* We can delete the table that was passed as a parameter */
255 -
256 - AcpiTbDeleteTable (TableDesc);
257 -
258 - /* Setup descriptor for the new table */
259 -
260 - TableDesc->Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
261 - TableDesc->Pointer = OverrideTable;
262 - TableDesc->Length = OverrideTable->Length;
263 - TableDesc->Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
264 - }
265 -
266 245 /* Add the table to the global root table list */
267 246
268 247 Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer,
269 248 TableDesc->Length, TableDesc->Flags, TableIndex);
270 249 if (ACPI_FAILURE (Status))
271 250 {
272 251 goto Release;
273 252 }
274 253
275 254 PrintHeader:
276 255 AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
277 256
278 257 Release:
279 258 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
280 259 return_ACPI_STATUS (Status);
281 260 }
282 261
283 262
284 263 /*******************************************************************************
285 264 *
265 + * FUNCTION: AcpiTbTableOverride
266 + *
267 + * PARAMETERS: TableHeader - Header for the original table
268 + * TableDesc - Table descriptor initialized for the
269 + * original table. May or may not be mapped.
270 + *
271 + * RETURN: Pointer to the entire new table. NULL if table not overridden.
272 + * If overridden, installs the new table within the input table
273 + * descriptor.
274 + *
275 + * DESCRIPTION: Attempt table override by calling the OSL override functions.
276 + * Note: If the table is overridden, then the entire new table
277 + * is mapped and returned by this function.
278 + *
279 + ******************************************************************************/
280 +
281 +ACPI_TABLE_HEADER *
282 +AcpiTbTableOverride (
283 + ACPI_TABLE_HEADER *TableHeader,
284 + ACPI_TABLE_DESC *TableDesc)
285 +{
286 + ACPI_STATUS Status;
287 + ACPI_TABLE_HEADER *NewTable = NULL;
288 + ACPI_PHYSICAL_ADDRESS NewAddress = 0;
289 + UINT32 NewTableLength = 0;
290 + UINT8 NewFlags;
291 + char *OverrideType;
292 +
293 +
294 + /* (1) Attempt logical override (returns a logical address) */
295 +
296 + Status = AcpiOsTableOverride (TableHeader, &NewTable);
297 + if (ACPI_SUCCESS (Status) && NewTable)
298 + {
299 + NewAddress = ACPI_PTR_TO_PHYSADDR (NewTable);
300 + NewTableLength = NewTable->Length;
301 + NewFlags = ACPI_TABLE_ORIGIN_OVERRIDE;
302 + OverrideType = "Logical";
303 + goto FinishOverride;
304 + }
305 +
306 + /* (2) Attempt physical override (returns a physical address) */
307 +
308 + Status = AcpiOsPhysicalTableOverride (TableHeader,
309 + &NewAddress, &NewTableLength);
310 + if (ACPI_SUCCESS (Status) && NewAddress && NewTableLength)
311 + {
312 + /* Map the entire new table */
313 +
314 + NewTable = AcpiOsMapMemory (NewAddress, NewTableLength);
315 + if (!NewTable)
316 + {
317 + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
318 + "%4.4s " ACPI_PRINTF_UINT
319 + " Attempted physical table override failed",
320 + TableHeader->Signature,
321 + ACPI_FORMAT_TO_UINT (TableDesc->Address)));
322 + return (NULL);
323 + }
324 +
325 + OverrideType = "Physical";
326 + NewFlags = ACPI_TABLE_ORIGIN_MAPPED;
327 + goto FinishOverride;
328 + }
329 +
330 + return (NULL); /* There was no override */
331 +
332 +
333 +FinishOverride:
334 +
335 + ACPI_INFO ((AE_INFO, "%4.4s " ACPI_PRINTF_UINT
336 + " %s table override, new table: " ACPI_PRINTF_UINT,
337 + TableHeader->Signature,
338 + ACPI_FORMAT_TO_UINT (TableDesc->Address),
339 + OverrideType, ACPI_FORMAT_TO_UINT (NewTable)));
340 +
341 + /* We can now unmap/delete the original table (if fully mapped) */
342 +
343 + AcpiTbDeleteTable (TableDesc);
344 +
345 + /* Setup descriptor for the new table */
346 +
347 + TableDesc->Address = NewAddress;
348 + TableDesc->Pointer = NewTable;
349 + TableDesc->Length = NewTableLength;
350 + TableDesc->Flags = NewFlags;
351 +
352 + return (NewTable);
353 +}
354 +
355 +
356 +/*******************************************************************************
357 + *
286 358 * FUNCTION: AcpiTbResizeRootTableList
287 359 *
288 360 * PARAMETERS: None
289 361 *
290 362 * RETURN: Status
291 363 *
292 364 * DESCRIPTION: Expand the size of global table array
293 365 *
294 366 ******************************************************************************/
295 367
296 368 ACPI_STATUS
297 369 AcpiTbResizeRootTableList (
298 370 void)
299 371 {
300 372 ACPI_TABLE_DESC *Tables;
373 + UINT32 TableCount;
301 374
302 375
303 376 ACPI_FUNCTION_TRACE (TbResizeRootTableList);
304 377
305 378
306 379 /* AllowResize flag is a parameter to AcpiInitializeTables */
307 380
308 381 if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
309 382 {
310 383 ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
311 384 return_ACPI_STATUS (AE_SUPPORT);
312 385 }
313 386
314 387 /* Increase the Table Array size */
315 388
389 + if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
390 + {
391 + TableCount = AcpiGbl_RootTableList.MaxTableCount;
392 + }
393 + else
394 + {
395 + TableCount = AcpiGbl_RootTableList.CurrentTableCount;
396 + }
397 +
316 398 Tables = ACPI_ALLOCATE_ZEROED (
317 - ((ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount +
318 - ACPI_ROOT_TABLE_SIZE_INCREMENT) *
399 + ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) *
319 400 sizeof (ACPI_TABLE_DESC));
320 401 if (!Tables)
321 402 {
322 403 ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
323 404 return_ACPI_STATUS (AE_NO_MEMORY);
324 405 }
325 406
326 407 /* Copy and free the previous table array */
327 408
328 409 if (AcpiGbl_RootTableList.Tables)
329 410 {
330 411 ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
331 - (ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount * sizeof (ACPI_TABLE_DESC));
412 + (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC));
332 413
333 414 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
334 415 {
335 416 ACPI_FREE (AcpiGbl_RootTableList.Tables);
336 417 }
337 418 }
338 419
339 420 AcpiGbl_RootTableList.Tables = Tables;
340 - AcpiGbl_RootTableList.MaxTableCount += ACPI_ROOT_TABLE_SIZE_INCREMENT;
341 - AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED;
421 + AcpiGbl_RootTableList.MaxTableCount =
422 + TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT;
423 + AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
342 424
343 425 return_ACPI_STATUS (AE_OK);
344 426 }
345 427
346 428
347 429 /*******************************************************************************
348 430 *
349 431 * FUNCTION: AcpiTbStoreTable
350 432 *
351 433 * PARAMETERS: Address - Table address
352 434 * Table - Table header
353 435 * Length - Table length
354 436 * Flags - flags
355 437 *
356 438 * RETURN: Status and table index.
357 439 *
358 440 * DESCRIPTION: Add an ACPI table to the global table list
359 441 *
360 442 ******************************************************************************/
361 443
362 444 ACPI_STATUS
363 445 AcpiTbStoreTable (
364 446 ACPI_PHYSICAL_ADDRESS Address,
365 447 ACPI_TABLE_HEADER *Table,
366 448 UINT32 Length,
367 449 UINT8 Flags,
368 450 UINT32 *TableIndex)
369 451 {
370 452 ACPI_STATUS Status;
371 453 ACPI_TABLE_DESC *NewTable;
372 454
373 455
374 456 /* Ensure that there is room for the table in the Root Table List */
375 457
376 458 if (AcpiGbl_RootTableList.CurrentTableCount >=
377 459 AcpiGbl_RootTableList.MaxTableCount)
378 460 {
379 461 Status = AcpiTbResizeRootTableList();
380 462 if (ACPI_FAILURE (Status))
381 463 {
382 464 return (Status);
383 465 }
384 466 }
385 467
386 468 NewTable = &AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount];
387 469
388 470 /* Initialize added table */
389 471
390 472 NewTable->Address = Address;
391 473 NewTable->Pointer = Table;
392 474 NewTable->Length = Length;
393 475 NewTable->OwnerId = 0;
394 476 NewTable->Flags = Flags;
395 477
396 478 ACPI_MOVE_32_TO_32 (&NewTable->Signature, Table->Signature);
397 479
398 480 *TableIndex = AcpiGbl_RootTableList.CurrentTableCount;
399 481 AcpiGbl_RootTableList.CurrentTableCount++;
400 482 return (AE_OK);
401 483 }
402 484
403 485
404 486 /*******************************************************************************
405 487 *
406 488 * FUNCTION: AcpiTbDeleteTable
407 489 *
408 490 * PARAMETERS: TableIndex - Table index
409 491 *
410 492 * RETURN: None
411 493 *
412 494 * DESCRIPTION: Delete one internal ACPI table
413 495 *
414 496 ******************************************************************************/
415 497
416 498 void
417 499 AcpiTbDeleteTable (
418 500 ACPI_TABLE_DESC *TableDesc)
419 501 {
420 502
↓ open down ↓ |
69 lines elided |
↑ open up ↑ |
421 503 /* Table must be mapped or allocated */
422 504
423 505 if (!TableDesc->Pointer)
424 506 {
425 507 return;
426 508 }
427 509
428 510 switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
429 511 {
430 512 case ACPI_TABLE_ORIGIN_MAPPED:
513 +
431 514 AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
432 515 break;
433 516
434 517 case ACPI_TABLE_ORIGIN_ALLOCATED:
518 +
435 519 ACPI_FREE (TableDesc->Pointer);
436 520 break;
437 521
522 + /* Not mapped or allocated, there is nothing we can do */
523 +
438 524 default:
439 - break;
525 +
526 + return;
440 527 }
441 528
442 529 TableDesc->Pointer = NULL;
443 530 }
444 531
445 532
446 533 /*******************************************************************************
447 534 *
448 535 * FUNCTION: AcpiTbTerminate
449 536 *
450 537 * PARAMETERS: None
451 538 *
452 539 * RETURN: None
453 540 *
454 541 * DESCRIPTION: Delete all internal ACPI tables
455 542 *
456 543 ******************************************************************************/
457 544
458 545 void
459 546 AcpiTbTerminate (
460 547 void)
461 548 {
462 549 UINT32 i;
463 550
464 551
465 552 ACPI_FUNCTION_TRACE (TbTerminate);
466 553
467 554
468 555 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
469 556
470 557 /* Delete the individual tables */
471 558
472 559 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
473 560 {
474 561 AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
475 562 }
476 563
477 564 /*
478 565 * Delete the root table array if allocated locally. Array cannot be
479 566 * mapped, so we don't need to check for that flag.
480 567 */
481 568 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
482 569 {
483 570 ACPI_FREE (AcpiGbl_RootTableList.Tables);
484 571 }
485 572
486 573 AcpiGbl_RootTableList.Tables = NULL;
487 574 AcpiGbl_RootTableList.Flags = 0;
488 575 AcpiGbl_RootTableList.CurrentTableCount = 0;
489 576
490 577 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
491 578 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
579 +
580 + return_VOID;
492 581 }
493 582
494 583
495 584 /*******************************************************************************
496 585 *
497 586 * FUNCTION: AcpiTbDeleteNamespaceByOwner
498 587 *
499 588 * PARAMETERS: TableIndex - Table index
500 589 *
501 590 * RETURN: Status
502 591 *
503 592 * DESCRIPTION: Delete all namespace objects created when this table was loaded.
504 593 *
505 594 ******************************************************************************/
506 595
507 596 ACPI_STATUS
508 597 AcpiTbDeleteNamespaceByOwner (
509 598 UINT32 TableIndex)
510 599 {
511 600 ACPI_OWNER_ID OwnerId;
512 601 ACPI_STATUS Status;
513 602
514 603
515 604 ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner);
516 605
517 606
518 607 Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
519 608 if (ACPI_FAILURE (Status))
520 609 {
521 610 return_ACPI_STATUS (Status);
522 611 }
523 612
524 613 if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
525 614 {
526 615 /* The table index does not exist */
527 616
528 617 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
529 618 return_ACPI_STATUS (AE_NOT_EXIST);
530 619 }
531 620
532 621 /* Get the owner ID for this table, used to delete namespace nodes */
533 622
534 623 OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
535 624 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
536 625
537 626 /*
538 627 * Need to acquire the namespace writer lock to prevent interference
539 628 * with any concurrent namespace walks. The interpreter must be
540 629 * released during the deletion since the acquisition of the deletion
541 630 * lock may block, and also since the execution of a namespace walk
542 631 * must be allowed to use the interpreter.
543 632 */
544 633 (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
545 634 Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
546 635
547 636 AcpiNsDeleteNamespaceByOwner (OwnerId);
548 637 if (ACPI_FAILURE (Status))
549 638 {
550 639 return_ACPI_STATUS (Status);
551 640 }
552 641
553 642 AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
554 643
555 644 Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
556 645 return_ACPI_STATUS (Status);
557 646 }
558 647
559 648
560 649 /*******************************************************************************
561 650 *
562 651 * FUNCTION: AcpiTbAllocateOwnerId
563 652 *
564 653 * PARAMETERS: TableIndex - Table index
565 654 *
566 655 * RETURN: Status
567 656 *
568 657 * DESCRIPTION: Allocates OwnerId in TableDesc
569 658 *
570 659 ******************************************************************************/
571 660
572 661 ACPI_STATUS
573 662 AcpiTbAllocateOwnerId (
574 663 UINT32 TableIndex)
575 664 {
576 665 ACPI_STATUS Status = AE_BAD_PARAMETER;
577 666
578 667
579 668 ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
580 669
581 670
582 671 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
583 672 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
584 673 {
585 674 Status = AcpiUtAllocateOwnerId
586 675 (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
587 676 }
588 677
589 678 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
590 679 return_ACPI_STATUS (Status);
591 680 }
592 681
593 682
594 683 /*******************************************************************************
595 684 *
596 685 * FUNCTION: AcpiTbReleaseOwnerId
597 686 *
598 687 * PARAMETERS: TableIndex - Table index
599 688 *
600 689 * RETURN: Status
601 690 *
602 691 * DESCRIPTION: Releases OwnerId in TableDesc
603 692 *
604 693 ******************************************************************************/
605 694
606 695 ACPI_STATUS
607 696 AcpiTbReleaseOwnerId (
608 697 UINT32 TableIndex)
609 698 {
610 699 ACPI_STATUS Status = AE_BAD_PARAMETER;
611 700
612 701
613 702 ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
614 703
615 704
616 705 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
617 706 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
618 707 {
619 708 AcpiUtReleaseOwnerId (
620 709 &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
621 710 Status = AE_OK;
622 711 }
623 712
624 713 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
625 714 return_ACPI_STATUS (Status);
626 715 }
627 716
628 717
629 718 /*******************************************************************************
630 719 *
631 720 * FUNCTION: AcpiTbGetOwnerId
632 721 *
633 722 * PARAMETERS: TableIndex - Table index
634 723 * OwnerId - Where the table OwnerId is returned
635 724 *
636 725 * RETURN: Status
637 726 *
638 727 * DESCRIPTION: returns OwnerId for the ACPI table
639 728 *
640 729 ******************************************************************************/
641 730
642 731 ACPI_STATUS
643 732 AcpiTbGetOwnerId (
644 733 UINT32 TableIndex,
645 734 ACPI_OWNER_ID *OwnerId)
646 735 {
647 736 ACPI_STATUS Status = AE_BAD_PARAMETER;
648 737
649 738
650 739 ACPI_FUNCTION_TRACE (TbGetOwnerId);
651 740
652 741
653 742 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
654 743 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
655 744 {
656 745 *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
657 746 Status = AE_OK;
658 747 }
659 748
660 749 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
661 750 return_ACPI_STATUS (Status);
662 751 }
663 752
664 753
665 754 /*******************************************************************************
666 755 *
667 756 * FUNCTION: AcpiTbIsTableLoaded
668 757 *
669 758 * PARAMETERS: TableIndex - Table index
670 759 *
671 760 * RETURN: Table Loaded Flag
672 761 *
673 762 ******************************************************************************/
674 763
675 764 BOOLEAN
676 765 AcpiTbIsTableLoaded (
677 766 UINT32 TableIndex)
678 767 {
679 768 BOOLEAN IsLoaded = FALSE;
680 769
681 770
682 771 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
683 772 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
684 773 {
685 774 IsLoaded = (BOOLEAN)
686 775 (AcpiGbl_RootTableList.Tables[TableIndex].Flags &
687 776 ACPI_TABLE_IS_LOADED);
688 777 }
689 778
690 779 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
691 780 return (IsLoaded);
692 781 }
693 782
694 783
695 784 /*******************************************************************************
696 785 *
697 786 * FUNCTION: AcpiTbSetTableLoadedFlag
698 787 *
699 788 * PARAMETERS: TableIndex - Table index
700 789 * IsLoaded - TRUE if table is loaded, FALSE otherwise
701 790 *
702 791 * RETURN: None
703 792 *
704 793 * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
705 794 *
706 795 ******************************************************************************/
707 796
708 797 void
709 798 AcpiTbSetTableLoadedFlag (
710 799 UINT32 TableIndex,
711 800 BOOLEAN IsLoaded)
712 801 {
713 802
714 803 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
715 804 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
716 805 {
717 806 if (IsLoaded)
718 807 {
719 808 AcpiGbl_RootTableList.Tables[TableIndex].Flags |=
720 809 ACPI_TABLE_IS_LOADED;
↓ open down ↓ |
219 lines elided |
↑ open up ↑ |
721 810 }
722 811 else
723 812 {
724 813 AcpiGbl_RootTableList.Tables[TableIndex].Flags &=
725 814 ~ACPI_TABLE_IS_LOADED;
726 815 }
727 816 }
728 817
729 818 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
730 819 }
731 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX