[coreboot] patch: fix USB ports on DBE62, and other cs5536-based platforms

ron minnich rminnich at gmail.com
Wed Jun 4 16:43:00 CEST 2008

Committed revision 689.

A little meta-note here. I am seeing, more frequently now than 20
years ago, this kind of style in drivers and bios code:

base = (u32 *)pci_read_config_long(whatever);
*(base + xyz) =

Somehow, in all the usage of pragmas, attributes, segment names, and
all the other gadgets that have been added to C in the last while,
we've completely lost track of one of the most important reasons to
use C in systems programming!

What's the right way to work on memory-mapped registers? Well, in this case:

struct usb_otg{
  u32 uoc;
  u32 uocmux;
  u32 _1; /* A Plan 9 trick, and  if it's good enough for the guys who
designed C,
                       it's good enough for me (this is a reserved register) */
  u32 uocctl;

and so on. So, just a note: don't forget about structs as templates
for memory mapped registers. That capability has been there and been
used since, oh, 1973 or so :-)



More information about the coreboot mailing list