Two hda_verb.h files: Add more comments.
[coreboot.git] / src / arch / i386 / boot / tables.c
index b47826dd06f6d8769d755fd312f73373aee7d45a..d816e767500f1fb6cbbde5813f36153f3a7df816 100644 (file)
 #include <cpu/cpu.h>
 #include <boot/tables.h>
 #include <boot/coreboot_tables.h>
+#include <arch/coreboot_tables.h>
 #include <arch/pirq_routing.h>
 #include <arch/smp/mpspec.h>
 #include <arch/acpi.h>
 #include <string.h>
 #include <cpu/x86/multiboot.h>
-#include "coreboot_table.h"
 #include <cbmem.h>
+#include <lib.h>
 
 uint64_t high_tables_base = 0;
 uint64_t high_tables_size;
 
-void move_gdt(void);
 void cbmem_arch_init(void)
 {
        /* defined in gdt.c */
@@ -53,19 +53,19 @@ struct lb_memory *write_tables(void)
        unsigned long high_table_pointer;
 
        if (!high_tables_base) {
-               printk_err("ERROR: High Tables Base is not set.\n");
+               printk(BIOS_ERR, "ERROR: High Tables Base is not set.\n");
                // Are there any boards without?
                // Stepan thinks we should die() here!
        }
 
-       printk_debug("High Tables Base is %llx.\n", high_tables_base);
+       printk(BIOS_DEBUG, "High Tables Base is %llx.\n", high_tables_base);
 
-       rom_table_start = 0xf0000; 
+       rom_table_start = 0xf0000;
        rom_table_end =   0xf0000;
 
        /* Start low addr at 0x500, so we don't run into conflicts with the BDA
         * in case our data structures grow beyound 0x400. Only multiboot, GDT
-        * and the coreboot table use low_tables. 
+        * and the coreboot table use low_tables.
         */
        low_table_start = 0;
        low_table_end = 0x500;
@@ -126,7 +126,7 @@ struct lb_memory *write_tables(void)
        /* Write ACPI tables to F segment and high tables area */
 
        /* Ok, this is a bit hacky still, because some day we want to have this
-        * completely dynamic. But right now we are setting fixed sizes. 
+        * completely dynamic. But right now we are setting fixed sizes.
         * It's probably still better than the old high_table_base code because
         * now at least we know when we have an overflow in the area.
         *
@@ -167,9 +167,9 @@ struct lb_memory *write_tables(void)
 
                        acpi_write_rsdp(low_rsdp,
                                (acpi_rsdt_t *)(high_rsdp->rsdt_address),
-                               (acpi_xsdt_t *)(high_rsdp->xsdt_address));
+                               (acpi_xsdt_t *)((unsigned long)high_rsdp->xsdt_address));
                } else {
-                       printk_err("ERROR: Didn't find RSDP in high table.\n");
+                       printk(BIOS_ERR, "ERROR: Didn't find RSDP in high table.\n");
                }
                rom_table_end = ALIGN(rom_table_end + sizeof(acpi_rsdp_t), 16);
        } else {
@@ -179,19 +179,11 @@ struct lb_memory *write_tables(void)
 
 #endif
 
-#if CONFIG_MULTIBOOT
-       post_code(0x9d);
-
-       /* The Multiboot information structure */
-       rom_table_end = write_multiboot_info(
-                               low_table_start, low_table_end,
-                               rom_table_start, rom_table_end);
-#endif
 
 #define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
        post_code(0x9d);
 
-       high_table_pointer = cbmem_add(CBMEM_ID_CBTABLE, MAX_COREBOOT_TABLE_SIZE);
+       high_table_pointer = (unsigned long)cbmem_add(CBMEM_ID_CBTABLE, MAX_COREBOOT_TABLE_SIZE);
 
        if (high_table_pointer) {
                unsigned long new_high_table_pointer;
@@ -202,7 +194,7 @@ struct lb_memory *write_tables(void)
 
                if (new_high_table_pointer > (high_table_pointer +
                                        MAX_COREBOOT_TABLE_SIZE))
-                       printk_err("%s: coreboot table didn't fit (%llx)\n",
+                       printk(BIOS_ERR, "%s: coreboot table didn't fit (%lx)\n",
                                   __func__, new_high_table_pointer -
                                   high_table_pointer);
 
@@ -210,10 +202,11 @@ struct lb_memory *write_tables(void)
                                new_high_table_pointer - high_table_pointer);
        } else {
                /* The coreboot table must be in 0-4K or 960K-1M */
-               write_coreboot_table(low_table_start, low_table_end,
-                             rom_table_start, rom_table_end);
+               rom_table_end = write_coreboot_table(
+                                    low_table_start, low_table_end,
+                                    rom_table_start, rom_table_end);
        }
+
        post_code(0x9e);
 
 #if CONFIG_HAVE_ACPI_RESUME
@@ -221,9 +214,16 @@ struct lb_memory *write_tables(void)
         * it begin there during reboot time. We don't need the pointer, nor
         * the result right now. If it fails, ACPI resume will be disabled.
         */
-       cbmem_add(CBMEM_ID_RESUME, 1024 * (1024-64));
+       cbmem_add(CBMEM_ID_RESUME, HIGH_MEMORY_SAVE);
 #endif
-       
+
+#if CONFIG_MULTIBOOT
+       post_code(0x9d);
+
+       /* The Multiboot information structure */
+       write_multiboot_info(rom_table_end);
+#endif
+
        // Remove before sending upstream
        cbmem_list();