summaryrefslogtreecommitdiff
path: root/src/soc/intel/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r--src/soc/intel/common/Makefile.inc1
-rw-r--r--src/soc/intel/common/fsp_ramstage.c66
-rw-r--r--src/soc/intel/common/memmap.h18
-rw-r--r--src/soc/intel/common/stage_cache.c19
4 files changed, 38 insertions, 66 deletions
diff --git a/src/soc/intel/common/Makefile.inc b/src/soc/intel/common/Makefile.inc
index 76854ad857..7c5bbbee48 100644
--- a/src/soc/intel/common/Makefile.inc
+++ b/src/soc/intel/common/Makefile.inc
@@ -13,6 +13,7 @@ ramstage-y += hda_verb.c
ramstage-$(CONFIG_CACHE_MRC_SETTINGS) += mrc_cache.c
ramstage-$(CONFIG_CACHE_MRC_SETTINGS) += nvm.c
ramstage-$(CONFIG_SOC_INTEL_COMMON_RESET) += reset.c
+ramstage-$(CONFIG_SOC_INTEL_COMMON_STAGE_CACHE) += stage_cache.c
ramstage-$(CONFIG_PLATFORM_USES_FSP1_1) += util.c
ramstage-$(CONFIG_GOP_SUPPORT) += vbt.c
diff --git a/src/soc/intel/common/fsp_ramstage.c b/src/soc/intel/common/fsp_ramstage.c
index a5728b594d..c5916e3a47 100644
--- a/src/soc/intel/common/fsp_ramstage.c
+++ b/src/soc/intel/common/fsp_ramstage.c
@@ -36,63 +36,23 @@ __attribute__((weak)) void soc_after_silicon_init(void)
printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
}
-/*
- * SMM Memory Map:
- *
- * +--------------------------+ smm_region_size() ----.
- * | FSP Cache | |
- * +--------------------------+ |
- * | SMM Stage Cache | + CONFIG_SMM_RESERVED_SIZE
- * +--------------------------+ ---------------------'
- * | SMM Code |
- * +--------------------------+ smm_base
- *
- */
-
-void stage_cache_external_region(void **base, size_t *size)
-{
- size_t cache_size;
- u8 *cache_base;
-
- /* Determine the location of the ramstage cache */
- smm_region((void **)&cache_base, &cache_size);
- *size = CONFIG_SMM_RESERVED_SIZE;
- *base = &cache_base[cache_size - CONFIG_SMM_RESERVED_SIZE];
-}
-
/* Display SMM memory map */
static void smm_memory_map(void)
{
- u8 *smm_base;
- size_t smm_bytes;
- size_t smm_code_bytes;
- u8 *ext_cache;
- size_t ext_cache_bytes;
- u8 *smm_reserved;
- size_t smm_reserved_bytes;
-
- /* Locate the SMM regions */
- smm_region((void **)&smm_base, &smm_bytes);
- stage_cache_external_region((void **)&ext_cache, &ext_cache_bytes);
- smm_code_bytes = ext_cache - smm_base;
- smm_reserved_bytes = smm_bytes - ext_cache_bytes - smm_code_bytes;
- smm_reserved = smm_base + smm_bytes - smm_reserved_bytes;
-
- /* Display the SMM regions */
- printk(BIOS_SPEW, "\nLocation SMM Memory Map Offset\n");
- if (smm_reserved_bytes) {
- printk(BIOS_SPEW, "0x%p +--------------------------+ 0x%08x\n",
- &smm_reserved[smm_reserved_bytes], (u32)smm_bytes);
- printk(BIOS_SPEW, " | Other reserved region |\n");
+ void *base;
+ size_t size;
+ int i;
+
+ printk(BIOS_SPEW, "SMM Memory Map\n");
+
+ smm_region(&base, &size);
+ printk(BIOS_SPEW, "SMRAM : %p 0x%zx\n", base, size);
+
+ for (i = 0; i < SMM_SUBREGION_NUM; i++) {
+ if (smm_subregion(i, &base, &size))
+ continue;
+ printk(BIOS_SPEW, " Subregion %d: %p 0x%zx\n", i, base, size);
}
- printk(BIOS_SPEW, "0x%p +--------------------------+ 0x%08x\n",
- smm_reserved, (u32)(smm_reserved - smm_base));
- printk(BIOS_SPEW, " | external cache |\n");
- printk(BIOS_SPEW, "0x%p +--------------------------+ 0x%08x\n",
- ext_cache, (u32)(ext_cache - smm_base));
- printk(BIOS_SPEW, " | SMM code |\n");
- printk(BIOS_SPEW, "0x%p +--------------------------+ 0x%08x\n",
- smm_base, 0);
}
static void fsp_run_silicon_init(int is_s3_wakeup)
diff --git a/src/soc/intel/common/memmap.h b/src/soc/intel/common/memmap.h
index d94f0add7f..3d51539f55 100644
--- a/src/soc/intel/common/memmap.h
+++ b/src/soc/intel/common/memmap.h
@@ -28,6 +28,24 @@
* this value should be set to 8 MiB.
*/
size_t mmap_region_granluarity(void);
+
+/* Fills in the arguments for the entire SMM region covered by chipset
+ * protections. e.g. TSEG. */
void smm_region(void **start, size_t *size);
+enum {
+ /* SMM handler area. */
+ SMM_SUBREGION_HANDLER,
+ /* SMM cache region. */
+ SMM_SUBREGION_CACHE,
+ /* Chipset specific area. */
+ SMM_SUBREGION_CHIPSET,
+ /* Total sub regions supported. */
+ SMM_SUBREGION_NUM,
+};
+
+/* Fills in the start and size for the requested SMM subregion. Returns
+ * 0 on susccess, < 0 on failure. */
+int smm_subregion(int sub, void **start, size_t *size);
+
#endif /* _COMMON_MEMMAP_H_ */
diff --git a/src/soc/intel/common/stage_cache.c b/src/soc/intel/common/stage_cache.c
index 8e96d73179..5bb83c9499 100644
--- a/src/soc/intel/common/stage_cache.c
+++ b/src/soc/intel/common/stage_cache.c
@@ -18,22 +18,15 @@
* Foundation, Inc.
*/
-#include <cbmem.h>
+#include <console/console.h>
#include <soc/intel/common/memmap.h>
-#include <soc/smm.h>
#include <stage_cache.h>
void stage_cache_external_region(void **base, size_t *size)
{
- char *smm_base;
- size_t smm_size;
- const size_t cache_size = CONFIG_SMM_RESERVED_SIZE;
-
- /*
- * The ramstage cache lives in the TSEG region.
- * The top of ram is defined to be the TSEG base address.
- */
- smm_region((void **)&smm_base, &smm_size);
- *size = cache_size;
- *base = (void *)(&smm_base[smm_size - cache_size]);
+ if (smm_subregion(SMM_SUBREGION_CACHE, base, size)) {
+ printk(BIOS_ERR, "ERROR: No cache SMM subregion.\n");
+ *base = NULL;
+ *size = 0;
+ }
}