aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/ebda/ebda.c
blob: 41c77a8f2c631509474360c316be340346b0aebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2017 Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <arch/ebda.h>
#include <compiler.h>
#include <intelblocks/ebda.h>
#include <string.h>

/*
 * Mainboard Override function
 *
 * Mainboard directory may implement below functionality for romstage.
 */

/* Fill up EBDA structure inside Mainboard directory */
__weak void create_mainboard_ebda(struct ebda_config *cfg)
{
	/* no-op */
}

static void create_soc_ebda(struct ebda_config *cfg)
{
	/* Create EBDA header */
	cfg->signature = EBDA_SIGNATURE;
	/* Fill up memory layout information */
	fill_soc_memmap_ebda(cfg);
}

void fill_ebda_area(void)
{
	struct ebda_config ebda_cfg;

	/* Initialize EBDA area early during romstage. */
	setup_default_ebda();
	create_soc_ebda(&ebda_cfg);
	create_mainboard_ebda(&ebda_cfg);
	write_ebda_data(&ebda_cfg, sizeof(ebda_cfg));
}

void retrieve_ebda_object(struct ebda_config *cfg)
{
	read_ebda_data(cfg, sizeof(*cfg));

	if (cfg->signature != EBDA_SIGNATURE)
		memset(cfg, 0, sizeof(*cfg));
}