[coreboot] [PATCH] make AMD CAR disable a C function
Kevin O'Connor
kevin at koconnor.net
Sun May 16 19:50:35 CEST 2010
On Sun, May 16, 2010 at 06:46:34PM +0200, Rudolf Marek wrote:
> Following patch reworks car_disable into C. Tested, works here. I compared
> also the GCC generated code and it looks all right. Please test on some
> multicore CPU.
The AMD disable_cache_as_ram can be C code, but the other
architectures can not. It would be nice if there was a single calling
convention for this capability across architectures.
Maybe something like:
void __regparm(3) __noreturn disable_car(void (*func)(u32), u32 param, u32 esp);
which would call func(param) on the stack specified by 'esp'. The
caller would then do something like:
void romstage(u32 bist) {
...
disable_car(load_ramstage, bist, CONFIG_RAMTOP)
}
void load_ramstage(u32 bist) {
...
}
> I added the "memory" clobber to read_cr0 / write_cr0 function as it is in Linux
> Kernel. Seems that if this is missing, GCC is too smart and messes the order
> of reads/writes to CR0 (not tested if really a problem here, but be safe for
> future users of this function ;)
Good catch!
-Kevin
More information about the coreboot
mailing list