On Sun, May 18, 2025 at 12:14:23PM +0200, Jean Delvare wrote:
> Hi Jerry,
> 
> On Wed, 14 May 2025 16:29:49 -0600, Jerry Hoemann wrote:
> > OEM Type 193: Other ROM Info.
> > 
> > Signed-off-by: Jerry Hoemann <jerry.hoem...@hpe.com>
> > ---
> >  dmioem.c | 31 +++++++++++++++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> > 
> > diff --git a/dmioem.c b/dmioem.c
> > index ffbcd95..f158a77 100644
> > --- a/dmioem.c
> > +++ b/dmioem.c
> > @@ -1001,6 +1001,37 @@ static int dmi_decode_hp(const struct dmi_header *h)
> >  
> >     switch (h->type)
> >     {
> > +           case 193:
> > +                   /*
> > +                    * Vendor Specific: Other ROM Info
> > +                    *
> > +                    * Offset |  Name      | Width | Description
> > +                    * -------------------------------------
> > +                    *  0x00  | Type       | BYTE  | 0xC1, ROM Structure 
> > Indicator
> > +                    *  0x01  | Length     | BYTE  | Length of structure
> > +                    *  0x02  | Handle     | WORD  | Unique handle
> > +                    *  0x04  | ROM        | BYTE  | 01: Redundant ROM 
> > installed
> > +                    *  0x05  | ROM vers   | STRING| Version of the 
> > Redundant ROM
> > +                    *  0x06  | Reserved   | BYTE  | Reserved in Gen9 
> > forward
> > +                    *  0x07  | OEM ROM    | STRING| If not blank, OEM ROM 
> > binary file name
> > +                    *  0x08  | OEM Date   | STRING| If not blank, OEM ROM 
> > binary build date
> > +                    */
> > +                   if (gen < G9) return 0;
> > +                   pr_handle_name("%s ProLiant Other ROM Info", company);
> > +                   if (h->length < 0x09) break;
> > +                   if ((gen < G12) && data[0x04])
> 
> Don't you want to mask with 0x01 to explicitly check bit 0? I imagine
> the other bits may be used for something else in the future.

changed.

> 
> > +                           pr_attr("Redundant ROM Version", "%s", 
> > dmi_string(h, data[0x05]));
> > +                   if (data[0x07])
> > +                   {
> > +                           const char * str = dmi_string(h, data[0x07]);
> > +                           if (str && *str && *str++ != ' ' && *str && 
> > *str != ' ')
> 
> dmi_string() can't return NULL so the first test isn't needed.
> 
> For the rest, I think strncmp(str, "  ", 2) would be more readable. If
> you still prefer to open-code it, note that you could use str[0] to
> test the first char and str[1] to test the second char, which would
> make the intentions more obvious. Both options would let you reuse str
> in pr_attr().

done.

> 
> (Personally I would only test the first char as I can't imagine a valid
> filename starting with a space, but you'll know better.)
> 
> You can tell me what you prefer and I'll edit before committing, if you
> don't want to resend.

i'll send v3 

> 
> > +                           {
> > +                                   pr_attr("OEM ROM Binary Filename", 
> > "%s", dmi_string(h, data[0x07]));
> > +                                   pr_attr("OEM ROM Binary Build Date", 
> > "%s", dmi_string(h, data[0x08]));
> > +                           }
> > +                   }
> > +                   break;
> > +
> >             case 194:
> >                     /*
> >                      * Vendor Specific: Super IO Enable/Disable Features
> 
> Thanks,
> -- 
> Jean Delvare
> SUSE L3 Support

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------

Reply via email to