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
#define __SIMPLE_DEVICE__
4
5
#include <
arch/romstage.h
>
6
#include <
device/pci_ops.h
>
7
#include <
cbmem.h
>
8
#include <
cpu/x86/mtrr.h
>
9
#include <
cpu/x86/smm.h
>
10
#include <types.h>
11
12
#include "
ironlake.h
"
13
14
static
uintptr_t
northbridge_get_tseg_base
(
void
)
15
{
16
/* Base of TSEG is top of usable DRAM */
17
return
pci_read_config32
(
PCI_DEV
(0, 0, 0),
TSEG
);
18
}
19
20
static
size_t
northbridge_get_tseg_size
(
void
)
21
{
22
return
CONFIG_SMM_TSEG_SIZE;
23
}
24
25
void
*
cbmem_top_chipset
(
void
)
26
{
27
return
(
void
*)
northbridge_get_tseg_base
();
28
}
29
30
void
smm_region
(
uintptr_t
*start,
size_t
*size)
31
{
32
*start =
northbridge_get_tseg_base
();
33
*size =
northbridge_get_tseg_size
();
34
}
35
36
void
fill_postcar_frame
(
struct
postcar_frame
*pcf)
37
{
38
uintptr_t
top_of_ram;
39
40
/* Cache at least 8 MiB below the top of ram, and at most 8 MiB
41
* above top of the ram. This satisfies MTRR alignment requirement
42
* with different TSEG size configurations.
43
*/
44
top_of_ram =
ALIGN_DOWN
((
uintptr_t
)
cbmem_top
(), 8*
MiB
);
45
postcar_frame_add_mtrr
(pcf, top_of_ram - 8*
MiB
, 8*
MiB
,
MTRR_TYPE_WRBACK
);
46
postcar_frame_add_mtrr
(pcf, top_of_ram, 8*
MiB
,
MTRR_TYPE_WRBACK
);
47
}
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
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
TSEG
#define TSEG
Definition:
host_bridge.h:60
smm.h
pci_ops.h
pci_read_config32
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition:
pci_ops.h:58
ironlake.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
northbridge_get_tseg_size
static size_t northbridge_get_tseg_size(void)
Definition:
memmap.c:20
northbridge_get_tseg_base
static uintptr_t northbridge_get_tseg_base(void)
Definition:
memmap.c:14
PCI_DEV
#define PCI_DEV(SEGBUS, DEV, FN)
Definition:
pci_type.h: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
northbridge
intel
ironlake
memmap.c
Generated by
1.9.1