Intel cpus: Extend cache to cover complete Flash Device
CACHE_ROM_SIZE default is ROM_SIZE, the Flash device size set in menuconfig. This fixes a case where 8 MB SPI flash MTRR setup would not cover the bottom 4 MB when ramstage is decompressed. Verify CACHE_ROM_SIZE is power of two. One may set CACHE_ROM_SIZE==0 to disable this cache. Change-Id: Ib2b4ea528a092b96ff954894e60406d64f250783 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/1146 Tested-by: build bot (Jenkins) Reviewed-by: Sven Schnelle <svens@stackframe.org>
This commit is contained in:
parent
ae7d6ef8b7
commit
5458b9d90a
|
@ -30,9 +30,6 @@
|
||||||
#define LAPIC(x) $(LAPIC_DEFAULT_BASE | LAPIC_ ## x)
|
#define LAPIC(x) $(LAPIC_DEFAULT_BASE | LAPIC_ ## x)
|
||||||
#define START_IPI_VECTOR ((CONFIG_AP_SIPI_VECTOR >> 12) & 0xff)
|
#define START_IPI_VECTOR ((CONFIG_AP_SIPI_VECTOR >> 12) & 0xff)
|
||||||
|
|
||||||
/* Base address to cache all of Flash ROM, just below 4GB. */
|
|
||||||
#define CACHE_ROM_BASE ((1<<22 - CONFIG_CACHE_ROM_SIZE>>10)<<10)
|
|
||||||
|
|
||||||
#define CACHE_AS_RAM_SIZE CONFIG_DCACHE_RAM_SIZE
|
#define CACHE_AS_RAM_SIZE CONFIG_DCACHE_RAM_SIZE
|
||||||
#define CACHE_AS_RAM_BASE CONFIG_DCACHE_RAM_BASE
|
#define CACHE_AS_RAM_BASE CONFIG_DCACHE_RAM_BASE
|
||||||
|
|
||||||
|
@ -380,6 +377,7 @@ no_msr_11e:
|
||||||
movl $(~(CONFIG_RAMTOP - 1) | MTRRphysMaskValid), %eax
|
movl $(~(CONFIG_RAMTOP - 1) | MTRRphysMaskValid), %eax
|
||||||
wrmsr
|
wrmsr
|
||||||
|
|
||||||
|
#if CONFIG_CACHE_ROM_SIZE
|
||||||
/* Enable caching and Speculative Reads for Flash ROM device. */
|
/* Enable caching and Speculative Reads for Flash ROM device. */
|
||||||
movl $MTRRphysBase_MSR(1), %ecx
|
movl $MTRRphysBase_MSR(1), %ecx
|
||||||
movl $(CACHE_ROM_BASE | MTRR_TYPE_WRPROT), %eax
|
movl $(CACHE_ROM_BASE | MTRR_TYPE_WRPROT), %eax
|
||||||
|
@ -389,6 +387,7 @@ no_msr_11e:
|
||||||
rdmsr
|
rdmsr
|
||||||
movl $(~(CONFIG_CACHE_ROM_SIZE - 1) | MTRRphysMaskValid), %eax
|
movl $(~(CONFIG_CACHE_ROM_SIZE - 1) | MTRRphysMaskValid), %eax
|
||||||
wrmsr
|
wrmsr
|
||||||
|
#endif
|
||||||
|
|
||||||
post_code(0x39)
|
post_code(0x39)
|
||||||
|
|
||||||
|
|
|
@ -259,17 +259,19 @@ before_romstage:
|
||||||
movl $CPU_PHYSMASK_HI, %edx // 36bit address space
|
movl $CPU_PHYSMASK_HI, %edx // 36bit address space
|
||||||
wrmsr
|
wrmsr
|
||||||
|
|
||||||
|
#if CONFIG_CACHE_ROM_SIZE
|
||||||
/* Enable Caching and speculative Reads for the
|
/* Enable Caching and speculative Reads for the
|
||||||
* complete ROM now that we actually have RAM.
|
* complete ROM now that we actually have RAM.
|
||||||
*/
|
*/
|
||||||
movl $MTRRphysBase_MSR(1), %ecx
|
movl $MTRRphysBase_MSR(1), %ecx
|
||||||
movl $(0xffc00000 | MTRR_TYPE_WRPROT), %eax
|
movl $(CACHE_ROM_BASE | MTRR_TYPE_WRPROT), %eax
|
||||||
xorl %edx, %edx
|
xorl %edx, %edx
|
||||||
wrmsr
|
wrmsr
|
||||||
movl $MTRRphysMask_MSR(1), %ecx
|
movl $MTRRphysMask_MSR(1), %ecx
|
||||||
movl $(~(4*1024*1024 - 1) | MTRRphysMaskValid), %eax
|
movl $(~(CONFIG_CACHE_ROM_SIZE - 1) | MTRRphysMaskValid), %eax
|
||||||
movl $CPU_PHYSMASK_HI, %edx
|
movl $CPU_PHYSMASK_HI, %edx
|
||||||
wrmsr
|
wrmsr
|
||||||
|
#endif
|
||||||
|
|
||||||
post_code(0x39)
|
post_code(0x39)
|
||||||
|
|
||||||
|
|
|
@ -191,15 +191,17 @@ clear_mtrrs:
|
||||||
movl $CPU_PHYSMASK_HI, %edx
|
movl $CPU_PHYSMASK_HI, %edx
|
||||||
wrmsr
|
wrmsr
|
||||||
|
|
||||||
/* Enable caching and Speculative Reads for the last 4MB. */
|
#if CONFIG_CACHE_ROM_SIZE
|
||||||
|
/* Enable caching and Speculative Reads for Flash ROM device. */
|
||||||
movl $MTRRphysBase_MSR(1), %ecx
|
movl $MTRRphysBase_MSR(1), %ecx
|
||||||
movl $(0xffc00000 | MTRR_TYPE_WRPROT), %eax
|
movl $(CACHE_ROM_BASE | MTRR_TYPE_WRPROT), %eax
|
||||||
xorl %edx, %edx
|
xorl %edx, %edx
|
||||||
wrmsr
|
wrmsr
|
||||||
movl $MTRRphysMask_MSR(1), %ecx
|
movl $MTRRphysMask_MSR(1), %ecx
|
||||||
movl $(~(4 * 1024 * 1024 - 1) | MTRRphysMaskValid), %eax
|
movl $(~(CONFIG_CACHE_ROM_SIZE - 1) | MTRRphysMaskValid), %eax
|
||||||
movl $CPU_PHYSMASK_HI, %edx
|
movl $CPU_PHYSMASK_HI, %edx
|
||||||
wrmsr
|
wrmsr
|
||||||
|
#endif
|
||||||
|
|
||||||
post_code(0x39)
|
post_code(0x39)
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,12 @@ void x86_setup_fixed_mtrrs(void);
|
||||||
# error "CONFIG_XIP_ROM_SIZE is not a power of 2"
|
# error "CONFIG_XIP_ROM_SIZE is not a power of 2"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ((CONFIG_CACHE_ROM_SIZE & (CONFIG_CACHE_ROM_SIZE -1)) != 0)
|
||||||
|
# error "CONFIG_CACHE_ROM_SIZE is not a power of 2"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CACHE_ROM_BASE (((1<<20) - (CONFIG_CACHE_ROM_SIZE>>12))<<12)
|
||||||
|
|
||||||
#if (CONFIG_RAMTOP & (CONFIG_RAMTOP - 1)) != 0
|
#if (CONFIG_RAMTOP & (CONFIG_RAMTOP - 1)) != 0
|
||||||
# error "CONFIG_RAMTOP must be a power of 2"
|
# error "CONFIG_RAMTOP must be a power of 2"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue