summaryrefslogtreecommitdiff
path: root/src/include/cbmem.h
blob: 6a48dd20e08810c66c558a4d84d24589a2bc062e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2009 coresystems GmbH
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
 */

#ifndef _CBMEM_H_
#define _CBMEM_H_

/* Reserve 128k for ACPI and other tables */
#if CONFIG_CONSOLE_CBMEM
#define HIGH_MEMORY_DEF_SIZE	( 256 * 1024 )
#else
#define HIGH_MEMORY_DEF_SIZE	( 128 * 1024 )
#endif

#ifndef __PRE_RAM__
extern uint64_t high_tables_base, high_tables_size;
#endif

#if CONFIG_HAVE_ACPI_RESUME
#define HIGH_MEMORY_SIZE	((CONFIG_RAMTOP - CONFIG_RAMBASE) + HIGH_MEMORY_DEF_SIZE)
#define HIGH_MEMORY_SAVE	( HIGH_MEMORY_SIZE - HIGH_MEMORY_DEF_SIZE )
#else
#define HIGH_MEMORY_SIZE	HIGH_MEMORY_DEF_SIZE
#endif

#define CBMEM_ID_FREESPACE	0x46524545
#define CBMEM_ID_GDT		0x4c474454
#define CBMEM_ID_ACPI		0x41435049
#define CBMEM_ID_CBTABLE	0x43425442
#define CBMEM_ID_PIRQ		0x49525154
#define CBMEM_ID_MPTABLE	0x534d5054
#define CBMEM_ID_RESUME		0x5245534d
#define CBMEM_ID_SMBIOS         0x534d4254
#define CBMEM_ID_TIMESTAMP	0x54494d45
#define CBMEM_ID_CONSOLE	0x434f4e53
#define CBMEM_ID_NONE		0x00000000

int cbmem_initialize(void);

void cbmem_init(u64 baseaddr, u64 size);
int cbmem_reinit(u64 baseaddr);
void *cbmem_add(u32 id, u64 size);
void *cbmem_find(u32 id);
void cbmem_list(void);
void cbmem_arch_init(void);

extern struct cbmem_entry *get_cbmem_toc(void);

#ifndef __PRE_RAM__
void set_cbmem_toc(struct cbmem_entry *);
#endif
#endif