Hi guys
I have some questions about stages / payload in coreboot-v2 and CBFS. First of all, there is no way to run a 64 bit payload today. So I wrote some code and now I'm able to parse and add a 64 bit elf in a cbfs rom, and run it as a payload in coreboot. Coreboot will switch to 64 bit mode then jump into the payload.
I can send a patch for review but it's not really clean code : - I need some memory to store the page translation tables before going to 64 bits. It's hardcoded to some unused (I hope) location. How can I allocate space in a generic way ? Is it possible to reuse the resource allocator for this ? - If the payload returns, I guess I shall switch back to protected mode. Under which circumstances a payload can return ? - When a payload is parsed and added in the CBFS rom, is there any way to know if this is 32 or 64 code ? I added a field elfclass in the cbfs_payload structure to keep the information.
Other question : what is the correct way to insert code running from ram (a stage) in the bootblock or at a fixed location ? In my case, after the CAR, coreboot will load the fallback or normal stage, then jump in it. I need to add a third one : a recover stage. If the user pushes a key, strap a jumper... then I go in recover stage, otherwise I continue as usual. I modified the newconfig/config.g to add a custom 'stage' rule. I'm able to add a 32 bit elf as a custom stage (I can provide a patch if interested).
But I need to be sure that this custom stage lives in the top block (64 KB) of my FWH (2MB). Is there any way to specify this ?
Regards, Thomas