summaryrefslogtreecommitdiff
path: root/src/soc/intel/common
diff options
context:
space:
mode:
authorMichael Niewöhner <foss@mniewoehner.de>2019-10-19 15:17:06 +0200
committerNico Huber <nico.h@gmx.de>2019-11-04 19:24:49 +0000
commite75a64f822931a5fbdd80f20c4d168a5c346e01a (patch)
treebe951bed3220dac1d7a9fc34c8e534da53f55311 /src/soc/intel/common
parent68da45479fd289281017768a8cfa51b2f642ac07 (diff)
downloadcoreboot-e75a64f822931a5fbdd80f20c4d168a5c346e01a.tar.xz
soc/intel: skl,cnl,icl: consolidate ebda and memmap
As of CB:36136 ebda and memmap are identical for skl, cnl and icl, thus move them to common code. Tested successfully on X11SSM-F Change-Id: I9a20c814d2a6874fcb4ff99ef1a7825d891f74e2 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36137 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r--src/soc/intel/common/block/ebda/ebda.c26
-rw-r--r--src/soc/intel/common/block/include/intelblocks/ebda.h49
-rw-r--r--src/soc/intel/common/block/systemagent/memmap.c67
3 files changed, 80 insertions, 62 deletions
diff --git a/src/soc/intel/common/block/ebda/ebda.c b/src/soc/intel/common/block/ebda/ebda.c
index 6b0bd6752b..072023cd16 100644
--- a/src/soc/intel/common/block/ebda/ebda.c
+++ b/src/soc/intel/common/block/ebda/ebda.c
@@ -17,34 +17,14 @@
#include <intelblocks/ebda.h>
#include <string.h>
-/*
- * Mainboard Override function
- *
- * Mainboard directory may implement below functionality for romstage.
- */
-
-/* Fill up EBDA structure inside Mainboard directory */
-__weak void create_mainboard_ebda(struct ebda_config *cfg)
-{
- /* no-op */
-}
-
-static void create_soc_ebda(struct ebda_config *cfg)
-{
- /* Create EBDA header */
- cfg->signature = EBDA_SIGNATURE;
- /* Fill up memory layout information */
- fill_soc_memmap_ebda(cfg);
-}
-
-void fill_ebda_area(void)
+void initialize_ebda_area(void)
{
struct ebda_config ebda_cfg;
/* Initialize EBDA area early during romstage. */
setup_default_ebda();
- create_soc_ebda(&ebda_cfg);
- create_mainboard_ebda(&ebda_cfg);
+ ebda_cfg.signature = EBDA_SIGNATURE;
+ fill_memmap_ebda(&ebda_cfg);
write_ebda_data(&ebda_cfg, sizeof(ebda_cfg));
}
diff --git a/src/soc/intel/common/block/include/intelblocks/ebda.h b/src/soc/intel/common/block/include/intelblocks/ebda.h
index 16124df7e0..48904f4705 100644
--- a/src/soc/intel/common/block/include/intelblocks/ebda.h
+++ b/src/soc/intel/common/block/include/intelblocks/ebda.h
@@ -16,52 +16,23 @@
#ifndef SOC_INTEL_COMMON_BLOCK_EBDA_H
#define SOC_INTEL_COMMON_BLOCK_EBDA_H
-#include <soc/ebda.h>
-
#define EBDA_SIGNATURE 0xebdaebda
-/*
- * Mainboard Override function
- *
- * Mainboard directory may implement below functionality for romstage.
- */
-
-/* Fill up EBDA structure inside Mainboard directory */
-void create_mainboard_ebda(struct ebda_config *cfg);
+/* EBDA structure */
+struct ebda_config {
+ uint32_t signature; /* EBDA signature */
+ uint32_t cbmem_top; /* coreboot memory start */
+};
-/*
- * SoC overrides
- *
- * All new SoC must implement below functionality for romstage.
- */
-void fill_soc_memmap_ebda(struct ebda_config *cfg);
+/* Initialize EBDA and store structure into EBDA area */
+void initialize_ebda_area(void);
/*
- * API to perform below operation
- * 1. Initialize EBDA area
- * 2. Fill up EBDA structure inside SOC directory
- * 3. Fill up EBDA structure inside Mainboard directory
- * 4. Store EBDA structure into EBDA area
- */
-void fill_ebda_area(void);
-
-/* Fill the ebda object pointed to by cfg. Object will be zero filled
+ * Fill the ebda object pointed to by cfg. Object will be zero filled
* if signature check fails. */
void retrieve_ebda_object(struct ebda_config *cfg);
-/*
- * EBDA structure
- *
- * SOC should implement EBDA structure as per need
- * as below.
- *
- * Note: First 4 bytes should be reserved for signature as
- * 0xEBDA
- *
- * struct ebda_config {
- * uint32_t signature;
- * <Required variables..>
- * };
- */
+/* API for filling ebda with data in romstage */
+void fill_memmap_ebda(struct ebda_config *cfg);
#endif
diff --git a/src/soc/intel/common/block/systemagent/memmap.c b/src/soc/intel/common/block/systemagent/memmap.c
index ea22aa6d18..809c13a1ff 100644
--- a/src/soc/intel/common/block/systemagent/memmap.c
+++ b/src/soc/intel/common/block/systemagent/memmap.c
@@ -19,15 +19,82 @@
#include <console/console.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/smm.h>
+#include <fsp/util.h>
+#include <intelblocks/ebda.h>
#include <intelblocks/systemagent.h>
#include <stdlib.h>
+/*
+ * Expected Host Memory Map (we don't know 100% and not all regions are present on all SoCs):
+ *
+ * +---------------------------+ TOUUD
+ * | |
+ * +---------------------------+ TOM (if mem > 4GB)
+ * | CSME UMA (if mem > 4 GiB) |
+ * +---------------------------+ TOUUD
+ * | |
+ * +---------------------------+ 4GiB
+ * | PCI Address Space |
+ * +---------------------------+ TOM (if mem < 4GB)
+ * | CSME UMA (if mem < 4 GiB) |
+ * +---------------------------+ TOLUD (also maps into MC address space)
+ * | iGD / DSM |
+ * +---------------------------+ BDSM
+ * | GTT / GSM |
+ * +---------------------------+ TOLM
+ * | TSEG |
+ * +---------------------------+ TSEGMB
+ * | DMA Protected Region |
+ * +---------------------------+ DPR
+ * | PRM (C6DRAM/SGX) |
+ * +---------------------------+ PRMRR
+ * | Probeless Trace |
+ * +---------------------------+ ME Stolen
+ * | PTT |
+ * +---------------------------+ TOLUM / top_of_ram / cbmem_top
+ * | CBMEM Root |
+ * +---------------------------+
+ * | FSP Reserved Memory |
+ * +---------------------------+
+ * | various CBMEM entries |
+ * +---------------------------+ top_of_stack (8 byte aligned)
+ * | stack (CBMEM entry) |
+ * +---------------------------+ FSP TOLUM
+ * | |
+ * +---------------------------+ 0
+ */
+
void smm_region(uintptr_t *start, size_t *size)
{
*start = sa_get_tseg_base();
*size = sa_get_tseg_size();
}
+#if CONFIG(SOC_INTEL_COMMON_BLOCK_EBDA)
+void fill_memmap_ebda(struct ebda_config *cfg)
+{
+ struct range_entry tolum;
+
+ fsp_find_bootloader_tolum(&tolum);
+ cfg->cbmem_top = range_entry_end(&tolum);
+}
+
+void cbmem_top_init(void)
+{
+ /* Initialize EBDA area */
+ initialize_ebda_area();
+}
+
+void *cbmem_top_chipset(void)
+{
+ struct ebda_config ebda_cfg;
+
+ retrieve_ebda_object(&ebda_cfg);
+
+ return (void *)(uintptr_t)ebda_cfg.cbmem_top;
+}
+#endif
+
void fill_postcar_frame(struct postcar_frame *pcf)
{
uintptr_t top_of_ram;