Add constants for fast path resume copying
[coreboot.git] / src / include / cbmem.h
1 /*
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
23 /* Reserve 128k for ACPI and other tables */
24 #if CONFIG_CONSOLE_CBMEM
25 #define HIGH_MEMORY_DEF_SIZE    ( 256 * 1024 )
26 #else
27 #define HIGH_MEMORY_DEF_SIZE    ( 128 * 1024 )
28 #endif
29
30 #if CONFIG_HAVE_ACPI_RESUME
31 #define HIGH_MEMORY_SIZE        ((CONFIG_RAMTOP - CONFIG_RAMBASE) + HIGH_MEMORY_DEF_SIZE)
32 #define HIGH_MEMORY_SAVE        ( HIGH_MEMORY_SIZE - HIGH_MEMORY_DEF_SIZE )
33
34 /* Delegation of resume backup memory so we don't have to
35  * (slowly) handle backing up OS memory in romstage.c
36  */
37 #define CBMEM_BOOT_MODE         0x610
38 #define CBMEM_RESUME_BACKUP     0x614
39 #else
40 #define HIGH_MEMORY_SIZE        HIGH_MEMORY_DEF_SIZE
41 #endif
42
43 #define CBMEM_ID_FREESPACE      0x46524545
44 #define CBMEM_ID_GDT            0x4c474454
45 #define CBMEM_ID_ACPI           0x41435049
46 #define CBMEM_ID_CBTABLE        0x43425442
47 #define CBMEM_ID_PIRQ           0x49525154
48 #define CBMEM_ID_MPTABLE        0x534d5054
49 #define CBMEM_ID_RESUME         0x5245534d
50 #define CBMEM_ID_SMBIOS         0x534d4254
51 #define CBMEM_ID_TIMESTAMP      0x54494d45
52 #define CBMEM_ID_MRCDATA        0x4d524344
53 #define CBMEM_ID_CONSOLE        0x434f4e53
54 #define CBMEM_ID_NONE           0x00000000
55
56 #ifndef __ASSEMBLER__
57 #ifndef __PRE_RAM__
58 extern uint64_t high_tables_base, high_tables_size;
59 #endif
60
61 int cbmem_initialize(void);
62
63 void cbmem_init(u64 baseaddr, u64 size);
64 int cbmem_reinit(u64 baseaddr);
65 void *cbmem_add(u32 id, u64 size);
66 void *cbmem_find(u32 id);
67 void cbmem_list(void);
68 void cbmem_arch_init(void);
69
70 extern struct cbmem_entry *get_cbmem_toc(void);
71
72 #ifndef __PRE_RAM__
73 void set_cbmem_toc(struct cbmem_entry *);
74 #endif
75 #endif
76 #endif