2015-05-08 17:31 GMT+02:00 Aaron Durbin adurbin@google.com:
In romstage *both* struct device and device_t are present but are completely different types. It's the romstage, ramstage, and smm overlap that is large and extremely annoying to deal with.
History time: Until not too long ago, bootblock and romstage used u32 device_t, ramstage used struct device, smm didn't really matter and nothing else existed. This was further enforced by struct device being available in ramstage _only_. We now have a read-only view of the device tree available in romstage that makes things look more complicated.
One of the ideas that led to the devicetree in romstage was to make struct device the default interface where possible, together with the aforementioned isolation of romcc based code. Essentially: for romcc, use u32. For everything else, struct device.
We may want to determine first what data structure we want to use in each stage. This could be 'u32 for all hardware accesses, with some struct device -> u32 conversion to move from devicetree to hardware', which sounds like what you propose (and is completely contrary to that other idea). But until there's a consensus on that, I guess it's too early to discuss the fate of device_t.
Patrick