Ejemplo n.º 1
0
ACPI_STATUS
AcpiOsTableOverride (
    ACPI_TABLE_HEADER       *ExistingTable,
    ACPI_TABLE_HEADER       **NewTable)
{
#ifdef ACPI_ASL_COMPILER
    ACPI_STATUS             Status;
    ACPI_PHYSICAL_ADDRESS   Address;
#endif

    if (!ExistingTable || !NewTable)
    {
        return (AE_BAD_PARAMETER);
    }

    *NewTable = NULL;


#ifdef ACPI_EXEC_APP

    /* Call back up to AcpiExec */

    AeTableOverride (ExistingTable, NewTable);
#endif


#ifdef ACPI_ASL_COMPILER

    /* Attempt to get the table from the registry */

    /* Construct a null-terminated string from table signature */

    ACPI_MOVE_NAME (TableName, ExistingTable->Signature);
    TableName[ACPI_NAME_SIZE] = 0;

    Status = AcpiOsGetTableByName (TableName, 0, NewTable, &Address);
    if (ACPI_SUCCESS (Status))
    {
        AcpiOsPrintf ("Table [%s] obtained from registry, %u bytes\n",
            TableName, (*NewTable)->Length);
    }
    else
    {
        AcpiOsPrintf ("Could not read table %s from registry (%s)\n",
            TableName, AcpiFormatException (Status));
    }
#endif

    return (AE_OK);
}
Ejemplo n.º 2
0
ACPI_STATUS
AcpiOsGetTableByIndex (
    UINT32                  Index,
    ACPI_TABLE_HEADER       **Table,
    UINT32                  *Instance,
    ACPI_PHYSICAL_ADDRESS   *Address)
{
    ACPI_STATUS             Status;


    if (Index > ACPI_OS_MAX_TABLE_INDEX)
    {
        return (AE_LIMIT);
    }

    Status = AcpiOsGetTableByName (SupportedTables[Index], 0, Table, Address);
    return (Status);
}
Ejemplo n.º 3
0
ACPI_STATUS
AcpiOsGetTableByIndex (
    UINT32                  Index,
    ACPI_TABLE_HEADER       **Table,
    UINT32                  *Instance,
    ACPI_PHYSICAL_ADDRESS   *Address)
{
    ACPI_STATUS             Status;
    char                    *Signature;


    if (Index < ACPI_OS_NUM_TABLE_ENTRIES)
    {
        Signature = SupportedTables[Index];
        Index = 0;
    }
    else
    {
        Signature = ACPI_SIG_SSDT;
        Index -= ACPI_OS_NUM_TABLE_ENTRIES;
    }

    Status = AcpiOsGetTableByName (Signature, Index, Table, Address);

    if (ACPI_SUCCESS (Status))
    {
        *Instance = Index;
    }
    else if (Status == AE_NOT_FOUND && ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
    {
        /* Treat SSDTs that are not found as invalid index. */
        Status = (AE_LIMIT);
    }

    return (Status);
}
Ejemplo n.º 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);
}
ACPI_STATUS
AcpiOsGetTableByIndex (
    UINT32                  Index,
    ACPI_TABLE_HEADER       **Table,
    UINT32                  *Instance,
    ACPI_PHYSICAL_ADDRESS   *Address)
{
    OSL_TABLE_INFO          *Info;
    ACPI_STATUS             Status;
    UINT32                  i;


    /* Initialize main tables */

    Status = OslTableInitialize ();
    if (ACPI_FAILURE (Status))
    {
        return (Status);
    }

    /* Add all tables to list */

    Status = OslAddTablesToList ();
    if (ACPI_FAILURE (Status))
    {
        return (Status);
    }

    /* Validate Index */

    if (Index >= Gbl_TableListHead->Instance)
    {
        return (AE_LIMIT);
    }

    /* Point to the table list entry specified by the Index argument */

    Info = Gbl_TableListHead;
    for (i = 0; i <= Index; i++)
    {
        Info = Info->Next;
    }

    /* Now we can just get the table via the address or name */

    if (Info->Address)
    {
        Status = AcpiOsGetTableByAddress (Info->Address, Table);
        if (ACPI_SUCCESS (Status))
        {
            *Address = Info->Address;
        }
    }
    else
    {
        Status = AcpiOsGetTableByName (Info->Signature, Info->Instance,
            Table, Address);
    }

    if (ACPI_SUCCESS (Status))
    {
        *Instance = Info->Instance;
    }
    return (Status);
}