Fix compilation when USE_OPTION_TABLE is not defined.
[coreboot.git] / src / arch / x86 / boot / coreboot_table.c
index cdfc0c1d8d79d1ce6176febc290421fcf175a0f1..b0dcc9e65aa57d109328f5e12d17ec1642422c5c 100644 (file)
@@ -29,9 +29,9 @@
 #include <version.h>
 #include <device/device.h>
 #include <stdlib.h>
-#if (CONFIG_USE_OPTION_TABLE == 1)
-#include <option_table.h>
 #include <cbfs.h>
+#if CONFIG_USE_OPTION_TABLE
+#include <option_table.h>
 #endif
 
 static struct lb_header *lb_table_init(unsigned long addr)
@@ -112,7 +112,19 @@ static struct lb_serial *lb_serial(struct lb_header *header)
        serial = (struct lb_serial *)rec;
        serial->tag = LB_TAG_SERIAL;
        serial->size = sizeof(*serial);
-       serial->ioport = CONFIG_TTYS0_BASE;
+       serial->type = LB_SERIAL_TYPE_IO_MAPPED;
+       serial->baseaddr = CONFIG_TTYS0_BASE;
+       serial->baud = CONFIG_TTYS0_BAUD;
+       return serial;
+#elif CONFIG_CONSOLE_SERIAL8250MEM
+       struct lb_record *rec;
+       struct lb_serial *serial;
+       rec = lb_new_record(header);
+       serial = (struct lb_serial *)rec;
+       serial->tag = LB_TAG_SERIAL;
+       serial->size = sizeof(*serial);
+       serial->type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+       serial->baseaddr = uartmem_getbaseaddr();
        serial->baud = CONFIG_TTYS0_BAUD;
        return serial;
 #else
@@ -131,7 +143,6 @@ static void add_console(struct lb_header *header, u16 consoletype)
        console->size = sizeof(*console);
        console->type = consoletype;
 }
-
 #endif
 
 static void lb_console(struct lb_header *header)
@@ -187,7 +198,7 @@ static struct lb_mainboard *lb_mainboard(struct lb_header *header)
        return mainboard;
 }
 
-#if (CONFIG_USE_OPTION_TABLE == 1)
+#if CONFIG_USE_OPTION_TABLE
 static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header)
 {
        struct lb_record *rec;
@@ -309,9 +320,10 @@ static unsigned long lb_table_fini(struct lb_header *head, int fixup)
        head->table_checksum = compute_ip_checksum(first_rec, head->table_bytes);
        head->header_checksum = 0;
        head->header_checksum = compute_ip_checksum(head, sizeof(*head));
-       printk(BIOS_DEBUG, "Wrote coreboot table at: %p - %p  checksum %x\n",
-               head, rec, head->table_checksum);
-       return (unsigned long)rec;
+       printk(BIOS_DEBUG,
+              "Wrote coreboot table at: %p, 0x%x bytes, checksum %x\n",
+              head, head->table_bytes, head->table_checksum);
+       return (unsigned long)rec + rec->size;
 }
 
 static void lb_cleanup_memory_ranges(struct lb_memory *mem)
@@ -501,7 +513,7 @@ static void add_lb_reserved(struct lb_memory *mem)
                lb_add_rsvd_range, mem);
 }
 
-#if CONFIG_WRITE_HIGH_TABLES == 1
+#if CONFIG_WRITE_HIGH_TABLES
 extern uint64_t high_tables_base, high_tables_size;
 #endif
 
@@ -512,7 +524,7 @@ unsigned long write_coreboot_table(
        struct lb_header *head;
        struct lb_memory *mem;
 
-#if CONFIG_WRITE_HIGH_TABLES == 1
+#if CONFIG_WRITE_HIGH_TABLES
        printk(BIOS_DEBUG, "Writing high table forward entry at 0x%08lx\n",
                        low_table_end);
        head = lb_table_init(low_table_end);
@@ -548,7 +560,7 @@ unsigned long write_coreboot_table(
        rom_table_end &= ~0xffff;
        printk(BIOS_DEBUG, "0x%08lx \n", rom_table_end);
 
-#if (CONFIG_USE_OPTION_TABLE == 1)
+#if CONFIG_USE_OPTION_TABLE
        {
                struct cmos_option_table *option_table = cbfs_find_file("cmos_layout.bin", 0x1aa);
                if (option_table) {
@@ -573,7 +585,7 @@ unsigned long write_coreboot_table(
        lb_add_memory_range(mem, LB_MEM_TABLE,
                rom_table_start, rom_table_end-rom_table_start);
 
-#if CONFIG_WRITE_HIGH_TABLES == 1
+#if CONFIG_WRITE_HIGH_TABLES
        printk(BIOS_DEBUG, "Adding high table area\n");
        // should this be LB_MEM_ACPI?
        lb_add_memory_range(mem, LB_MEM_TABLE,
@@ -583,7 +595,7 @@ unsigned long write_coreboot_table(
        /* Add reserved regions */
        add_lb_reserved(mem);
 
-#if (CONFIG_HAVE_MAINBOARD_RESOURCES == 1)
+#if CONFIG_HAVE_MAINBOARD_RESOURCES
        add_mainboard_resources(mem);
 #endif