firmware: dmi_scan: add SBMIOS entry and DMI tables
Some utils, like dmidecode and smbios, need to access SMBIOS entry table area in order to get information like SMBIOS version, size, etc. Currently it's done via /dev/mem. But for situation when /dev/mem usage is disabled, the utils have to use dmi sysfs instead, which doesn't represent SMBIOS entry and adds code/delay redundancy when direct access for table is needed. So this patch creates dmi/tables and adds SMBIOS entry point to allow utils in question to work correctly without /dev/mem. Also patch adds raw dmi table to simplify dmi table processing in user space, as proposed by Jean Delvare. Tested-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@globallogic.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
This commit is contained in:

committed by
Jean Delvare

parent
6e0ad59e3d
commit
d7f96f97c4
@@ -566,7 +566,6 @@ static struct kobj_type dmi_sysfs_entry_ktype = {
|
||||
.default_attrs = dmi_sysfs_entry_attrs,
|
||||
};
|
||||
|
||||
static struct kobject *dmi_kobj;
|
||||
static struct kset *dmi_kset;
|
||||
|
||||
/* Global count of all instances seen. Only for setup */
|
||||
@@ -648,17 +647,20 @@ static void cleanup_entry_list(void)
|
||||
|
||||
static int __init dmi_sysfs_init(void)
|
||||
{
|
||||
int error = -ENOMEM;
|
||||
int error;
|
||||
int val;
|
||||
|
||||
/* Set up our directory */
|
||||
dmi_kobj = kobject_create_and_add("dmi", firmware_kobj);
|
||||
if (!dmi_kobj)
|
||||
if (!dmi_kobj) {
|
||||
pr_err("dmi-sysfs: dmi entry is absent.\n");
|
||||
error = -ENODATA;
|
||||
goto err;
|
||||
}
|
||||
|
||||
dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj);
|
||||
if (!dmi_kset)
|
||||
if (!dmi_kset) {
|
||||
error = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
val = 0;
|
||||
error = dmi_walk(dmi_sysfs_register_handle, &val);
|
||||
@@ -675,7 +677,6 @@ static int __init dmi_sysfs_init(void)
|
||||
err:
|
||||
cleanup_entry_list();
|
||||
kset_unregister(dmi_kset);
|
||||
kobject_put(dmi_kobj);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -685,8 +686,6 @@ static void __exit dmi_sysfs_exit(void)
|
||||
pr_debug("dmi-sysfs: unloading.\n");
|
||||
cleanup_entry_list();
|
||||
kset_unregister(dmi_kset);
|
||||
kobject_del(dmi_kobj);
|
||||
kobject_put(dmi_kobj);
|
||||
}
|
||||
|
||||
module_init(dmi_sysfs_init);
|
||||
|
Reference in New Issue
Block a user