On 19 January 2015 at 16:07, Ard Biesheuvel ard.biesheuvel@linaro.org wrote:
On 16 January 2015 at 17:56, Ivan Khoronzhuk ivan.khoronzhuk@linaro.org wrote:
There are situations when code needs to access SMBIOS entry table
area, but cannot use /dev/mem for this. As the table format is
consistent only for a version, and can be changed, use binary
attribute to give access to raw SMBIOS entry table area.
So now we have a sysfs entry for the entry point, but still need
/dev/mem to get at the actual data?
Ignore me, I was looking in the wrong place in /sys
So as I understand it, you need these patches to get at the payload of
the entry point, i.e., the version number.
Could we instead export the version number directly, and not bother
with recording and remapping the structure table?
The version is already recorded in dmi_ver afaik,
--
Ard.
>> Signed-off-by: Ivan Khoronzhuk
ivan.khoronzhuk@linaro.org
>> ---
>> drivers/firmware/dmi-sysfs.c | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
>> index e0f1cb3..c308b8b 100644
>> --- a/drivers/firmware/dmi-sysfs.c
>> +++ b/drivers/firmware/dmi-sysfs.c
>> @@ -646,6 +646,37 @@ static void cleanup_entry_list(void)
>> }
>> }
>>
>> +static ssize_t smbios_entry_area_raw_read(struct file *filp,
>> + struct kobject *kobj,
>> + struct bin_attribute *bin_attr,
>> + char *buf, loff_t pos, size_t count)
>> +{
>> + ssize_t size;
>> + unsigned char area[32];
>> +
>> + size = dmi_get_smbios_entry_area(area);
>> + if (size == -ENODATA)
>> + return size;
>> +
>> + if (size > pos)
>> + size -= pos;
>> + else
>> + return 0;
>> +
>> + if (count < size)
>> + size = count;
>> +
>> + memcpy(buf, &area[pos], size);
>> +
>> + return size;
>> +}
>> +
>> +static const struct bin_attribute smbios_entry_area_raw_attr = {
>> + .size = 32,
>> + .read = smbios_entry_area_raw_read,
>> + .attr = {.name = "smbios_raw", .mode = 0400},
>> +};
>> +
>> static int __init dmi_sysfs_init(void)
>> {
>> int error = -ENOMEM;
>> @@ -656,6 +687,10 @@ static int __init dmi_sysfs_init(void)
>> if (!dmi_kobj)
>> goto err;
>>
>> + /* Create the raw binary file to access the entry area */
>> + if (sysfs_create_bin_file(dmi_kobj, &smbios_entry_area_raw_attr))
>> + goto err;
>> +
>> dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj);
>> if (!dmi_kset)
>> goto err;
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> Linaro-uefi mailing list
>> Linaro-uefi@lists.linaro.org
>>
http://lists.linaro.org/mailman/listinfo/linaro-uefi