Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8031
-gerrit
commit e624ae2cf503e8bc1b6c72ea4f22a46fa288a400
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Dec 31 19:13:12 2014 +0200
CBMEM: Rename utility file
This file will have CBMEM init hooks API one day.
Change-Id: I0c31495d4217a5eb235b13e6d8e8c99a87a3b840
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/lib/Makefile.inc | 4 +++-
src/lib/cbmem_common.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/cbmem_info.c | 45 ---------------------------------------------
3 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 0501091..ec3c2f4 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -81,7 +81,9 @@ else
ramstage-y += cbmem.c
romstage-y += cbmem.c
endif # CONFIG_DYNAMIC_CBMEM
-ramstage-y += cbmem_info.c
+
+romstage-y += cbmem_common.c
+ramstage-y += cbmem_common.c
ramstage-y += hexdump.c
romstage-y += hexdump.c
diff --git a/src/lib/cbmem_common.c b/src/lib/cbmem_common.c
new file mode 100644
index 0000000..a800173
--- /dev/null
+++ b/src/lib/cbmem_common.c
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 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 wacbmem_entryanty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <console/console.h>
+#include <cbmem.h>
+#include <stdlib.h>
+
+#ifndef __PRE_RAM__
+
+static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
+
+void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
+{
+ int i;
+ const char *name;
+
+ name = NULL;
+ for (i = 0; i < ARRAY_SIZE(cbmem_ids); i++) {
+ if (cbmem_ids[i].id == id) {
+ name = cbmem_ids[i].name;
+ break;
+ }
+ }
+
+ if (name == NULL)
+ printk(BIOS_DEBUG, "%08x ", id);
+ else
+ printk(BIOS_DEBUG, "%s", name);
+ printk(BIOS_DEBUG, "%2d. ", n);
+ printk(BIOS_DEBUG, "%08llx ", base);
+ printk(BIOS_DEBUG, "%08llx\n", size);
+}
+
+#endif /* !__PRE_RAM__ */
diff --git a/src/lib/cbmem_info.c b/src/lib/cbmem_info.c
deleted file mode 100644
index 7b1168d..0000000
--- a/src/lib/cbmem_info.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2013 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 wacbmem_entryanty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <console/console.h>
-#include <cbmem.h>
-#include <stdlib.h>
-
-static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
-
-void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
-{
- int i;
- const char *name;
-
- name = NULL;
- for (i = 0; i < ARRAY_SIZE(cbmem_ids); i++) {
- if (cbmem_ids[i].id == id) {
- name = cbmem_ids[i].name;
- break;
- }
- }
-
- if (name == NULL)
- printk(BIOS_DEBUG, "%08x ", id);
- else
- printk(BIOS_DEBUG, "%s", name);
- printk(BIOS_DEBUG, "%2d. ", n);
- printk(BIOS_DEBUG, "%08llx ", base);
- printk(BIOS_DEBUG, "%08llx\n", size);
-}
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8030
-gerrit
commit 56667da3976d95dbb9e82f534edf9a0cfc3bd1ae
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Nov 10 15:08:47 2014 +0200
ARMv7: Always has DYNAMIC_CBMEM
The static allocator only worked for x86 anyway.
Change-Id: I0d2b63465620512e62334d7aa0c885fc5ab3e589
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/arch/arm/tables.c | 9 ---------
src/cpu/ti/am335x/Kconfig | 1 +
src/cpu/ti/am335x/Makefile.inc | 2 ++
src/cpu/ti/am335x/cbmem.c | 24 ++++++++++++++++++++++++
src/mainboard/emulation/qemu-armv7/Kconfig | 1 +
src/mainboard/emulation/qemu-armv7/Makefile.inc | 3 +++
src/mainboard/emulation/qemu-armv7/cbmem.c | 24 ++++++++++++++++++++++++
7 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/src/arch/arm/tables.c b/src/arch/arm/tables.c
index 20c5a9f..a2b7b9b 100644
--- a/src/arch/arm/tables.c
+++ b/src/arch/arm/tables.c
@@ -29,15 +29,6 @@
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
-#if !CONFIG_DYNAMIC_CBMEM
-void __attribute__((weak)) get_cbmem_table(uint64_t *base, uint64_t *size)
-{
- printk(BIOS_WARNING, "WARNING: you need to define get_cbmem_table for your board\n");
- *base = 0;
- *size = 0;
-}
-#endif
-
void cbmem_arch_init(void)
{
}
diff --git a/src/cpu/ti/am335x/Kconfig b/src/cpu/ti/am335x/Kconfig
index fae527d..eb60ad1 100644
--- a/src/cpu/ti/am335x/Kconfig
+++ b/src/cpu/ti/am335x/Kconfig
@@ -6,6 +6,7 @@ config CPU_TI_AM335X
select HAVE_UART_SPECIAL
select BOOTBLOCK_CONSOLE
select CPU_HAS_BOOTBLOCK_INIT
+ select DYNAMIC_CBMEM
bool
default n
diff --git a/src/cpu/ti/am335x/Makefile.inc b/src/cpu/ti/am335x/Makefile.inc
index 24d2594..45188ce 100644
--- a/src/cpu/ti/am335x/Makefile.inc
+++ b/src/cpu/ti/am335x/Makefile.inc
@@ -4,11 +4,13 @@ bootblock-y += dmtimer.c
bootblock-y += pinmux.c
romstage-y += nand.c
+romstage-y += cbmem.c
ramstage-y += dmtimer.c
ramstage-y += monotonic_timer.c
ramstage-y += nand.c
ramstage-y += timer.c
+ramstage-y += cbmem.c
ifeq ($(CONFIG_DRIVERS_UART),y)
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += uart.c
diff --git a/src/cpu/ti/am335x/cbmem.c b/src/cpu/ti/am335x/cbmem.c
new file mode 100644
index 0000000..84f88cf
--- /dev/null
+++ b/src/cpu/ti/am335x/cbmem.c
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stddef.h>
+#include <cbmem.h>
+
+void *cbmem_top(void)
+{
+ return (void *)CONFIG_SYS_SDRAM_BASE + (CONFIG_DRAM_SIZE_MB << 20);
+}
diff --git a/src/mainboard/emulation/qemu-armv7/Kconfig b/src/mainboard/emulation/qemu-armv7/Kconfig
index b275e88..7e24a20 100644
--- a/src/mainboard/emulation/qemu-armv7/Kconfig
+++ b/src/mainboard/emulation/qemu-armv7/Kconfig
@@ -32,6 +32,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select ARM_ROMSTAGE_ARMV7
select ARM_RAMSTAGE_ARMV7
select BOARD_ROMSIZE_KB_4096
+ select DYNAMIC_CBMEM
config MAINBOARD_DIR
string
diff --git a/src/mainboard/emulation/qemu-armv7/Makefile.inc b/src/mainboard/emulation/qemu-armv7/Makefile.inc
index e088da6..4119f93 100644
--- a/src/mainboard/emulation/qemu-armv7/Makefile.inc
+++ b/src/mainboard/emulation/qemu-armv7/Makefile.inc
@@ -14,6 +14,9 @@
romstage-y += romstage.c
+romstage-y += cbmem.c
+ramstage-y += cbmem.c
+
bootblock-y += media.c
romstage-y += media.c
ramstage-y += media.c
diff --git a/src/mainboard/emulation/qemu-armv7/cbmem.c b/src/mainboard/emulation/qemu-armv7/cbmem.c
new file mode 100644
index 0000000..84f88cf
--- /dev/null
+++ b/src/mainboard/emulation/qemu-armv7/cbmem.c
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stddef.h>
+#include <cbmem.h>
+
+void *cbmem_top(void)
+{
+ return (void *)CONFIG_SYS_SDRAM_BASE + (CONFIG_DRAM_SIZE_MB << 20);
+}
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8028
-gerrit
commit 170356b4e468d658d3fd38f8adc4dd135c5245ef
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Nov 10 15:08:47 2014 +0200
ARM64: Always has DYNAMIC_CBMEM
The static allocator only worked for x86 anyway.
Change-Id: Ibe4e172bb654f6414949bd11787c9407d091a858
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/arch/arm64/cbmem.c | 30 ------------------------------
src/arch/arm64/tables.c | 17 -----------------
2 files changed, 47 deletions(-)
diff --git a/src/arch/arm64/cbmem.c b/src/arch/arm64/cbmem.c
deleted file mode 100644
index b33e9b8..0000000
--- a/src/arch/arm64/cbmem.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <cbmem.h>
-
-unsigned long get_top_of_ram(void);
-
-unsigned long get_top_of_ram(void)
-{
- return CONFIG_RAMTOP;
-}
-
-void *cbmem_top(void)
-{
- return (void *)get_top_of_ram();
-}
diff --git a/src/arch/arm64/tables.c b/src/arch/arm64/tables.c
index 49fab9f..ce7ad5a 100644
--- a/src/arch/arm64/tables.c
+++ b/src/arch/arm64/tables.c
@@ -29,15 +29,6 @@
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
-#if ! CONFIG_DYNAMIC_CBMEM
-/*
- * TODO: "High" tables are a convention used on x86. Maybe we can
- * clean up that naming at some point.
- */
-uint64_t high_tables_base = 0;
-uint64_t high_tables_size;
-#endif
-
void cbmem_arch_init(void)
{
}
@@ -46,14 +37,6 @@ struct lb_memory *write_tables(void)
{
unsigned long table_pointer, new_table_pointer;
-#if ! CONFIG_DYNAMIC_CBMEM
- if (!high_tables_base) {
- printk(BIOS_ERR, "ERROR: high_tables_base is not set.\n");
- }
-
- printk(BIOS_DEBUG, "high_tables_base: %llx.\n", high_tables_base);
-#endif
-
post_code(0x9d);
table_pointer = (unsigned long)cbmem_add(CBMEM_ID_CBTABLE,