tbutils.c (229989) | tbutils.c (231844) |
---|---|
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 | 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 |
|
53/* Local prototypes */ 54 55static void 56AcpiTbFixString ( 57 char *String, 58 ACPI_SIZE Length); 59 60static void 61AcpiTbCleanupTableHeader ( 62 ACPI_TABLE_HEADER *OutHeader, 63 ACPI_TABLE_HEADER *Header); 64 65static ACPI_PHYSICAL_ADDRESS 66AcpiTbGetRootTableEntry ( 67 UINT8 *TableEntry, 68 UINT32 TableEntrySize); 69 70 | 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) |
|
71/******************************************************************************* 72 * 73 * FUNCTION: AcpiTbInitializeFacs 74 * 75 * PARAMETERS: None 76 * 77 * RETURN: Status 78 * --- 16 unchanged lines hidden (view full) --- 95 AcpiGbl_FACS = NULL; 96 return (AE_OK); 97 } 98 99 Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, 100 ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS)); 101 return (Status); 102} | 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 */ |
|
103 104 105/******************************************************************************* 106 * 107 * FUNCTION: AcpiTbTablesLoaded 108 * 109 * PARAMETERS: None 110 * --- 307 unchanged lines hidden (view full) --- 418 * PARAMETERS: Address - Physical address of DSDT or FACS 419 * Signature - Table signature, NULL if no need to 420 * match 421 * TableIndex - Index into root table array 422 * 423 * RETURN: None 424 * 425 * DESCRIPTION: Install an ACPI table into the global data structure. The | 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 |
426 * table override mechanism is implemented here to allow the host | 429 * table override mechanism is called to allow the host |
427 * OS to replace any table before it is installed in the root 428 * table array. 429 * 430 ******************************************************************************/ 431 432void 433AcpiTbInstallTable ( 434 ACPI_PHYSICAL_ADDRESS Address, 435 char *Signature, 436 UINT32 TableIndex) 437{ | 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{ |
438 UINT8 Flags; 439 ACPI_STATUS Status; 440 ACPI_TABLE_HEADER *TableToInstall; 441 ACPI_TABLE_HEADER *MappedTable; 442 ACPI_TABLE_HEADER *OverrideTable = NULL; | 441 ACPI_TABLE_HEADER *Table; 442 ACPI_TABLE_HEADER *FinalTable; 443 ACPI_TABLE_DESC *TableDesc; |
443 444 445 if (!Address) 446 { 447 ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]", 448 Signature)); 449 return; 450 } 451 452 /* Map just the table header */ 453 | 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 |
454 MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); 455 if (!MappedTable) | 455 Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); 456 if (!Table) |
456 { | 457 { |
458 ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p", 459 Signature, ACPI_CAST_PTR (void, Address))); |
|
457 return; 458 } 459 460 /* Skip SSDT when DSDT is overriden */ 461 | 460 return; 461 } 462 463 /* Skip SSDT when DSDT is overriden */ 464 |
462 if (ACPI_COMPARE_NAME (MappedTable->Signature, ACPI_SIG_SSDT) && | 465 if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) && |
463 (AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags & 464 ACPI_TABLE_ORIGIN_OVERRIDE)) 465 { 466 ACPI_INFO ((AE_INFO, 467 "%4.4s @ 0x%p Table override, replaced with:", ACPI_SIG_SSDT, 468 ACPI_CAST_PTR (void, Address))); 469 AcpiTbPrintTableHeader ( 470 AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Address, 471 AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer); 472 goto UnmapAndExit; 473 } 474 475 /* If a particular signature is expected (DSDT/FACS), it must match */ 476 477 if (Signature && | 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 && |
478 !ACPI_COMPARE_NAME (MappedTable->Signature, Signature)) | 481 !ACPI_COMPARE_NAME (Table->Signature, Signature)) |
479 { 480 ACPI_ERROR ((AE_INFO, 481 "Invalid signature 0x%X for ACPI table, expected [%s]", | 482 { 483 ACPI_ERROR ((AE_INFO, 484 "Invalid signature 0x%X for ACPI table, expected [%s]", |
482 *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature)); | 485 *ACPI_CAST_PTR (UINT32, Table->Signature), Signature)); |
483 goto UnmapAndExit; 484 } 485 486 /* | 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 /* |
|
487 * ACPI Table Override: 488 * 489 * Before we install the table, let the host OS override it with a new 490 * one if desired. Any table within the RSDT/XSDT can be replaced, 491 * including the DSDT which is pointed to by the FADT. | 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. |
|
492 */ | 512 */ |
493 Status = AcpiOsTableOverride (MappedTable, &OverrideTable); 494 if (ACPI_SUCCESS (Status) && OverrideTable) | 513 FinalTable = AcpiTbTableOverride (Table, TableDesc); 514 if (!FinalTable) |
495 { | 515 { |
496 ACPI_INFO ((AE_INFO, 497 "%4.4s @ 0x%p Table override, replaced with:", 498 MappedTable->Signature, ACPI_CAST_PTR (void, Address))); 499 500 AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable; 501 Address = ACPI_PTR_TO_PHYSADDR (OverrideTable); 502 503 TableToInstall = OverrideTable; 504 Flags = ACPI_TABLE_ORIGIN_OVERRIDE; | 516 FinalTable = Table; /* There was no override */ |
505 } | 517 } |
506 else 507 { 508 TableToInstall = MappedTable; 509 Flags = ACPI_TABLE_ORIGIN_MAPPED; 510 } | |
511 | 518 |
512 /* Initialize the table entry */ | 519 AcpiTbPrintTableHeader (TableDesc->Address, FinalTable); |
513 | 520 |
514 AcpiGbl_RootTableList.Tables[TableIndex].Address = Address; 515 AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length; 516 AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags; | 521 /* Set the global integer width (based upon revision of the DSDT) */ |
517 | 522 |
518 ACPI_MOVE_32_TO_32 ( 519 &(AcpiGbl_RootTableList.Tables[TableIndex].Signature), 520 TableToInstall->Signature); 521 522 AcpiTbPrintTableHeader (Address, TableToInstall); 523 | |
524 if (TableIndex == ACPI_TABLE_INDEX_DSDT) 525 { | 523 if (TableIndex == ACPI_TABLE_INDEX_DSDT) 524 { |
526 /* Global integer width is based upon revision of the DSDT */ 527 528 AcpiUtSetIntegerWidth (TableToInstall->Revision); | 525 AcpiUtSetIntegerWidth (FinalTable->Revision); |
529 } 530 531UnmapAndExit: | 526 } 527 528UnmapAndExit: |
532 AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER)); | 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 --- | 533} 534 535 536/******************************************************************************* 537 * 538 * FUNCTION: AcpiTbGetRootTableEntry 539 * 540 * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry --- 235 unchanged lines hidden --- |