On Wed, Oct 29, 2008 at 1:26 PM, Uwe Hermann <span dir="ltr"><<a href="mailto:uwe@hermann-uwe.de">uwe@hermann-uwe.de</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Wed, Oct 29, 2008 at 05:02:17PM +0100, Peter Stuge wrote:<br>
> <a href="mailto:svn@coreboot.org">svn@coreboot.org</a> wrote:<br>
> >  static const struct pci_driver mc_driver __pci_driver = {<br>
> >     .ops    = &mc_ops,<br>
> >     .vendor = PCI_VENDOR_ID_INTEL,<br>
> > -   .device = 0x27a0,<br>
> > +   .device = PCI_DEVICE_ID_INTEL_945_HOST_BRIDGE,<br>
><br>
> Sorry, but I don't really agree with these changes.<br>
<br>
</div>Yes, we really seems to have a disagreement here. I think the device<br>
names from pci_ids.h make perfect sense, that's why we (and Linux for<br>
that matters) has such a file in the first place, and why we use the<br>
#defines instead of hard-coded PCI device numbers in the code.<br>
<div class="Ih2E3d"><br>
<br>
> >  static const struct pci_driver i82801gx_ide __pci_driver = {<br>
> >     .ops    = &ide_ops,<br>
> >     .vendor = PCI_VENDOR_ID_INTEL,<br>
> > -   .device = 0x27df,<br>
> > +   .device = PCI_DEVICE_ID_INTEL_82801GB_IDE,<br>
> >  };<br>
><br>
> My reasoning is that #defines should add information to the code and<br>
> not be an end in itself.<br>
<br>
</div>That's exactly my reasoning as well. The number 0x27df is utterly<br>
useless and conveys not information at all. The #define<br>
PCI_DEVICE_ID_INTEL_82801GB_IDE however, where-ever in the code I<br>
stumble upon it, I immediately know that it's an Intel device,<br>
it belongs to the 82801GB chipset/southbridge, and it refers to<br>
the IDE device (not audio, not USB, not anything else).<br>
<br>
Yes, if you really want to know the hex number you'll have to look it<br>
up in the pci_ids.h file but that's the case for all other PCI device<br>
numbers we use all over the place (and for all #defines in general).<br>
That shouldn't be a reason to _not_ use them, IMO.<br>
<br>
Or, to put it in another way, if we all agree to not use #defines for<br>
PCI IDs (or no #defines at all), we should just drop pci_ids.h (or all<br>
*.h files with #defines in them) entirely. I cannot image we'd want that.</blockquote><div><br>I'm in agreement with Peter on this one. The pci_driver is named i82801gx_ide, that should clarify exactly what device this is working on. I can agree that having the #define anywhere else in code (where it may not be as clear what device you're aiming for) makes sense, but here it could be much more useful to know the device id here, ex. if you wanted to compare a register set by the driver to a stock bios' lspci -nxxx. <br>
</div></div><br>-Corey<br>