mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
PCI: export SMBIOS provided firmware instance and label to sysfs
This patch exports SMBIOS provided firmware instance and label of onboard PCI devices to sysfs. New files are: /sys/bus/pci/devices/.../label which contains the firmware name for the device in question, and /sys/bus/pci/devices/.../index which contains the firmware device type instance for the given device. Signed-off-by: Jordan Hargrave <[email protected]> Signed-off-by: Narendra K <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
This commit is contained in:
parent
8633328be2
commit
911e1c9b05
7 changed files with 221 additions and 0 deletions
|
|
@ -277,6 +277,29 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
|
|||
list_add_tail(&dev->list, &dmi_devices);
|
||||
}
|
||||
|
||||
static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
|
||||
int devfn, const char *name)
|
||||
{
|
||||
struct dmi_dev_onboard *onboard_dev;
|
||||
|
||||
onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
|
||||
if (!onboard_dev) {
|
||||
printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
|
||||
return;
|
||||
}
|
||||
onboard_dev->instance = instance;
|
||||
onboard_dev->segment = segment;
|
||||
onboard_dev->bus = bus;
|
||||
onboard_dev->devfn = devfn;
|
||||
|
||||
strcpy((char *)&onboard_dev[1], name);
|
||||
onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
|
||||
onboard_dev->dev.name = (char *)&onboard_dev[1];
|
||||
onboard_dev->dev.device_data = onboard_dev;
|
||||
|
||||
list_add(&onboard_dev->dev.list, &dmi_devices);
|
||||
}
|
||||
|
||||
static void __init dmi_save_extended_devices(const struct dmi_header *dm)
|
||||
{
|
||||
const u8 *d = (u8*) dm + 5;
|
||||
|
|
@ -285,6 +308,8 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
|
|||
if ((*d & 0x80) == 0)
|
||||
return;
|
||||
|
||||
dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
|
||||
dmi_string_nosave(dm, *(d-1)));
|
||||
dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue