• Al Stone's avatar
    ACPI / tables: fix incorrect counts returned by acpi_parse_entries_array() · fa162a05
    Al Stone authored
    The static function acpi_parse_entries_array() is provided an array of
    type struct acpi_subtable_proc that has a callback function and a count.
    The count should reflect how many times the callback has been called.
    However, the current code only increments the 0th element of the array,
    regardless of the number of entries in the array, or which callback has
    been invoked.  The result is that we know the total number of callbacks
    made but we cannot determine which callbacks were made, nor how often.
    The fix is to index into the array of structs and increment the proper
    counts.
    
    There is one place in the x86 code for acpi_parse_madt_lapic_entries()
    where the counts for each callback are used.  If no LAPICs *and* no
    X2APICs are found, an ENODEV is supposed to be returned; as it stands,
    the count of X2APICs will always be zero, regardless of what is in the
    MADT.  Should there be no LAPICs, ENODEV will be returned in error, if
    there are X2APICs in the MADT.
    
    Otherwise, there are no other functional consequences of the count being
    done as it currently is; all other uses simply check that the return value
    from acpi_parse_entries_array() or passed back via its callers is either
    non-zero, an error, or in one case just ignored.
    
    In future patches, I will also need these counts to be correct; I need
    to count the number of instances of subtables of certain types within
    the MADT to determine whether or not an ACPI IORT is required or not,
    and report when it is not present when it should be.
    Signed-off-by: default avatarAl Stone <ahs3@redhat.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    fa162a05
tables.c 21.4 KB