diff options
Diffstat (limited to 'source/components/tables/tbutils.c')
-rw-r--r-- | source/components/tables/tbutils.c | 70 |
1 files changed, 52 insertions, 18 deletions
diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index df1e053fbfe8..988a3b18f637 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -75,6 +75,8 @@ ACPI_STATUS AcpiTbInitializeFacs ( void) { + ACPI_TABLE_FACS *Facs; + /* If Hardware Reduced flag is set, there is no FACS */ @@ -83,19 +85,18 @@ AcpiTbInitializeFacs ( AcpiGbl_FACS = NULL; return (AE_OK); } - - (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs32)); - (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_X_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs64)); - - if (AcpiGbl_Facs64 && (!AcpiGbl_Facs32 || !AcpiGbl_Use32BitFacsAddresses)) + else if (AcpiGbl_FADT.XFacs && + (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses)) { - AcpiGbl_FACS = AcpiGbl_Facs64; + (void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); + AcpiGbl_FACS = Facs; } - else if (AcpiGbl_Facs32) + else if (AcpiGbl_FADT.Facs) { - AcpiGbl_FACS = AcpiGbl_Facs32; + (void) AcpiGetTableByIndex (AcpiGbl_FacsIndex, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); + AcpiGbl_FACS = Facs; } /* If there is no FACS, just continue. There was already an error msg */ @@ -206,7 +207,7 @@ AcpiTbCopyDsdt ( AcpiTbUninstallTable (TableDesc); AcpiTbInitTableDescriptor ( - &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT], + &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex], ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable); @@ -400,13 +401,6 @@ AcpiTbParseRootTable ( TableEntrySize); TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); - /* - * First three entries in the table array are reserved for the DSDT - * and 32bit/64bit FACS, which are not actually present in the - * RSDT/XSDT - they come from the FADT - */ - AcpiGbl_RootTableList.CurrentTableCount = 3; - /* Initialize the root table array from the RSDT/XSDT */ for (i = 0; i < TableCount; i++) @@ -441,3 +435,43 @@ NextTable: return_ACPI_STATUS (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: AcpiIsValidSignature + * + * PARAMETERS: Signature - Sig string to be validated + * + * RETURN: TRUE if signature is correct length and has valid characters + * + * DESCRIPTION: Validate an ACPI table signature. + * + ******************************************************************************/ + +BOOLEAN +AcpiIsValidSignature ( + char *Signature) +{ + UINT32 i; + + + /* Validate the signature length */ + + if (strlen (Signature) != ACPI_NAME_SIZE) + { + return (FALSE); + } + + /* Validate each character in the signature */ + + for (i = 0; i < ACPI_NAME_SIZE; i++) + { + if (!AcpiUtValidAcpiChar (Signature[i], i)) + { + return (FALSE); + } + } + + return (TRUE); +} |