Deleted Added
sdiff udiff text old ( 229989 ) new ( 231844 )
full compact
1/******************************************************************************
2 *
3 * Module Name: tbutils - table utilities
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.

--- 36 unchanged lines hidden (view full) ---

45
46#include <contrib/dev/acpica/include/acpi.h>
47#include <contrib/dev/acpica/include/accommon.h>
48#include <contrib/dev/acpica/include/actables.h>
49
50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbutils")
52
53
54/* Local prototypes */
55
56static void
57AcpiTbFixString (
58 char *String,
59 ACPI_SIZE Length);
60
61static void
62AcpiTbCleanupTableHeader (
63 ACPI_TABLE_HEADER *OutHeader,
64 ACPI_TABLE_HEADER *Header);
65
66static ACPI_PHYSICAL_ADDRESS
67AcpiTbGetRootTableEntry (
68 UINT8 *TableEntry,
69 UINT32 TableEntrySize);
70
71
72#if (!ACPI_REDUCED_HARDWARE)
73/*******************************************************************************
74 *
75 * FUNCTION: AcpiTbInitializeFacs
76 *
77 * PARAMETERS: None
78 *
79 * RETURN: Status
80 *

--- 16 unchanged lines hidden (view full) ---

97 AcpiGbl_FACS = NULL;
98 return (AE_OK);
99 }
100
101 Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
102 ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS));
103 return (Status);
104}
105#endif /* !ACPI_REDUCED_HARDWARE */
106
107
108/*******************************************************************************
109 *
110 * FUNCTION: AcpiTbTablesLoaded
111 *
112 * PARAMETERS: None
113 *

--- 307 unchanged lines hidden (view full) ---

421 * PARAMETERS: Address - Physical address of DSDT or FACS
422 * Signature - Table signature, NULL if no need to
423 * match
424 * TableIndex - Index into root table array
425 *
426 * RETURN: None
427 *
428 * DESCRIPTION: Install an ACPI table into the global data structure. The
429 * table override mechanism is called to allow the host
430 * OS to replace any table before it is installed in the root
431 * table array.
432 *
433 ******************************************************************************/
434
435void
436AcpiTbInstallTable (
437 ACPI_PHYSICAL_ADDRESS Address,
438 char *Signature,
439 UINT32 TableIndex)
440{
441 ACPI_TABLE_HEADER *Table;
442 ACPI_TABLE_HEADER *FinalTable;
443 ACPI_TABLE_DESC *TableDesc;
444
445
446 if (!Address)
447 {
448 ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
449 Signature));
450 return;
451 }
452
453 /* Map just the table header */
454
455 Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
456 if (!Table)
457 {
458 ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p",
459 Signature, ACPI_CAST_PTR (void, Address)));
460 return;
461 }
462
463 /* Skip SSDT when DSDT is overriden */
464
465 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) &&
466 (AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags &
467 ACPI_TABLE_ORIGIN_OVERRIDE))
468 {
469 ACPI_INFO ((AE_INFO,
470 "%4.4s @ 0x%p Table override, replaced with:", ACPI_SIG_SSDT,
471 ACPI_CAST_PTR (void, Address)));
472 AcpiTbPrintTableHeader (
473 AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Address,
474 AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer);
475 goto UnmapAndExit;
476 }
477
478 /* If a particular signature is expected (DSDT/FACS), it must match */
479
480 if (Signature &&
481 !ACPI_COMPARE_NAME (Table->Signature, Signature))
482 {
483 ACPI_ERROR ((AE_INFO,
484 "Invalid signature 0x%X for ACPI table, expected [%s]",
485 *ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
486 goto UnmapAndExit;
487 }
488
489 /*
490 * Initialize the table entry. Set the pointer to NULL, since the
491 * table is not fully mapped at this time.
492 */
493 TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex];
494
495 TableDesc->Address = Address;
496 TableDesc->Pointer = NULL;
497 TableDesc->Length = Table->Length;
498 TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED;
499 ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
500
501 /*
502 * ACPI Table Override:
503 *
504 * Before we install the table, let the host OS override it with a new
505 * one if desired. Any table within the RSDT/XSDT can be replaced,
506 * including the DSDT which is pointed to by the FADT.
507 *
508 * NOTE: If the table is overridden, then FinalTable will contain a
509 * mapped pointer to the full new table. If the table is not overridden,
510 * then the table will be fully mapped elsewhere (in verify table).
511 * In any case, we must unmap the header that was mapped above.
512 */
513 FinalTable = AcpiTbTableOverride (Table, TableDesc);
514 if (!FinalTable)
515 {
516 FinalTable = Table; /* There was no override */
517 }
518
519 AcpiTbPrintTableHeader (TableDesc->Address, FinalTable);
520
521 /* Set the global integer width (based upon revision of the DSDT) */
522
523 if (TableIndex == ACPI_TABLE_INDEX_DSDT)
524 {
525 AcpiUtSetIntegerWidth (FinalTable->Revision);
526 }
527
528UnmapAndExit:
529
530 /* Always unmap the table header that we mapped above */
531
532 AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
533}
534
535
536/*******************************************************************************
537 *
538 * FUNCTION: AcpiTbGetRootTableEntry
539 *
540 * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry

--- 235 unchanged lines hidden ---