The postcar phase was only recently introduced, and it helped create clearer boundaries _especially_ in light of FSP (that is, without the FSP1/FSP2 saga, we might have never introduced a postcar stage). Messing with that again needs a better argument than "we want to mess with FSP some more and coreboot makes that inconvenient".

To clarify things a bit on this. I put in postcar for the following reasons (not related to FSP at all):

1. romstage path that was loading ramstage dropped into assembly to tear down CAR and then came back into C code. The same c program (romstage) that was linked for running with CAR enabled. This behavior has implications because of the following.
2. Because of the volatility of CAR space there was a necessity for car_get_var() (early_variables.h) API. The CAR data needed to migrate to RAM to maintain its values but it needed to go through that API to steer the load/store to the correct location (RAM vs CAR).

With the introduction of postcar it provides romstage to run to completion without car_get_var() implementation and actually paves the way for complete removal of the API and variable decorators to place globals in the correct section in the linker in CAR space. Instead, these programs act like normal C programs with the .bss section landing in the correct part of the address space. postcar's first order of business is to tear down CAR before it runs C code. Therefore, it provides consistency in all stages/programs of a normal C program of having normal global variables w/o the necessity of car_get_var() API. If all platforms employ postcar currently then we can finally remove early_variables.h entirely (yay!).

As for this change specifically, I haven't looked into the details just yet. A first glance does indicate it's a little messy and could be cleaned up, but it's very much possible to remove postcar and put the CAR teardown at the first part of ramstage. Now whether that's worth it (commit description is 4ms) in comparison to the support cost is another matter that needs to be weighed.

View Change

To view, visit change 34752. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ibc88e6727b2fa692585dffe576e69f6d4d0b349d
Gerrit-Change-Number: 34752
Gerrit-PatchSet: 3
Gerrit-Owner: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: Aaron Durbin <adurbin@chromium.org>
Gerrit-Reviewer: Damien Zammit
Gerrit-Reviewer: David Guckian <david.guckian@intel.com>
Gerrit-Reviewer: Huang Jin <huang.jin@intel.com>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-Reviewer: Lee Leahy <leroy.p.leahy@intel.com>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: Vanny E <vanessa.f.eusebio@intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-CC: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-CC: ron minnich <rminnich@gmail.com>
Gerrit-Comment-Date: Wed, 07 Aug 2019 07:32:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment