<p>Martin Roth would like Lijian Zhao to <strong>review</strong> this change.</p><p><a href="https://review.coreboot.org/20688">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/intel/cannonlake: Add postcar stage support<br><br>Initialize postcar frame once finish FSP memoryinit<br><br>This patch was merged too early and reverted.<br>Originally reviewed on https://review.coreboot.org/#/c/20534<br><br>Change-Id: Id36aa44bb7a89303bc22e92e0313cf685351690a<br>Signed-off-by: Lijian Zhao <lijian.zhao@intel.com><br>---<br>M src/drivers/intel/fsp2_0/Makefile.inc<br>M src/soc/intel/cannonlake/Kconfig<br>M src/soc/intel/cannonlake/Makefile.inc<br>M src/soc/intel/cannonlake/romstage/romstage.c<br>M src/soc/intel/cannonlake/uart.c<br>5 files changed, 38 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/20688/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc<br>index cdf6146..d5709ad 100644<br>--- a/src/drivers/intel/fsp2_0/Makefile.inc<br>+++ b/src/drivers/intel/fsp2_0/Makefile.inc<br>@@ -43,6 +43,7 @@<br> postcar-$(CONFIG_FSP_CAR) += temp_ram_exit.c<br> postcar-$(CONFIG_FSP_CAR) += util.c<br> postcar-$(CONFIG_DISPLAY_FSP_HEADER) += header_display.c<br>+postcar-y += hand_off_block.c<br> <br> CPPFLAGS_common += -I$(src)/drivers/intel/fsp2_0/include<br> <br>diff --git a/src/soc/intel/cannonlake/Kconfig b/src/soc/intel/cannonlake/Kconfig<br>index 1c0f1bf..483bb67 100644<br>--- a/src/soc/intel/cannonlake/Kconfig<br>+++ b/src/soc/intel/cannonlake/Kconfig<br>@@ -23,6 +23,8 @@<br>       select HAVE_INTEL_FIRMWARE<br>    select INTEL_CAR_NEM_ENHANCED<br>         select PLATFORM_USES_FSP2_0<br>+  select POSTCAR_CONSOLE<br>+       select POSTCAR_STAGE<br>  select RELOCATABLE_RAMSTAGE<br>   select SOC_INTEL_COMMON<br>       select SOC_INTEL_COMMON_BLOCK_SA<br>diff --git a/src/soc/intel/cannonlake/Makefile.inc b/src/soc/intel/cannonlake/Makefile.inc<br>index 1557b2e..2549e4c 100644<br>--- a/src/soc/intel/cannonlake/Makefile.inc<br>+++ b/src/soc/intel/cannonlake/Makefile.inc<br>@@ -5,20 +5,23 @@<br> subdirs-y += ../../../cpu/x86/mtrr<br> subdirs-y += ../../../cpu/x86/tsc<br> <br>-bootblock-$(CONFIG_DRIVERS_UART_8250MEM) += uart.c<br> bootblock-y += bootblock/bootblock.c<br> bootblock-y += bootblock/cpu.c<br> bootblock-y += bootblock/pch.c<br> bootblock-y += bootblock/report_platform.c<br> bootblock-y += gpio.c<br>+bootblock-$(CONFIG_UART_DEBUG) += uart.c<br> <br> romstage-y += memmap.c<br> romstage-y += reset.c<br>-romstage-$(CONFIG_DRIVERS_UART_8250MEM) += uart.c<br>+romstage-$(CONFIG_UART_DEBUG) += uart.c<br> <br> ramstage-y += cbmem.c<br> ramstage-$(CONFIG_PLATFORM_USES_FSP2_0) += reset.c<br>-ramstage-$(CONFIG_DRIVERS_UART_8250MEM) += uart.c<br>+ramstage-$(CONFIG_UART_DEBUG) += uart.c<br>+<br>+postcar-y += memmap.c<br>+postcar-$(CONFIG_UART_DEBUG) += uart.c<br> <br> CPPFLAGS_common += -I$(src)/soc/intel/cannonlake/include/fsp20<br> CPPFLAGS_common += -I$(src)/vendorcode/intel/fsp/fsp2_0/cannonlake<br>diff --git a/src/soc/intel/cannonlake/romstage/romstage.c b/src/soc/intel/cannonlake/romstage/romstage.c<br>index 26ccd96..644b603 100644<br>--- a/src/soc/intel/cannonlake/romstage/romstage.c<br>+++ b/src/soc/intel/cannonlake/romstage/romstage.c<br>@@ -14,6 +14,10 @@<br>  */<br> <br> #include <arch/io.h><br>+#include <arch/symbols.h><br>+#include <assert.h><br>+#include <cpu/x86/mtrr.h><br>+#include <cpu/x86/msr.h><br> #include <cbmem.h><br> #include <console/console.h><br> #include <fsp/util.h><br>@@ -25,6 +29,8 @@<br> asmlinkage void car_stage_entry(void)<br> {<br>      bool s3wake;<br>+ struct postcar_frame pcf;<br>+    uintptr_t top_of_ram;<br>         struct chipset_power_state *ps;<br> <br>    console_init();<br>@@ -36,7 +42,25 @@<br>   timestamp_add_now(TS_START_ROMSTAGE);<br>         s3wake = ps->prev_sleep_state == ACPI_S3;<br>  fsp_memory_init(s3wake);<br>-     die("Get out from FSP memoryinit. \n");<br>+    if (postcar_frame_init(&pcf, 1 * KiB))<br>+           die("Unable to initialize postcar frame.\n");<br>+<br>+   /*<br>+    * We need to make sure ramstage will be run cached. At this<br>+  * point exact location of ramstage in cbmem is not known.<br>+    * Instruct postcar to cache 16 megs under cbmem top which is<br>+         * a safe bet to cover ramstage.<br>+      */<br>+  top_of_ram = (uintptr_t) cbmem_top();<br>+        printk(BIOS_DEBUG, "top_of_ram = 0x%lx\n", top_of_ram);<br>+    top_of_ram -= 16*MiB;<br>+        postcar_frame_add_mtrr(&pcf, top_of_ram, 16*MiB, MTRR_TYPE_WRBACK);<br>+<br>+   /* Cache the ROM as WP just below 4GiB. */<br>+   postcar_frame_add_mtrr(&pcf, 0xFFFFFFFF - CONFIG_ROM_SIZE + 1,<br>+                           CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT);<br>+<br>+       run_postcar_phase(&pcf);<br> }<br> <br> void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version)<br>diff --git a/src/soc/intel/cannonlake/uart.c b/src/soc/intel/cannonlake/uart.c<br>index 6f5fb6d..dd121b0 100644<br>--- a/src/soc/intel/cannonlake/uart.c<br>+++ b/src/soc/intel/cannonlake/uart.c<br>@@ -13,6 +13,8 @@<br>  * GNU General Public License for more details.<br>  */<br> <br>+#define __SIMPLE_DEVICE__<br>+<br> #include <assert.h><br> #include <console/uart.h><br> #include <device/pci_def.h><br>@@ -60,8 +62,10 @@<br>       gpio_configure_pads(p->pads, ARRAY_SIZE(p->pads));<br> }<br> <br>+#if IS_ENABLED(CONFIG_DRIVERS_UART_8250MEM)<br> uintptr_t uart_platform_base(int idx)<br> {<br>     /* We can only have one serial console at a time */<br>   return UART_DEBUG_BASE_ADDRESS;<br> }<br>+#endif<br></pre><p>To view, visit <a href="https://review.coreboot.org/20688">change 20688</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/20688"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id36aa44bb7a89303bc22e92e0313cf685351690a </div>
<div style="display:none"> Gerrit-Change-Number: 20688 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Martin Roth <martinroth@google.com> </div>
<div style="display:none"> Gerrit-Reviewer: Lijian Zhao <lijian.zhao@intel.com> </div>