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: Neil Horman
Subject: Re: [dmidecode] [PATCH] update dmidecode to parse Modern Management Controller blocks
Date: Thu, 2 Aug 2018 10:51:32 -0400
User-agent: Mutt/1.10.0 (2018-05-17)

On Thu, Aug 02, 2018 at 02:17:42PM +0000, Elliott, Robert (Persistent Memory) 
wrote:
> 
> 
> > -----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.
> 
I can do that.

> The USB and PCI ID fields are 16-bit values, so %04x is a better fit.
> 
Yup, my bad, for some reason I was thinking 2 bytes, not 2 characters.

> "0x%01x" is probably not right for bDescriptor (0 pad for
> 1 character?); if that's a 1-byte field, it should be %02x.
> 
Thats always a 1 byte field, I'll make the format %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.
> 
Thats an interesting question.  Currently as far as I know smbios is only
supported on intel, which is a little endian system.  The application is written
to expect that, so were good.  That said, dmidecode can also read from a dump
file, so its possible that someone might take a dump on an intel system, and go
read it on an old power system.

I would say, it wouldn't hurt to update dmidecode to be endian aware, but such
an update is likely outside the scope of this patch.

I'll post a v2 shortly.
Best
Neil

> 
> ---
> Robert Elliott, HPE Persistent Memory
> 
> 
> 



reply via email to

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