Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1272625

[PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan

From <Jordan_Hargrave@Dell.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan
Date 2015-11-18 23:20 +0100
Message-ID <qwjf5-Ju-25@gated-at.bofh.it> (permalink)
References <qwjf5-Ju-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


PCI address of onboard devices is currently saved but not for slots.

Signed-off-by: Jordan Hargrave <Jordan_Hargrave@dell.com>
---
 drivers/firmware/dmi_scan.c | 39 +++++++++++++++++++++++++++++++++++++++
 include/linux/dmi.h         |  1 +
 2 files changed, 40 insertions(+)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index ac1ce4a..43cb7db 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -356,6 +356,41 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
        dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }

+static void __init dmi_save_dev_slot(int instance, int segment, int bus, int devfn, const char *name)
+{
+       struct dmi_dev_onboard *slot;
+
+       slot = dmi_alloc(sizeof(*slot) + strlen(name) + 1);
+       if (!slot) {
+               printk(KERN_ERR "dmi_save_system_slot: out of memory.\n");
+               return;
+       }
+       slot->instance = instance;
+       slot->segment = segment;
+       slot->bus = bus;
+       slot->devfn = devfn;
+
+       strcpy((char *)&slot[1], name);
+       slot->dev.type = DMI_DEV_TYPE_SYSTEM_SLOT;
+       slot->dev.name = (char *)&slot[1];
+       slot->dev.device_data = slot;
+
+       list_add(&slot->dev.list, &dmi_devices);
+}
+
+
+static void __init dmi_save_system_slot(const struct dmi_header *dm)
+{
+       const char *name;
+       const u8 *d = (u8*)dm;
+
+       if (dm->type == DMI_ENTRY_SYSTEM_SLOT && dm->length >= 0x11) {
+               name = dmi_string_nosave(dm, *(d + 0x04));
+               dmi_save_dev_slot(*(u16 *)(d + 0x09), *(u16 *)(d + 0xD),
+                                 *(d + 0xF), *(d + 0x10), name);
+       }
+}
+
 static void __init count_mem_devices(const struct dmi_header *dm, void *v)
 {
        if (dm->type != DMI_ENTRY_MEM_DEVICE)
@@ -437,6 +472,10 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
                break;
        case 41:        /* Onboard Devices Extended Information */
                dmi_save_extended_devices(dm);
+               break;
+       case 9:         /* System Slots */
+               dmi_save_system_slot(dm);
+               break;
        }
 }

diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 5055ac3..09f42e7 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -22,6 +22,7 @@ enum dmi_device_type {
        DMI_DEV_TYPE_IPMI = -1,
        DMI_DEV_TYPE_OEM_STRING = -2,
        DMI_DEV_TYPE_DEV_ONBOARD = -3,
+       DMI_DEV_TYPE_SYSTEM_SLOT = -4,
 };

 enum dmi_entry_type {
--
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan Jordan Hargrave <Jordan_Hargrave@dell.com> - 2015-11-18 23:20 +0100
  [PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan <Jordan_Hargrave@Dell.com> - 2015-11-18 23:20 +0100
  Re: [PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan Jean Delvare <jdelvare@suse.de> - 2015-11-25 12:50 +0100
    Re: [PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan Jean Delvare <jdelvare@suse.de> - 2015-11-26 09:30 +0100
      Re: [PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan Jean Delvare <jdelvare@suse.de> - 2015-11-27 10:30 +0100
        Re: [PATCH 1/2] Save SMBIOS Type 9 System Slots during DMI Scan Jean Delvare <jdelvare@suse.de> - 2015-11-27 12:50 +0100

csiph-web