Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36145 )
Change subject: arch/arm: Pass cbmem_top to ramstage via calling argument ......................................................................
Patch Set 3:
Patch Set 3:
Would it make more sense to instead pass the size of DRAM as an argument?
You can pass on every information you want from romstage (I assume you can compute the total amount of dram more easily here?) to ramstage via cbmem, but for that you need to know where cbmem is in ramstage. So all you'd need to pass from romstage to ramstage(s) is the pointer to cbmem.
Well, it just seems unnecessarily complicated. Pretty much every non-x86 platform calculates cbmem_top() in the same way based on the end of DRAM. If you're passing something anyway, you might as well pass the DRAM size and then implement cbmem_top() with a common one-liner for all of them. If you're passing cbmem_top(), then they all need to add this extra CBMEM section to pass the DRAM size as well. If we're standardizing on something, I believe standardizing on DRAM size would just work better for those architectures.
cbmem_top is implemented now is one one-liner for every arch, with very few LOC to fetch it from the romstage call argument. Also the code for passing on the argument is now common for every arch. Doing things differently per arch means introducing a new callback. If you always know the _dram at compile time then the size of dram is simply cbmem_top() - _dram, assuming you need it for computing resources? The _dram symbol is not a symbol available on all targets so it looses universality. Note that passing multiple arguments is likely too messy.