static ssize_t sfi_table_show(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t offset, size_t count) { struct sfi_table_attr *tbl_attr = container_of(bin_attr, struct sfi_table_attr, attr); struct sfi_table_header *th = NULL; struct sfi_table_key key; ssize_t cnt; key.sig = tbl_attr->name; key.oem_id = NULL; key.oem_table_id = NULL; if (strncmp(SFI_SIG_SYST, tbl_attr->name, SFI_SIGNATURE_SIZE)) { th = sfi_get_table(&key); if (!th) return 0; cnt = memory_read_from_buffer(buf, count, &offset, th, th->len); sfi_put_table(th); } else cnt = memory_read_from_buffer(buf, count, &offset, syst_va, syst_va->header.len); return cnt; }
int __init sfi_acpi_init(void) { struct sfi_table_key xsdt_key = { .sig = SFI_SIG_XSDT }; sfi_table_parse(SFI_SIG_XSDT, NULL, NULL, sfi_acpi_parse_xsdt); xsdt_va = (struct acpi_table_xsdt *)sfi_get_table(&xsdt_key); return 0; }
/* Find table with signature, run handler on it */ int sfi_table_parse(char *signature, char *oem_id, char *oem_table_id, sfi_table_handler handler) { struct sfi_table_header *table = NULL; struct sfi_table_key key; int ret = -EINVAL; if (sfi_disabled || !handler || !signature) goto exit; key.sig = signature; key.oem_id = oem_id; key.oem_table_id = oem_table_id; table = sfi_get_table(&key); if (!table) goto exit; ret = handler(table); sfi_put_table(table); exit: return ret; }