ron minnich wrote:
romcc-based code used to have: nbcap = pci_read_config32(ctrl->f3, NORTHBRIDGE_CAP);
This worked in v2 due to abuse of cpp and a few other bits.
I think that was very elegant actually, given the assumption that we need a device_t (I still like that better than struct device) to do a simple pci config read/write,... but...
I was never comfortable with it -- more magic than I like. in romcc and CAR code, a device_t was a u32; in other code, it was a struct device *. icky.
In v3 pci_read_config32 takes a struct device *. We don't have them in stage 1. So to make this work, I do this:
nbcap = pci_cf8_conf1.read32(NULL, 0, ctrl->f3, NORTHBRIDGE_CAP);
Which will work fine.
The obvious question: Do we need to use device_t as an input to that function at all? Why don't we instead use simple pci functions taking a u32 as an input? We're a bios, after all, not an OS. Are we?
I did not pick the name, it's the name of the struct with the function pointers.
I've got an ack from peter and I'd like to commit. Yes these are two patches but --key point -- they'll work and we can keep going.
Sure, keep going. I'll wait and see what comes out of this in the end.
Stefan