blob: bde53307ae0e8a2c8fc662412b77b915aa758a1d [file] [log] [blame]
Aaron Durbinbd74a4b2015-03-06 23:17:33 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2015 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.
18 */
19
20#ifndef _STAGE_CACHE_H_
21#define _STAGE_CACHE_H_
22
23#include <stddef.h>
24#include <stdint.h>
25#include <program_loading.h>
26
27enum {
28 STAGE_RAMSTAGE,
29 STAGE_REFCODE,
30};
31
32/* Create an empty stage cache. */
33void stage_cache_create_empty(void);
34/* Recover existing stage cache. */
35void stage_cache_recover(void);
36/* Cache the loaded stage provided according to the parameters. */
37void stage_cache_add(int stage_id, struct prog *stage);
38/* Load the cached stage at given location returning the stage entry point. */
39void stage_cache_load_stage(int stage_id, struct prog *stage);
40/* Fill in parameters for the external stage cache, if utilized. */
41void stage_cache_external_region(void **base, size_t *size);
42
43/* Metadata associated with each stage. */
44struct stage_cache {
45 uint64_t load_addr;
46 uint64_t entry_addr;
47};
48
49#endif /* _STAGE_CACHE_H_ */