[coreboot] [LinuxBIOS] adding "--list-supported" feature to superiotool #91

Robinson Tryon bishop.robinson at gmail.com
Sat Jan 12 23:46:38 CET 2008


On Jan 12, 2008 12:20 PM, Peter Stuge <peter at stuge.se> wrote:
> Thanks for the patch! Some comments.
>
> On Sat, Jan 12, 2008 at 06:09:21AM -0500, Robinson Tryon wrote:
> > I wasn't very sure about what the "wiki links" part of this feature
> > entailed.  I included the primary url for superiotool, but perhaps
> > there's something more that needs to be done?
>
> I think there's a page for each supported sio chip with the output
> from previous superiotool runs. Or there should be. Would be handy
> to have that address available as well.

On the wiki page it looked like there were links to several mailing
list posts -- those emails probably contained the dumps for each chip.

Should that information be included in the data section of each vendor
file?  If so, should there be a new field in the superio_registers
STRUCT to handle that?

> > Oh, and how should I go about getting an account on Trac?
>
> Stefan should get you hooked up. :)

Great!  (hopefully he's reading this thread...)

>
>
> > +void print_fintek_chips(void) {
> > +  char name [] = "Fintek";
> > +  print_vendor_chips(name, reg_table);
> > +}
>
> Why the extra char[]? The function parameter is const so the name
> could just be a string constant in the call.

Good point.  (I haven't been programming in C for quite some time...)

>
> And thinking further I saw that the vendor name is given as a string
> constant in more places in the files. Perhaps make it a #define near
> the top of the file? That's a separate patch though, and just a
> thought.

Yes, I noticed that as well (as well as a couple of other things that
could stand to be refactored).  But as you pointed out, one thing at a
time.

>
>
> > +void print_vendor_chips(const char *vendor,
> > +                     const struct superio_registers reg_table[]) {
> > +     int i, any_supported_chips = 0;
> > +
> > +     printf("  Chips from %s:\n", vendor);
> > +
> > +     for (i = 0; /* Nothing */; i++) {
> > +             if (reg_table[i].superio_id == EOT)
> > +                     break;
>
> So why not write the break condition in the for statement?

I was just borrowing code? :-)
But yes, that's a good point.

Actually, here's another question for you:
Why is all of the data for superiotool stored in arrays terminated
with EOT?  Can't we just use ARRAY_SIZE (or some similar construct) to
figure out the length of a given array before we iterate over it?

>
> > +             any_supported_chips = 1;
> > +             print_chip(reg_table[i]);
> > +     }
> > +
> > +     if (!any_supported_chips)
> > +             printf("    None.\n");
>
> any_supported_chips could just check if 0==i, right?

yep.

> Also - isn't the vendor inclued in the reg_table? Why is it needed at
> all in this function? Sorry if I'm being slow.

I don't believe that the vendor name is included in the reg_table --
just the chip id, chip name, and registers, right?


Here's the updated patch.  Let me know how the dump URLs should be
stored, and I'll add support for that as well.

Signed-off-by: Robinson P. Tryon <bishop.robinson at gmail.com>

--R
-------------- next part --------------
A non-text attachment was scrubbed...
Name: superiotool-list-supported2.patch
Type: text/x-patch
Size: 8200 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20080112/fb3afff1/attachment.patch>


More information about the coreboot mailing list