Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36291 )
Change subject: lib/romstage_save: Add methods to pass on romstage information ......................................................................
Patch Set 13:
Patch Set 13:
Patch Set 13:
It would require some linker script wrapping to achieve it, but I think it would be nice to be able to tag such structures with, let's call it CAR_PERSIST, and they would magically get migrated all the way to CBMEM. I think Julius insisted such symbols must resolve at build-time, so we would need to find a way to lock the symbol locations inside CAR, across the stages, while other sections (.bss) can grow and shrink.
That sounds nice, but how to make sure that the symbols in (I assume you have a new region for it in which CAR_PERSISTS goes?) the new region are the same across pre-ram stages? That would somehow require to use some of the bootblock symbols in verstage and romstage. Sounds a bit hacky to do 'nm' and parse output into something to be included by memlayout.ld of romstage & ramstage?
That's the question to solve. Ramstage and postcar would not be involved. Maybe one could use objcopy to mirror a complete section from romstage.elf into bootblock.elf, and linker scripts would not need to change at all. Just throwing out ideas, I have no clue :)
We need a proper data section before we can migrate things automatically. Currently, we support .bss (0 values) but not initialized objects that are writable. Once you have that it is certainly possible to relocate the objects. But even then it can be complicated in that you need everyone to utilize pointers to objects where the pointers live in the correct location. Otherwise you'll have address references in your instruction stream. That will break for xip programs since you can't modify the instructions as they are read only.