Hi,
attached patch implements my tinybootblock concept (formerly known as newfailover) in Kconfig. It's designed to be non-instrusive, so boards will continue to build as usual unless they're changed to use the feature. As a proof of concept (which I used for development), emulation/qemu-x86 is changed to tinybootblock, but other boards will require more changes, so it not a complete example on how to convert a board.
Objectives of tinybootblock (when fully implemented): - Fix Fam10 boards on Kconfig, which require >64kb for raminit. That should help with replacing newconfig with kconfig completely. newconfig requires the failover mechanism on those boards to work around this limit, and this solves it similarily by splitting the code in a top-64k block and "the rest".
- Use CBFS The newconfig failover mechanism uses the pre-CBFS image layout (cat(1)ing files together and relying on magic offsets to determine entry points). CBFS provides a clean solution for that.
- Provide a framework to build image selection logic In newconfig, most boards have their own code to select the image. The goal in this layout is to have generic decision routines to take care of that, and encourage their use.
- Push as much as possible out of the bootblock The failover mechanism so far did CAR in the bootblock and raminit in the later stage. With tinybootblock, CAR is supposed to end up outside the bootblock. "Safe updates", once we provide them, will be able to update CAR support for new CPU types, too.
Code flow in tinybootblock: - 16bit reset vector (0xfffffff0) - jump to 32bit mode - Do whatever is necessary to have the entire ROM around (C code, compiled with romcc) - Look up fallback/romstage in CBFS (this can be extended with selection logic if desired) ("selection logic" is C, compiled with romcc, lookup is assembly) - Fetch the entry point which is stored in the romstage's header - Jump to the entry point. fallback/romstage is linked for the address where it finally resides in the image, so it's execute in place. - fallback/romstage is the original bootblock code (except for ROM enable): Setup CAR if available, do raminit, call coreboot_ram
Current issues: - No support for rom enable sequences yet. QEmu doesn't need them, but they're what I do next.
- The bootblock isn't exactly tiny, it's 64kb. Most of it is empty (on qemu, it's ~400 used bytes including id section and reset vector, ~350 byte for all code). To be done after rom enable works.
- There might be better places to push files to (both in the sources and in the build tree)
- There's some problem with the various section types in ELF which I worked around in cbfstool: If the section starts earlier than the desired load address, strip the bytes before the load address. This is no problem in automatic operation but can have lead to mistakes in manual operation.
Future developments: - At some point we might want to have various variants of the bootblock: Unconditionally loading a given romstage (what we have now), selecting between fallback/normal by CMOS (as in newconfig), enabling a rescue flash routine on GPIO, etc.
As mentioned, ROM enable support is still missing. Once this is done, tinybootblock should be useful for a broader audience (eg. to port boards), but I wanted to get the current state out now, as it finally works.
Signed-off-by: Patrick Georgi patrick.georgi@coresystems.de