David Hendricks (dhendrix@chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2302
-gerrit
commit 9d238f29d861a05c6f2f00956f909b4600fdb379 Author: David Hendricks dhendrix@chromium.org Date: Wed Feb 6 16:29:42 2013 -0800
snow: cleanup ramstage and call hardwaremain()
** do not submit **
It dies when trying to init CBMEM, but at least it gets somewhere...
Change-Id: I30200432535244de971a7cea9f7902f5e9b46403 Signed-off-by: David Hendricks dhendrix@chromium.org --- src/arch/armv7/boot/coreboot_table.c | 17 +++++++++++++++++ src/lib/compute_ip_checksum.c | 5 +++++ src/mainboard/google/snow/ramstage.c | 21 ++++++++++++++------- 3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/src/arch/armv7/boot/coreboot_table.c b/src/arch/armv7/boot/coreboot_table.c index b2d88aa..014316b 100644 --- a/src/arch/armv7/boot/coreboot_table.c +++ b/src/arch/armv7/boot/coreboot_table.c @@ -391,21 +391,30 @@ static void lb_reserve_table_memory(struct lb_header *head) static unsigned long lb_table_fini(struct lb_header *head, int fixup) { struct lb_record *rec, *first_rec; + printk(BIOS_DEBUG, "%s: entered\n", __func__); rec = lb_last_record(head); if (head->table_entries) { head->table_bytes += rec->size; } + printk(BIOS_DEBUG, "%s: checkpoint 1\n", __func__); + printk(BIOS_DEBUG, "%s: table_entries: %s, head->table_bytes: 0x%x\n", + __func__, head->table_entries ? "yes" : "no", head->table_bytes);
if (fixup) lb_reserve_table_memory(head);
+ printk(BIOS_DEBUG, "%s: checkpoint 2\n", __func__); first_rec = lb_first_record(head); + printk(BIOS_DEBUG, "%s: checkpoint 3, first_rec: %p\n", __func__, first_rec); head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes); + printk(BIOS_DEBUG, "%s: checkpoint 4\n", __func__); head->header_checksum = 0; head->header_checksum = compute_ip_checksum(head, sizeof(*head)); + printk(BIOS_DEBUG, "%s: checkpoint 5\n", __func__); printk(BIOS_DEBUG, "Wrote coreboot table at: %p, 0x%x bytes, checksum %x\n", head, head->table_bytes, head->table_checksum); + printk(BIOS_DEBUG, "%s: exitingn", __func__); return (unsigned long)rec + rec->size; }
@@ -603,10 +612,18 @@ unsigned long write_coreboot_table( struct lb_memory *mem;
#if CONFIG_WRITE_HIGH_TABLES + printk(BIOS_DEBUG, "low_table_start: 0x%lx, low_table_end: 0x%lx, " + "rom_table_start: 0x%lx, rom_table_end: 0x%lx\n", + low_table_start, low_table_end, + rom_table_start, rom_table_end); printk(BIOS_DEBUG, "Writing high table forward entry at 0x%08lx\n", low_table_end); head = lb_table_init(low_table_end); + printk(BIOS_DEBUG, "low_table_end: 0x%lx, head: 0x%p,... ", + low_table_end, head); + printk(BIOS_DEBUG, "writing head (0x%p)... ", head); lb_forward(head, (struct lb_header*)rom_table_end); + printk(BIOS_DEBUG, "done\n");
low_table_end = (unsigned long) lb_table_fini(head, 0); printk(BIOS_DEBUG, "New low_table_end: 0x%08lx\n", low_table_end); diff --git a/src/lib/compute_ip_checksum.c b/src/lib/compute_ip_checksum.c index 48f93d4..58f691a 100644 --- a/src/lib/compute_ip_checksum.c +++ b/src/lib/compute_ip_checksum.c @@ -1,6 +1,8 @@ #include <stdint.h> #include <ip_checksum.h>
+#include <console/console.h> + unsigned long compute_ip_checksum(void *addr, unsigned long length) { uint8_t *ptr; @@ -15,6 +17,7 @@ unsigned long compute_ip_checksum(void *addr, unsigned long length) */ sum = 0; ptr = addr; + printk(BIOS_DEBUG, "%s: ptr: 0x%p, length: %ld\n", __func__, ptr, length); for(i = 0; i < length; i++) { unsigned long v; v = ptr[i]; @@ -28,8 +31,10 @@ unsigned long compute_ip_checksum(void *addr, unsigned long length) sum = (sum + (sum >> 16)) & 0xFFFF; } } + printk(BIOS_DEBUG, "%s: done\n", __func__); value.byte[0] = sum & 0xff; value.byte[1] = (sum >> 8) & 0xff; + printk(BIOS_DEBUG, "%s: exiting...\n", __func__); return (~value.word) & 0xFFFF; }
diff --git a/src/mainboard/google/snow/ramstage.c b/src/mainboard/google/snow/ramstage.c index 50050d3..d280dbe 100644 --- a/src/mainboard/google/snow/ramstage.c +++ b/src/mainboard/google/snow/ramstage.c @@ -19,14 +19,21 @@
#include <console/console.h>
+#if CONFIG_WRITE_HIGH_TABLES +#include <cbmem.h> +#endif + +void hardwaremain(int boot_complete); void main(void) { -// volatile unsigned long *pshold = (unsigned long *)0x1004330c; -// *pshold &= ~0x100; /* shut down */ - - /* FIXME: console_init() seems to cause things to die... Maybe - we need to reset our stack pointer? */ -// console_init(); + console_init(); printk(BIOS_INFO, "hello from ramstage\n"); - while (1); + +#if CONFIG_WRITE_HIGH_TABLES + /* Leave some space for ACPI tables */ + high_tables_base = CONFIG_RAMBASE; + high_tables_size = CONFIG_RAMBASE + 0x100000; +#endif + + hardwaremain(0); }