blob: 6a48dd20e08810c66c558a4d84d24589a2bc062e [file] [log] [blame]
Stefan Reinauer3b314022009-10-26 17:04:28 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
18 */
19
20#ifndef _CBMEM_H_
21#define _CBMEM_H_
22
Stefan Reinauer294edb22011-08-14 13:52:03 -070023/* Reserve 128k for ACPI and other tables */
Vadim Bendeburyf2f93862011-10-04 10:44:16 -070024#if CONFIG_CONSOLE_CBMEM
25#define HIGH_MEMORY_DEF_SIZE ( 256 * 1024 )
26#else
Stefan Reinauer294edb22011-08-14 13:52:03 -070027#define HIGH_MEMORY_DEF_SIZE ( 128 * 1024 )
Vadim Bendeburyf2f93862011-10-04 10:44:16 -070028#endif
29
Vadim Bendeburye1860602011-09-20 17:07:14 -070030#ifndef __PRE_RAM__
Rudolf Marek97be27e2010-12-13 19:50:25 +000031extern uint64_t high_tables_base, high_tables_size;
Vadim Bendeburye1860602011-09-20 17:07:14 -070032#endif
Stefan Reinauer3b314022009-10-26 17:04:28 +000033
34#if CONFIG_HAVE_ACPI_RESUME
Rudolf Marek97be27e2010-12-13 19:50:25 +000035#define HIGH_MEMORY_SIZE ((CONFIG_RAMTOP - CONFIG_RAMBASE) + HIGH_MEMORY_DEF_SIZE)
36#define HIGH_MEMORY_SAVE ( HIGH_MEMORY_SIZE - HIGH_MEMORY_DEF_SIZE )
Stefan Reinauer3b314022009-10-26 17:04:28 +000037#else
Rudolf Marek97be27e2010-12-13 19:50:25 +000038#define HIGH_MEMORY_SIZE HIGH_MEMORY_DEF_SIZE
Stefan Reinauer3b314022009-10-26 17:04:28 +000039#endif
40
41#define CBMEM_ID_FREESPACE 0x46524545
42#define CBMEM_ID_GDT 0x4c474454
43#define CBMEM_ID_ACPI 0x41435049
44#define CBMEM_ID_CBTABLE 0x43425442
45#define CBMEM_ID_PIRQ 0x49525154
46#define CBMEM_ID_MPTABLE 0x534d5054
47#define CBMEM_ID_RESUME 0x5245534d
Sven Schnelle164bcfd2011-08-14 20:56:34 +020048#define CBMEM_ID_SMBIOS 0x534d4254
Vadim Bendebury6f72d692011-09-21 16:12:39 -070049#define CBMEM_ID_TIMESTAMP 0x54494d45
Vadim Bendeburybe25a4d2011-09-30 11:13:06 -070050#define CBMEM_ID_CONSOLE 0x434f4e53
Stefan Reinauer3b314022009-10-26 17:04:28 +000051#define CBMEM_ID_NONE 0x00000000
52
Vadim Bendeburye1860602011-09-20 17:07:14 -070053int cbmem_initialize(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000054
55void cbmem_init(u64 baseaddr, u64 size);
56int cbmem_reinit(u64 baseaddr);
57void *cbmem_add(u32 id, u64 size);
58void *cbmem_find(u32 id);
Maciej Pijankaea921852009-10-27 14:29:29 +000059void cbmem_list(void);
60void cbmem_arch_init(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000061
Rudolf Marek475916d2010-12-13 20:02:23 +000062extern struct cbmem_entry *get_cbmem_toc(void);
63
Rudolf Marek33109342010-12-11 22:26:10 +000064#ifndef __PRE_RAM__
Rudolf Marekbcaea142010-11-22 22:00:52 +000065void set_cbmem_toc(struct cbmem_entry *);
Stefan Reinauer3b314022009-10-26 17:04:28 +000066#endif
Rudolf Marek33109342010-12-11 22:26:10 +000067#endif