static ACPI_STATUS OslMapTable ( ACPI_SIZE Address, char *Signature, ACPI_TABLE_HEADER **Table) { ACPI_TABLE_HEADER *MappedTable; UINT32 Length; /* Map the header so we can get the table length */ MappedTable = AcpiOsMapMemory (Address, sizeof (*MappedTable)); if (!MappedTable) { return (AE_BAD_ADDRESS); } /* Check if table is valid */ if (!ApIsValidHeader (MappedTable)) { AcpiOsUnmapMemory (MappedTable, sizeof (*MappedTable)); return (AE_BAD_HEADER); } /* If specified, signature must match */ if (Signature && !ACPI_COMPARE_NAME (Signature, MappedTable->Signature)) { AcpiOsUnmapMemory (MappedTable, sizeof (*MappedTable)); return (AE_NOT_EXIST); } /* Map the entire table */ Length = MappedTable->Length; AcpiOsUnmapMemory (MappedTable, sizeof (*MappedTable)); MappedTable = AcpiOsMapMemory (Address, Length); if (!MappedTable) { return (AE_BAD_ADDRESS); } (void) ApIsValidChecksum (MappedTable); *Table = MappedTable; return (AE_OK); }
UINT32 ApGetTableLength ( ACPI_TABLE_HEADER *Table) { ACPI_TABLE_RSDP *Rsdp; /* Check if table is valid */ if (!ApIsValidHeader (Table)) { return (0); } if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) { Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table); return (AcpiTbGetRsdpLength (Rsdp)); } /* Normal ACPI table */ return (Table->Length); }