summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorAndrey Petrov <andrey.petrov@intel.com>2016-02-25 17:22:17 -0800
committerPatrick Georgi <pgeorgi@google.com>2016-03-05 16:00:42 +0100
commitdd56de974ddc7d0d8d782b50d9260b0596f59a1a (patch)
tree3ecc573eb8dad7cf0034f8508c60175c50048674 /src/arch/x86
parentb1bca88a049bab525828c549bd7097cca7b5f80f (diff)
downloadcoreboot-dd56de974ddc7d0d8d782b50d9260b0596f59a1a.tar.xz
arch/x86: document CAR symbols and expose them in symbols.h
Attempt to better document the symbol usage in car.ld for cache-as-ram usage. Additionally, add _car_region_[start|end] that completely covers the entire cache-as-ram region. The _car_data_[start|end] symbols were renamed to _car_relocatable_data_[start|end] in the hopes of making it clearer that objects within there move. Lastly, all these symbols were added to arch/symbols.h. Change-Id: I1f1af4983804dc8521d0427f43381bde6d23a060 Signed-off-by: Andrey Petrov <andrey.petrov@intel.com> Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13804 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/car.ld11
-rw-r--r--src/arch/x86/include/arch/early_variables.h8
-rw-r--r--src/arch/x86/include/arch/symbols.h52
3 files changed, 62 insertions, 9 deletions
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index d19e61300b..c221fb88b1 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -18,6 +18,7 @@
/* This file is included inside a SECTIONS block */
. = CONFIG_DCACHE_RAM_BASE;
.car.data . (NOLOAD) : {
+ _car_region_start = . ;
/* Vboot work buffer is completely volatile outside of verstage and
* romstage. Appropriate code needs to handle the transition. */
#if IS_ENABLED(CONFIG_SEPARATE_VERSTAGE)
@@ -36,12 +37,12 @@
* so that multiple stages (romstage and verstage) have a consistent
* link address of these shared objects. */
PRERAM_CBMEM_CONSOLE(., (CONFIG_LATE_CBMEM_INIT ? 0 : 0xc00))
- _car_data_start = .;
+ _car_relocatable_data_start = .;
/* The timestamp implementation relies on this storage to be around
* after migration. One of the fields indicates not to use it as the
* backing store once cbmem comes online. Therefore, this data needs
- * to reside in the migrated area (between _car_data_start and
- * _car_data_end). */
+ * to reside in the migrated area (between _car_relocatable_data_start
+ * and _car_relocatable_data_end). */
TIMESTAMP(., 0x100)
/* _car_global_start and _car_global_end provide symbols to per-stage
* variables that are not shared like the timestamp and the pre-ram
@@ -51,7 +52,9 @@
*(.car.global_data);
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_car_global_end = .;
- _car_data_end = .;
+ _car_relocatable_data_end = .;
+
+ _car_region_end = . + CONFIG_DCACHE_RAM_SIZE - (. - _car_region_start);
}
/* Global variables are not allowed in romstage
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h
index 16eeacce62..e78b846f8e 100644
--- a/src/arch/x86/include/arch/early_variables.h
+++ b/src/arch/x86/include/arch/early_variables.h
@@ -16,6 +16,7 @@
#ifndef ARCH_EARLY_VARIABLES_H
#define ARCH_EARLY_VARIABLES_H
+#include <arch/symbols.h>
#include <stdlib.h>
#include <rules.h>
@@ -59,18 +60,15 @@ void *car_sync_var_ptr(void *var);
#define car_set_var(var, val) \
do { car_get_var(var) = (val); } while(0)
-extern char _car_data_start[];
-extern char _car_data_end[];
-
static inline size_t car_data_size(void)
{
- size_t car_size = &_car_data_end[0] - &_car_data_start[0];
+ size_t car_size = _car_relocatable_data_size;
return ALIGN(car_size, 64);
}
static inline size_t car_object_offset(void *ptr)
{
- return (char *)ptr - &_car_data_start[0];
+ return (char *)ptr - &_car_relocatable_data_start[0];
}
#else
diff --git a/src/arch/x86/include/arch/symbols.h b/src/arch/x86/include/arch/symbols.h
new file mode 100644
index 0000000000..e055fa0f5b
--- /dev/null
+++ b/src/arch/x86/include/arch/symbols.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ * Copyright 2016 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ARCH_SYMBOLS_H
+#define __ARCH_SYMBOLS_H
+
+/*
+ * The _car_region_[start|end] covers the entirety of the cache as ram
+ * region. All other symbols with the _car prefix a subsets of this
+ * larger region.
+ */
+extern char _car_region_start[];
+extern char _car_region_end[];
+#define _car_region_size (_car_region_end - _car_region_start)
+
+/*
+ * This is the stack used under CONFIG_C_ENVIRONMENT_BOOTBLOCK for
+ * all stages that execute when cache-as-ram is up.
+ */
+extern char _car_stack_start[];
+extern char _car_stack_end[];
+#define _car_stack_size (_car_stack_end - _car_stack_start)
+
+/*
+ * The _car_relocatable_data_[start|end] symbols cover CAR data which is
+ * relocatable once memory comes online. Variables with CAR_GLOBAL decoration
+ * reside within this region. The _car_global_[start|end] is a subset of the
+ * relocatable region which excludes the timestamp region because of
+ * intricacies in the timestamp code.
+ */
+extern char _car_relocatable_data_start[];
+extern char _car_relocatable_data_end[];
+#define _car_relocatable_data_size \
+ (_car_relocatable_data_end - _car_relocatable_data_start)
+extern char _car_global_start[];
+extern char _car_global_end[];
+#define _car_global_size (_car_global_end - _car_global_start)
+
+#endif