Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 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 | |
Stefan Reinauer | 294edb2 | 2011-08-14 13:52:03 -0700 | [diff] [blame] | 23 | /* Reserve 128k for ACPI and other tables */ |
Vadim Bendebury | f2f9386 | 2011-10-04 10:44:16 -0700 | [diff] [blame] | 24 | #if CONFIG_CONSOLE_CBMEM |
| 25 | #define HIGH_MEMORY_DEF_SIZE ( 256 * 1024 ) |
| 26 | #else |
Stefan Reinauer | 294edb2 | 2011-08-14 13:52:03 -0700 | [diff] [blame] | 27 | #define HIGH_MEMORY_DEF_SIZE ( 128 * 1024 ) |
Vadim Bendebury | f2f9386 | 2011-10-04 10:44:16 -0700 | [diff] [blame] | 28 | #endif |
| 29 | |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 30 | #if CONFIG_HAVE_ACPI_RESUME |
zbao | f722373 | 2012-04-13 13:42:15 +0800 | [diff] [blame] | 31 | #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 Reinauer | 61f4a74 | 2012-04-03 16:21:04 -0700 | [diff] [blame] | 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 |
zbao | f722373 | 2012-04-13 13:42:15 +0800 | [diff] [blame] | 39 | |
| 40 | #else /* CONFIG_HAVE_ACPI_RESUME */ |
Rudolf Marek | 97be27e | 2010-12-13 19:50:25 +0000 | [diff] [blame] | 41 | #define HIGH_MEMORY_SIZE HIGH_MEMORY_DEF_SIZE |
zbao | f722373 | 2012-04-13 13:42:15 +0800 | [diff] [blame] | 42 | #endif /* CONFIG_HAVE_ACPI_RESUME */ |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 43 | |
| 44 | #define CBMEM_ID_FREESPACE 0x46524545 |
| 45 | #define CBMEM_ID_GDT 0x4c474454 |
| 46 | #define CBMEM_ID_ACPI 0x41435049 |
Duncan Laurie | 11290c4 | 2012-10-03 19:07:05 -0700 | [diff] [blame] | 47 | #define CBMEM_ID_ACPI_GNVS 0x474e5653 |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 48 | #define CBMEM_ID_CBTABLE 0x43425442 |
| 49 | #define CBMEM_ID_PIRQ 0x49525154 |
| 50 | #define CBMEM_ID_MPTABLE 0x534d5054 |
| 51 | #define CBMEM_ID_RESUME 0x5245534d |
zbao | f722373 | 2012-04-13 13:42:15 +0800 | [diff] [blame] | 52 | #define CBMEM_ID_RESUME_SCRATCH 0x52455343 |
Sven Schnelle | 164bcfd | 2011-08-14 20:56:34 +0200 | [diff] [blame] | 53 | #define CBMEM_ID_SMBIOS 0x534d4254 |
Vadim Bendebury | 6f72d69 | 2011-09-21 16:12:39 -0700 | [diff] [blame] | 54 | #define CBMEM_ID_TIMESTAMP 0x54494d45 |
Stefan Reinauer | 61f4a74 | 2012-04-03 16:21:04 -0700 | [diff] [blame] | 55 | #define CBMEM_ID_MRCDATA 0x4d524344 |
Vadim Bendebury | be25a4d | 2011-09-30 11:13:06 -0700 | [diff] [blame] | 56 | #define CBMEM_ID_CONSOLE 0x434f4e53 |
Duncan Laurie | 215f2785 | 2012-10-10 14:34:49 -0700 | [diff] [blame] | 57 | #define CBMEM_ID_ELOG 0x454c4f47 |
Stefan Reinauer | d37ab45 | 2012-12-18 16:23:28 -0800 | [diff] [blame^] | 58 | #define CBMEM_ID_COVERAGE 0x47434f56 |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 59 | #define CBMEM_ID_NONE 0x00000000 |
| 60 | |
Stefan Reinauer | 61f4a74 | 2012-04-03 16:21:04 -0700 | [diff] [blame] | 61 | #ifndef __ASSEMBLER__ |
| 62 | #ifndef __PRE_RAM__ |
| 63 | extern uint64_t high_tables_base, high_tables_size; |
| 64 | #endif |
| 65 | |
Vadim Bendebury | e186060 | 2011-09-20 17:07:14 -0700 | [diff] [blame] | 66 | int cbmem_initialize(void); |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 67 | |
| 68 | void cbmem_init(u64 baseaddr, u64 size); |
| 69 | int cbmem_reinit(u64 baseaddr); |
| 70 | void *cbmem_add(u32 id, u64 size); |
| 71 | void *cbmem_find(u32 id); |
Maciej Pijanka | ea92185 | 2009-10-27 14:29:29 +0000 | [diff] [blame] | 72 | void cbmem_list(void); |
| 73 | void cbmem_arch_init(void); |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 74 | |
Rudolf Marek | 475916d | 2010-12-13 20:02:23 +0000 | [diff] [blame] | 75 | extern struct cbmem_entry *get_cbmem_toc(void); |
| 76 | |
Rudolf Marek | 3310934 | 2010-12-11 22:26:10 +0000 | [diff] [blame] | 77 | #ifndef __PRE_RAM__ |
Rudolf Marek | bcaea14 | 2010-11-22 22:00:52 +0000 | [diff] [blame] | 78 | void set_cbmem_toc(struct cbmem_entry *); |
Stefan Reinauer | bb11e60 | 2012-05-10 12:15:18 -0700 | [diff] [blame] | 79 | void __attribute__((weak)) cbmem_post_handling(void); |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 80 | #endif |
Rudolf Marek | 3310934 | 2010-12-11 22:26:10 +0000 | [diff] [blame] | 81 | #endif |
Stefan Reinauer | 61f4a74 | 2012-04-03 16:21:04 -0700 | [diff] [blame] | 82 | #endif |