Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15454
-gerrit
commit 6aff62f952d762bee833c0bef437cdf7d2c538e2
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Fri Jun 24 18:15:09 2016 -0700
WIP: soc/intel/apollolake: Update stage link addresses for 768 KiB cache
Update link addresses for romstage and verstage. Also change build time
relocation address for FSP-M to match.
Actual addresses are ballpark estimate and need to be validated.
BUG=chrome-os-partner:51959
Change-Id: Ia51a341f05b33151ea5fda9f8620408b5a15bc19
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index f51dbfb..c49d67d 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -120,13 +120,13 @@ config X86_TOP4G_BOOTMEDIA_MAP
config ROMSTAGE_ADDR
hex
- default 0xfef3e000
+ default 0xfef11000
help
The base address (in CAR) where romstage should be linked
config VERSTAGE_ADDR
hex
- default 0xfef60000
+ default 0xfef09000
help
The base address (in CAR) where verstage should be linked
@@ -136,7 +136,7 @@ config CACHE_MRC_SETTINGS
config FSP_M_ADDR
hex
- default 0xfef60000
+ default 0xfef40000
help
The address FSP-M will be relocated to during build time
Brandon Breitenstein (brandon.breitenstein(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15458
-gerrit
commit abe74ce8ab28998bd93d5f25b925b337808d0587
Author: Brandon Breitenstein <brandon.breitenstein(a)intel.com>
Date: Fri Jun 24 12:09:50 2016 -0700
soc/intel/apollolake: Remove UPDs that are no longer valid
Removing base address upds that are no longer valid from coreboot
This is required for use with the FSP 143_10 header files.
BUG=chrome-os-partner:54677
BRANCH=none
TEST=built image with FSP 143_10 headers
Change-Id: Id34c6a397d7de432c2450a7617d28b57bfe0d804
Signed-off-by: Brandon Breitenstein <brandon.breitenstein(a)intel.com>
---
src/soc/intel/apollolake/chip.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c
index 821570b..044ef91 100644
--- a/src/soc/intel/apollolake/chip.c
+++ b/src/soc/intel/apollolake/chip.c
@@ -253,12 +253,6 @@ void platform_fsp_silicon_init_params_cb(struct FSPS_UPD *silupd)
if (cfg->emmc_rx_cmd_data_cntl2 != 0)
silconfig->EmmcRxCmdDataCntl2 = cfg->emmc_rx_cmd_data_cntl2;
- /* Our defaults may not match FSP defaults, so set them explicitly */
- silconfig->AcpiBase = ACPI_PMIO_BASE;
- /* First 4k in BAR0 is used for IPC, real registers start at 4k offset */
- silconfig->PmcBase = PMC_BAR0 + 0x1000;
- silconfig->P2sbBase = P2SB_BAR;
-
silconfig->IshEnable = cfg->integrated_sensor_hub_enable;
/* Disable setting of EISS bit in FSP. */
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15456
-gerrit
commit 62bfe0add03efce7fe71b5436ae251785c0f2a7a
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Fri Jun 24 18:40:28 2016 -0700
WIP: soc/intel/apollolake: Cache cbmem region
Configure write-back MTRRs so that 16 MiB under cbmem_top is cached.
This allows caching of FSP reserved memory and postcar stage itself.
On CAR teardown the memory is flushed with clflush instruction.
Depending on what cache configuration is used, either L1 (NEM) or
both L1 and L2 (CQOS) storage is used for caching purposes.
This is WIP patch, because currently location of cbmem_top can not
be known before memory is trained. So addresses are hardcoded.
BUG=chrome-os-partner:51959
TEST=run primitive memtest on 16 MiB cached memory region after mem
is trained, observe x7 improvement on L1 only, x12 on L2 of 256 KiB
Change-Id: I62aad238a3056f9bbe5327dfb33a2a1112d61194
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/exit_car.S | 8 ++++++++
src/soc/intel/apollolake/romstage.c | 9 ++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/apollolake/exit_car.S b/src/soc/intel/apollolake/exit_car.S
index e5706cf..c0fb39b 100644
--- a/src/soc/intel/apollolake/exit_car.S
+++ b/src/soc/intel/apollolake/exit_car.S
@@ -38,6 +38,14 @@ chipset_teardown_car:
and $(~(MTRR_DEF_TYPE_EN | MTRR_DEF_TYPE_FIX_EN)), %eax
wrmsr
+ /* Flush down whatever we have */
+ mov $0x7a000000, %eax
+loop:
+ clflush (%eax)
+ add $CACHE_LINE_SIZE, %eax
+ cmp $0x7b000000, %eax
+ jl loop
+
#if IS_ENABLED(CONFIG_CAR_CQOS)
mov $MTRR_L2_QOS_MASK(0), %ecx
rdmsr
diff --git a/src/soc/intel/apollolake/romstage.c b/src/soc/intel/apollolake/romstage.c
index ce28326..1fa52fd 100644
--- a/src/soc/intel/apollolake/romstage.c
+++ b/src/soc/intel/apollolake/romstage.c
@@ -112,7 +112,7 @@ asmlinkage void car_stage_entry(void)
struct postcar_frame pcf;
size_t mrc_data_size;
uintptr_t top_of_ram;
- int prev_sleep_state;
+ int prev_sleep_state, mtrr;
struct romstage_handoff *handoff;
struct chipset_power_state *ps = car_get_var_ptr(&power_state);
@@ -129,6 +129,13 @@ asmlinkage void car_stage_entry(void)
range_entry_init(®_car, (uintptr_t)_car_relocatable_data_end,
(uintptr_t)_car_region_end, 0);
+ mtrr = get_free_var_mtrr();
+ if (mtrr==-1)
+ printk(BIOS_CRIT, "no available MTRRs to cache cbmem!\n");
+ else
+ /* Make sure cbmem 16 MiB under CBMEM is cachable */
+ set_var_mtrr(mtrr, 0x7a000000, 16 * MiB, MTRR_TYPE_WRBACK);
+
if (fsp_memory_init(&hob_list_ptr, ®_car) != FSP_SUCCESS) {
die("FSP memory init failed. Giving up.");
}
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15453
-gerrit
commit 8a57f5e0c82eb3ed4e367eb1172a0b7f93b5b8dd
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Mon Jun 27 13:37:51 2016 -0700
WIP: soc/intel/apollolake: Change default CAR size to 768 KiB
As whole 1024 KiB is not used, it is possible to shrink CAR size
to 768 KiB. Since 768 KiB is not power of two, 2 MTRRs are used
to setup it. This is part of preparation for CQOS enabling.
BUG=chrome-os-partner:51959
Change-Id: I56326a1790df202a0e428e092dd90286c58763c5
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 26 ++++++++++++-
src/soc/intel/apollolake/bootblock/cache_as_ram.S | 46 +++++++++++++++++++++++
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index 98ce7d8..fd4e5ac 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -77,7 +77,7 @@ config DCACHE_RAM_BASE
config DCACHE_RAM_SIZE
hex "Length in bytes of cache-as-RAM"
- default 0x100000
+ default 0xc0000
help
The size of the cache-as-ram region required during bootblock
and/or romstage.
@@ -182,4 +182,28 @@ config IFWI_FILE_NAME
help
Name of file to store in the IFWI region.
+choice
+ prompt "Cache-as-ram implementation"
+ default CAR_CQOS
+ help
+ This option allows you to select how cache-as-ram (CAR) is set up.
+
+config CAR_NEM
+ bool "Non-evict mode"
+ help
+ Traditionally, CAR is set up by using Non-Evict mode. This method
+ does not allow CAR and cache to co-exist, because cache fills are
+ block in NEM mode.
+
+
+config CAR_CQOS
+ bool "Cache Quality of Service"
+ help
+ Cache Quality of Service allows more fine-grained control of cache
+ usage. As result, it is possible to set up portion of L2 cache for
+ CAR and use remainded for actual caching.
+
+endchoice
+
+
endif
diff --git a/src/soc/intel/apollolake/bootblock/cache_as_ram.S b/src/soc/intel/apollolake/bootblock/cache_as_ram.S
index 8647206..3c97bb2 100644
--- a/src/soc/intel/apollolake/bootblock/cache_as_ram.S
+++ b/src/soc/intel/apollolake/bootblock/cache_as_ram.S
@@ -70,6 +70,31 @@ clear_var_mtrr:
post_code(0x24)
+#if (CONFIG_DCACHE_RAM_SIZE == 0xc0000) /* 768 KiB */
+ /* 512 KiB */
+ mov $MTRR_PHYS_BASE(0), %ecx
+ mov $CONFIG_DCACHE_RAM_BASE, %eax
+ or $MTRR_TYPE_WRBACK, %eax
+ xor %edx,%edx
+ wrmsr
+
+ mov $MTRR_PHYS_MASK(0), %ecx
+ mov $~(0x80000 - 1), %eax /* size mask */
+ or $MTRR_PHYS_MASK_VALID, %eax
+ wrmsr
+
+ /* 256 KiB */
+ mov $MTRR_PHYS_BASE(1), %ecx
+ mov $(CONFIG_DCACHE_RAM_BASE + 0x80000), %eax
+ or $MTRR_TYPE_WRBACK, %eax
+ xor %edx,%edx
+ wrmsr
+
+ mov $MTRR_PHYS_MASK(1), %ecx
+ mov $~(0x40000 - 1), %eax /* size mask */
+ or $MTRR_PHYS_MASK_VALID, %eax
+ wrmsr
+#else
/* Configure CAR region as write-back (WB) */
mov $MTRR_PHYS_BASE(0), %ecx
mov $CONFIG_DCACHE_RAM_BASE, %eax
@@ -82,6 +107,7 @@ clear_var_mtrr:
mov $~(CONFIG_DCACHE_RAM_SIZE - 1), %eax /* size mask */
or $MTRR_PHYS_MASK_VALID, %eax
wrmsr
+#endif
post_code(0x25)
@@ -97,12 +123,30 @@ clear_var_mtrr:
invd
mov %eax, %cr0
+#if IS_ENABLED(CONFIG_CAR_NEM)
/* Disable cache eviction (setup stage) */
mov $MSR_EVICT_CTL, %ecx
rdmsr
or $0x1, %eax
wrmsr
+#endif
+#if IS_ENABLED(CONFIG_CAR_CQOS)
+ /* Mask 0 is used for CAR */
+ mov $MTRR_L2_QOS_MASK(0), %ecx
+ rdmsr
+ /* Calculate how many bits to be used for CAR */
+ mov $(1 << (CONFIG_DCACHE_RAM_SIZE / CACHE_QOS_SIZE_PER_BIT) - 1), %al
+ wrmsr
+
+ /* Mask 1 is used for evicatable cache */
+ mov $MTRR_L2_QOS_MASK(1), %ecx
+ rdmsr
+ /* Invert bits that are to be used for cache */
+ mov $(1 << (CONFIG_DCACHE_RAM_SIZE / CACHE_QOS_SIZE_PER_BIT) - 1), %al
+ xor $~0, %al
+ wrmsr
+#endif
post_code(0x26)
/* Clear the cache memory region. This will also fill up the cache */
@@ -113,11 +157,13 @@ clear_var_mtrr:
post_code(0x27)
+#if IS_ENABLED(CONFIG_CAR_NEM)
/* Disable cache eviction (run stage) */
mov $MSR_EVICT_CTL, %ecx
rdmsr
or $0x2, %eax
wrmsr
+#endif
post_code(0x28)
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15454
-gerrit
commit 97d08821c867f711aa0840c60dba44e2f7139387
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Fri Jun 24 18:15:09 2016 -0700
WIP: soc/intel/apollolake: Update stage link addresses for 768 KiB cache
Update link addresses for romstage and verstage. Also change build time
relocation address for FSP-M to match.
Actual addresses are ballpark estimate and need to be validated.
BUG=chrome-os-partner:51959
Change-Id: Ia51a341f05b33151ea5fda9f8620408b5a15bc19
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index fd4e5ac..cbe1da8 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -120,13 +120,13 @@ config X86_TOP4G_BOOTMEDIA_MAP
config ROMSTAGE_ADDR
hex
- default 0xfef3e000
+ default 0xfef11000
help
The base address (in CAR) where romstage should be linked
config VERSTAGE_ADDR
hex
- default 0xfef60000
+ default 0xfef09000
help
The base address (in CAR) where verstage should be linked
@@ -136,7 +136,7 @@ config CACHE_MRC_SETTINGS
config FSP_M_ADDR
hex
- default 0xfef60000
+ default 0xfef40000
help
The address FSP-M will be relocated to during build time