blob: 0aa9b305d7fde1571ba01c3f8b3017746841c96f [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
Stefan Reinauer3b314022009-10-26 17:04:28 +000030#if CONFIG_HAVE_ACPI_RESUME
zbaof7223732012-04-13 13:42:15 +080031#define HIGH_MEMORY_SAVE (CONFIG_RAMTOP - CONFIG_RAMBASE)
32#define HIGH_MEMORY_SIZE (HIGH_MEMORY_SAVE + CONFIG_HIGH_SCRATCH_MEMORY_SIZE + HIGH_MEMORY_DEF_SIZE)
Stefan Reinauer61f4a742012-04-03 16:21:04 -070033
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
zbaof7223732012-04-13 13:42:15 +080039
40#else /* CONFIG_HAVE_ACPI_RESUME */
Rudolf Marek97be27e2010-12-13 19:50:25 +000041#define HIGH_MEMORY_SIZE HIGH_MEMORY_DEF_SIZE
zbaof7223732012-04-13 13:42:15 +080042#endif /* CONFIG_HAVE_ACPI_RESUME */
Stefan Reinauer3b314022009-10-26 17:04:28 +000043
44#define CBMEM_ID_FREESPACE 0x46524545
45#define CBMEM_ID_GDT 0x4c474454
46#define CBMEM_ID_ACPI 0x41435049
Duncan Laurie11290c42012-10-03 19:07:05 -070047#define CBMEM_ID_ACPI_GNVS 0x474e5653
Stefan Reinauer3b314022009-10-26 17:04:28 +000048#define CBMEM_ID_CBTABLE 0x43425442
49#define CBMEM_ID_PIRQ 0x49525154
50#define CBMEM_ID_MPTABLE 0x534d5054
51#define CBMEM_ID_RESUME 0x5245534d
zbaof7223732012-04-13 13:42:15 +080052#define CBMEM_ID_RESUME_SCRATCH 0x52455343
Sven Schnelle164bcfd2011-08-14 20:56:34 +020053#define CBMEM_ID_SMBIOS 0x534d4254
Vadim Bendebury6f72d692011-09-21 16:12:39 -070054#define CBMEM_ID_TIMESTAMP 0x54494d45
Stefan Reinauer61f4a742012-04-03 16:21:04 -070055#define CBMEM_ID_MRCDATA 0x4d524344
Vadim Bendeburybe25a4d2011-09-30 11:13:06 -070056#define CBMEM_ID_CONSOLE 0x434f4e53
Duncan Laurie215f27852012-10-10 14:34:49 -070057#define CBMEM_ID_ELOG 0x454c4f47
Stefan Reinauerd37ab452012-12-18 16:23:28 -080058#define CBMEM_ID_COVERAGE 0x47434f56
Aaron Durbina1db81b42013-02-08 17:11:28 -060059#define CBMEM_ID_ROMSTAGE_INFO 0x47545352
Stefan Reinauer3b314022009-10-26 17:04:28 +000060#define CBMEM_ID_NONE 0x00000000
61
Stefan Reinauer61f4a742012-04-03 16:21:04 -070062#ifndef __ASSEMBLER__
63#ifndef __PRE_RAM__
64extern uint64_t high_tables_base, high_tables_size;
65#endif
66
Vadim Bendeburye1860602011-09-20 17:07:14 -070067int cbmem_initialize(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000068
69void cbmem_init(u64 baseaddr, u64 size);
70int cbmem_reinit(u64 baseaddr);
71void *cbmem_add(u32 id, u64 size);
72void *cbmem_find(u32 id);
Maciej Pijankaea921852009-10-27 14:29:29 +000073void cbmem_list(void);
74void cbmem_arch_init(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000075
Rudolf Marek475916d2010-12-13 20:02:23 +000076extern struct cbmem_entry *get_cbmem_toc(void);
77
Rudolf Marek33109342010-12-11 22:26:10 +000078#ifndef __PRE_RAM__
Rudolf Marekbcaea142010-11-22 22:00:52 +000079void set_cbmem_toc(struct cbmem_entry *);
Stefan Reinauerbb11e602012-05-10 12:15:18 -070080void __attribute__((weak)) cbmem_post_handling(void);
Stefan Reinauer3b314022009-10-26 17:04:28 +000081#endif
Rudolf Marek33109342010-12-11 22:26:10 +000082#endif
Stefan Reinauer61f4a742012-04-03 16:21:04 -070083#endif