Example #1
0
int
ApDumpTableByAddress (
    char                    *AsciiAddress)
{
    ACPI_PHYSICAL_ADDRESS   Address;
    ACPI_TABLE_HEADER       *Table;
    ACPI_STATUS             Status;
    int                     TableStatus;
    UINT64                  LongAddress;


    /* Convert argument to an integer physical address */

    Status = AcpiUtStrtoul64 (AsciiAddress, 0, &LongAddress);
    if (ACPI_FAILURE (Status))
    {
        AcpiLogError ("%s: Could not convert to a physical address\n",
            AsciiAddress);
        return (-1);
    }

    Address = (ACPI_PHYSICAL_ADDRESS) LongAddress;
    Status = AcpiOsGetTableByAddress (Address, &Table);
    if (ACPI_FAILURE (Status))
    {
        AcpiLogError ("Could not get table at 0x%8.8X%8.8X, %s\n",
            ACPI_FORMAT_UINT64 (Address),
            AcpiFormatException (Status));
        return (-1);
    }

    TableStatus = ApDumpTableBuffer (Table, 0, Address);
    ACPI_FREE (Table);
    return (TableStatus);
}
Example #2
0
int
ApDumpAllTables (
    void)
{
    ACPI_TABLE_HEADER       *Table;
    UINT32                  Instance = 0;
    ACPI_PHYSICAL_ADDRESS   Address;
    ACPI_STATUS             Status;
    int                     TableStatus;
    UINT32                  i;


    /* Get and dump all available ACPI tables */

    for (i = 0; i < AP_MAX_ACPI_FILES; i++)
    {
        Status = AcpiOsGetTableByIndex (i, &Table, &Instance, &Address);
        if (ACPI_FAILURE (Status))
        {
            /* AE_LIMIT means that no more tables are available */

            if (Status == AE_LIMIT)
            {
                return (0);
            }
            else if (i == 0)
            {
                AcpiLogError ("Could not get ACPI tables, %s\n",
                    AcpiFormatException (Status));
                return (-1);
            }
            else
            {
                AcpiLogError ("Could not get ACPI table at index %u, %s\n",
                    i, AcpiFormatException (Status));
                continue;
            }
        }

        TableStatus = ApDumpTableBuffer (Table, Instance, Address);
        ACPI_FREE (Table);

        if (TableStatus)
        {
            break;
        }
    }

    /* Something seriously bad happened if the loop terminates here */

    return (-1);
}
Example #3
0
int
ApDumpTableFromFile (
    char                    *Pathname)
{
    ACPI_TABLE_HEADER       *Table;
    UINT32                  FileSize = 0;
    int                     TableStatus = -1;


    /* Get the entire ACPI table from the file */

    Table = ApGetTableFromFile (Pathname, &FileSize);
    if (!Table)
    {
        return (-1);
    }

    if (!AcpiUtValidNameseg (Table->Signature))
    {
        fprintf (stderr,
            "No valid ACPI signature was found in input file %s\n",
            Pathname);
    }

    /* File must be at least as long as the table length */

    if (Table->Length > FileSize)
    {
        fprintf (stderr,
            "Table length (0x%X) is too large for input file (0x%X) %s\n",
            Table->Length, FileSize, Pathname);
        goto Exit;
    }

    if (Gbl_VerboseMode)
    {
        fprintf (stderr,
            "Input file:  %s contains table [%4.4s], 0x%X (%u) bytes\n",
            Pathname, Table->Signature, FileSize, FileSize);
    }

    TableStatus = ApDumpTableBuffer (Table, 0, 0);

Exit:
    ACPI_FREE (Table);
    return (TableStatus);
}
Example #4
0
int
ApDumpTableByName (
    char                    *Signature)
{
    char                    LocalSignature [ACPI_NAME_SIZE + 1];
    UINT32                  Instance;
    ACPI_TABLE_HEADER       *Table;
    ACPI_PHYSICAL_ADDRESS   Address;
    ACPI_STATUS             Status;
    int                     TableStatus;


    if (strlen (Signature) != ACPI_NAME_SIZE)
    {
        AcpiLogError (
            "Invalid table signature [%s]: must be exactly 4 characters\n",
            Signature);
        return (-1);
    }

    /* Table signatures are expected to be uppercase */

    strcpy (LocalSignature, Signature);
    AcpiUtStrupr (LocalSignature);

    /* To be friendly, handle tables whose signatures do not match the name */

    if (ACPI_COMPARE_NAME (LocalSignature, "FADT"))
    {
        strcpy (LocalSignature, ACPI_SIG_FADT);
    }
    else if (ACPI_COMPARE_NAME (LocalSignature, "MADT"))
    {
        strcpy (LocalSignature, ACPI_SIG_MADT);
    }

    /* Dump all instances of this signature (to handle multiple SSDTs) */

    for (Instance = 0; Instance < AP_MAX_ACPI_FILES; Instance++)
    {
        Status = AcpiOsGetTableByName (LocalSignature, Instance,
            &Table, &Address);
        if (ACPI_FAILURE (Status))
        {
            /* AE_LIMIT means that no more tables are available */

            if (Status == AE_LIMIT)
            {
                return (0);
            }

            AcpiLogError (
                "Could not get ACPI table with signature [%s], %s\n",
                LocalSignature, AcpiFormatException (Status));
            return (-1);
        }

        TableStatus = ApDumpTableBuffer (Table, Instance, Address);
        ACPI_FREE (Table);

        if (TableStatus)
        {
            break;
        }
    }

    /* Something seriously bad happened if the loop terminates here */

    return (-1);
}