blob: fbf9c4657897fa4d9d2f15ac76ca176667ab838e [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.
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060014 */
15
16#ifndef _STAGE_CACHE_H_
17#define _STAGE_CACHE_H_
18
19#include <stddef.h>
20#include <stdint.h>
21#include <program_loading.h>
22
23enum {
24 STAGE_RAMSTAGE,
25 STAGE_REFCODE,
Aaron Durbind0084132016-11-29 15:52:08 -060026 STAGE_POSTCAR,
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060027};
28
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060029/* Cache the loaded stage provided according to the parameters. */
Aaron Durbin54546c92015-08-05 00:52:13 -050030void stage_cache_add(int stage_id, const struct prog *stage);
Aaron Durbinbd74a4b2015-03-06 23:17:33 -060031/* Load the cached stage at given location returning the stage entry point. */
32void stage_cache_load_stage(int stage_id, struct prog *stage);
33/* Fill in parameters for the external stage cache, if utilized. */
34void stage_cache_external_region(void **base, size_t *size);
35
36/* Metadata associated with each stage. */
37struct stage_cache {
38 uint64_t load_addr;
39 uint64_t entry_addr;
40};
41
42#endif /* _STAGE_CACHE_H_ */