coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
memmap.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
arch/romstage.h
>
4
#include <
cbmem.h
>
5
#include <
cpu/x86/mtrr.h
>
6
#include <
cpu/x86/smm.h
>
7
#include <soc/iosf.h>
8
9
static
uintptr_t
smm_region_start
(
void
)
10
{
11
return
(
iosf_bunit_read
(
BUNIT_SMRRL
) << 20);
12
}
13
14
static
size_t
smm_region_size
(
void
)
15
{
16
return
CONFIG_SMM_TSEG_SIZE;
17
}
18
19
void
*
cbmem_top_chipset
(
void
)
20
{
21
return
(
void
*)
smm_region_start
();
22
}
23
24
void
smm_region
(
uintptr_t
*start,
size_t
*size)
25
{
26
*start = (
iosf_bunit_read
(
BUNIT_SMRRL
) & 0xFFFF) << 20;
27
*size =
smm_region_size
();
28
}
29
30
void
fill_postcar_frame
(
struct
postcar_frame
*pcf)
31
{
32
uintptr_t
top_of_ram;
33
34
/* Cache at least 8 MiB below the top of ram, and at most 8 MiB
35
* above top of the ram. This satisfies MTRR alignment requirement
36
* with different TSEG size configurations.
37
*/
38
top_of_ram =
ALIGN_DOWN
((
uintptr_t
)
cbmem_top
(), 8*
MiB
);
39
postcar_frame_add_mtrr
(pcf, top_of_ram - 8*
MiB
, 16*
MiB
,
40
MTRR_TYPE_WRBACK
);
41
}
romstage.h
postcar_frame_add_mtrr
void postcar_frame_add_mtrr(struct postcar_frame *pcf, uintptr_t addr, size_t size, int type)
Definition:
postcar_loader.c:71
BUNIT_SMRRL
#define BUNIT_SMRRL
Definition:
iosf.h:190
iosf_bunit_read
uint32_t iosf_bunit_read(int reg)
Definition:
iosf.c:39
ALIGN_DOWN
#define ALIGN_DOWN(x, a)
Definition:
helpers.h:18
MiB
#define MiB
Definition:
helpers.h:76
cbmem.h
cbmem_top
void * cbmem_top(void)
Definition:
imd_cbmem.c:18
smm.h
cbmem_top_chipset
void * cbmem_top_chipset(void)
Definition:
memmap.c:44
fill_postcar_frame
void fill_postcar_frame(struct postcar_frame *pcf)
Definition:
memmap.c:63
smm_region
void smm_region(uintptr_t *start, size_t *size)
Definition:
memmap.c:50
smm_region_start
static uintptr_t smm_region_start(void)
Definition:
memmap.c:9
smm_region_size
static size_t smm_region_size(void)
Definition:
memmap.c:14
uintptr_t
unsigned long uintptr_t
Definition:
stdint.h:21
postcar_frame
Definition:
romstage.h:18
mtrr.h
MTRR_TYPE_WRBACK
#define MTRR_TYPE_WRBACK
Definition:
mtrr.h:14
src
soc
intel
baytrail
memmap.c
Generated by
1.9.1