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 | |
Vadim Bendebury | e186060 | 2011-09-20 17:07:14 -0700 | [diff] [blame] | 30 | #ifndef __PRE_RAM__ |
Rudolf Marek | 97be27e | 2010-12-13 19:50:25 +0000 | [diff] [blame] | 31 | extern uint64_t high_tables_base, high_tables_size; |
Vadim Bendebury | e186060 | 2011-09-20 17:07:14 -0700 | [diff] [blame] | 32 | #endif |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 33 | |
| 34 | #if CONFIG_HAVE_ACPI_RESUME |
Rudolf Marek | 97be27e | 2010-12-13 19:50:25 +0000 | [diff] [blame] | 35 | #define HIGH_MEMORY_SIZE ((CONFIG_RAMTOP - CONFIG_RAMBASE) + HIGH_MEMORY_DEF_SIZE) |
| 36 | #define HIGH_MEMORY_SAVE ( HIGH_MEMORY_SIZE - HIGH_MEMORY_DEF_SIZE ) |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 37 | #else |
Rudolf Marek | 97be27e | 2010-12-13 19:50:25 +0000 | [diff] [blame] | 38 | #define HIGH_MEMORY_SIZE HIGH_MEMORY_DEF_SIZE |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 39 | #endif |
| 40 | |
| 41 | #define CBMEM_ID_FREESPACE 0x46524545 |
| 42 | #define CBMEM_ID_GDT 0x4c474454 |
| 43 | #define CBMEM_ID_ACPI 0x41435049 |
| 44 | #define CBMEM_ID_CBTABLE 0x43425442 |
| 45 | #define CBMEM_ID_PIRQ 0x49525154 |
| 46 | #define CBMEM_ID_MPTABLE 0x534d5054 |
| 47 | #define CBMEM_ID_RESUME 0x5245534d |
Sven Schnelle | 164bcfd | 2011-08-14 20:56:34 +0200 | [diff] [blame] | 48 | #define CBMEM_ID_SMBIOS 0x534d4254 |
Vadim Bendebury | 6f72d69 | 2011-09-21 16:12:39 -0700 | [diff] [blame] | 49 | #define CBMEM_ID_TIMESTAMP 0x54494d45 |
Vadim Bendebury | be25a4d | 2011-09-30 11:13:06 -0700 | [diff] [blame^] | 50 | #define CBMEM_ID_CONSOLE 0x434f4e53 |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 51 | #define CBMEM_ID_NONE 0x00000000 |
| 52 | |
Vadim Bendebury | e186060 | 2011-09-20 17:07:14 -0700 | [diff] [blame] | 53 | int cbmem_initialize(void); |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 54 | |
| 55 | void cbmem_init(u64 baseaddr, u64 size); |
| 56 | int cbmem_reinit(u64 baseaddr); |
| 57 | void *cbmem_add(u32 id, u64 size); |
| 58 | void *cbmem_find(u32 id); |
Maciej Pijanka | ea92185 | 2009-10-27 14:29:29 +0000 | [diff] [blame] | 59 | void cbmem_list(void); |
| 60 | void cbmem_arch_init(void); |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 61 | |
Rudolf Marek | 475916d | 2010-12-13 20:02:23 +0000 | [diff] [blame] | 62 | extern struct cbmem_entry *get_cbmem_toc(void); |
| 63 | |
Rudolf Marek | 3310934 | 2010-12-11 22:26:10 +0000 | [diff] [blame] | 64 | #ifndef __PRE_RAM__ |
Rudolf Marek | bcaea14 | 2010-11-22 22:00:52 +0000 | [diff] [blame] | 65 | void set_cbmem_toc(struct cbmem_entry *); |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 66 | #endif |
Rudolf Marek | 3310934 | 2010-12-11 22:26:10 +0000 | [diff] [blame] | 67 | #endif |