staticunsignedlong __init_or_fwtbl_lib
acpi_table_get_length(enum acpi_subtable_type type, union fw_table_header *header)
{ if (type == CDAT_SUBTABLE) {
__le32 length = (__force __le32)header->cdat.length;
return le32_to_cpu(length);
}
return header->acpi.length;
}
static __init_or_fwtbl_lib int call_handler(struct acpi_subtable_proc *proc, union acpi_subtable_headers *hdr, unsignedlong end)
{ if (proc->handler) return proc->handler(hdr, end); if (proc->handler_arg) return proc->handler_arg(hdr, proc->arg, end); return -EINVAL;
}
/** * acpi_parse_entries_array - for each proc_num find a suitable subtable * * @id: table id (for debugging purposes) * @table_size: size of the root table * @max_length: maximum size of the table (ignore if 0) * @table_header: where does the table start? * @proc: array of acpi_subtable_proc struct containing entry id * and associated handler with it * @proc_num: how big proc is? * @max_entries: how many entries can we process? * * For each proc_num find a subtable with proc->id and run proc->handler * on it. Assumption is that there's only single handler for particular * entry id. * * The table_size is not the size of the complete ACPI table (the length * field in the header struct), but only the size of the root table; i.e., * the offset from the very first byte of the complete ACPI table, to the * first byte of the very first subtable. * * On success returns sum of all matching entries for all proc handlers. * Otherwise, -ENODEV or -EINVAL is returned.
*/ int __init_or_fwtbl_lib
acpi_parse_entries_array(char *id, unsignedlong table_size, union fw_table_header *table_header, unsignedlong max_length, struct acpi_subtable_proc *proc, int proc_num, unsignedint max_entries)
{ unsignedlong table_len, table_end, subtable_len, entry_len; struct acpi_subtable_entry entry; enum acpi_subtable_type type; int count = 0; int i;
while (((unsignedlong)entry.hdr) + subtable_len < table_end) { for (i = 0; i < proc_num; i++) { if (acpi_get_entry_type(&entry) != proc[i].id) continue;
if (!max_entries || count < max_entries) if (call_handler(&proc[i], entry.hdr, table_end)) return -EINVAL;
proc[i].count++;
count++; break;
}
/* * If entry->length is 0, break from this loop to avoid * infinite loop.
*/
entry_len = acpi_get_entry_length(&entry); if (entry_len == 0) {
pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, proc->id); return -EINVAL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.