dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] [PATCH] update dmidecode to parse Modern Management Cont


From: Elliott, Robert (Persistent Memory)
Subject: Re: [dmidecode] [PATCH] update dmidecode to parse Modern Management Controller blocks
Date: Thu, 2 Aug 2018 14:17:42 +0000


> -----Original Message-----
> From: dmidecode-devel <dmidecode-devel-
> address@hidden> On Behalf Of Neil Horman
> Sent: Thursday, August 02, 2018 9:00 AM
> To: address@hidden
> Cc: address@hidden; Neil Horman <address@hidden>;
> address@hidden
> Subject: [dmidecode] [PATCH] update dmidecode to parse Modern
> Management Controller blocks
> 
> Starting with version 0x300 the SMBIOS specification defined in more
> detail the contents of the management controller type.  DMTF further
> reserved values to define the Redfish host interface specification.
> Update dmidecode to properly parse and present that information
> 
...
> +             if (type == IFC_DEVICE_USB) {
> +                     /* USB */
> +                     u8 *usbdata = &data[USB_DESCRIPTOR];
> +                     printf("%s\tidVendor: 0x%02x\n", prefix,
> (unsigned short)usbdata[USB_VENDOR]);
> +                     printf("%s\tidProduct: 0x%02x\n", prefix,
> (unsigned short)usbdata[USB_PRODUCT]);
> +                     printf("%s\tSerialNumber:\n", prefix);
> +                     printf("%s\t\tbDescriptor: 0x%01x\n", prefix,
> usbdata[USB_SERIAL_DESCRIPTOR]);
> +                     /* Note bString is not printable here, so skip it
> */
> +             } else if (type == IFC_DEVICE_PCI) {
> +                     /* PCI */
> +                     u8 *pcidata = &data[PCI_DESCRIPTOR];
> +                     printf("%s\tVendorID: %02x\n", prefix, (unsigned
> short)pcidata[PCI_VENDOR]);
> +                     printf("%s\tDeviceID: %02x\n", prefix, (unsigned
> short)pcidata[PCI_DEVICE]);
> +                     printf("%s\tSubVendorID: %02x\n", prefix,
> (unsigned short)pcidata[PCI_SUBVENDOR]);
> +                     printf("%s\tSubDeviceID: %02x\n", prefix,
> (unsigned short)pcidata[PCI_SUBDEVICE]);

I'd add 0x prefixes for the PCI fields.

The USB and PCI ID fields are 16-bit values, so %04x is a better fit.

"0x%01x" is probably not right for bDescriptor (0 pad for
1 character?); if that's a 1-byte field, it should be %02x.

Also be careful of endianness; these are all little-endian values. Does
dmidecode support being run on a big-endian machine?  If so, it should
still print the same characters.  For example, Intel's PCI vendor ID
should always print as "0x8086", not '0x8680" on some machines.


---
Robert Elliott, HPE Persistent Memory





reply via email to

[Prev in Thread] Current Thread [Next in Thread]