blob: c3f10efee11f9699a8b01b2cd5a4a7a0d0c88962 [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 */
24#define HIGH_MEMORY_DEF_SIZE ( 128 * 1024 )
Vadim Bendeburye1860602011-09-20 17:07:14 -070025#ifndef __PRE_RAM__
Rudolf Marek97be27e2010-12-13 19:50:25 +000026extern uint64_t high_tables_base, high_tables_size;
Vadim Bendeburye1860602011-09-20 17:07:14 -070027#endif
Stefan Reinauer3b314022009-10-26 17:04:28 +000028
29#if CONFIG_HAVE_ACPI_RESUME
Rudolf Marek97be27e2010-12-13 19:50:25 +000030#define HIGH_MEMORY_SIZE ((CONFIG_RAMTOP - CONFIG_RAMBASE) + HIGH_MEMORY_DEF_SIZE)
31#define HIGH_MEMORY_SAVE ( HIGH_MEMORY_SIZE - HIGH_MEMORY_DEF_SIZE )
Stefan Reinauer3b314022009-10-26 17:04:28 +000032#else
Rudolf Marek97be27e2010-12-13 19:50:25 +000033#define HIGH_MEMORY_SIZE HIGH_MEMORY_DEF_SIZE
Stefan Reinauer3b314022009-10-26 17:04:28 +000034#endif
35
36#define CBMEM_ID_FREESPACE 0x46524545
37#define CBMEM_ID_GDT 0x4c474454
38#define CBMEM_ID_ACPI 0x41435049
39#define CBMEM_ID_CBTABLE 0x43425442
40#define CBMEM_ID_PIRQ 0x49525154
41#define CBMEM_ID_MPTABLE 0x534d5054
42#define CBMEM_ID_RESUME 0x5245534d
Sven Schnelle164bcfd2011-08-14 20:56:34 +020043#define CBMEM_ID_SMBIOS 0x534d4254
Vadim Bendebury6f72d692011-09-21 16:12:39 -070044#define CBMEM_ID_TIMESTAMP 0x54494d45
Stefan Reinauer3b314022009-10-26 17:04:28 +000045#define CBMEM_ID_NONE 0x00000000
46
Vadim Bendeburye1860602011-09-20 17:07:14 -070047int cbmem_initialize(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000048
49void cbmem_init(u64 baseaddr, u64 size);
50int cbmem_reinit(u64 baseaddr);
51void *cbmem_add(u32 id, u64 size);
52void *cbmem_find(u32 id);
Maciej Pijankaea921852009-10-27 14:29:29 +000053void cbmem_list(void);
54void cbmem_arch_init(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000055
Rudolf Marek475916d2010-12-13 20:02:23 +000056extern struct cbmem_entry *get_cbmem_toc(void);
57
Rudolf Marek33109342010-12-11 22:26:10 +000058#ifndef __PRE_RAM__
Rudolf Marekbcaea142010-11-22 22:00:52 +000059void set_cbmem_toc(struct cbmem_entry *);
Stefan Reinauer3b314022009-10-26 17:04:28 +000060#endif
Rudolf Marek33109342010-12-11 22:26:10 +000061#endif