On Thu, Jun 18, 2009 at 2:06 PM, Peter Stuge <[email protected]> wrote:
> ron minnich wrote:
> > I think we ought to not bring over the v3 stage numbering.
> > I've gotten very mixed reactions to the stage1 etc. naming.
> > It seemed like a good idea but in the end it did not seem that
> > essential.
>
> It really helps me too in understanding the code. And it helps
> explaining the code flow to new people.
>
> Numbers are not critical, but I liked them as a way to not have to
> deal with finding perfect names for every single function.
>
> I'd like to have either great names for all functions and good
> consistent structure, or some kind of numbering scheme.
I'd be happy with having the functions ordered correctly in the structures
as a first step.
In other words, if .init always came last, that would help.
// from src/include/device/device.h:
struct device_operations {
void (*read_resources)(device_t dev);
void (*set_resources)(device_t dev);
void (*enable_resources)(device_t dev);
void (*init)(device_t dev);
unsigned int (*scan_bus)(device_t bus, unsigned int max);
void (*enable)(device_t dev);
void (*set_link)(device_t dev, unsigned int link);
void (*reset_bus)(struct bus *bus);
const struct pci_operations *ops_pci;
const struct smbus_bus_operations *ops_smbus_bus;
const struct pci_bus_operations *ops_pci_bus;
};
It's hard to tell from there that the order is:
1. Enable
2. Scan bus
3. Read resources
4. Set resources
5. Enable resources
6. Init
( I could have gotten something wrong there.)
I admit I don't know what
1. set_link
2. reset_bus
are good for or when they're called. This seems like the place to document
it, though.
Thanks,
Myles
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot