[coreboot] PCI register read/mod/write code

Arne Georg Gleditsch arne.gleditsch at numascale.com
Tue Oct 5 09:43:59 CEST 2010

Peter Stuge <peter at stuge.se> writes:
> I think the ratio of simple vs. complex operations is significant.
> The majority I've seen in the code are simple, but granted I haven't
> read every file. I agree that mixed idioms are annoying if nothing
> else, but I think the benefit from replacing all the simple cases is
> important enough to do it.

I'll add my couple of cents here as well: I think this change is a win.
I acknowledge the concern about mixed idioms, but I think the
simplification in the general case outweighs it.

I think I prefer the names pci_set_configX and pci_clear_configX,
though.  In the cases where you need to mix idioms, I feel they make it
more obvious that you deal with the same components as
pci_{read,write}_configX.  I'd also consider using "setb" and "clearb"
just to make it explicit that the functions operate on individual bits
and not the entire register, but that's secondary.

(Finally, I think it might be worthwhile to add
pci_clear_and_set_configX as well.)


More information about the coreboot mailing list