Christian Walter has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32910
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Emtries will be automatically created.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h 2 files changed, 93 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/32910/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index d389314..3d62614 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -30,6 +30,8 @@ #include <memory_info.h> #include <spd.h> #include <cbmem.h> +#include <device/pci_ids.h> +#include <device/pci_def.h> #if CONFIG(CHROMEOS) #include <vendorcode/google/chromeos/gnvs.h> #endif @@ -50,6 +52,67 @@ return -ret; }
+static const char *smbios_get_name_from_type(u8 device_type) +{ + switch (device_type) { + case SMBIOS_DEVICE_TYPE_VIDEO: + return "Video Controller"; + case SMBIOS_DEVICE_TYPE_ETHERNET: + case SMBIOS_DEVICE_TYPE_TOKEN_RING: + return "Ethernet Controller"; + case SMBIOS_DEVICE_TYPE_SOUND: + return "Sound Controller"; + case SMBIOS_DEVICE_TYPE_PATA: + case SMBIOS_DEVICE_TYPE_SAS: + case SMBIOS_DEVICE_TYPE_SATA: + case SMBIOS_DEVICE_TYPE_SCSI: + return "Memory Controller"; + default: + return "Unknown"; + } + + return "Unknown"; +} + +/* Get the device type from the dev struct */ +static u8 smbios_get_device_type_from_dev(struct device *dev) +{ + u16 pci_basesubclass = (dev->class >> 8) & 0xFFFF; + + switch (pci_basesubclass) { + case PCI_CLASS_NOT_DEFINED: + return SMBIOS_DEVICE_TYPE_OTHER; + case PCI_CLASS_DISPLAY_VGA: + case PCI_CLASS_DISPLAY_XGA: + case PCI_CLASS_DISPLAY_3D: + case PCI_CLASS_DISPLAY_OTHER: + return SMBIOS_DEVICE_TYPE_VIDEO; + case PCI_CLASS_STORAGE_SCSI: + return SMBIOS_DEVICE_TYPE_SCSI; + case PCI_CLASS_NETWORK_ETHERNET: + return SMBIOS_DEVICE_TYPE_ETHERNET; + case PCI_CLASS_NETWORK_TOKEN_RING: + return SMBIOS_DEVICE_TYPE_TOKEN_RING; + case PCI_CLASS_MULTIMEDIA_VIDEO: + case PCI_CLASS_MULTIMEDIA_AUDIO: + case PCI_CLASS_MULTIMEDIA_PHONE: + case PCI_CLASS_MULTIMEDIA_OTHER: + return SMBIOS_DEVICE_TYPE_SOUND; + case PCI_CLASS_STORAGE_ATA: + return SMBIOS_DEVICE_TYPE_PATA; + case PCI_CLASS_STORAGE_SATA: + return SMBIOS_DEVICE_TYPE_SATA; + case PCI_CLASS_STORAGE_SAS: + return SMBIOS_DEVICE_TYPE_SAS; + default: + return SMBIOS_DEVICE_TYPE_UNKNOWN; + break; + } + + return SMBIOS_DEVICE_TYPE_UNKNOWN; // safety first + +} +
int smbios_add_string(u8 *start, const char *str) { @@ -999,6 +1062,33 @@ return len; }
+/* Generate Type41 entries from devicetree */ +static int smbios_walk_device_tree_type41(struct device *dev, int *handle, + unsigned long *current) +{ + static u8 type41_instance_cnt = 0; + + if (dev->path.type != DEVICE_PATH_PCI) + return 0; + + u8 device_type = smbios_get_device_type_from_dev(dev); + + if (device_type == SMBIOS_DEVICE_TYPE_OTHER || + device_type == SMBIOS_DEVICE_TYPE_UNKNOWN) + return 0; + + const char *name = smbios_get_name_from_type(device_type); + + return smbios_write_type41(current, handle, + name, // name + type41_instance_cnt++, // instance + 0, // segment + dev->bus->secondary, //bus + PCI_SLOT(dev->path.pci.devfn), //device + PCI_FUNC(dev->path.pci.devfn), //func + device_type); +} + /* Generate Type9 entries from devicetree */ static int smbios_walk_device_tree_type9(struct device *dev, int *handle, unsigned long *current) @@ -1062,6 +1152,7 @@ len += dev->ops->get_smbios_data(dev, handle, current); } len += smbios_walk_device_tree_type9(dev, handle, current); + len += smbios_walk_device_tree_type41(dev, handle, current); } return len; } diff --git a/src/include/device/pci_ids.h b/src/include/device/pci_ids.h index 6453951..bd98e91 100644 --- a/src/include/device/pci_ids.h +++ b/src/include/device/pci_ids.h @@ -18,6 +18,7 @@ #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_ATA 0x0105 #define PCI_CLASS_STORAGE_SATA 0x0106 #define PCI_CLASS_STORAGE_OTHER 0x0180
@@ -3081,6 +3082,7 @@ #define PCI_DEVICE_ID_INTEL_KBL_ID_Y 0x590c #define PCI_DEVICE_ID_INTEL_KBL_ID_H 0x5910 #define PCI_DEVICE_ID_INTEL_KBL_U_R 0x5914 +#define PCI_DEVICE_ID_INTEL_KBL_ID_DT_2 0x5918 #define PCI_DEVICE_ID_INTEL_KBL_ID_DT 0x591f #define PCI_DEVICE_ID_INTEL_CNL_ID_U 0x5A04 #define PCI_DEVICE_ID_INTEL_CNL_ID_Y 0x5A02
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 2:
(7 comments)
https://review.coreboot.org/#/c/32910/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32910/2//COMMIT_MSG@9 PS2, Line 9: Emtries entries
https://review.coreboot.org/#/c/32910/2//COMMIT_MSG@10 PS2, Line 10: Please elaborate what type 41 entries are, and what they are needed for.
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@109 PS2, Line 109: break; Is that `break` really needed?
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@113 PS2, Line 113: Please remove this blank line.
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@1086 PS2, Line 1086: dev->bus->secondary, //bus : PCI_SLOT(dev->path.pci.devfn), //device : PCI_FUNC(dev->path.pci.devfn), //func Please add a space after `//`.
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h File src/include/device/pci_ids.h:
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h@21 PS2, Line 21: Use tabs for alignment (see above).
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h@3085 PS2, Line 3085: Tab please.
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 2:
(5 comments)
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@55 PS2, Line 55: static const char *smbios_get_name_from_type(u8 device_type) please use const char *get_pci_class_name(struct device *dev) and const char *get_pci_subclass_name(struct device *dev) instead.
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@77 PS2, Line 77: /* Get the device type from the dev struct */ mention type 41
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@1072 PS2, Line 1072: return 0; test for dev->on_mainboard
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@1077 PS2, Line 1077: device_type == SMBIOS_DEVICE_TYPE_UNKNOWN) align with (
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h File src/include/device/pci_ids.h:
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h@3085 PS2, Line 3085: #define PCI_DEVICE_ID_INTEL_KBL_ID_DT_2 0x5918 unrelated
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32910
to look at the new patch set (#3).
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Emtries will be automatically created.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h 2 files changed, 69 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/32910/3
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32910
to look at the new patch set (#4).
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Entries will be automatically created. Type 41 entries define attributes of the onboard devices.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h 2 files changed, 70 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/32910/4
Christian Walter has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 4:
(12 comments)
https://review.coreboot.org/#/c/32910/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32910/2//COMMIT_MSG@9 PS2, Line 9: Emtries
entries
Ack
https://review.coreboot.org/#/c/32910/2//COMMIT_MSG@10 PS2, Line 10:
Please elaborate what type 41 entries are, and what they are needed for.
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@55 PS2, Line 55: static const char *smbios_get_name_from_type(u8 device_type)
please use […]
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@77 PS2, Line 77: /* Get the device type from the dev struct */
mention type 41
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@109 PS2, Line 109: break;
Is that `break` really needed?
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@113 PS2, Line 113:
Please remove this blank line.
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@1072 PS2, Line 1072: return 0;
test for dev->on_mainboard
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@1077 PS2, Line 1077: device_type == SMBIOS_DEVICE_TYPE_UNKNOWN)
align with (
Ack
https://review.coreboot.org/#/c/32910/2/src/arch/x86/smbios.c@1086 PS2, Line 1086: dev->bus->secondary, //bus : PCI_SLOT(dev->path.pci.devfn), //device : PCI_FUNC(dev->path.pci.devfn), //func
Please add a space after `//`.
Ack
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h File src/include/device/pci_ids.h:
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h@21 PS2, Line 21:
Use tabs for alignment (see above).
Ack
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h@3085 PS2, Line 3085:
Tab please.
Ack
https://review.coreboot.org/#/c/32910/2/src/include/device/pci_ids.h@3085 PS2, Line 3085: #define PCI_DEVICE_ID_INTEL_KBL_ID_DT_2 0x5918
unrelated
Ack
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 4:
(2 comments)
Tested on P8H61M-Pro: Two onboard devices are found and the PCI address' are correct.
https://review.coreboot.org/#/c/32910/4/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/4/src/arch/x86/smbios.c@1057 PS4, Line 1057: const char *name = get_pci_class_name(dev); I'd prefer the get_pci_subclass_name() here, as the class name is already shown in dmidecode as "Type".
https://review.coreboot.org/#/c/32910/4/src/arch/x86/smbios.c@1061 PS4, Line 1061: type41_instance_cnt++, // instance the instance id need to increment per device_type, not globally.
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32910
to look at the new patch set (#5).
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Entries will be automatically created. Type 41 entries define attributes of the onboard devices.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h M src/include/smbios.h 3 files changed, 72 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/32910/5
Christian Walter has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/#/c/32910/4/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/4/src/arch/x86/smbios.c@1057 PS4, Line 1057: const char *name = get_pci_class_name(dev);
I'd prefer the get_pci_subclass_name() here, as the class name is already shown in dmidecode as "Typ […]
Ack
https://review.coreboot.org/#/c/32910/4/src/arch/x86/smbios.c@1061 PS4, Line 1061: type41_instance_cnt++, // instance
the instance id need to increment per device_type, not globally.
Ack
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/#/c/32910/6/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/6/src/arch/x86/smbios.c@1054 PS6, Line 1054: device_type == SMBIOS_DEVICE_TYPE_UNKNOWN) please check for device_type < ARRAY_SIZE(type41_inst_cnt), too
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32910
to look at the new patch set (#7).
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Entries will be automatically created. Type 41 entries define attributes of the onboard devices.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h M src/include/smbios.h 3 files changed, 75 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/32910/7
Christian Walter has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/#/c/32910/6/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/6/src/arch/x86/smbios.c@1054 PS6, Line 1054: device_type == SMBIOS_DEVICE_TYPE_UNKNOWN)
please check for device_type < ARRAY_SIZE(type41_inst_cnt), too
Ack
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/#/c/32910/8/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/8/src/arch/x86/smbios.c@1057 PS8, Line 1057: if (device_type > SMBIOS_DEVICE_TYPE_COUNT)
=
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32910
to look at the new patch set (#9).
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Entries will be automatically created. Type 41 entries define attributes of the onboard devices.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h M src/include/smbios.h 3 files changed, 75 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/32910/9
Christian Walter has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 10:
(1 comment)
Patch Set 8:
(1 comment)
Done.
https://review.coreboot.org/#/c/32910/8/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32910/8/src/arch/x86/smbios.c@1057 PS8, Line 1057: if (device_type > SMBIOS_DEVICE_TYPE_COUNT)
=
Not necessary - Increased the Array by 1.
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 10: Code-Review+2
Tested on P8H61M-Pro. All onboard PCI devices are listed under Type41.
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/#/c/32910/12/src/include/device/pci_ids.h File src/include/device/pci_ids.h:
PS12: empty???
Christian Walter has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 13:
Patch Set 12:
(1 comment)
I just rebased the patch..
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
Patch Set 13: Code-Review+2
Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32910 )
Change subject: src/arch/x86: Add automatic type41 entry creation ......................................................................
src/arch/x86: Add automatic type41 entry creation
SMBIOS Type41 Entries will be automatically created. Type 41 entries define attributes of the onboard devices.
Change-Id: Idcb3532a5c05666d6613af4f303df85f4f1f6e97 Signed-off-by: Christian Walter christian.walter@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/32910 Reviewed-by: Philipp Deppenwiese zaolin.daisuki@gmail.com Reviewed-by: Patrick Rudolph siro@das-labor.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/arch/x86/smbios.c M src/include/device/pci_ids.h M src/include/smbios.h 3 files changed, 75 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Philipp Deppenwiese: Looks good to me, approved Patrick Rudolph: Looks good to me, approved
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 310a870..bf627f2 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -30,6 +30,9 @@ #include <memory_info.h> #include <spd.h> #include <cbmem.h> +#include <device/pci_ids.h> +#include <device/pci_def.h> +#include <device/pci.h> #if CONFIG(CHROMEOS) #include <vendorcode/google/chromeos/gnvs.h> #endif @@ -50,6 +53,41 @@ return -ret; }
+/* Get the device type 41 from the dev struct */ +static u8 smbios_get_device_type_from_dev(struct device *dev) +{ + u16 pci_basesubclass = (dev->class >> 8) & 0xFFFF; + + switch (pci_basesubclass) { + case PCI_CLASS_NOT_DEFINED: + return SMBIOS_DEVICE_TYPE_OTHER; + case PCI_CLASS_DISPLAY_VGA: + case PCI_CLASS_DISPLAY_XGA: + case PCI_CLASS_DISPLAY_3D: + case PCI_CLASS_DISPLAY_OTHER: + return SMBIOS_DEVICE_TYPE_VIDEO; + case PCI_CLASS_STORAGE_SCSI: + return SMBIOS_DEVICE_TYPE_SCSI; + case PCI_CLASS_NETWORK_ETHERNET: + return SMBIOS_DEVICE_TYPE_ETHERNET; + case PCI_CLASS_NETWORK_TOKEN_RING: + return SMBIOS_DEVICE_TYPE_TOKEN_RING; + case PCI_CLASS_MULTIMEDIA_VIDEO: + case PCI_CLASS_MULTIMEDIA_AUDIO: + case PCI_CLASS_MULTIMEDIA_PHONE: + case PCI_CLASS_MULTIMEDIA_OTHER: + return SMBIOS_DEVICE_TYPE_SOUND; + case PCI_CLASS_STORAGE_ATA: + return SMBIOS_DEVICE_TYPE_PATA; + case PCI_CLASS_STORAGE_SATA: + return SMBIOS_DEVICE_TYPE_SATA; + case PCI_CLASS_STORAGE_SAS: + return SMBIOS_DEVICE_TYPE_SAS; + default: + return SMBIOS_DEVICE_TYPE_UNKNOWN; + } +} +
int smbios_add_string(u8 *start, const char *str) { @@ -999,6 +1037,38 @@ return len; }
+/* Generate Type41 entries from devicetree */ +static int smbios_walk_device_tree_type41(struct device *dev, int *handle, + unsigned long *current) +{ + static u8 type41_inst_cnt[SMBIOS_DEVICE_TYPE_COUNT + 1] = {}; + + if (dev->path.type != DEVICE_PATH_PCI) + return 0; + if (!dev->on_mainboard) + return 0; + + u8 device_type = smbios_get_device_type_from_dev(dev); + + if (device_type == SMBIOS_DEVICE_TYPE_OTHER || + device_type == SMBIOS_DEVICE_TYPE_UNKNOWN) + return 0; + + if (device_type > SMBIOS_DEVICE_TYPE_COUNT) + return 0; + + const char *name = get_pci_subclass_name(dev); + + return smbios_write_type41(current, handle, + name, // name + type41_inst_cnt[device_type]++, // inst + 0, // segment + dev->bus->secondary, //bus + PCI_SLOT(dev->path.pci.devfn), // device + PCI_FUNC(dev->path.pci.devfn), // func + device_type); +} + /* Generate Type9 entries from devicetree */ static int smbios_walk_device_tree_type9(struct device *dev, int *handle, unsigned long *current) @@ -1062,6 +1132,7 @@ len += dev->ops->get_smbios_data(dev, handle, current); } len += smbios_walk_device_tree_type9(dev, handle, current); + len += smbios_walk_device_tree_type41(dev, handle, current); } return len; } diff --git a/src/include/device/pci_ids.h b/src/include/device/pci_ids.h index 3c48e68..a35e134 100644 --- a/src/include/device/pci_ids.h +++ b/src/include/device/pci_ids.h @@ -18,7 +18,9 @@ #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_ATA 0x0105 #define PCI_CLASS_STORAGE_SATA 0x0106 +#define PCI_CLASS_STORAGE_SAS 0x0107 #define PCI_CLASS_STORAGE_OTHER 0x0180
#define PCI_BASE_CLASS_NETWORK 0x02 diff --git a/src/include/smbios.h b/src/include/smbios.h index 017e90e..0bba0a7 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -756,6 +756,8 @@ SMBIOS_DEVICE_TYPE_SAS, } smbios_onboard_device_type;
+#define SMBIOS_DEVICE_TYPE_COUNT 10 + struct smbios_type41 { u8 type; u8 length;