Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36145 )
Change subject: [RFC,POC]arch/arm: Pass cbmem_top to ramstage via calling argument ......................................................................
Patch Set 2:
(1 comment)
Patch Set 2:
(1 comment)
Hmmm... in general I agree it would be good to do something here, since this is a problem that annoys us a lot on Arm platforms (have to figure out a new way to pass this stuff for every new SoC). But just passing cbmem_top() wouldn't really solve it, because we still need to know the full DRAM size to write the correct memory tables (with ram_resource()). We can calculate cbmem_top() easily when we know the size of DRAM (it's essentially MIN(4GB, _dram + dram_size)), but not the other way round.
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.
https://review.coreboot.org/c/coreboot/+/36145/2/src/arch/arm/stages.c File src/arch/arm/stages.c:
https://review.coreboot.org/c/coreboot/+/36145/2/src/arch/arm/stages.c@34 PS2, Line 34: #endif
This sort of stuff shouldn't be here. You'll probably want to centralize it in src/lib/imd_cbmem.c somehow, and call a function here that would call into there (or pass it through to main() and call it from there, that would probably be even cleaner).
Sure. This is just a dirty hack/POC to see if it works on qemu arm. The idea is indeed to have one common implementation covering all architectures.