FreeBSD/sys/contrib/dev/acpica/components/tables/tbdata.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiTbResizeRootTableList
 *
 * PARAMETERS:  None
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Expand the size of global table array
 *
 ******************************************************************************/


Status

Expand the size of global table array
Status Expand the size of global table array
ACPI_STATUS
AcpiTbResizeRootTableList (
    void)
{
    ACPI_TABLE_DESC         *Tables;
    UINT32                  TableCount;
    ACPI_FUNCTION_TRACE (TbResizeRootTableList);
    if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
    {
        ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
        return_ACPI_STATUS (AE_SUPPORT);
    }
    if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
    {
        TableCount = AcpiGbl_RootTableList.MaxTableCount;
    }
    else
    {
        TableCount = AcpiGbl_RootTableList.CurrentTableCount;
    }
    Tables = ACPI_ALLOCATE_ZEROED (
        ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) *
        sizeof (ACPI_TABLE_DESC));
    if (!Tables)
    {
        ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
        return_ACPI_STATUS (AE_NO_MEMORY);
    }
    if (AcpiGbl_RootTableList.Tables)
    {
        memcpy (Tables, AcpiGbl_RootTableList.Tables,
            (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC));
        if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
        {
            ACPI_FREE (AcpiGbl_RootTableList.Tables);
        }
    }
    AcpiGbl_RootTableList.Tables = Tables;
    AcpiGbl_RootTableList.MaxTableCount =
        TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT;
    AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
    return_ACPI_STATUS (AE_OK);
}
ACPI_STATUS AcpiTbResizeRootTableList ( void ) { ACPI_TABLE_DESC * Tables ; UINT32 TableCount ; ACPI_FUNCTION_TRACE ( TbResizeRootTableList ) ; if ( ! ( AcpiGbl_RootTableList . Flags & ACPI_ROOT_ALLOW_RESIZE ) ) { ACPI_ERROR ( ( AE_INFO , " " ) ) ; return_ACPI_STATUS ( AE_SUPPORT ) ; } if ( AcpiGbl_RootTableList . Flags & ACPI_ROOT_ORIGIN_ALLOCATED ) { TableCount = AcpiGbl_RootTableList . MaxTableCount ; } else { TableCount = AcpiGbl_RootTableList . CurrentTableCount ; } Tables = ACPI_ALLOCATE_ZEROED ( ( ( ACPI_SIZE ) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT ) * sizeof ( ACPI_TABLE_DESC ) ) ; if ( ! Tables ) { ACPI_ERROR ( ( AE_INFO , " " ) ) ; return_ACPI_STATUS ( AE_NO_MEMORY ) ; } if ( AcpiGbl_RootTableList . Tables ) { memcpy ( Tables , AcpiGbl_RootTableList . Tables , ( ACPI_SIZE ) TableCount * sizeof ( ACPI_TABLE_DESC ) ) ; if ( AcpiGbl_RootTableList . Flags & ACPI_ROOT_ORIGIN_ALLOCATED ) { ACPI_FREE ( AcpiGbl_RootTableList . Tables ) ; } } AcpiGbl_RootTableList . Tables = Tables ; AcpiGbl_RootTableList . MaxTableCount = TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT ; AcpiGbl_RootTableList . Flags |= ACPI_ROOT_ORIGIN_ALLOCATED ; return_ACPI_STATUS ( AE_OK ) ; }
FUNCTION:    AcpiTbResizeRootTableList
 PARAMETERS:  None
FUNCTION : AcpiTbResizeRootTableList PARAMETERS : None
/* AllowResize flag is a parameter to AcpiInitializeTables */ /* Increase the Table Array size */ /* Copy and free the previous table array */