blob: 656769f8db5d1a51d02362fc049f90a72ecd94d4 [file] [log] [blame]
Aaron Durbin49048022014-02-18 21:55:02 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Google Inc.
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 BOOTMEM_H
21#define BOOTMEM_H
22
23#include <memrange.h>
24#include <stdint.h>
25#include <boot/coreboot_tables.h>
26
27/*
28 * Initialize the memory address space prior to payload loading. The bootmem
29 * serves as the source for the lb_mem table.
30 */
31void bootmem_init(void);
32
33/* Add a range of a given type to the bootmem address space. */
34void bootmem_add_range(uint64_t start, uint64_t size, uint32_t type);
35
36/* Write memory coreboot table. */
37void bootmem_write_memory_table(struct lb_memory *mem);
38
39/* Print current range map of boot memory. */
40void bootmem_dump_ranges(void);
41
42/* Return 1 if region targets usable RAM, 0 otherwise. */
43int bootmem_region_targets_usable_ram(uint64_t start, uint64_t size);
44
45/* Allocate a temporary buffer from the unused RAM areas. */
46void *bootmem_allocate_buffer(size_t size);
47
48#endif /* BOOTMEM_H */