Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36867 )
Change subject: cbfs: Make cbfs_default_props() hidden again ......................................................................
Patch Set 1:
Patch Set 1:
Patch Set 1:
How about just replacing struct cbfs_props with struct region everywhere? They're the exact same struct on the inside, I don't understand why they have different names anyway. Then your apollolake problem should go away because you can call region_is_subregion() directly on the thing cbfs_default_props() fills out.
On the other hand, yes, just having it fill out the region_device directly may also be good. Passing raw regions around with the implicit assumption that they point to boot_device_ro() seems a bit unclean if we could have region and device tied together instead.
I don't think the API would look like you described though, I think it would just be
int (*locate)(struct region_device *cbfs_rdev);
The backing storage of the region device comes from the leaf function (from the FMAP code calling boot_device_ro()). cbfs_boot_locate() wouldn't have to call boot_device_ro() at all anymore.
Ya. I wasn't thinking about that we'd be just utilizing the FMAP code. That certainly makes sense. I'll throw something together.
Here's what I came up with: https://review.coreboot.org/c/coreboot/+/36939