diff options
Diffstat (limited to 'source/tools/acpinames/antables.c')
-rw-r--r-- | source/tools/acpinames/antables.c | 115 |
1 files changed, 84 insertions, 31 deletions
diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c index 9646ba4974f7..1dbf692992cf 100644 --- a/source/tools/acpinames/antables.c +++ b/source/tools/acpinames/antables.c @@ -48,6 +48,13 @@ /* Local prototypes */ +static void +AeInitializeTableHeader ( + ACPI_TABLE_HEADER *Header, + char *Signature, + UINT32 Length); + + /* Non-AML tables that are constructed locally and installed */ static ACPI_TABLE_RSDP LocalRSDP; @@ -69,7 +76,43 @@ static ACPI_TABLE_XSDT *LocalXSDT; #define BASE_XSDT_SIZE (sizeof (ACPI_TABLE_XSDT) + \ ((BASE_XSDT_TABLES -1) * sizeof (UINT64))) -ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES]; + +/****************************************************************************** + * + * FUNCTION: AeInitializeTableHeader + * + * PARAMETERS: Header - A valid standard ACPI table header + * Signature - Signature to insert + * Length - Length of the table + * + * RETURN: None. Header is modified. + * + * DESCRIPTION: Initialize the table header for a local ACPI table. + * + *****************************************************************************/ + +static void +AeInitializeTableHeader ( + ACPI_TABLE_HEADER *Header, + char *Signature, + UINT32 Length) +{ + + ACPI_MOVE_NAME (Header->Signature, Signature); + Header->Length = Length; + + Header->OemRevision = 0x1001; + strncpy (Header->OemId, "Intel", ACPI_OEM_ID_SIZE); + strncpy (Header->OemTableId, "AcpiName", ACPI_OEM_TABLE_ID_SIZE); + strncpy (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE); + Header->AslCompilerRevision = ACPI_CA_VERSION; + + /* Set the checksum, must set to zero first */ + + Header->Checksum = 0; + Header->Checksum = (UINT8) -AcpiTbChecksum ( + (void *) Header, Header->Length); +} /****************************************************************************** @@ -99,9 +142,9 @@ AeBuildLocalTables ( /* - * Update the table count. For DSDT, it is not put into the XSDT. For - * FADT, this is already accounted for since we usually install a - * local FADT. + * Update the table count. For the DSDT, it is not put into the XSDT. + * For the FADT, this table is already accounted for since we usually + * install a local FADT. */ NextTable = TableList; while (NextTable) @@ -125,15 +168,14 @@ AeBuildLocalTables ( } memset (LocalXSDT, 0, XsdtSize); - ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT); - LocalXSDT->Header.Length = XsdtSize; - LocalXSDT->Header.Revision = 1; - LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); /* * Install the user tables. The DSDT must be installed in the FADT. * All other tables are installed directly into the XSDT. + * + * Note: The tables are loaded in reverse order from the incoming + * input, which makes it match the command line order. */ NextIndex = BASE_XSDT_TABLES; NextTable = TableList; @@ -158,32 +200,35 @@ AeBuildLocalTables ( else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); - LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); } else { /* Install the table in the XSDT */ - LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + LocalXSDT->TableOffsetEntry[TableCount - NextIndex + 1] = + ACPI_PTR_TO_PHYSADDR (NextTable->Table); NextIndex++; } NextTable = NextTable->Next; } - /* Build an RSDP */ + /* Build an RSDP. Contains a valid XSDT only, no RSDT */ memset (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature); - memcpy (LocalRSDP.OemId, "I_TEST", 6); + memcpy (LocalRSDP.OemId, "Intel", 6); + LocalRSDP.Revision = 2; LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT); LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT); /* Set checksums for both XSDT and RSDP */ - LocalXSDT->Header.Checksum = (UINT8) -AcpiTbChecksum ( - (void *) LocalXSDT, LocalXSDT->Header.Length); + AeInitializeTableHeader ((void *) LocalXSDT, ACPI_SIG_XSDT, XsdtSize); + + LocalRSDP.Checksum = 0; LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ( (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH); @@ -192,21 +237,36 @@ AeBuildLocalTables ( return (AE_SUPPORT); } + /* + * Build an FADT. There are two options for the FADT: + * 1) Incoming external FADT specified on the command line + * 2) A fully featured local FADT + */ + memset (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + if (ExternalFadt) { /* - * Use the external FADT, but we must update the DSDT/FACS addresses - * as well as the checksum + * Use the external FADT, but we must update the DSDT/FACS + * addresses as well as the checksum */ ExternalFadt->Dsdt = (UINT32) DsdtAddress; ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); - if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (&ExternalFadt->XDsdt, ExternalFadt)) + /* + * If there room in the FADT for the XDsdt and XFacs 64-bit + * pointers, use them. + */ + if (ExternalFadt->Header.Length > ACPI_PTR_DIFF ( + &ExternalFadt->XDsdt, ExternalFadt)) { + ExternalFadt->Dsdt = 0; + ExternalFadt->Facs = 0; ExternalFadt->XDsdt = DsdtAddress; ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); } - /* Complete the FADT with the checksum */ + + /* Complete the external FADT with the checksum */ ExternalFadt->Header.Checksum = 0; ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum ( @@ -217,8 +277,7 @@ AeBuildLocalTables ( /* * Build a local FADT so we can test the hardware/event init */ - memset (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); - ACPI_MOVE_NAME (LocalFADT.Header.Signature, ACPI_SIG_FADT); + LocalFADT.Header.Revision = 5; /* Setup FADT header and DSDT/FACS addresses */ @@ -228,9 +287,6 @@ AeBuildLocalTables ( LocalFADT.XDsdt = DsdtAddress; LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); - LocalFADT.Header.Revision = 3; - LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT); - /* Miscellaneous FADT fields */ LocalFADT.Gpe0BlockLength = 16; @@ -257,15 +313,13 @@ AeBuildLocalTables ( LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock; - LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength); - - /* Complete the FADT with the checksum */ - - LocalFADT.Header.Checksum = 0; - LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum ( - (void *) &LocalFADT, LocalFADT.Header.Length); + LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) + ACPI_MUL_8 (LocalFADT.Pm1EventLength); } + AeInitializeTableHeader ((void *) &LocalFADT, + ACPI_SIG_FADT, sizeof (ACPI_TABLE_FADT)); + /* Build a FACS */ memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); @@ -273,7 +327,6 @@ AeBuildLocalTables ( LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; - return (AE_OK); } |