Lines Matching +full:proc +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * fw_tables.c - Parsing support for ACPI and ACPI-like tables provided by
33 switch (entry->type) { in acpi_get_entry_type()
35 return entry->hdr->common.type; in acpi_get_entry_type()
37 return entry->hdr->hmat.type; in acpi_get_entry_type()
41 return entry->hdr->cedt.type; in acpi_get_entry_type()
43 return entry->hdr->cdat.type; in acpi_get_entry_type()
51 switch (entry->type) { in acpi_get_entry_length()
53 return entry->hdr->common.length; in acpi_get_entry_length()
55 return entry->hdr->hmat.length; in acpi_get_entry_length()
57 return entry->hdr->prmt.length; in acpi_get_entry_length()
59 return entry->hdr->cedt.length; in acpi_get_entry_length()
61 __le16 length = (__force __le16)entry->hdr->cdat.length; in acpi_get_entry_length()
72 switch (entry->type) { in acpi_get_subtable_header_length()
74 return sizeof(entry->hdr->common); in acpi_get_subtable_header_length()
76 return sizeof(entry->hdr->hmat); in acpi_get_subtable_header_length()
78 return sizeof(entry->hdr->prmt); in acpi_get_subtable_header_length()
80 return sizeof(entry->hdr->cedt); in acpi_get_subtable_header_length()
82 return sizeof(entry->hdr->cdat); in acpi_get_subtable_header_length()
88 acpi_get_subtable_type(char *id) in acpi_get_subtable_type() argument
90 if (strncmp(id, ACPI_SIG_HMAT, 4) == 0) in acpi_get_subtable_type()
92 if (strncmp(id, ACPI_SIG_PRMT, 4) == 0) in acpi_get_subtable_type()
94 if (strncmp(id, ACPI_SIG_CEDT, 4) == 0) in acpi_get_subtable_type()
96 if (strncmp(id, ACPI_SIG_CDAT, 4) == 0) in acpi_get_subtable_type()
106 __le32 length = (__force __le32)header->cdat.length; in acpi_table_get_length()
111 return header->acpi.length; in acpi_table_get_length()
114 static __init_or_fwtbl_lib int call_handler(struct acpi_subtable_proc *proc, in call_handler() argument
118 if (proc->handler) in call_handler()
119 return proc->handler(hdr, end); in call_handler()
120 if (proc->handler_arg) in call_handler()
121 return proc->handler_arg(hdr, proc->arg, end); in call_handler()
122 return -EINVAL; in call_handler()
126 * acpi_parse_entries_array - for each proc_num find a suitable subtable
128 * @id: table id (for debugging purposes)
132 * @proc: array of acpi_subtable_proc struct containing entry id
134 * @proc_num: how big proc is?
137 * For each proc_num find a subtable with proc->id and run proc->handler
139 * entry id.
146 * On success returns sum of all matching entries for all proc handlers.
147 * Otherwise, -ENODEV or -EINVAL is returned.
150 acpi_parse_entries_array(char *id, unsigned long table_size, in acpi_parse_entries_array() argument
153 struct acpi_subtable_proc *proc, in acpi_parse_entries_array() argument
162 type = acpi_get_subtable_type(id); in acpi_parse_entries_array()
177 if (acpi_get_entry_type(&entry) != proc[i].id) in acpi_parse_entries_array()
181 if (call_handler(&proc[i], entry.hdr, table_end)) in acpi_parse_entries_array()
182 return -EINVAL; in acpi_parse_entries_array()
184 proc[i].count++; in acpi_parse_entries_array()
190 * If entry->length is 0, break from this loop to avoid in acpi_parse_entries_array()
195 pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, proc->id); in acpi_parse_entries_array()
196 return -EINVAL; in acpi_parse_entries_array()
205 id, proc->id, count - max_entries, count); in acpi_parse_entries_array()
218 struct acpi_subtable_proc proc = { in cdat_table_parse() local
219 .id = type, in cdat_table_parse()
225 return -EINVAL; in cdat_table_parse()
230 length, &proc, 1, 0); in cdat_table_parse()