blob: c73f428725461e680feb31cef31c622b386fe1db [file] [log] [blame]
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2003 Eric Biederman
5 * Copyright (C) 2005 Steve Magnani
6 * Copyright (C) 2008-2009 coresystems GmbH
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000016 */
17
18#include <console/console.h>
19#include <cpu/cpu.h>
20#include <boot/tables.h>
21#include <boot/coreboot_tables.h>
22#include <string.h>
23#include <cbmem.h>
24#include <lib.h>
25
26#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
27
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000028// WTF. this does not agre with the prototype!
29static struct lb_memory *wtf_write_tables(void)
30{
31 unsigned long table_pointer, new_table_pointer;
32
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000033 post_code(0x9d);
34
35 table_pointer = (unsigned long)cbmem_add(CBMEM_ID_CBTABLE,
36 MAX_COREBOOT_TABLE_SIZE);
37 if (!table_pointer) {
38 printk(BIOS_ERR, "Could not add CBMEM for coreboot table.\n");
39 return NULL;
40 }
41
42 new_table_pointer = write_coreboot_table(0UL, 0UL,
43 table_pointer, table_pointer);
44
45 if (new_table_pointer > (table_pointer + MAX_COREBOOT_TABLE_SIZE)) {
46 printk(BIOS_ERR, "coreboot table didn't fit (%lx/%x bytes)\n",
47 new_table_pointer - table_pointer, MAX_COREBOOT_TABLE_SIZE);
48 }
49
50 printk(BIOS_DEBUG, "coreboot table: %ld bytes.\n",
51 new_table_pointer - table_pointer);
52
53 post_code(0x9e);
54
55 /* Print CBMEM sections */
56 cbmem_list();
57
58// return get_lb_mem();
59 return NULL;
60}
61void write_tables(void)
62{
63 wtf_write_tables();
64}