[LinuxBIOS] patch for making system run past disable_car

Marc Jones marc.jones at amd.com
Thu Dec 13 03:00:13 CET 2007

Marc Jones wrote:
> Carl-Daniel Hailfinger wrote:
>> Dumb question: We know the location of the stack when we enter
>> disable_car(). We also know that all memory belongs to us. Can we copy
>> CAR stack contents to some safe location and restore them after wbinvd()?
> This shouldn't be needed. If the stack needed to be moved you would want 
> to do it before the wbinvd so you were copying from cache to memory. 
> Much faster than memory to memory.
> Marc

and I am too smart for my own good.....

Here is the deal. Look in cpu/amd/model_lx/cache_as_ram.inc.
/* If you wanted to maintain the stack in memory you would need to set 
the tags as dirty
	  so the wbinvd would push out the old stack contents to memory */
/* Clear the cache, the following code from crt0.S.lb will setup a new 

For LX we didn't need to maintain the stack or any variables beyond CAR. 
That meant that we didn't need to do any stack copy like the K8 
post_cache_as_ram()(that never returns). The LX cache_as_ram_main 
returns and the LB copy function is back in cache_as_ram.inc. Since 
there is nothing on the stack and everything is running out of the ROM a 
new stack is easily created.

Sooo, if you want to maintain the stack in v3... I left a comment in the 
  v2 code. Recall that they cache is disabled so the way doesn't get 
reallocated and thus the tags are never marked dirty and written back. 
Since the tags are never marked dirty the wbind won't wb but it will invd.

There are a couple ways to address this.
1. copy the stack to a new location.
2. Set the tags dirty with by writing the way MSRs.
3. enable the cache and copy the stack back on it's self to dirty the tags.

I am least sure about number three.

I think that sums it up. I still think that it is best/fastest if the 
code returned to the CAR function and it setup a new stack in memory and 
then launched the next stage.


Marc Jones
Senior Firmware Engineer
(970) 226-9684 Office
mailto:Marc.Jones at amd.com

More information about the coreboot mailing list